Changeset 41312 in vbox for trunk/src/VBox/VMM
- Timestamp:
- May 15, 2012 1:43:43 PM (13 years ago)
- svn:sync-xref-src-repo-rev:
- 77982
- Location:
- trunk/src/VBox/VMM
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/VMM/VMMR0/HWACCMR0.cpp
r40227 r41312 865 865 866 866 pCpu->idCpu = idCpu; 867 868 /* Make sure we start with a clean TLB. */869 pCpu->fFlushTLB = true;870 871 867 pCpu->uCurrentASID = 0; /* we'll aways increment this the first time (host uses ASID 0) */ 872 868 pCpu->cTLBFlushes = 0; -
trunk/src/VBox/VMM/VMMR0/HWSVMR0.cpp
r41309 r41312 1014 1014 1015 1015 pVCpu->hwaccm.s.idLastCpu = pCpu->idCpu; 1016 pCpu->fFlushTLB = false;1017 1016 pVMCB->ctrl.TLBCtrl.n.u8TLBFlush = SVM_TLB_FLUSH_NOTHING; 1018 1017 … … 1102 1101 if (pVMCB->ctrl.TLBCtrl.n.u8TLBFlush == SVM_TLB_FLUSH_NOTHING) 1103 1102 STAM_COUNTER_INC(&pVCpu->hwaccm.s.StatNoFlushTLBWorldSwitch); 1103 else if ( pVMCB->ctrl.TLBCtrl.n.u8TLBFlush == SVM_TLB_FLUSH_SINGLE_CONTEXT 1104 || pVMCB->ctrl.TLBCtrl.n.u8TLBFlush == SVM_TLB_FLUSH_SINGLE_CONTEXT_RETAIN_GLOBALS) 1105 { 1106 STAM_COUNTER_INC(&pVCpu->hwaccm.s.StatFlushASID); 1107 } 1104 1108 else 1105 1109 STAM_COUNTER_INC(&pVCpu->hwaccm.s.StatFlushTLBWorldSwitch); … … 1332 1336 LogFlow(("Force TLB flush due to changed TLB flush count (%x vs %x)\n", pVCpu->hwaccm.s.cTLBFlushes, pCpu->cTLBFlushes)); 1333 1337 } 1334 if (pCpu->fFlushTLB)1335 LogFlow((" Force TLB flush: first time cpu %d is used -> flush\n", pCpu->idCpu));1338 else if (VMCPU_FF_ISSET(pVCpu, VMCPU_FF_TLB_FLUSH)) 1339 LogFlow(("Manual TLB flush\n")); 1336 1340 #endif 1337 1341 -
trunk/src/VBox/VMM/VMMR0/HWVMXR0.cpp
r41281 r41312 233 233 #endif 234 234 235 /* Allocate VMC Bs for all guest CPUs. */235 /* Allocate VMCSs for all guest CPUs. */ 236 236 for (VMCPUID i = 0; i < pVM->cCpus; i++) 237 237 { … … 2205 2205 2206 2206 pVCpu->hwaccm.s.idLastCpu = pCpu->idCpu; 2207 pCpu->fFlushTLB = false;2208 2209 #ifdef VBOX_WITH_STATISTICS2210 if (pVCpu->hwaccm.s.fForceTLBFlush)2211 STAM_COUNTER_INC(&pVCpu->hwaccm.s.StatFlushTLBWorldSwitch);2212 else2213 STAM_COUNTER_INC(&pVCpu->hwaccm.s.StatNoFlushTLBWorldSwitch);2214 #endif2215 2207 2216 2208 if (pVCpu->hwaccm.s.fForceTLBFlush) … … 2228 2220 pVCpu->hwaccm.s.uCurrentASID = pCpu->uCurrentASID; 2229 2221 if (pCpu->fFlushASIDBeforeUse) 2222 { 2230 2223 hmR0VmxFlushVPID(pVM, pVCpu, pVM->hwaccm.s.vmx.enmFlushVPID, 0 /* GCPtr */); 2224 #ifdef VBOX_WITH_STATISTICS 2225 STAM_COUNTER_INC(&pVCpu->hwaccm.s.StatFlushASID); 2226 #endif 2227 } 2231 2228 } 2232 2229 else … … 2236 2233 else 2237 2234 hmR0VmxFlushEPT(pVM, pVCpu, pVM->hwaccm.s.vmx.enmFlushEPT); 2235 2236 #ifdef VBOX_WITH_STATISTICS 2237 /* 2238 * This is not terribly accurate (i.e. we don't have a StatFlushEPT counter so we currently count these 2239 * as ASID flushes too, better than including them under StatFlushTLBWorldSwitch. 2240 */ 2241 STAM_COUNTER_INC(&pVCpu->hwaccm.s.StatFlushASID); 2242 #endif 2238 2243 } 2239 2244 … … 2264 2269 hmR0VmxFlushEPT(pVM, pVCpu, pVM->hwaccm.s.vmx.enmFlushEPT); 2265 2270 } 2271 else 2272 { 2273 #ifdef VBOX_WITH_STATISTICS 2274 STAM_COUNTER_INC(&pVCpu->hwaccm.s.StatNoFlushTLBWorldSwitch); 2275 #endif 2276 } 2266 2277 } 2267 2278 pVCpu->hwaccm.s.TlbShootdown.cPages = 0; 2268 2279 VMCPU_FF_CLEAR(pVCpu, VMCPU_FF_TLB_SHOOTDOWN); 2269 2280 2270 Assert(pCpu->fFlushTLB == false);2271 2281 AssertMsg(pVCpu->hwaccm.s.cTLBFlushes == pCpu->cTLBFlushes, 2272 2282 ("Flush count mismatch for cpu %d (%x vs %x)\n", pCpu->idCpu, pVCpu->hwaccm.s.cTLBFlushes, pCpu->cTLBFlushes)); … … 2307 2317 pVCpu->hwaccm.s.fForceTLBFlush = true; 2308 2318 } 2309 /* Disabled because this has triggered every time I have suspended my2310 * laptop with a VM running for the past three months or more. */2311 // else2312 // Assert(!pCpu->fFlushTLB);2313 2319 2314 2320 /* Check for tlb shootdown flushes. */ … … 2317 2323 2318 2324 pVCpu->hwaccm.s.idLastCpu = pCpu->idCpu; 2319 pCpu->fFlushTLB = false;2320 2325 2321 2326 if (pVCpu->hwaccm.s.fForceTLBFlush) 2322 {2323 2327 hmR0VmxFlushEPT(pVM, pVCpu, pVM->hwaccm.s.vmx.enmFlushEPT); 2324 }2325 2328 else 2326 2329 { … … 2374 2377 pVCpu->hwaccm.s.fForceTLBFlush = true; 2375 2378 } 2376 else2377 Assert(!pCpu->fFlushTLB);2378 2379 2379 2380 pVCpu->hwaccm.s.idLastCpu = pCpu->idCpu; … … 2387 2388 { 2388 2389 ++pCpu->uCurrentASID; 2389 if ( pCpu->uCurrentASID >= pVM->hwaccm.s.uMaxASID 2390 || pCpu->fFlushTLB) 2391 { 2392 pCpu->fFlushTLB = false; 2390 if (pCpu->uCurrentASID >= pVM->hwaccm.s.uMaxASID) 2391 { 2393 2392 pCpu->uCurrentASID = 1; /* start at 1; host uses 0 */ 2394 2393 pCpu->cTLBFlushes++; … … 2406 2405 else 2407 2406 { 2408 Assert(!pCpu->fFlushTLB);2409 2407 Assert(pVCpu->hwaccm.s.uCurrentASID && pCpu->uCurrentASID); 2410 2408 … … 2757 2755 LogFlow(("Force TLB flush due to changed TLB flush count (%x vs %x)\n", pVCpu->hwaccm.s.cTLBFlushes, pCpu->cTLBFlushes)); 2758 2756 } 2759 if (pCpu->fFlushTLB) 2760 LogFlow(("Force TLB flush: first time cpu %d is used -> flush\n", pCpu->idCpu)); 2761 else if (pVCpu->hwaccm.s.fForceTLBFlush) 2757 else if (VMCPU_FF_ISSET(pVCpu, VMCPU_FF_TLB_FLUSH)) 2762 2758 LogFlow(("Manual TLB flush\n")); 2763 2759 } -
trunk/src/VBox/VMM/include/HWACCMInternal.h
r41205 r41312 168 168 /** Whether to flush each new ASID/VPID before use. */ 169 169 bool fFlushASIDBeforeUse; 170 171 /** Set the first time a cpu is used to make sure we start with a clean TLB. */172 bool fFlushTLB;173 170 174 171 /** Configured for VT-x or AMD-V. */
Note:
See TracChangeset
for help on using the changeset viewer.