Re: [RFC PATCH v3 04/10] timekeeping: Guard against divide-by-zero in timekeeping_adjust

From: John Stultz

Date: Wed May 20 2026 - 19:50:15 EST


On Wed, May 20, 2026 at 6:52 AM David Woodhouse <dwmw2@xxxxxxxxxxxxx> wrote:
>
> From: David Woodhouse <dwmw@xxxxxxxxxxxx>
>
> When the TSC clocksource is recalibrated (e.g. on KVM guests with
> clocksource=tsc), cycle_interval can momentarily be zero during the
> transition. Guard the div64_u64 in timekeeping_adjust() to prevent a
> divide-by-zero oops.
>
> This can be triggered on KVM guests that force clocksource=tsc when
> the guest's measured TSC frequency doesn't match what KVM reported,
> causing a recalibration during boot.
>
> Signed-off-by: David Woodhouse <dwmw@xxxxxxxxxxxx>
> Assisted-by: Kiro:claude-opus-4.6-1m

Acked-by: John Stultz <jstultz@xxxxxxxxxx>