VirtualBox

Changeset 50917 in vbox for trunk/src/VBox/VMM


Ignore:
Timestamp:
Mar 28, 2014 1:50:09 PM (11 years ago)
Author:
vboxsync
Message:

Added PDMQueueFlushIfNecessary.

File:
1 edited

Legend:

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

    r46420 r50917  
    6868
    6969/**
     70 * Sets the FFs and fQueueFlushed.
     71 *
     72 * @param   pQueue              The PDM queue.
     73 */
     74static void pdmQueueSetFF(PPDMQUEUE pQueue)
     75{
     76    PVM pVM = pQueue->CTX_SUFF(pVM);
     77    Log2(("PDMQueueInsert: VM_FF_PDM_QUEUES %d -> 1\n", VM_FF_IS_SET(pVM, VM_FF_PDM_QUEUES)));
     78    VM_FF_SET(pVM, VM_FF_PDM_QUEUES);
     79    ASMAtomicBitSet(&pVM->pdm.s.fQueueFlushing, PDM_QUEUE_FLUSH_FLAG_PENDING_BIT);
     80#ifdef IN_RING3
     81# ifdef VBOX_WITH_REM
     82    REMR3NotifyQueuePending(pVM); /** @todo r=bird: we can remove REMR3NotifyQueuePending and let VMR3NotifyFF do the work. */
     83# endif
     84    VMR3NotifyGlobalFFU(pVM->pUVM, VMNOTIFYFF_FLAGS_DONE_REM);
     85#endif
     86}
     87
     88
     89/**
    7090 * Queue an item.
    7191 * The item must have been obtained using PDMQueueAlloc(). Once the item
     
    98118
    99119    if (!pQueue->pTimer)
    100     {
    101         PVM pVM = pQueue->CTX_SUFF(pVM);
    102         Log2(("PDMQueueInsert: VM_FF_PDM_QUEUES %d -> 1\n", VM_FF_IS_SET(pVM, VM_FF_PDM_QUEUES)));
    103         VM_FF_SET(pVM, VM_FF_PDM_QUEUES);
    104         ASMAtomicBitSet(&pVM->pdm.s.fQueueFlushing, PDM_QUEUE_FLUSH_FLAG_PENDING_BIT);
    105 #ifdef IN_RING3
    106 # ifdef VBOX_WITH_REM
    107         REMR3NotifyQueuePending(pVM); /** @todo r=bird: we can remove REMR3NotifyQueuePending and let VMR3NotifyFF do the work. */
    108 # endif
    109         VMR3NotifyGlobalFFU(pVM->pUVM, VMNOTIFYFF_FLAGS_DONE_REM);
    110 #endif
    111     }
     120        pdmQueueSetFF(pQueue);
    112121    STAM_REL_COUNTER_INC(&pQueue->StatInsert);
    113122    STAM_STATS({ ASMAtomicIncU32(&pQueue->cStatPending); });
     
    184193}
    185194
     195
     196/**
     197 * Schedule the queue for flushing (processing) if necessary.
     198 *
     199 * @returns @c true if necessary, @c false if not.
     200 * @param   pQueue              The queue.
     201 */
     202VMMDECL(bool) PDMQueueFlushIfNecessary(PPDMQUEUE pQueue)
     203{
     204    AssertPtr(pQueue);
     205    if (   pQueue->pPendingR3 != NIL_RTR3PTR
     206        || pQueue->pPendingR0 != NIL_RTR0PTR
     207        || pQueue->pPendingRC != NIL_RTRCPTR)
     208    {
     209        pdmQueueSetFF(pQueue);
     210        return false;
     211    }
     212    return false;
     213}
     214
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