VirtualBox

Changeset 99920 in vbox


Ignore:
Timestamp:
May 22, 2023 8:52:26 PM (2 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
157563
Message:

VMM/EM: Time slice cleanups. Scm fixes.

Location:
trunk
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/include/VBox/vmm/em.h

    r99899 r99920  
    9595    EMSTATE_GURU_MEDITATION,
    9696    /** Executing in IEM, falling back on REM if we cannot switch back to HM or
    97      * RAW after a short while. 
     97     * RAW after a short while.
    9898     * @note obsolete, here only for saved state reasons.  */
    9999    EMSTATE_IEM_THEN_REM_OBSOLETE,
  • trunk/src/VBox/VMM/VMMR3/EM.cpp

    r99899 r99920  
    219219        pVCpu->em.s.enmState            = idCpu == 0 ? EMSTATE_NONE : EMSTATE_WAIT_SIPI;
    220220        pVCpu->em.s.enmPrevState        = EMSTATE_NONE;
    221         pVCpu->em.s.u64TimeSliceStart   = 0; /* paranoia */
     221        pVCpu->em.s.msTimeSliceStart    = 0; /* paranoia */
    222222        pVCpu->em.s.idxContinueExitRec  = UINT16_MAX;
    223223
     
    20332033    {
    20342034        uint64_t const msTimeNow = RTTimeMilliTS();
    2035         if (pVCpu->em.s.u64TimeSliceStart + EM_TIME_SLICE < msTimeNow)
     2035        if (pVCpu->em.s.msTimeSliceStart + EM_TIME_SLICE < msTimeNow)
    20362036        {
    20372037            /* New time slice. */
    2038             pVCpu->em.s.u64TimeSliceStart     = msTimeNow;
    2039             pVCpu->em.s.u64TimeSliceStartExec = cMsKernelTime + cMsUserTime;
    2040             pVCpu->em.s.u64TimeSliceExec      = 0;
    2041         }
    2042         pVCpu->em.s.u64TimeSliceExec = cMsKernelTime + cMsUserTime - pVCpu->em.s.u64TimeSliceStartExec;
    2043 
    2044         bool const fRet = pVCpu->em.s.u64TimeSliceExec < (EM_TIME_SLICE * pVM->uCpuExecutionCap) / 100;
    2045         Log2(("emR3IsExecutionAllowed: start=%RX64 startexec=%RX64 exec=%RX64 (cap=%x)\n", pVCpu->em.s.u64TimeSliceStart,
    2046               pVCpu->em.s.u64TimeSliceStartExec, pVCpu->em.s.u64TimeSliceExec, (EM_TIME_SLICE * pVM->uCpuExecutionCap) / 100));
     2038            pVCpu->em.s.msTimeSliceStart      = msTimeNow;
     2039            pVCpu->em.s.cMsTimeSliceStartExec = cMsKernelTime + cMsUserTime;
     2040            pVCpu->em.s.cMsTimeSliceExec      = 0;
     2041        }
     2042        pVCpu->em.s.cMsTimeSliceExec = cMsKernelTime + cMsUserTime - pVCpu->em.s.cMsTimeSliceStartExec;
     2043
     2044        bool const fRet = pVCpu->em.s.cMsTimeSliceExec < (EM_TIME_SLICE * pVM->uCpuExecutionCap) / 100;
     2045        Log2(("emR3IsExecutionAllowed: start=%RX64 startexec=%RX64 exec=%RX64 (cap=%x)\n", pVCpu->em.s.msTimeSliceStart,
     2046              pVCpu->em.s.cMsTimeSliceStartExec, pVCpu->em.s.cMsTimeSliceExec, (EM_TIME_SLICE * pVM->uCpuExecutionCap) / 100));
    20472047        return fRet;
    20482048    }
  • trunk/src/VBox/VMM/include/EMInline.h

    r99898 r99920  
    5757#endif /* !VMM_INCLUDED_SRC_include_EMInline_h */
    5858
    59 
  • trunk/src/VBox/VMM/include/EMInternal.h

    r99899 r99920  
    160160    uint8_t                 abPadding0[7];
    161161
    162     /** Start of the current time slice in ms. */
    163     uint64_t                u64TimeSliceStart;
    164     /** Start of the current time slice in thread execution time (ms). */
    165     uint64_t                u64TimeSliceStartExec;
    166     /** Current time slice value. */
    167     uint64_t                u64TimeSliceExec;
     162    /** Start of the current time slice in ms (RTTimeMilliTS). */
     163    uint64_t                msTimeSliceStart;
     164    /** The sum of the RTThreadGetExecutionTimeMilli() values at the start of the
     165     * current slice. */
     166    uint64_t                cMsTimeSliceStartExec;
     167    /** Number of milliseconds into the current time slice last we checked.
     168     * This is in terms of the RTThreadGetExecutionTimeMilli() total, like for
     169     * cMsTimeSliceStartExec. */
     170    uint64_t                cMsTimeSliceExec;
    168171
    169172    /** Pending ring-3 I/O port access (VINF_EM_PENDING_R3_IOPORT_READ / VINF_EM_PENDING_R3_IOPORT_WRITE). */
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