VirtualBox

Ignore:
Timestamp:
Jun 24, 2009 1:56:19 AM (15 years ago)
Author:
vboxsync
Message:

VMM: Make sure there is enough room for a few physical handler notification before we disable ring-3 calls. Partial VMM[GC|R0]CallHost unification.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/VMM/VMMAll/REMAll.cpp

    r20869 r20871  
    2222
    2323/*******************************************************************************
    24 *   Global Variables                                                           *
     24*   Header Files                                                               *
    2525*******************************************************************************/
    2626#define LOG_GROUP LOG_GROUP_REM
     
    8080
    8181/**
    82  * Flushes the handler notifications by calling the host.
    83  *
    84  * @param   pVM     The VM handle.
    85  */
    86 static void remFlushHandlerNotifications(PVM pVM)
    87 {
    88 #ifdef IN_RC
    89     VMMGCCallHost(pVM, VMMCALLHOST_REM_REPLAY_HANDLER_NOTIFICATIONS, 0);
    90 #elif defined(IN_RING0)
    91     /** @todo necessary? */
    92     VMMR0CallHost(pVM, VMMCALLHOST_REM_REPLAY_HANDLER_NOTIFICATIONS, 0);
    93 #else
    94     AssertReleaseMsgFailed(("Ring 3 call????.\n"));
    95 #endif
    96 }
    97 
    98 
    99 /**
    10082 * Insert pending notification
    10183 *
     
    120102                Assert(cFlushes++ != 128);
    121103                AssertFatal(cFlushes < _1M);
    122                 remFlushHandlerNotifications(pVM);
     104                VMMRZCallRing3NoCpu(pVM, VMMCALLHOST_REM_REPLAY_HANDLER_NOTIFICATIONS, 0);
    123105                idxFree = ASMAtomicUoReadU32(&pVM->rem.s.idxFreeList);
    124106            } while (idxFree == (uint32_t)-1);
     
    145127
    146128    VM_FF_SET(pVM, VM_FF_REM_HANDLER_NOTIFY);
    147 
    148 #if 0 /* Enable this to trigger odd flush bugs. */
    149     remFlushHandlerNotifications(pVM);
    150 #endif
    151129}
    152130
     
    222200#endif /* !IN_RING3 */
    223201
     202#ifdef IN_RC
     203/**
     204 * Flushes the physical handler notifications if the queue is almost full.
     205 *
     206 * This is for avoiding trouble in RC when changing CR3.
     207 *
     208 * @param   pVM         The VM handle.
     209 * @param   pVCpu       The virtual CPU handle of the calling EMT.
     210 */
     211VMMDECL(void) REMNotifyHandlerPhysicalFlushIfAlmostFull(PVM pVM, PVMCPU pVCpu)
     212{
     213    Assert(pVM->cCPUs == 1);
     214
     215    /*
     216     * Less than 10 items means we should flush.
     217     */
     218    uint32_t cFree = 0;
     219    for (uint32_t idx = pVM->rem.s.idxFreeList;
     220         idx != UINT32_MAX;
     221         idx = pVM->rem.s.aHandlerNotifications[idx].idxNext)
     222    {
     223        Assert(idx < RT_ELEMENTS(pVM->rem.s.aHandlerNotifications));
     224        if (++cFree > 10)
     225            return;
     226    }
     227
     228    /* Ok, we gotta flush them. */
     229    VMMRZCallRing3NoCpu(pVM, VMMCALLHOST_REM_REPLAY_HANDLER_NOTIFICATIONS, 0);
     230}
     231#endif /* IN_RC */
     232
     233
    224234/**
    225235 * Make REM flush all translation block upon the next call to REMR3State().
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