Files
serenity/Kernel
Lucas Chollet d62c97ce48 Kernel/x86: Prefer the TSC over the HPET to update the system's time
As it requires MMIO access, reading the raw value of the HPET timer is
quite expensive, so doing it every time the system timer fired (~4ms)
resulted in a heavy overload over the system. As shown in [1] it is
quite known that HPET timers are slow to read. Moreover, when using QEMU
reading from MMIO causes a VM exit and makes the whole virtualized world
stop. The consequence is that reading the HPET timer would not appear in
profiles as it is not slow from the perspective of the VM.

To solve that issue, we're now using the Time Stamp Counter (TSC) as our
time-keeping source. Whenever the system interrupt fires, we read the
TSC (which is cheap, see [1], and doesn't cause a VM exit) and compute
the elapsed time based on how many cycle the CPU made during that time.

[1] https://docs.redhat.com/en/documentation/red_hat_enterprise_linux_for_real_time/7/html/reference_guide/chap-timestamping#Reading_hardware_clock_sources
2026-07-26 12:06:38 +02:00
..
2026-02-04 16:06:04 +01:00
2023-11-08 09:31:54 +01:00