VirtualBox

Changeset 73035 in vbox


Ignore:
Timestamp:
Jul 10, 2018 2:04:41 PM (7 years ago)
Author:
vboxsync
Message:

NEM/win: Poll timers from inner loop and adjust run/wait timeout to next timer deadline. Helps with rhel5 smoketest. bugref:9044

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

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/VMM/VMMAll/NEMAllNativeTemplate-win.cpp.h

    r72926 r73035  
    40864086# ifdef NEM_WIN_TEMPLATE_MODE_OWN_RUN_API
    40874087    VID_MESSAGE_MAPPING_HEADER volatile *pMappingHeader = (VID_MESSAGE_MAPPING_HEADER volatile *)pVCpu->nem.s.pvMsgSlotMapping;
    4088     uint32_t        cMillies            = 5000; /** @todo lower this later... */
    40894088# endif
    40904089    const bool      fSingleStepping     = DBGFIsStepping(pVCpu);
     
    41674166
    41684167        /*
    4169          * Run a bit.
     4168         * Poll timers and run for a bit.
     4169         *
     4170         * With the VID approach (ring-0 or ring-3) we can specify a timeout here,
     4171         * so we take the time of the next timer event and uses that as a deadline.
     4172         * The rounding heuristics are "tuned" so that rhel5 (1K timer) will boot fine.
    41704173         */
     4174        /** @todo See if we cannot optimize this TMTimerPollGIP by only redoing
     4175         *        the whole polling job when timers have changed... */
     4176        uint64_t       offDeltaIgnored;
     4177        uint64_t const nsNextTimerEvt = TMTimerPollGIP(pVM, pVCpu, &offDeltaIgnored); NOREF(nsNextTimerEvt);
    41714178        if (   !VM_FF_IS_PENDING(pVM, VM_FF_EMT_RENDEZVOUS | VM_FF_TM_VIRTUAL_SYNC)
    41724179            && !VMCPU_FF_IS_PENDING(pVCpu, VMCPU_FF_HM_TO_R3_MASK))
     
    41984205            {
    41994206# ifdef NEM_WIN_TEMPLATE_MODE_OWN_RUN_API
     4207                uint64_t const  nsNow           = RTTimeNanoTS();
     4208                int64_t const   cNsNextTimerEvt = nsNow - nsNextTimerEvt;
     4209                uint32_t        cMsWait;
     4210                if (cNsNextTimerEvt < 100000 /* ns */)
     4211                    cMsWait = 0;
     4212                else if ((uint64_t)cNsNextTimerEvt < RT_NS_1SEC)
     4213                {
     4214                    if ((uint32_t)cNsNextTimerEvt < 2*RT_NS_1MS)
     4215                        cMsWait = 1;
     4216                    else
     4217                        cMsWait = ((uint32_t)cNsNextTimerEvt - 100000 /*ns*/) / RT_NS_1MS;
     4218                }
     4219                else
     4220                    cMsWait = RT_MS_1SEC;
    42004221#  ifdef IN_RING0
    42014222                pVCpu->nem.s.uIoCtlBuf.MsgSlotHandleAndGetNext.iCpu     = pGVCpu->idCpu;
    42024223                pVCpu->nem.s.uIoCtlBuf.MsgSlotHandleAndGetNext.fFlags   = pVCpu->nem.s.fHandleAndGetFlags;
    4203                 pVCpu->nem.s.uIoCtlBuf.MsgSlotHandleAndGetNext.cMillies = cMillies;
     4224                pVCpu->nem.s.uIoCtlBuf.MsgSlotHandleAndGetNext.cMillies = cMsWait;
    42044225                NTSTATUS rcNt = nemR0NtPerformIoControl(pGVM, pGVM->nem.s.IoCtlMessageSlotHandleAndGetNext.uFunction,
    42054226                                                        &pVCpu->nem.s.uIoCtlBuf.MsgSlotHandleAndGetNext,
     
    42104231#  else
    42114232                BOOL fRet = VidMessageSlotHandleAndGetNext(pVM->nem.s.hPartitionDevice, pVCpu->idCpu,
    4212                                                            pVCpu->nem.s.fHandleAndGetFlags, cMillies);
     4233                                                           pVCpu->nem.s.fHandleAndGetFlags, cMsWait);
    42134234                VMCPU_CMPXCHG_STATE(pVCpu, VMCPUSTATE_STARTED_EXEC_NEM, VMCPUSTATE_STARTED_EXEC_NEM_WAIT);
    42144235                if (fRet)
  • trunk/src/VBox/VMM/VMMR0/NEMR0Native-win.cpp

    r72924 r73035  
    4242#include <iprt/memobj.h>
    4343#include <iprt/string.h>
     44#include <iprt/time.h>
    4445
    4546
Note: See TracChangeset for help on using the changeset viewer.

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