VirtualBox

Changeset 53235 in vbox for trunk/src/VBox/VMM/VMMR0


Ignore:
Timestamp:
Nov 5, 2014 12:56:17 PM (10 years ago)
Author:
vboxsync
Message:

VMM: Fixed incorrect pure TSC-offsetting mode switch with paravirt. VMs when the host/TM cannot do offsetting.

Location:
trunk/src/VBox/VMM/VMMR0
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/VMM/VMMR0/HMSVMR0.cpp

    r53197 r53235  
    22622262        uint64_t u64CurTSC   = ASMReadTSC();
    22632263        uint64_t u64LastTick = TMCpuTickGetLastSeen(pVCpu);
    2264         if (fParavirtTsc)
    2265         {
    2266 #if 0
    2267             if (u64CurTSC - pVmcb->ctrl.u64TSCOffset < u64LastTick)
    2268             {
    2269                 pVmcb->ctrl.u64TSCOffset = u64CurTSC - u64LastTick;
    2270                 STAM_COUNTER_INC(&pVCpu->hm.s.StatTscOffsetAdjusted);
    2271             }
    2272             int rc = GIMR0UpdateParavirtTsc(pVCpu->CTX_SUFF(pVM), pVmcb->ctrl.u64TSCOffset);
    2273             AssertRC(rc);
    2274 #endif
    2275             STAM_COUNTER_INC(&pVCpu->hm.s.StatTscParavirt);
    2276         }
    22772264
    22782265        if (u64CurTSC - pVmcb->ctrl.u64TSCOffset >= TMCpuTickGetLastSeen(pVCpu))
     
    22952282        pVmcb->ctrl.u32InterceptCtrl2 |= SVM_CTRL2_INTERCEPT_RDTSCP;
    22962283        STAM_COUNTER_INC(&pVCpu->hm.s.StatTscIntercept);
     2284    }
     2285
     2286    if (fParavirtTsc)
     2287    {
     2288        int rc = GIMR0UpdateParavirtTsc(pVCpu->CTX_SUFF(pVM), 0 /* u64Offset */);
     2289        AssertRC(rc);
     2290        STAM_COUNTER_INC(&pVCpu->hm.s.StatTscParavirt);
    22972291    }
    22982292
  • trunk/src/VBox/VMM/VMMR0/HMVMXR0.cpp

    r53200 r53235  
    56225622    if (fParavirtTsc)
    56235623    {
    5624         /** @todo this is a hack until TM switches to pure-offsetting mode. */
    5625         uint64_t const u64CurTsc   = ASMReadTSC();
    5626         uint64_t const u64LastTick = TMCpuTickGetLastSeen(pVCpu);
    5627         if (u64CurTsc - pVCpu->hm.s.vmx.u64TSCOffset < u64LastTick)
    5628         {
    5629             pVCpu->hm.s.vmx.u64TSCOffset = u64CurTsc - u64LastTick;
    5630             STAM_COUNTER_INC(&pVCpu->hm.s.StatTscOffsetAdjusted);
    5631         }
    5632 
    5633         Assert(u64CurTsc - pVCpu->hm.s.vmx.u64TSCOffset >= u64LastTick);
    5634         rc = GIMR0UpdateParavirtTsc(pVM, pVCpu->hm.s.vmx.u64TSCOffset);
     5624        rc = GIMR0UpdateParavirtTsc(pVM, 0 /* u64Offset */);
    56355625        AssertRC(rc);
    5636         /* Note: VMX_VMCS_CTRL_PROC_EXEC_RDTSC_EXIT takes precedence over TSC_OFFSET, applies to RDTSCP too. */
    5637         rc = VMXWriteVmcs64(VMX_VMCS64_CTRL_TSC_OFFSET_FULL, 0);                                    AssertRC(rc);
    5638 
    5639         pVCpu->hm.s.vmx.u32ProcCtls &= ~VMX_VMCS_CTRL_PROC_EXEC_RDTSC_EXIT;
    5640         rc = VMXWriteVmcs32(VMX_VMCS32_CTRL_PROC_EXEC, pVCpu->hm.s.vmx.u32ProcCtls);                AssertRC(rc);
    56415626        STAM_COUNTER_INC(&pVCpu->hm.s.StatTscParavirt);
    56425627    }
    5643     else if (fOffsettedTsc)
     5628
     5629    if (fOffsettedTsc)
    56445630    {
    56455631        uint64_t u64CurTSC = ASMReadTSC();
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette