diff options
author | 2024-03-25 08:40:23 +0200 | |
---|---|---|
committer | 2024-04-08 15:03:08 +0200 | |
commit | d0304569fb019d1bcfbbbce1ce6df6b96f04079b (patch) | |
tree | d900f55b9d79777af57bcb3d8daea7e1eb703af0 /scripts/gdb/linux/utils.py | |
parent | timekeeping: Let timekeeping_cycles_to_ns() handle both under and overflow (diff) | |
download | linux-rng-d0304569fb019d1bcfbbbce1ce6df6b96f04079b.tar.xz linux-rng-d0304569fb019d1bcfbbbce1ce6df6b96f04079b.zip |
clocksource: Make watchdog and suspend-timing multiplication overflow safe
Kernel timekeeping is designed to keep the change in cycles (since the last
timer interrupt) below max_cycles, which prevents multiplication overflow
when converting cycles to nanoseconds. However, if timer interrupts stop,
the clocksource_cyc2ns() calculation will eventually overflow.
Add protection against that. Simplify by folding together
clocksource_delta() and clocksource_cyc2ns() into cycles_to_nsec_safe().
Check against max_cycles, falling back to a slower higher precision
calculation.
Suggested-by: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: Adrian Hunter <adrian.hunter@intel.com>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Link: https://lore.kernel.org/r/20240325064023.2997-20-adrian.hunter@intel.com
Diffstat (limited to 'scripts/gdb/linux/utils.py')
0 files changed, 0 insertions, 0 deletions