Changeset 87480 in vbox
- Timestamp:
- Jan 29, 2021 2:55:56 PM (4 years ago)
- Location:
- trunk/src/VBox/VMM
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/VMM/VMMAll/HMAll.cpp
r87479 r87480 429 429 * Wrapper for RTMpPokeCpu to deal with VERR_NOT_SUPPORTED. 430 430 */ 431 static void hmR0PokeCpu(PVMCPU pVCpu, RTCPUID idHostCpu)432 { 433 uint32_t cWorldSwitchExits = ASMAtomicUoReadU32(&pVCpu->hm .s.cWorldSwitchExits);431 static void hmR0PokeCpu(PVMCPUCC pVCpu, RTCPUID idHostCpu) 432 { 433 uint32_t cWorldSwitchExits = ASMAtomicUoReadU32(&pVCpu->hmr0.s.cWorldSwitchExits); 434 434 435 435 STAM_PROFILE_ADV_START(&pVCpu->hm.s.StatPoke, x); … … 460 460 /* Spin until the VCPU has switched back (poking is async). */ 461 461 while ( ASMAtomicUoReadBool(&pVCpu->hm.s.fCheckedTLBFlush) 462 && cWorldSwitchExits == ASMAtomicUoReadU32(&pVCpu->hm .s.cWorldSwitchExits))462 && cWorldSwitchExits == ASMAtomicUoReadU32(&pVCpu->hmr0.s.cWorldSwitchExits)) 463 463 ASMNopPause(); 464 464 -
trunk/src/VBox/VMM/VMMR0/HMSVMR0.cpp
r87479 r87480 1284 1284 Assert(pHostCpu->idCpu != NIL_RTCPUID); 1285 1285 if ( pVCpu->hmr0.s.idLastCpu != pHostCpu->idCpu 1286 || pVCpu->hm .s.cTlbFlushes != pHostCpu->cTlbFlushes1286 || pVCpu->hmr0.s.cTlbFlushes != pHostCpu->cTlbFlushes 1287 1287 #ifdef VBOX_WITH_NESTED_HWVIRT_SVM 1288 1288 || CPUMIsGuestInSvmNestedHwVirtMode(&pVCpu->cpum.GstCtx) … … 1314 1314 pHostCpu->uCurrentAsid = 1; 1315 1315 pVCpu->hmr0.s.uCurrentAsid = 1; 1316 pVCpu->hm .s.cTlbFlushes= pHostCpu->cTlbFlushes;1316 pVCpu->hmr0.s.cTlbFlushes = pHostCpu->cTlbFlushes; 1317 1317 pVCpu->hmr0.s.idLastCpu = pHostCpu->idCpu; 1318 1318 pVmcb->ctrl.TLBCtrl.n.u8TLBFlush = SVM_TLB_FLUSH_ENTIRE; … … 1338 1338 pHostCpu->uCurrentAsid = 1; /* Wraparound at 1; host uses 0 */ 1339 1339 pHostCpu->cTlbFlushes++; /* All VCPUs that run on this host CPU must use a new ASID. */ 1340 fHitASIDLimit = true;1340 fHitASIDLimit = true; 1341 1341 } 1342 1342 … … 1350 1350 pVCpu->hmr0.s.uCurrentAsid = pHostCpu->uCurrentAsid; 1351 1351 pVCpu->hmr0.s.idLastCpu = pHostCpu->idCpu; 1352 pVCpu->hm .s.cTlbFlushes= pHostCpu->cTlbFlushes;1352 pVCpu->hmr0.s.cTlbFlushes = pHostCpu->cTlbFlushes; 1353 1353 } 1354 1354 else … … 1373 1373 AssertMsg(pVCpu->hmr0.s.idLastCpu == pHostCpu->idCpu, 1374 1374 ("vcpu idLastCpu=%u hostcpu idCpu=%u\n", pVCpu->hmr0.s.idLastCpu, pHostCpu->idCpu)); 1375 AssertMsg(pVCpu->hm .s.cTlbFlushes == pHostCpu->cTlbFlushes,1376 ("Flush count mismatch for cpu %u (%u vs %u)\n", pHostCpu->idCpu, pVCpu->hm .s.cTlbFlushes, pHostCpu->cTlbFlushes));1375 AssertMsg(pVCpu->hmr0.s.cTlbFlushes == pHostCpu->cTlbFlushes, 1376 ("Flush count mismatch for cpu %u (%u vs %u)\n", pHostCpu->idCpu, pVCpu->hmr0.s.cTlbFlushes, pHostCpu->cTlbFlushes)); 1377 1377 AssertMsg(pHostCpu->uCurrentAsid >= 1 && pHostCpu->uCurrentAsid < pVM->hm.s.uMaxAsid, 1378 1378 ("cpu%d uCurrentAsid = %x\n", pHostCpu->idCpu, pHostCpu->uCurrentAsid)); … … 4341 4341 uint64_t const uHostTsc = ASMReadTSC(); /* Read the TSC as soon as possible. */ 4342 4342 ASMAtomicWriteBool(&pVCpu->hm.s.fCheckedTLBFlush, false); /* See HMInvalidatePageOnAllVCpus(): used for TLB flushing. */ 4343 ASMAtomicIncU32(&pVCpu->hm .s.cWorldSwitchExits);/* Initialized in vmR3CreateUVM(): used for EMT poking. */4343 ASMAtomicIncU32(&pVCpu->hmr0.s.cWorldSwitchExits); /* Initialized in vmR3CreateUVM(): used for EMT poking. */ 4344 4344 4345 4345 PSVMVMCB pVmcb = pSvmTransient->pVmcb; -
trunk/src/VBox/VMM/VMMR0/HMVMXR0.cpp
r87479 r87480 2986 2986 2987 2987 Assert(pHostCpu->idCpu != NIL_RTCPUID); 2988 pVCpu->hmr0.s.idLastCpu = pHostCpu->idCpu;2989 pVCpu->hm .s.cTlbFlushes= pHostCpu->cTlbFlushes;2990 pVCpu->hm.s.fForceTLBFlush = false;2988 pVCpu->hmr0.s.idLastCpu = pHostCpu->idCpu; 2989 pVCpu->hmr0.s.cTlbFlushes = pHostCpu->cTlbFlushes; 2990 pVCpu->hm.s.fForceTLBFlush = false; 2991 2991 return; 2992 2992 } … … 3035 3035 * cannot reuse the current ASID anymore. 3036 3036 */ 3037 if ( pVCpu->hmr0.s.idLastCpu != pHostCpu->idCpu3038 || pVCpu->hm .s.cTlbFlushes != pHostCpu->cTlbFlushes)3037 if ( pVCpu->hmr0.s.idLastCpu != pHostCpu->idCpu 3038 || pVCpu->hmr0.s.cTlbFlushes != pHostCpu->cTlbFlushes) 3039 3039 { 3040 3040 ++pHostCpu->uCurrentAsid; … … 3048 3048 pVCpu->hmr0.s.uCurrentAsid = pHostCpu->uCurrentAsid; 3049 3049 pVCpu->hmr0.s.idLastCpu = pHostCpu->idCpu; 3050 pVCpu->hm .s.cTlbFlushes= pHostCpu->cTlbFlushes;3050 pVCpu->hmr0.s.cTlbFlushes = pHostCpu->cTlbFlushes; 3051 3051 3052 3052 /* … … 3093 3093 3094 3094 Assert(pVCpu->hmr0.s.idLastCpu == pHostCpu->idCpu); 3095 Assert(pVCpu->hm .s.cTlbFlushes == pHostCpu->cTlbFlushes);3096 AssertMsg(pVCpu->hm .s.cTlbFlushes == pHostCpu->cTlbFlushes,3097 ("Flush count mismatch for cpu %d (%u vs %u)\n", pHostCpu->idCpu, pVCpu->hm .s.cTlbFlushes, pHostCpu->cTlbFlushes));3095 Assert(pVCpu->hmr0.s.cTlbFlushes == pHostCpu->cTlbFlushes); 3096 AssertMsg(pVCpu->hmr0.s.cTlbFlushes == pHostCpu->cTlbFlushes, 3097 ("Flush count mismatch for cpu %d (%u vs %u)\n", pHostCpu->idCpu, pVCpu->hmr0.s.cTlbFlushes, pHostCpu->cTlbFlushes)); 3098 3098 AssertMsg(pHostCpu->uCurrentAsid >= 1 && pHostCpu->uCurrentAsid < pVM->hm.s.uMaxAsid, 3099 3099 ("Cpu[%u] uCurrentAsid=%u cTlbFlushes=%u pVCpu->idLastCpu=%u pVCpu->cTlbFlushes=%u\n", pHostCpu->idCpu, 3100 pHostCpu->uCurrentAsid, pHostCpu->cTlbFlushes, pVCpu->hmr0.s.idLastCpu, pVCpu->hm .s.cTlbFlushes));3100 pHostCpu->uCurrentAsid, pHostCpu->cTlbFlushes, pVCpu->hmr0.s.idLastCpu, pVCpu->hmr0.s.cTlbFlushes)); 3101 3101 AssertMsg(pVCpu->hmr0.s.uCurrentAsid >= 1 && pVCpu->hmr0.s.uCurrentAsid < pVM->hm.s.uMaxAsid, 3102 3102 ("Cpu[%u] pVCpu->uCurrentAsid=%u\n", pHostCpu->idCpu, pVCpu->hmr0.s.uCurrentAsid)); … … 3132 3132 */ 3133 3133 if ( pVCpu->hmr0.s.idLastCpu != pHostCpu->idCpu 3134 || pVCpu->hm .s.cTlbFlushes != pHostCpu->cTlbFlushes)3134 || pVCpu->hmr0.s.cTlbFlushes != pHostCpu->cTlbFlushes) 3135 3135 { 3136 3136 pVCpu->hm.s.fForceTLBFlush = true; … … 3154 3154 3155 3155 pVCpu->hmr0.s.idLastCpu = pHostCpu->idCpu; 3156 pVCpu->hm .s.cTlbFlushes = pHostCpu->cTlbFlushes;3156 pVCpu->hmr0.s.cTlbFlushes = pHostCpu->cTlbFlushes; 3157 3157 3158 3158 if (pVCpu->hm.s.fForceTLBFlush) … … 3187 3187 */ 3188 3188 if ( pVCpu->hmr0.s.idLastCpu != pHostCpu->idCpu 3189 || pVCpu->hm .s.cTlbFlushes != pHostCpu->cTlbFlushes)3189 || pVCpu->hmr0.s.cTlbFlushes != pHostCpu->cTlbFlushes) 3190 3190 { 3191 3191 pVCpu->hm.s.fForceTLBFlush = true; … … 3227 3227 3228 3228 pVCpu->hm.s.fForceTLBFlush = false; 3229 pVCpu->hm .s.cTlbFlushes = pHostCpu->cTlbFlushes;3229 pVCpu->hmr0.s.cTlbFlushes = pHostCpu->cTlbFlushes; 3230 3230 pVCpu->hmr0.s.uCurrentAsid = pHostCpu->uCurrentAsid; 3231 3231 if (pHostCpu->fFlushAsidBeforeUse) … … 3246 3246 } 3247 3247 3248 AssertMsg(pVCpu->hm .s.cTlbFlushes == pHostCpu->cTlbFlushes,3249 ("Flush count mismatch for cpu %d (%u vs %u)\n", pHostCpu->idCpu, pVCpu->hm .s.cTlbFlushes, pHostCpu->cTlbFlushes));3248 AssertMsg(pVCpu->hmr0.s.cTlbFlushes == pHostCpu->cTlbFlushes, 3249 ("Flush count mismatch for cpu %d (%u vs %u)\n", pHostCpu->idCpu, pVCpu->hmr0.s.cTlbFlushes, pHostCpu->cTlbFlushes)); 3250 3250 AssertMsg(pHostCpu->uCurrentAsid >= 1 && pHostCpu->uCurrentAsid < pVM->hm.s.uMaxAsid, 3251 3251 ("Cpu[%u] uCurrentAsid=%u cTlbFlushes=%u pVCpu->idLastCpu=%u pVCpu->cTlbFlushes=%u\n", pHostCpu->idCpu, 3252 pHostCpu->uCurrentAsid, pHostCpu->cTlbFlushes, pVCpu->hmr0.s.idLastCpu, pVCpu->hm .s.cTlbFlushes));3252 pHostCpu->uCurrentAsid, pHostCpu->cTlbFlushes, pVCpu->hmr0.s.idLastCpu, pVCpu->hmr0.s.cTlbFlushes)); 3253 3253 AssertMsg(pVCpu->hmr0.s.uCurrentAsid >= 1 && pVCpu->hmr0.s.uCurrentAsid < pVM->hm.s.uMaxAsid, 3254 3254 ("Cpu[%u] pVCpu->uCurrentAsid=%u\n", pHostCpu->idCpu, pVCpu->hmr0.s.uCurrentAsid)); … … 11100 11100 11101 11101 ASMAtomicWriteBool(&pVCpu->hm.s.fCheckedTLBFlush, false); /* See HMInvalidatePageOnAllVCpus(): used for TLB flushing. */ 11102 ASMAtomicIncU32(&pVCpu->hm .s.cWorldSwitchExits);/* Initialized in vmR3CreateUVM(): used for EMT poking. */11102 ASMAtomicIncU32(&pVCpu->hmr0.s.cWorldSwitchExits); /* Initialized in vmR3CreateUVM(): used for EMT poking. */ 11103 11103 pVCpu->hm.s.fCtxChanged = 0; /* Exits/longjmps to ring-3 requires saving the guest state. */ 11104 11104 pVmxTransient->fVmcsFieldsRead = 0; /* Transient fields need to be read from the VMCS. */ -
trunk/src/VBox/VMM/include/HMInternal.h
r87479 r87480 999 999 bool afAlignment0[3]; 1000 1000 1001 /** World switch exit counter. */1002 uint32_t volatile cWorldSwitchExits;1003 /** TLB flush count. */1004 uint32_t cTlbFlushes;1005 1001 /** An additional error code used for some gurus. */ 1006 1002 uint32_t u32HMError; … … 1262 1258 AssertCompileMemberAlignment(HMCPU, fCheckedTLBFlush, 4); 1263 1259 AssertCompileMemberAlignment(HMCPU, fForceTLBFlush, 4); 1264 AssertCompileMemberAlignment(HMCPU, cWorldSwitchExits, 4);1265 1260 AssertCompileMemberAlignment(HMCPU, fCtxChanged, 8); 1266 1261 AssertCompileMemberAlignment(HMCPU, HM_UNION_NM(u.) vmx, 8); … … 1276 1271 typedef struct HMR0PERVCPU 1277 1272 { 1278 /** Current ASID in use by the VM. */ 1279 uint32_t uCurrentAsid; 1273 /** World switch exit counter. */ 1274 uint32_t volatile cWorldSwitchExits; 1275 /** TLB flush count. */ 1276 uint32_t cTlbFlushes; 1280 1277 /** The last CPU we were executing code on (NIL_RTCPUID for the first time). */ 1281 1278 RTCPUID idLastCpu; … … 1283 1280 * HMR0Enter and cleared in HMR0Leave. */ 1284 1281 RTCPUID idEnteredCpu; 1282 /** Current ASID in use by the VM. */ 1283 uint32_t uCurrentAsid; 1285 1284 1286 1285 uint32_t u32Padding0; … … 1344 1343 /** Pointer to HM ring-0 VMCPU instance data. */ 1345 1344 typedef HMR0PERVCPU *PHMR0PERVCPU; 1345 AssertCompileMemberAlignment(HMR0PERVCPU, cWorldSwitchExits, 4); 1346 1346 AssertCompileMemberAlignment(HMR0PERVCPU, HM_UNION_NM(u.) vmx.RestoreHost, 8); 1347 1347 -
trunk/src/VBox/VMM/include/HMInternal.mac
r87479 r87480 175 175 alignb 8 176 176 177 .cWorldSwitchExits resd 1178 .cTlbFlushes resd 1179 177 .u32HMError resd 1 180 178 .rcLastExitToR3 resd 1 … … 228 226 229 227 struc HMR0PERVCPU 230 .uCurrentAsid resd 1 228 .cWorldSwitchExits resd 1 229 .cTlbFlushes resd 1 231 230 .idLastCpu resd 1 232 231 .idEnteredCpu resd 1 232 .uCurrentAsid resd 1 233 233 234 234 alignb 8
Note:
See TracChangeset
for help on using the changeset viewer.