Changeset 42184 in vbox for trunk/src/VBox/VMM/VMMR0
- Timestamp:
- Jul 17, 2012 1:27:53 PM (12 years ago)
- Location:
- trunk/src/VBox/VMM/VMMR0
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/VMM/VMMR0/HWSVMR0.cpp
r42174 r42184 1178 1178 unsigned cResume = 0; 1179 1179 uint8_t u8LastTPR = 0; /* Initialized for potentially stupid compilers. */ 1180 uint32_t u32HostExtFeatures = 0; 1180 1181 PHMGLOBLCPUINFO pCpu = 0; 1181 1182 RTCCUINTREG uOldEFlags = ~(RTCCUINTREG)0; … … 1396 1397 #ifdef LOG_ENABLED 1397 1398 pCpu = HWACCMR0GetCurrentCpu(); 1398 if ( pVCpu->hwaccm.s.idLastCpu != pCpu->idCpu 1399 || pVCpu->hwaccm.s.cTLBFlushes != pCpu->cTLBFlushes) 1400 { 1401 if (pVCpu->hwaccm.s.idLastCpu != pCpu->idCpu) 1402 { 1403 LogFlow(("Force TLB flush due to rescheduling to a different cpu (%d vs %d)\n", pVCpu->hwaccm.s.idLastCpu, 1404 pCpu->idCpu)); 1405 } 1406 else 1407 { 1408 LogFlow(("Force TLB flush due to changed TLB flush count (%x vs %x)\n", pVCpu->hwaccm.s.cTLBFlushes, 1409 pCpu->cTLBFlushes)); 1410 } 1411 } 1399 if (pVCpu->hwaccm.s.idLastCpu != pCpu->idCpu) 1400 LogFlow(("Force TLB flush due to rescheduling to a different cpu (%d vs %d)\n", pVCpu->hwaccm.s.idLastCpu, pCpu->idCpu)); 1401 else if (pVCpu->hwaccm.s.cTLBFlushes != pCpu->cTLBFlushes) 1402 LogFlow(("Force TLB flush due to changed TLB flush count (%x vs %x)\n", pVCpu->hwaccm.s.cTLBFlushes, pCpu->cTLBFlushes)); 1412 1403 else if (VMCPU_FF_ISSET(pVCpu, VMCPU_FF_TLB_FLUSH)) 1413 1404 LogFlow(("Manual TLB flush\n")); … … 1460 1451 #endif 1461 1452 TMNotifyStartOfExecution(pVCpu); 1453 1454 /* 1455 * Save the current Host TSC_AUX and write the guest TSC_AUX to the host, so that 1456 * RDTSCPs (that don't cause exits) reads the guest MSR. See @bugref{3324}. 1457 */ 1458 u32HostExtFeatures = ASMCpuId_EDX(0x80000001); /** @todo Move this elsewhere, not needed on every world switch */ 1459 if ( (u32HostExtFeatures & X86_CPUID_EXT_FEATURE_EDX_RDTSCP) 1460 && !(pVMCB->ctrl.u32InterceptCtrl2 & SVM_CTRL2_INTERCEPT_RDTSCP)) 1461 { 1462 pVCpu->hwaccm.s.u64HostTSCAux = ASMRdMsr(MSR_K8_TSC_AUX); 1463 uint64_t u64GuestTSCAux = 0; 1464 rc2 = CPUMQueryGuestMsr(pVCpu, MSR_K8_TSC_AUX, &u64GuestTSCAux); 1465 AssertRC(rc2); 1466 ASMWrMsr(MSR_K8_TSC_AUX, u64GuestTSCAux); 1467 } 1468 1462 1469 #ifdef VBOX_WITH_KERNEL_USING_XMM 1463 1470 hwaccmR0SVMRunWrapXMM(pVCpu->hwaccm.s.svm.pVMCBHostPhys, pVCpu->hwaccm.s.svm.pVMCBPhys, pCtx, pVM, pVCpu, … … 1471 1478 if (!(pVMCB->ctrl.u32InterceptCtrl1 & SVM_CTRL1_INTERCEPT_RDTSC)) 1472 1479 { 1480 /* Restore host's TSC_AUX. */ 1481 if (u32HostExtFeatures & X86_CPUID_EXT_FEATURE_EDX_RDTSCP) 1482 ASMWrMsr(MSR_K8_TSC_AUX, pVCpu->hwaccm.s.u64HostTSCAux); 1483 1473 1484 TMCpuTickSetLastSeen(pVCpu, ASMReadTSC() + 1474 1485 pVMCB->ctrl.u64TSCOffset - 0x400 /* guestimate of world switch overhead in clock ticks */); -
trunk/src/VBox/VMM/VMMR0/HWVMXR0.cpp
r42173 r42184 1372 1372 # endif 1373 1373 1374 if ( (u32HostExtFeatures & X86_CPUID_EXT_FEATURE_EDX_RDTSCP) 1375 && pVCpu->hwaccm.s.vmx.proc_ctls2 & VMX_VMCS_CTRL_PROC_EXEC2_RDTSCP) 1374 if (pVCpu->hwaccm.s.vmx.proc_ctls2 & VMX_VMCS_CTRL_PROC_EXEC2_RDTSCP) 1376 1375 { 1377 1376 pMsr->u32IndexMSR = MSR_K8_TSC_AUX; … … 3178 3177 && !(pVCpu->hwaccm.s.vmx.proc_ctls & VMX_VMCS_CTRL_PROC_EXEC_CONTROLS_RDTSC_EXIT)) 3179 3178 { 3180 pVCpu->hwaccm.s. vmx.u64HostTSCAux = ASMRdMsr(MSR_K8_TSC_AUX);3179 pVCpu->hwaccm.s.u64HostTSCAux = ASMRdMsr(MSR_K8_TSC_AUX); 3181 3180 uint64_t u64GuestTSCAux = 0; 3182 3181 rc2 = CPUMQueryGuestMsr(pVCpu, MSR_K8_TSC_AUX, &u64GuestTSCAux); … … 3194 3193 ASMAtomicIncU32(&pVCpu->hwaccm.s.cWorldSwitchExits); 3195 3194 3196 #ifndef VBOX_WITH_AUTO_MSR_LOAD_RESTORE3197 /*3198 * Restore host's TSC_AUX.3199 */3200 if ( (pVCpu->hwaccm.s.vmx.proc_ctls2 & VMX_VMCS_CTRL_PROC_EXEC2_RDTSCP)3201 && !(pVCpu->hwaccm.s.vmx.proc_ctls & VMX_VMCS_CTRL_PROC_EXEC_CONTROLS_RDTSC_EXIT))3202 {3203 ASMWrMsr(MSR_K8_TSC_AUX, pVCpu->hwaccm.s.vmx.u64HostTSCAux);3204 }3205 #endif3206 3207 3195 /* Possibly the last TSC value seen by the guest (too high) (only when we're in TSC offset mode). */ 3208 3196 if (!(pVCpu->hwaccm.s.vmx.proc_ctls & VMX_VMCS_CTRL_PROC_EXEC_CONTROLS_RDTSC_EXIT)) 3209 3197 { 3198 #ifndef VBOX_WITH_AUTO_MSR_LOAD_RESTORE 3199 /* Restore host's TSC_AUX. */ 3200 if (pVCpu->hwaccm.s.vmx.proc_ctls2 & VMX_VMCS_CTRL_PROC_EXEC2_RDTSCP) 3201 ASMWrMsr(MSR_K8_TSC_AUX, pVCpu->hwaccm.s.u64HostTSCAux); 3202 #endif 3203 3210 3204 TMCpuTickSetLastSeen(pVCpu, 3211 3205 ASMReadTSC() + pVCpu->hwaccm.s.vmx.u64TSCOffset - 0x400 /* guestimate of world switch overhead in clock ticks */);
Note:
See TracChangeset
for help on using the changeset viewer.