VirtualBox

Changeset 105698 in vbox for trunk/src/VBox/VMM/VMMR3


Ignore:
Timestamp:
Aug 15, 2024 11:33:49 PM (9 months ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
164398
Message:

VMM/IEM,TM: Adaptive timer polling and running of the timer queues from the IEM recompiler execution loop. bugref:10656

Location:
trunk/src/VBox/VMM/VMMR3
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/VMM/VMMR3/EM.cpp

    r103415 r105698  
    10571057 * @param   pVM         The cross context VM structure.
    10581058 * @param   pVCpu       The cross context virtual CPU structure.
     1059 * @param   fWasHalted  Set if we're comming out of a CPU HALT state.
    10591060 * @param   pfFFDone    Where to store an indicator telling whether or not
    10601061 *                      FFs were done before returning.
    10611062 *
    10621063 */
    1063 static VBOXSTRICTRC emR3RecompilerExecute(PVM pVM, PVMCPU pVCpu, bool *pfFFDone)
     1064static VBOXSTRICTRC emR3RecompilerExecute(PVM pVM, PVMCPU pVCpu, bool fWasHalted, bool *pfFFDone)
    10641065{
    10651066    STAM_REL_PROFILE_START(&pVCpu->em.s.StatREMTotal, a);
     
    10981099#ifdef VBOX_WITH_IEM_RECOMPILER
    10991100            if (pVM->em.s.fIemRecompiled)
    1100                 rcStrict = IEMExecRecompiler(pVM, pVCpu);
     1101                rcStrict = IEMExecRecompiler(pVM, pVCpu, fWasHalted);
    11011102            else
    11021103#endif
     
    11901191        }
    11911192
     1193#ifdef VBOX_WITH_IEM_RECOMPILER
     1194        fWasHalted = false;
     1195#else
     1196        RT_NOREF(fWasHalted);
     1197#endif
    11921198    } /* The Inner Loop, recompiled execution mode version. */
    11931199
     
    22532259                case VINF_EM_RESUME:
    22542260                    Log2(("EMR3ExecuteVM: VINF_EM_RESUME: %d -> VINF_EM_RESCHEDULE\n", enmOldState));
    2255                     /* Don't reschedule in the halted or wait for SIPI case. */
     2261                    /* Don't reschedule in the halted or wait-for-SIPI cases. */
    22562262                    if (    pVCpu->em.s.enmPrevState == EMSTATE_WAIT_SIPI
    22572263                        ||  pVCpu->em.s.enmPrevState == EMSTATE_HALTED)
     
    25102516                 */
    25112517                case EMSTATE_RECOMPILER:
    2512                     rc = VBOXSTRICTRC_TODO(emR3RecompilerExecute(pVM, pVCpu, &fFFDone));
     2518                    rc = VBOXSTRICTRC_TODO(emR3RecompilerExecute(pVM, pVCpu, enmOldState == EMSTATE_HALTED, &fFFDone));
    25132519                    Log2(("EMR3ExecuteVM: emR3RecompilerExecute -> %Rrc\n", rc));
    25142520                    break;
  • trunk/src/VBox/VMM/VMMR3/IEMR3.cpp

    r105673 r105698  
    227227
    228228#ifndef VBOX_VMM_TARGET_ARMV8
    229         /* Poll timers every 400 us / 2500 Hz. (source: thin air) */
    230         pVCpu->iem.s.cNsIdealPollInterval       = 400U * RT_NS_1US;
    231         pVCpu->iem.s.cIrqChecksTillNextPoll     = 128;
    232         pVCpu->iem.s.cIrqChecksTillNextPollPrev = 128;
     229        pVCpu->iem.s.cTbsTillNextTimerPoll      = 128;
     230        pVCpu->iem.s.cTbsTillNextTimerPollPrev  = 128;
    233231#endif
    234232
     
    603601# endif
    604602
    605         STAMR3RegisterF(pVM, (void *)&pVCpu->iem.s.cIrqChecksTillNextPollPrev, STAMTYPE_U32, STAMVISIBILITY_ALWAYS, STAMUNIT_COUNT,
    606                         "Timer polling interval",                       "/IEM/CPU%u/re/cIrqChecksTillNextPollPrev", idCpu);
     603# ifdef VBOX_WITH_STATISTICS
     604        STAMR3RegisterF(pVM, (void *)&pVCpu->iem.s.StatTimerPoll, STAMTYPE_PROFILE, STAMVISIBILITY_ALWAYS, STAMUNIT_TICKS_PER_CALL,
     605                        "Timer polling profiling",                      "/IEM/CPU%u/re/TimerPoll/", idCpu);
     606        STAMR3RegisterF(pVM, (void *)&pVCpu->iem.s.StatTimerPollRun, STAMTYPE_PROFILE, STAMVISIBILITY_ALWAYS, STAMUNIT_TICKS_PER_CALL,
     607                        "Timer polling profiling",                      "/IEM/CPU%u/re/TimerPoll/Running", idCpu);
     608        STAMR3RegisterF(pVM, (void *)&pVCpu->iem.s.StatTimerPollUnchanged, STAMTYPE_COUNTER, STAMVISIBILITY_ALWAYS, STAMUNIT_COUNT,
     609                        "Timer polling interval unchanged",             "/IEM/CPU%u/re/TimerPoll/Unchanged", idCpu);
     610        STAMR3RegisterF(pVM, (void *)&pVCpu->iem.s.StatTimerPollTiny, STAMTYPE_COUNTER, STAMVISIBILITY_ALWAYS, STAMUNIT_COUNT,
     611                        "Timer polling interval tiny",                  "/IEM/CPU%u/re/TimerPoll/Tiny", idCpu);
     612        STAMR3RegisterF(pVM, (void *)&pVCpu->iem.s.StatTimerPollDefaultCalc, STAMTYPE_COUNTER, STAMVISIBILITY_ALWAYS, STAMUNIT_COUNT,
     613                        "Timer polling interval calculated using defaults", "/IEM/CPU%u/re/TimerPoll/DefaultCalc", idCpu);
     614        STAMR3RegisterF(pVM, (void *)&pVCpu->iem.s.StatTimerPollMax, STAMTYPE_COUNTER, STAMVISIBILITY_ALWAYS, STAMUNIT_COUNT,
     615                        "Timer polling interval maxed out",             "/IEM/CPU%u/re/TimerPoll/Max", idCpu);
     616        STAMR3RegisterF(pVM, (void *)&pVCpu->iem.s.StatTimerPollFactorDivision, STAMTYPE_PROFILE, STAMVISIBILITY_ALWAYS, STAMUNIT_COUNT,
     617                        "Timer polling factor",                         "/IEM/CPU%u/re/TimerPoll/FactorDivision", idCpu);
     618        STAMR3RegisterF(pVM, (void *)&pVCpu->iem.s.StatTimerPollFactorMultiplication, STAMTYPE_PROFILE, STAMVISIBILITY_ALWAYS, STAMUNIT_COUNT,
     619                        "Timer polling factor",                         "/IEM/CPU%u/re/TimerPoll/FactorMultiplication", idCpu);
     620# endif
     621        STAMR3RegisterF(pVM, (void *)&pVCpu->iem.s.cTbsTillNextTimerPollPrev, STAMTYPE_U32, STAMVISIBILITY_ALWAYS, STAMUNIT_COUNT,
     622                        "Timer polling interval (in TBs)",              "/IEM/CPU%u/re/TimerPollInterval", idCpu);
    607623
    608624        PIEMTBALLOCATOR const pTbAllocator = pVCpu->iem.s.pTbAllocatorR3;
Note: See TracChangeset for help on using the changeset viewer.

© 2025 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette