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