VirtualBox

Changeset 87634 in vbox for trunk/src/VBox/VMM


Ignore:
Timestamp:
Feb 5, 2021 9:52:24 PM (4 years ago)
Author:
vboxsync
Message:

VMM/TM,VMM/HMVMX: Try avoid calling TMCpuTickGetDeadlineAndTscOffset as it is expensive. Current approach is a bit erratic wrt CPUID benchmark results, but it's generally better than before. [build fix]

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/VMM/VMMAll/TMAllCpu.cpp

    r87633 r87634  
    234234
    235235
    236 #ifdef VBOX_WITH_STATISTICS
     236#ifdef IN_RING0 /* Only used in ring-0 at present (AMD-V and VT-x). */
     237
     238# ifdef VBOX_WITH_STATISTICS
    237239/**
    238240 * Record why we refused to use offsetted TSC.
     
    269271    }
    270272}
    271 #endif /* VBOX_WITH_STATISTICS */
    272 
    273 
    274 #ifdef IN_RING0 /* Only used in ring-0 at present (AMD-V and VT-x). */
     273# endif /* VBOX_WITH_STATISTICS */
     274
    275275/**
    276276 * Checks if AMD-V / VT-x can use an offsetted hardware TSC or not.
     
    355355    return false;
    356356}
    357 #endif /* IN_RING0 - at the moment */
     357
    358358
    359359/**
     
    371371{
    372372    AssertCompile(TMCLOCK_FREQ_VIRTUAL <= _4G);
    373 #ifdef IN_RING3
     373# ifdef IN_RING3
    374374    RT_NOREF_PV(pVCpu);
    375375    uint64_t uCpuHz = SUPGetCpuHzFromGip(g_pSUPGlobalInfoPage);
    376 #else
     376# else
    377377    uint64_t uCpuHz = SUPGetCpuHzFromGipBySetIndex(g_pSUPGlobalInfoPage, pVCpu->iHostCpuSet);
    378 #endif
     378# endif
    379379    if (RT_UNLIKELY(cNsToDeadline >= TMCLOCK_FREQ_VIRTUAL))
    380380        return uCpuHz;
     
    389389
    390390
    391 #ifdef IN_RING0 /* Only used in ring-0 from VT-x code at the moment. */
    392391/**
    393392 * Gets the next deadline in host CPU clock ticks and the TSC offset if we can
     
    466465    return tmCpuCalcTicksToDeadline(pVCpu, TMVirtualSyncGetNsToDeadline(pVM, puDeadlineVersion, puTscNow));
    467466}
     467
    468468#endif /* IN_RING0 - at the moment */
    469 
    470469
    471470/**
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