Changeset 19785 in vbox for trunk/src/VBox/VMM
- Timestamp:
- May 18, 2009 1:23:45 PM (16 years ago)
- Location:
- trunk/src/VBox/VMM
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/VMM/PDMInternal.h
r19784 r19785 613 613 typedef enum PDMQUEUETYPE 614 614 { 615 /** Uninitialized. */616 PDMQUEUETYPE_UNINIT = 0,617 615 /** Device consumer. */ 618 PDMQUEUETYPE_DEV ,616 PDMQUEUETYPE_DEV = 1, 619 617 /** Driver consumer. */ 620 618 PDMQUEUETYPE_DRV, … … 1022 1020 int pdmLockEx(PVM pVM, int rc); 1023 1021 void pdmUnlock(PVM pVM); 1024 bool pdmIsLockOwner(PVM pVM); 1022 1025 1023 /** @} */ 1026 1024 -
trunk/src/VBox/VMM/PDMQueue.cpp
r19784 r19785 92 92 * Initialize the data fields. 93 93 */ 94 pQueue->pVMR3 = pVM; 95 pQueue->pVMR0 = fRZEnabled ? pVM->pVMR0 : NIL_RTR0PTR; 96 pQueue->pVMRC = fRZEnabled ? pVM->pVMRC : NIL_RTRCPTR; 97 pQueue->enmType = PDMQUEUETYPE_UNINIT; 94 pQueue->pVMR3 = pVM; 95 pQueue->pVMR0 = fRZEnabled ? pVM->pVMR0 : NIL_RTR0PTR; 96 pQueue->pVMRC = fRZEnabled ? pVM->pVMRC : NIL_RTRCPTR; 98 97 pQueue->cMilliesInterval = cMilliesInterval; 99 98 //pQueue->pTimer = NULL; 100 pQueue->cbItem 101 pQueue->cItems 99 pQueue->cbItem = cbItem; 100 pQueue->cItems = cItems; 102 101 //pQueue->pPendingR3 = NULL; 103 102 //pQueue->pPendingR0 = NULL; … … 145 144 * Insert into the queue list for timer driven queues. 146 145 */ 147 pdmLock(pVM);148 146 pQueue->pNext = pVM->pdm.s.pQueuesTimer; 149 147 pVM->pdm.s.pQueuesTimer = pQueue; 150 pdmUnlock(pVM);151 148 } 152 149 else … … 162 159 * problem any longer. The priority might be a nice feature for later though. 163 160 */ 164 pdmLock(pVM);165 161 if (!pVM->pdm.s.pQueuesForced) 166 162 pVM->pdm.s.pQueuesForced = pQueue; … … 172 168 pPrev->pNext = pQueue; 173 169 } 174 pdmUnlock(pVM);175 170 } 176 171 … … 397 392 * Unlink it. 398 393 */ 399 pdmLock(pVM);400 394 if (pQueue->pTimer) 401 395 { … … 438 432 pQueue->pNext = NULL; 439 433 pQueue->pVMR3 = NULL; 440 pdmUnlock(pVM);441 434 442 435 /* … … 483 476 * Unlink it. 484 477 */ 485 pdmLock(pVM);486 478 PPDMQUEUE pQueueNext = pVM->pdm.s.pQueuesTimer; 487 479 PPDMQUEUE pQueue = pVM->pdm.s.pQueuesForced; … … 507 499 } while (pQueue); 508 500 509 pdmUnlock(pVM);510 511 501 return VINF_SUCCESS; 512 502 } … … 535 525 * Unlink it. 536 526 */ 537 pdmLock(pVM);538 527 PPDMQUEUE pQueueNext = pVM->pdm.s.pQueuesTimer; 539 528 PPDMQUEUE pQueue = pVM->pdm.s.pQueuesForced; … … 558 547 pQueueNext = NULL; 559 548 } while (pQueue); 560 pdmUnlock(pVM);561 549 562 550 return VINF_SUCCESS; … … 575 563 * Process the queues. 576 564 */ 577 pdmLock(pVM);578 565 PPDMQUEUE pQueueNext = pVM->pdm.s.pQueuesTimer; 579 566 PPDMQUEUE pQueue = pVM->pdm.s.pQueuesForced; … … 615 602 pQueueNext = NULL; 616 603 } while (pQueue); 617 pdmUnlock(pVM);618 604 } 619 605 … … 631 617 LogFlow(("PDMR3QueuesFlush:\n")); 632 618 633 Assert(!pdmIsLockOwner(pVM));634 619 /* Use atomic test and clear to prevent useless checks; pdmR3QueueFlush is SMP safe. */ 635 620 if (VM_FF_TESTANDCLEAR(pVM, VM_FF_PDM_QUEUES_BIT)) 636 621 { 637 pdmLock(pVM);638 622 for (PPDMQUEUE pCur = pVM->pdm.s.pQueuesForced; pCur; pCur = pCur->pNext) 639 623 { … … 648 632 } 649 633 } 650 pdmUnlock(pVM);651 634 } 652 635 } … … 670 653 671 654 AssertMsg(pItems || pItemsRC || pItemsR0, ("ERROR: can't all be NULL now!\n")); 672 Assert(pdmIsLockOwner(pQueue->pVMR3)); 655 673 656 674 657 /* … … 818 801 VM_ASSERT_EMT(pVM); 819 802 820 pdmLock(pVM);821 803 /* 822 804 * Flush the queue. … … 850 832 } 851 833 } 852 pdmUnlock(pVM);853 834 } 854 835 … … 859 840 * @param pQueue The queue. 860 841 * @param pItem The item. 861 *862 * Note: SMP safe863 842 */ 864 843 DECLINLINE(void) pdmR3QueueFree(PPDMQUEUE pQueue, PPDMQUEUEITEMCORE pItem) … … 893 872 PPDMQUEUE pQueue = (PPDMQUEUE)pvUser; 894 873 Assert(pTimer == pQueue->pTimer); NOREF(pTimer); 895 Assert(!pdmIsLockOwner(pVM));896 874 897 875 if ( pQueue->pPendingR3 898 876 || pQueue->pPendingR0 899 877 || pQueue->pPendingRC) 900 {901 pdmLock(pVM);902 878 pdmR3QueueFlush(pQueue); 903 pdmUnlock(pVM);904 }905 879 int rc = TMTimerSetMillies(pQueue->pTimer, pQueue->cMilliesInterval); 906 880 AssertRC(rc); -
trunk/src/VBox/VMM/VMMAll/PDMAll.cpp
r19784 r19785 349 349 } 350 350 351 /**352 * Check if this VCPU currently owns the PDM lock.353 *354 * @returns bool owner/not owner355 * @param pVM The VM to operate on.356 */357 bool pdmIsLockOwner(PVM pVM)358 {359 return PDMCritSectIsOwner(&pVM->pdm.s.CritSect);360 }361 362 351 363 352 /** -
trunk/src/VBox/VMM/VMMAll/PDMAllQueue.cpp
r19784 r19785 47 47 * @param pQueue The queue handle. 48 48 * @thread Any thread. 49 *50 * Note: SMP safe51 49 */ 52 50 VMMDECL(PPDMQUEUEITEMCORE) PDMQueueAlloc(PPDMQUEUE pQueue) … … 76 74 * @param pItem The item to insert. 77 75 * @thread Any thread. 78 *79 * Note: SMP safe80 76 */ 81 77 VMMDECL(void) PDMQueueInsert(PPDMQUEUE pQueue, PPDMQUEUEITEMCORE pItem) … … 196 192 #else /* IN_RING3: */ 197 193 PVMREQ pReq; 198 Assert(!pdmIsLockOwner(pVM));199 194 VMR3ReqCall(pVM, VMCPUID_ANY, &pReq, RT_INDEFINITE_WAIT, (PFNRT)PDMR3QueueFlushWorker, 2, pVM, pQueue); 200 195 VMR3ReqFree(pReq); -
trunk/src/VBox/VMM/VMMAll/PGMAllBth.h
r19784 r19785 421 421 && !(uErr & X86_TRAP_PF_P)) 422 422 { 423 pgmLock(pVM);424 423 rc = PGM_BTH_NAME(SyncPage)(pVCpu, PdeSrc, pvFault, PGM_SYNC_NR_PAGES, uErr); 425 pgmUnlock(pVM);426 424 if ( RT_FAILURE(rc) 427 425 || !(uErr & X86_TRAP_PF_RW) … … 469 467 && !(uErr & X86_TRAP_PF_P)) 470 468 { 471 pgmLock(pVM);472 469 rc = PGM_BTH_NAME(SyncPage)(pVCpu, PdeSrc, pvFault, PGM_SYNC_NR_PAGES, uErr); 473 pgmUnlock(pVM);474 470 if ( RT_FAILURE(rc) 475 471 || rc == VINF_PGM_SYNCPAGE_MODIFIED_PDE … … 565 561 && !(uErr & X86_TRAP_PF_P)) 566 562 { 567 pgmLock(pVM);568 563 rc = PGM_BTH_NAME(SyncPage)(pVCpu, PdeSrc, pvFault, PGM_SYNC_NR_PAGES, uErr); 569 pgmUnlock(pVM);570 564 if ( RT_FAILURE(rc) 571 565 || rc == VINF_PGM_SYNCPAGE_MODIFIED_PDE … … 701 695 */ 702 696 LogFlow(("CSAM ring 3 job\n")); 703 pgmLock(pVM);704 697 int rc2 = PGM_BTH_NAME(SyncPage)(pVCpu, PdeSrc, pvFault, 1, uErr); 705 pgmUnlock(pVM);706 698 AssertRC(rc2); 707 699 … … 751 743 } 752 744 # endif /* PGM_WITH_PAGING(PGM_GST_TYPE, PGM_SHW_TYPE) && !defined(IN_RING0) */ 753 pgmLock(pVM);754 745 rc = PGM_BTH_NAME(SyncPage)(pVCpu, PdeSrc, pvFault, PGM_SYNC_NR_PAGES, uErr); 755 pgmUnlock(pVM);756 746 if (RT_SUCCESS(rc)) 757 747 { … … 798 788 * page is not present, which is not true in this case. 799 789 */ 800 pgmLock(pVM);801 790 rc = PGM_BTH_NAME(SyncPage)(pVCpu, PdeSrc, pvFault, 1, uErr); 802 pgmUnlock(pVM);803 791 if (RT_SUCCESS(rc)) 804 792 { … … 1233 1221 PGM_BTH_NAME(SyncPageWorkerTrackDeref)(pShwPage, pPT->a[iPTEDst].u & SHW_PTE_PG_MASK); 1234 1222 # endif 1235 ASMAtomicWriteSize(&pPT->a[iPTEDst], 0);1223 pPT->a[iPTEDst].u = 0; 1236 1224 } 1237 1225 # else /* Syncing it here isn't 100% safe and it's probably not worth spending time syncing it. */ 1238 pgmLock(pVM);1239 1226 rc = PGM_BTH_NAME(SyncPage)(pVCpu, PdeSrc, GCPtrPage, 1, 0); 1240 pgmUnlock(pVM);1241 1227 if (RT_SUCCESS(rc)) 1242 1228 rc = VINF_SUCCESS; … … 1624 1610 LogFlow(("SyncPage: GCPtrPage=%RGv cPages=%u uErr=%#x\n", GCPtrPage, cPages, uErr)); 1625 1611 1626 Assert(PGMIsLockOwner(pVM));1627 1612 #if ( PGM_GST_TYPE == PGM_TYPE_32BIT \ 1628 1613 || PGM_GST_TYPE == PGM_TYPE_PAE \
Note:
See TracChangeset
for help on using the changeset viewer.