VirtualBox

Changeset 29902 in vbox for trunk/src


Ignore:
Timestamp:
May 31, 2010 12:56:31 PM (15 years ago)
Author:
vboxsync
Message:

PDM: Flushed out the PDMQueueFlush code as its unused and problematic wrt guest SMP.

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

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/VMM/PDMQueue.cpp

    r28800 r29902  
    666666
    667667    /*
    668      * Only let one EMT flushing queues at any one time to queue preserve order
     668     * Only let one EMT flushing queues at any one time to preserve the order
    669669     * and to avoid wasting time. The FF is always cleared here, because it's
    670670     * only used to get someones attention. Queue inserts occuring during the
    671671     * flush are caught using the pending bit.
    672672     *
    673      * Note. The order in which the FF and pending bit are set and cleared is important.
     673     * Note! The order in which the FF and pending bit are set and cleared is
     674     *       important.
    674675     */
    675676    VM_FF_CLEAR(pVM, VM_FF_PDM_QUEUES);
     
    856857
    857858/**
    858  * This is a worker function used by PDMQueueFlush to perform the
    859  * flush in ring-3.
    860  *
    861  * The queue which should be flushed is pointed to by either pQueueFlushRC,
    862  * pQueueFlushR0, or pQueue. This function will flush that queue and recalc
    863  * the queue FF.
    864  *
    865  * @param   pVM     The VM handle.
    866  * @param   pQueue  The queue to flush. Only used in Ring-3.
    867  */
    868 VMMR3DECL(void) PDMR3QueueFlushWorker(PVM pVM, PPDMQUEUE pQueue)
    869 {
    870     Assert(pVM->pdm.s.pQueueFlushR0 || pVM->pdm.s.pQueueFlushRC || pQueue);
    871     VM_ASSERT_EMT(pVM);
    872 
    873     /** @todo This will clash with PDMR3QueueFlushAll (guest SMP)! */
    874     Assert(!(pVM->pdm.s.fQueueFlushing & PDM_QUEUE_FLUSH_FLAG_ACTIVE));
    875 
    876     /*
    877      * Flush the queue.
    878      */
    879     if (!pQueue && pVM->pdm.s.pQueueFlushRC)
    880     {
    881         pQueue = (PPDMQUEUE)MMHyperRCToR3(pVM, pVM->pdm.s.pQueueFlushRC);
    882         pVM->pdm.s.pQueueFlushRC = NIL_RTRCPTR;
    883     }
    884     else if (!pQueue && pVM->pdm.s.pQueueFlushR0)
    885     {
    886         pQueue = (PPDMQUEUE)MMHyperR0ToR3(pVM, pVM->pdm.s.pQueueFlushR0);
    887         pVM->pdm.s.pQueueFlushR0 = NIL_RTR0PTR;
    888     }
    889     Assert(!pVM->pdm.s.pQueueFlushR0 && !pVM->pdm.s.pQueueFlushRC);
    890 
    891     if (    !pQueue
    892         ||  pdmR3QueueFlush(pQueue))
    893     {
    894         /*
    895          * Recalc the FF (for the queues using force action).
    896          */
    897         VM_FF_CLEAR(pVM, VM_FF_PDM_QUEUES);
    898         for (pQueue = pVM->pUVM->pdm.s.pQueuesForced; pQueue; pQueue = pQueue->pNext)
    899             if (    pQueue->pPendingRC
    900                 ||  pQueue->pPendingR0
    901                 ||  pQueue->pPendingR3)
    902             {
    903                 VM_FF_SET(pVM, VM_FF_PDM_QUEUES);
    904                 break;
    905             }
    906     }
    907 }
    908 
    909 
    910 /**
    911859 * Free an item.
    912860 *
  • trunk/src/VBox/VMM/VMM.cpp

    r28800 r29902  
    403403    STAM_REG(pVM, &pVM->vmm.s.StatRZRetCallRing3,           STAMTYPE_COUNTER, "/VMM/RZCallR3/Misc",             STAMUNIT_OCCURENCES, "Number of Other ring-3 calls.");
    404404    STAM_REG(pVM, &pVM->vmm.s.StatRZCallPDMLock,            STAMTYPE_COUNTER, "/VMM/RZCallR3/PDMLock",          STAMUNIT_OCCURENCES, "Number of VMMCALLRING3_PDM_LOCK calls.");
    405     STAM_REG(pVM, &pVM->vmm.s.StatRZCallPDMQueueFlush,      STAMTYPE_COUNTER, "/VMM/RZCallR3/PDMQueueFlush",    STAMUNIT_OCCURENCES, "Number of VMMCALLRING3_PDM_QUEUE_FLUSH calls.");
    406405    STAM_REG(pVM, &pVM->vmm.s.StatRZCallPGMLock,            STAMTYPE_COUNTER, "/VMM/RZCallR3/PGMLock",          STAMUNIT_OCCURENCES, "Number of VMMCALLRING3_PGM_LOCK calls.");
    407406    STAM_REG(pVM, &pVM->vmm.s.StatRZCallPGMPoolGrow,        STAMTYPE_COUNTER, "/VMM/RZCallR3/PGMPoolGrow",      STAMUNIT_OCCURENCES, "Number of VMMCALLRING3_PGM_POOL_GROW calls.");
     
    20262025        {
    20272026            pVCpu->vmm.s.rcCallRing3 = PDMR3LockCall(pVM);
    2028             break;
    2029         }
    2030 
    2031         /*
    2032          * Flush a PDM queue.
    2033          */
    2034         case VMMCALLRING3_PDM_QUEUE_FLUSH:
    2035         {
    2036             PDMR3QueueFlushWorker(pVM, NULL);
    2037             pVCpu->vmm.s.rcCallRing3 = VINF_SUCCESS;
    20382027            break;
    20392028        }
  • trunk/src/VBox/VMM/VMMAll/PDMAllQueue.cpp

    r28800 r29902  
    7979    Assert(VALID_PTR(pItem));
    8080
     81#if 0 /* the paranoid android version: */
     82    void *pvNext;
     83    do
     84    {
     85        pvNext = ASMAtomicUoReadPtr((void * volatile *)&pQueue->CTX_SUFF(pPending));
     86        ASMAtomicUoWritePtr((void * volatile *)&pItem->CTX_SUFF(pNext), pvNext);
     87    } while (!ASMAtomicCmpXchgPtr((void * volatile *)&pQueue->CTX_SUFF(pPending), pItem, pvNext));
     88#else
    8189    PPDMQUEUEITEMCORE pNext;
    8290    do
     
    8593        pItem->CTX_SUFF(pNext) = pNext;
    8694    } while (!ASMAtomicCmpXchgPtr((void * volatile *)&pQueue->CTX_SUFF(pPending), pItem, pNext));
     95#endif
    8796
    8897    if (!pQueue->pTimer)
     
    170179}
    171180
    172 
    173 /**
    174  * Flushes a PDM queue.
    175  *
    176  * @param   pQueue          The queue handle.
    177  */
    178 VMMDECL(void) PDMQueueFlush(PPDMQUEUE pQueue)
    179 {
    180     Assert(VALID_PTR(pQueue));
    181     Assert(pQueue->pVMR3);
    182     PVM pVM = pQueue->CTX_SUFF(pVM);
    183 
    184 #if defined(IN_RC) || defined(IN_RING0)
    185     Assert(pQueue->CTX_SUFF(pVM));
    186     pVM->pdm.s.CTX_SUFF(pQueueFlush) = pQueue;
    187     VMMRZCallRing3NoCpu(pVM, VMMCALLRING3_PDM_QUEUE_FLUSH, (uintptr_t)pQueue);
    188 
    189 #else /* IN_RING3: */
    190     VMR3ReqCallWait(pVM, VMCPUID_ANY, (PFNRT)PDMR3QueueFlushWorker, 2, pVM, pQueue);
    191 #endif
    192 }
  • trunk/src/VBox/VMM/VMMGC/VMMGC.def

    r28800 r29902  
    2727    PDMCritSectIsOwner
    2828    PDMQueueAlloc
    29     PDMQueueFlush
    3029    PDMQueueInsert
    3130    PGMHandlerPhysicalPageTempOff
  • trunk/src/VBox/VMM/VMMInternal.h

    r28800 r29902  
    371371    STAMCOUNTER                 StatRZCallPDMLock;
    372372    STAMCOUNTER                 StatRZCallLogFlush;
    373     STAMCOUNTER                 StatRZCallPDMQueueFlush;
    374373    STAMCOUNTER                 StatRZCallPGMPoolGrow;
    375374    STAMCOUNTER                 StatRZCallPGMMapChunk;
  • trunk/src/VBox/VMM/VMMR0/VMMR0.def

    r29573 r29902  
    2727    PDMCritSectTryEnterDebug
    2828    PDMQueueAlloc
    29     PDMQueueFlush
    3029    PDMQueueInsert
    3130    PGMHandlerPhysicalPageTempOff
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