- Timestamp:
- May 8, 2012 1:01:09 PM (13 years ago)
- Location:
- trunk/src/VBox/VMM
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/VMM/VMMR0/HWVMXR0.cpp
r41193 r41205 137 137 return VERR_VMX_VMXON_FAILED; 138 138 } 139 140 /* 141 * Flush all VPIDs (in case we or anyother hypervisor have been using VPIDs) so that 142 * we can avoid an explicit flush while using new VPIDs. 143 */ 144 if ( pVM 145 && pVM->hwaccm.s.vmx.fVPID 146 && (pVM->hwaccm.s.vmx.msr.vmx_eptcaps & MSR_IA32_VMX_EPT_CAPS_INVVPID_CAPS_ALL_CONTEXTS)) 147 { 148 hmR0VmxFlushVPID(pVM, NULL /* pvCpu */, VMX_FLUSH_VPID_ALL_CONTEXTS, 0 /* GCPtr */); 149 pCpu->fFlushASIDBeforeUse = false; 150 } 151 else 152 pCpu->fFlushASIDBeforeUse = true; 153 139 154 return VINF_SUCCESS; 140 155 } … … 2207 2222 pCpu->uCurrentASID = 1; /* start at 1; host uses 0 */ 2208 2223 pCpu->cTLBFlushes++; 2224 pCpu->fFlushASIDBeforeUse = true; 2209 2225 } 2210 2226 2211 2227 pVCpu->hwaccm.s.uCurrentASID = pCpu->uCurrentASID; 2212 hmR0VmxFlushVPID(pVM, pVCpu, pVM->hwaccm.s.vmx.enmFlushVPID, 0 /* GCPtr */); 2228 if (pCpu->fFlushASIDBeforeUse) 2229 hmR0VmxFlushVPID(pVM, pVCpu, pVM->hwaccm.s.vmx.enmFlushVPID, 0 /* GCPtr */); 2213 2230 } 2214 2231 else 2232 { 2233 /** @todo is it better to flush by EPT or VPID here? find out which is less 2234 * expensive. */ 2215 2235 hmR0VmxFlushEPT(pVM, pVCpu, pVM->hwaccm.s.vmx.enmFlushEPT); 2236 } 2216 2237 2217 2238 pVCpu->hwaccm.s.cTLBFlushes = pCpu->cTLBFlushes; … … 2363 2384 if (pVCpu->hwaccm.s.fForceTLBFlush) 2364 2385 { 2365 if ( ++pCpu->uCurrentASID >= pVM->hwaccm.s.uMaxASID 2386 ++pCpu->uCurrentASID; 2387 if ( pCpu->uCurrentASID >= pVM->hwaccm.s.uMaxASID 2366 2388 || pCpu->fFlushTLB) 2367 2389 { … … 2369 2391 pCpu->uCurrentASID = 1; /* start at 1; host uses 0 */ 2370 2392 pCpu->cTLBFlushes++; 2371 hmR0VmxFlushVPID(pVM, pVCpu, pVM->hwaccm.s.vmx.enmFlushVPID, 0 /* GCPtr */);2393 pCpu->fFlushASIDBeforeUse = true; 2372 2394 } 2373 2395 else … … 2377 2399 pVCpu->hwaccm.s.cTLBFlushes = pCpu->cTLBFlushes; 2378 2400 pVCpu->hwaccm.s.uCurrentASID = pCpu->uCurrentASID; 2401 if (pCpu->fFlushASIDBeforeUse) 2402 hmR0VmxFlushVPID(pVM, pVCpu, pVM->hwaccm.s.vmx.enmFlushVPID, 0 /* GCPtr */); 2379 2403 } 2380 2404 else … … 2410 2434 int rc = VMXWriteVMCS(VMX_VMCS16_GUEST_FIELD_VPID, pVCpu->hwaccm.s.uCurrentASID); 2411 2435 AssertRC(rc); 2412 2413 if (pVCpu->hwaccm.s.fForceTLBFlush)2414 hmR0VmxFlushVPID(pVM, pVCpu, pVM->hwaccm.s.vmx.enmFlushVPID, 0 /* GCPtr */);2415 2436 2416 2437 # ifdef VBOX_WITH_STATISTICS -
trunk/src/VBox/VMM/include/HWACCMInternal.h
r41190 r41205 165 165 /** TLB flush count. */ 166 166 uint32_t cTLBFlushes; 167 168 /** Whether to flush each new ASID/VPID before use. */ 169 bool fFlushASIDBeforeUse; 167 170 168 171 /** Set the first time a cpu is used to make sure we start with a clean TLB. */
Note:
See TracChangeset
for help on using the changeset viewer.