VirtualBox

Changeset 70794 in vbox for trunk/src/VBox


Ignore:
Timestamp:
Jan 29, 2018 5:54:59 PM (7 years ago)
Author:
vboxsync
Message:

VMM/CPUM: Try passthrough invariant TSC feature by default incl. on AMD hosts.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/VMM/VMMR3/CPUMR3CpuId.cpp

    r70720 r70794  
    34903490        if (pCpum->GuestFeatures.enmCpuVendor == CPUMCPUVENDOR_AMD)
    34913491        {
     3492            /*
     3493             * Older 64-bit linux kernels blindly assume that the AMD performance counters work
     3494             * if X86_CPUID_AMD_ADVPOWER_EDX_TSCINVAR is set, see @bugref{7243#c85}. Exposing this
     3495             * bit is now configurable.
     3496             */
    34923497            pCurLeaf->uEdx &= 0
    34933498                           //| X86_CPUID_AMD_ADVPOWER_EDX_TS
     
    34993504                           //| X86_CPUID_AMD_ADVPOWER_EDX_MC
    35003505                           //| X86_CPUID_AMD_ADVPOWER_EDX_HWPSTATE
    3501 #if 0   /*
    3502          * We don't expose X86_CPUID_AMD_ADVPOWER_EDX_TSCINVAR, because newer
    3503          * Linux kernels blindly assume that the AMD performance counters work
    3504          * if this is set for 64 bits guests. (Can't really find a CPUID feature
    3505          * bit for them though.)
    3506          */
    3507         /** @todo need to recheck this with new MSR emulation. */
    3508                            | X86_CPUID_AMD_ADVPOWER_EDX_TSCINVAR
    3509 #endif
     3506                             | X86_CPUID_AMD_ADVPOWER_EDX_TSCINVAR
    35103507                           //| X86_CPUID_AMD_ADVPOWER_EDX_CPB       RT_BIT(9)
    35113508                           //| X86_CPUID_AMD_ADVPOWER_EDX_EFRO      RT_BIT(10)
     
    35163513        else
    35173514            pCurLeaf->uEdx &= X86_CPUID_AMD_ADVPOWER_EDX_TSCINVAR;
    3518         if (pConfig->fInvariantTsc)
    3519             pCurLeaf->uEdx |= X86_CPUID_AMD_ADVPOWER_EDX_TSCINVAR;
     3515        if (!pConfig->fInvariantTsc)
     3516            pCurLeaf->uEdx &= ~X86_CPUID_AMD_ADVPOWER_EDX_TSCINVAR;
    35203517        uSubLeaf++;
    35213518    }
     
    38743871    AssertLogRelRCReturn(rc, rc);
    38753872
    3876     /** @cfgm{/CPUM/InvariantTsc, boolean, complicated}
    3877      * Set the invariant TSC flag in 0x80000007 if true, otherwas take default
    3878      * action.  By default the flag is passed thru as is from the host CPU, except
    3879      * on AMD CPUs where it's suppressed to avoid trouble from linux assuming we
    3880      * virtualize performance counters.
    3881      */
    3882     rc = CFGMR3QueryBoolDef(pCpumCfg, "InvariantTsc", &pConfig->fInvariantTsc, false);
     3873    /** @cfgm{/CPUM/InvariantTsc, boolean, true}
     3874     * Pass-through the invariant TSC flag in 0x80000007 if available on the host
     3875     * CPU. On AMD CPUs, users may wish to suppress it to avoid trouble from older
     3876     * 64-bit linux guests which assume the presence of AMD performance counters
     3877     * that we do not virtualize.
     3878     */
     3879    rc = CFGMR3QueryBoolDef(pCpumCfg, "InvariantTsc", &pConfig->fInvariantTsc, true);
    38833880    AssertLogRelRCReturn(rc, rc);
    38843881
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