Changeset 45301 in vbox
- Timestamp:
- Apr 3, 2013 9:51:13 AM (11 years ago)
- Location:
- trunk
- Files:
-
- 8 edited
-
include/VBox/vmm/iom.h (modified) (1 diff)
-
include/VBox/vmm/vm.h (modified) (2 diffs)
-
src/VBox/VMM/VMMAll/EMAll.cpp (modified) (1 diff)
-
src/VBox/VMM/VMMAll/IOMAll.cpp (modified) (1 diff)
-
src/VBox/VMM/VMMR3/EM.cpp (modified) (1 diff)
-
src/VBox/VMM/VMMR3/IOM.cpp (modified) (3 diffs)
-
src/VBox/VMM/include/IOMInline.h (modified) (7 diffs)
-
src/VBox/VMM/include/IOMInternal.h (modified) (5 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/include/VBox/vmm/iom.h
r44626 r45301 288 288 VMMDECL(int) IOMMMIOMapMMIOHCPage(PVM pVM, PVMCPU pVCpu, RTGCPHYS GCPhys, RTHCPHYS HCPhys, uint64_t fPageFlags); 289 289 VMMDECL(int) IOMMMIOResetRegion(PVM pVM, RTGCPHYS GCPhys); 290 VMMDECL(bool) IOMIsLock Owner(PVM pVM);290 VMMDECL(bool) IOMIsLockWriteOwner(PVM pVM); 291 291 292 292 #ifdef IN_RC -
trunk/include/VBox/vmm/vm.h
r45276 r45301 990 990 struct IOM s; 991 991 #endif 992 uint8_t padding[8 32]; /* multiple of 64 */992 uint8_t padding[896]; /* multiple of 64 */ 993 993 } iom; 994 994 … … 1087 1087 1088 1088 /** Padding for aligning the cpu array on a page boundary. */ 1089 uint8_t abAlignment2[ 542];1089 uint8_t abAlignment2[478]; 1090 1090 1091 1091 /* ---- end small stuff ---- */ -
trunk/src/VBox/VMM/VMMAll/EMAll.cpp
r45276 r45301 251 251 252 252 Assert(!PGMIsLockOwner(pVM)); 253 Assert(!IOMIsLock Owner(pVM));253 Assert(!IOMIsLockWriteOwner(pVM)); 254 254 int rc = PDMCritSectEnter(&pVM->em.s.CritSectREM, VERR_SEM_BUSY); 255 255 AssertRCSuccess(rc); -
trunk/src/VBox/VMM/VMMAll/IOMAll.cpp
r44528 r45301 41 41 42 42 /** 43 * Check if this VCPU currently owns the IOM lock .43 * Check if this VCPU currently owns the IOM lock exclusively. 44 44 * 45 45 * @returns bool owner/not owner 46 46 * @param pVM Pointer to the VM. 47 47 */ 48 VMMDECL(bool) IOMIsLock Owner(PVM pVM)48 VMMDECL(bool) IOMIsLockWriteOwner(PVM pVM) 49 49 { 50 #ifdef IOM_WITH_CRIT_SECT_RW 51 return PDMCritSectRwIsWriteOwner(&pVM->iom.s.CritSect); 52 #else 50 53 return PDMCritSectIsOwner(&pVM->iom.s.CritSect); 54 #endif 51 55 } 52 56 -
trunk/src/VBox/VMM/VMMR3/EM.cpp
r45276 r45301 1694 1694 if ( pVM->cCpus == 1 1695 1695 || ( !PGMIsLockOwner(pVM) 1696 && !IOMIsLock Owner(pVM))1696 && !IOMIsLockWriteOwner(pVM)) 1697 1697 ) 1698 1698 { -
trunk/src/VBox/VMM/VMMR3/IOM.cpp
r44850 r45301 166 166 * Initialize the REM critical section. 167 167 */ 168 #ifdef IOM_WITH_CRIT_SECT_RW 169 int rc = PDMR3CritSectRwInit(pVM, &pVM->iom.s.CritSect, RT_SRC_POS, "IOM Lock"); 170 #else 168 171 int rc = PDMR3CritSectInit(pVM, &pVM->iom.s.CritSect, RT_SRC_POS, "IOM Lock"); 172 #endif 169 173 AssertRCReturn(rc, rc); 170 174 … … 406 410 PIOMIOPORTSTATS iomR3IOPortStatsCreate(PVM pVM, RTIOPORT Port, const char *pszDesc) 407 411 { 408 Assert(IOMIsLockOwner(pVM)); 412 Assert(IOM_IS_EXCL_LOCK_OWNER(pVM)); 413 409 414 /* check if it already exists. */ 410 415 PIOMIOPORTSTATS pPort = (PIOMIOPORTSTATS)RTAvloIOPortGet(&pVM->iom.s.pTreesR3->IOPortStatTree, Port); … … 459 464 PIOMMMIOSTATS iomR3MMIOStatsCreate(PVM pVM, RTGCPHYS GCPhys, const char *pszDesc) 460 465 { 461 Assert(IOM IsLockOwner(pVM));466 Assert(IOM_IS_EXCL_LOCK_OWNER(pVM)); 462 467 #ifdef DEBUG_sandervl 463 468 AssertGCPhys32(GCPhys); 464 469 #endif 470 465 471 /* check if it already exists. */ 466 472 PIOMMMIOSTATS pStats = (PIOMMMIOSTATS)RTAvloGCPhysGet(&pVM->iom.s.pTreesR3->MmioStatTree, GCPhys); -
trunk/src/VBox/VMM/include/IOMInline.h
r44528 r45301 35 35 DECLINLINE(CTX_SUFF(PIOMIOPORTRANGE)) iomIOPortGetRange(PVM pVM, RTIOPORT Port) 36 36 { 37 Assert( PDMCritSectIsOwner(&pVM->iom.s.CritSect));37 Assert(IOM_IS_SHARED_LOCK_OWNER(pVM)); 38 38 return (CTX_SUFF(PIOMIOPORTRANGE))RTAvlroIOPortRangeGet(&pVM->iom.s.CTX_SUFF(pTrees)->CTX_SUFF(IOPortTree), Port); 39 39 } … … 51 51 DECLINLINE(PIOMIOPORTRANGER3) iomIOPortGetRangeR3(PVM pVM, RTIOPORT Port) 52 52 { 53 Assert( PDMCritSectIsOwner(&pVM->iom.s.CritSect));53 Assert(IOM_IS_SHARED_LOCK_OWNER(pVM)); 54 54 return (PIOMIOPORTRANGER3)RTAvlroIOPortRangeGet(&pVM->iom.s.CTX_SUFF(pTrees)->IOPortTreeR3, Port); 55 55 } … … 67 67 DECLINLINE(PIOMMMIORANGE) iomMmioGetRange(PVM pVM, RTGCPHYS GCPhys) 68 68 { 69 Assert( PDMCritSectIsOwner(&pVM->iom.s.CritSect));69 Assert(IOM_IS_SHARED_LOCK_OWNER(pVM)); 70 70 PIOMMMIORANGE pRange = pVM->iom.s.CTX_SUFF(pMMIORangeLast); 71 71 if ( !pRange … … 102 102 DECLINLINE(PIOMMMIORANGE) iomMmioGetRangeWithRef(PVM pVM, RTGCPHYS GCPhys) 103 103 { 104 int rc = PDMCritSectEnter(&pVM->iom.s.CritSect, VINF_SUCCESS);104 int rc = IOM_LOCK_SHARED_EX(pVM, VINF_SUCCESS); 105 105 AssertRCReturn(rc, NULL); 106 106 … … 113 113 iomMmioRetainRange(pRange); 114 114 115 PDMCritSectLeave(&pVM->iom.s.CritSect);115 IOM_UNLOCK_SHARED(pVM); 116 116 return pRange; 117 117 } … … 170 170 DECLINLINE(PIOMMMIOSTATS) iomMmioGetStats(PVM pVM, RTGCPHYS GCPhys, PIOMMMIORANGE pRange) 171 171 { 172 PDMCritSectEnter(&pVM->iom.s.CritSect, VINF_SUCCESS);172 IOM_LOCK_SHARED_EX(pVM, VINF_SUCCESS); 173 173 174 174 /* For large ranges, we'll put everything on the first byte. */ … … 187 187 } 188 188 189 PDMCritSectLeave(&pVM->iom.s.CritSect);189 IOM_UNLOCK_SHARED(pVM); 190 190 return pStats; 191 191 } -
trunk/src/VBox/VMM/include/IOMInternal.h
r44528 r45301 5 5 6 6 /* 7 * Copyright (C) 2006-201 2Oracle Corporation7 * Copyright (C) 2006-2013 Oracle Corporation 8 8 * 9 9 * This file is part of VirtualBox Open Source Edition (OSE), as … … 19 19 #define ___IOMInternal_h 20 20 21 //#define IOM_WITH_CRIT_SECT_RW 22 21 23 #include <VBox/cdefs.h> 22 24 #include <VBox/types.h> … … 25 27 #include <VBox/vmm/pgm.h> 26 28 #include <VBox/vmm/pdmcritsect.h> 29 #ifdef IOM_WITH_CRIT_SECT_RW 30 # include <VBox/vmm/pdmcritsectrw.h> 31 #endif 27 32 #include <VBox/param.h> 28 33 #include <iprt/assert.h> … … 324 329 325 330 /** Lock serializing EMT access to IOM. */ 331 #ifdef IOM_WITH_CRIT_SECT_RW 332 PDMCRITSECTRW CritSect; 333 #else 326 334 PDMCRITSECT CritSect; 335 #endif 327 336 328 337 /** @name Caching of I/O Port and MMIO ranges and statistics. … … 426 435 427 436 /* IOM locking helpers. */ 428 #define IOM_LOCK(a_pVM) PDMCritSectEnter(&(a_pVM)->iom.s.CritSect, VERR_SEM_BUSY) 429 #define IOM_UNLOCK(a_pVM) do { PDMCritSectLeave(&(a_pVM)->iom.s.CritSect); } while (0) 437 #ifdef IOM_WITH_CRIT_SECT_RW 438 # define IOM_LOCK(a_pVM) PDMCritSectRwEnterExcl(&(a_pVM)->iom.s.CritSect, VERR_SEM_BUSY) 439 # define IOM_UNLOCK(a_pVM) do { PDMCritSectRwLeaveExcl(&(a_pVM)->iom.s.CritSect); } while (0) 440 # if 1 /* for the time being (the lookup caches needs to be in VMCPU) */ 441 # define IOM_LOCK_SHARED_EX(a_pVM, a_rcBusy) PDMCritSectRwEnterExcl(&(a_pVM)->iom.s.CritSect, (a_rcBusy)) 442 # define IOM_UNLOCK_SHARED(a_pVM) do { PDMCritSectRwLeaveExcl(&(a_pVM)->iom.s.CritSect); } while (0) 443 # define IOM_IS_SHARED_LOCK_OWNER(a_pVM) PDMCritSectRwIsWriteOwner(&(a_pVM)->iom.s.CritSect) 444 # else 445 # define IOM_LOCK_SHARED_EX(a_pVM, a_rcBusy) PDMCritSectRwEnterShared(&(a_pVM)->iom.s.CritSect, (a_rcBusy)) 446 # define IOM_UNLOCK_SHARED(a_pVM) do { PDMCritSectRwLeaveShared(&(a_pVM)->iom.s.CritSect); } while (0) 447 # define IOM_IS_SHARED_LOCK_OWNER(a_pVM) PDMCritSectRwIsReadOwner(&(a_pVM)->iom.s.CritSect, true) 448 # endif 449 # define IOM_IS_EXCL_LOCK_OWNER(a_pVM) PDMCritSectRwIsWriteOwner(&(a_pVM)->iom.s.CritSect) 450 #else 451 # define IOM_LOCK(a_pVM) PDMCritSectEnter(&(a_pVM)->iom.s.CritSect, VERR_SEM_BUSY) 452 # define IOM_UNLOCK(a_pVM) do { PDMCritSectLeave(&(a_pVM)->iom.s.CritSect); } while (0) 453 # define IOM_LOCK_SHARED_EX(a_pVM, a_rcBusy) PDMCritSectEnter(&(a_pVM)->iom.s.CritSect, (a_rcBusy)) 454 # define IOM_UNLOCK_SHARED(a_pVM) do { PDMCritSectLeave(&(a_pVM)->iom.s.CritSect); } while (0) 455 # define IOM_IS_SHARED_LOCK_OWNER(a_pVM) PDMCritSectIsOwner(&(a_pVM)->iom.s.CritSect) 456 # define IOM_IS_EXCL_LOCK_OWNER(a_pVM) PDMCritSectIsOwner(&(a_pVM)->iom.s.CritSect) 457 #endif 458 #define IOM_LOCK_SHARED(a_pVM) IOM_LOCK_SHARED_EX(a_pVM, VERR_SEM_BUSY) 430 459 431 460
Note:
See TracChangeset
for help on using the changeset viewer.

