mirror of
https://github.com/RPCS3/rpcs3.git
synced 2025-07-08 16:01:42 +12:00
LV2: Improve sys_timer_usleep by using CPU usermode waiting
* Linux: set timerslack to minimum value - Linux delays the wakeup of threads to save power, this feature isn't needed for this application * Utils: Add detection for waitpkg and monitorx extensions - These instructions are used for user mode wait instructions * lv2: Use user mode wait instructions instead of yielding when appropriate
This commit is contained in:
parent
aee97e414f
commit
d4cf12bc17
4 changed files with 101 additions and 1 deletions
|
@ -298,7 +298,7 @@ bool utils::has_fma4()
|
|||
bool utils::has_fast_vperm2b()
|
||||
{
|
||||
#if defined(ARCH_X64)
|
||||
static const bool g_value = has_avx512() && (get_cpuid(7, 0)[2] & 0x2) == 0x2 && get_cpuid(0, 0)[0] >= 0x7 && (get_cpuid(0x80000001, 0)[2] & 0x20) == 0x20;
|
||||
static const bool g_value = has_avx512() && (get_cpuid(7, 0)[2] & 0x2) == 0x2 && get_cpuid(0, 0)[0] >= 0x7 && (get_cpuid(0x80000001, 0)[2] & 0x40) == 0x40;
|
||||
return g_value;
|
||||
#else
|
||||
return false;
|
||||
|
@ -325,6 +325,39 @@ bool utils::has_fsrm()
|
|||
#endif
|
||||
}
|
||||
|
||||
bool utils::has_waitx()
|
||||
{
|
||||
#if defined(ARCH_X64)
|
||||
static const bool g_value = get_cpuid(0, 0)[0] >= 0x7 && (get_cpuid(0x80000001, 0)[2] & 0x20000000) == 0x20000000;
|
||||
return g_value;
|
||||
#else
|
||||
return false;
|
||||
#endif
|
||||
}
|
||||
|
||||
bool utils::has_waitpkg()
|
||||
{
|
||||
#if defined(ARCH_X64)
|
||||
static const bool g_value = get_cpuid(0, 0)[0] >= 0x7 && (get_cpuid(7, 0)[2] & 0x20) == 0x20;
|
||||
return g_value;
|
||||
#else
|
||||
return false;
|
||||
#endif
|
||||
}
|
||||
|
||||
// User mode waits may be unfriendly to low thread CPUs
|
||||
// Filter out systems with less than 8 threads for linux and less than 12 threads for other platforms
|
||||
bool utils::has_appropriate_um_wait()
|
||||
{
|
||||
#ifdef __linux__
|
||||
static const bool g_value = (has_waitx() || has_waitpkg()) && (get_thread_count() >= 8) && get_tsc_freq();
|
||||
return g_value;
|
||||
#else
|
||||
static const bool g_value = (has_waitx() || has_waitpkg()) && (get_thread_count() >= 12) && get_tsc_freq();
|
||||
return g_value;
|
||||
#endif
|
||||
}
|
||||
|
||||
u32 utils::get_rep_movsb_threshold()
|
||||
{
|
||||
static const u32 g_value = []()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue