HPET and Nvidia on Linux

I tried using high precision event timer (HPET) as the clocksource for my system to see if it would benefit performance in gaming today, and the system performed normally with clocksource=hpet invoked on the kernel command line, but when playing a game it produced really strange performance.

I was locked at ~30 fps, but the connection between me making an action, and the game server responding appeared to improve dramatically.

I’ve tried customizing different linux distro’s over the past few years to maximize their gaming performance, but out of all the potential configuration options I haven’t stumbled upon this one yet, until today.

Some games perform better on windows versus linux, and their performance appears to become more dramatically improved as wine’s development improves specifically. The system’s performance itself, or customizing it doesn’t make as large of a difference in these cases.

I was under the impression that HPET was standard for gaming, coming from a windows background. Similarly to disabling security mitigations like memory randomization, configurations that lead to greater performance in online gaming have become a necessity.

I’ve spent a few hours trying to find information about the issue online, but mainly googling leads to forum posts with people recommending to turn off hpet and stick to default clocksource in linux tsc.

Now I’m using a system customized from the ground up hardware->software to produce extreme gaming performance, and on windows it is easily achievable for me, but on linux it’s impossible to achieve equal performance, but linux has the capability to perform uniquely, and light years beyond windows in many respects, such as…briefly in terms of system responsiveness.

These are potential kernel parameters I’ve found which can alter the situation.

clocksource=hpet

hpet=enable
hpet_mmap=1
hpet=force
hpet=verbose
nohpet
acpi=off
apic=off

But what I’ve noticed is that the system performs normally with hpet, except in the case of gaming, which leads me to believe it’s an issue with this clocksource and Nvidia specifically. I was wondering if anyone has any thoughts on this matter, or any helpful ideas whatsoever.

This is the quote from the arch wiki page on gaming that led me down this path…

Improve clock_gettime throughput

User space programs and especially games do many calls to clock_gettime(2) to get the current time for calculating game physics, fps and so on. The time usage can be seen by running

perf top

and looking at the overhead of read_hpet (or acpi_pm_read).

If you are not dependent on a very precise timer you can switch from hpet (high precision event timer) or acpi_pm (ACPI Power Management Timer) to the faster TSC (time stamp counter) timer. Add the kernel parameters

to make TSC available and enable it. After that reboot and confirm the clocksource by running

cat /sys/devices/system/clocksource/clocksource*/current_clocksource

You can see all currently available timers by runningAt the moment, the tickless kernel works best with the HPET.

cat /sys/devices/system/clocksource/clocksource*/available_clocksource

Also there is potential to improve tsc with some alterations apparently, but clearly we want hpet for gaming, for extreme response time… I think I paid about 800 dollars to get a gaming monitor with 1ms response time, and honestly these alterations are the difference between being competitive in online gaming or not, having fun, or not.

kernel commands I found to potentially improve tsc
(the default clock source)

tsc=reliable
clocksource=tsc
tsc=nowatchdog
tsc=directsync

Anyways, it seems to be an issue specifically with how the system clock is related to Nvidia, it’s hardware, and it’s software, so again I was just hoping maybe someone could point me in the right direction, to take advantage of the system clocksource on linux, and hopefully get to use hpet for online gaming…it’s my understanding that this will enable us to actually start to compete on an even playing field with windows gamers, and start to beat em up real bad ; D

edit: I also tested using acpi_pm instead of tsc as the clocksource and found that it produced a similar behavior to hpet, with immediate response time in an online competitive fps game , but with typical frame rates as opposed to hpet which was stuck hovering around 30-32fps.

I not sure if you correct here.

I running HPET for years

> cat /sys/devices/system/clocksource/clocksource0/current_clocksource
hpet

but when playing a game it produced really strange performance.

read this
https://www.reddit.com/r/linux_gaming/comments/j5fepu/psa_for_ue4_games_over_wineproton_use/

On my 10920X, switching between TSC and HPET was the difference between 70fps and 10fps. It’s that big of a difference.

It seems something about HPET as a clocksource severely negatively affects performance, acpi_pm, while also affected by a performance drop, doesn’t do it as severely.

From my experience - this is not just UE4 games, but also Unity, for example - RiskOfRain2 game need 5 min to load when hpet used, and have 2x less fps for me than with tsc.

Most of games work fine with hpet, but there rare exceptions.

P.S. if I remember correctly - on Windows there also games work incorrectly with hpet and it recommended to turn it off.

Interesting topic, my information over a decade old always was, hpet should be superior but is buggy as hell so disable it. Seems nothing has changed meanwhile.