All of lore.kernel.org
 help / color / mirror / Atom feed
From: Thomas Gleixner <tglx@kernel.org>
To: Karl Mehltretter <kmehltretter@gmail.com>,
	John Stultz <jstultz@google.com>, Stephen Boyd <sboyd@kernel.org>
Cc: Karl Mehltretter <kmehltretter@gmail.com>,
	Miroslav Lichvar <mlichvar@redhat.com>,
	Jiri Wiesner <jwiesner@suse.de>,
	Daniel J Blueman <daniel@quora.org>,
	regressions@lists.linux.dev, linux-kernel@vger.kernel.org
Subject: Re: [REGRESSION] clocksource: delayed watchdog can mark TSC unstable
Date: Thu, 15 Oct 2026 20:32:25 +0200	[thread overview]
Message-ID: <87a4oeerwm.ffs@fw13> (raw)
In-Reply-To: <20261010065509.72916-1-kmehltretter@gmail.com>

On Sat, Oct 10 2026 at 08:55, Karl Mehltretter wrote:
> Since the watchdog rewrite in v7.1, the TSC can be marked unstable
> after a delayed watchdog run under QEMU TCG. Without injected stalls,
> this happened on 5 of 12 boots on a loaded host and 0 of 6 on an idle
> host.
>
> The delayed run re-arms the timer with an expiry already in the past.
> The watchdog then runs again almost immediately and rejects the TSC
> based on a roughly 75 us measurement interval.
>
> #regzbot introduced: 763aacf86f1b
>
> v7.3-rc5, 4 vCPUs, after vCPU 0 was stopped for 0.8 s:
>
>   clocksource: Marking clocksource tsc unstable due to frequency skew
>   clocksource: Watchdog                    hpet interval:            74940ns
>   clocksource: Clocksource                  tsc interval:            74251ns
>   clocksource: Switched to clocksource hpet
>
> The intervals are 75 us, not the 500 ms watchdog period. A function
> trace of clocksource_watchdog() from the same boot:
>
>   busybox-79 [000] ..s1. 15.168486: clocksource_watchdog <-call_timer_fn
>   busybox-79 [000] .Ns.. 16.269726: clocksource_watchdog <-call_timer_fn
>   busybox-79 [000] .Ns.. 16.269820: clocksource_watchdog <-call_timer_fn

I did not think about that scenario obvioulsy. The code is resilient
against long intervals between two measurements, so the easy and
straight forward fix is indeed what you (or the LLM) suggested.

Thanks,

        tglx
---
--- a/kernel/time/clocksource.c
+++ b/kernel/time/clocksource.c
@@ -673,7 +673,7 @@ static void clocksource_watchdog(struct
 
 	/* Could have been rearmed by a stop/start cycle */
 	if (!timer_pending(&watchdog_timer)) {
-		watchdog_timer.expires += WATCHDOG_INTERVAL;
+		watchdog_timer.expires = jiffies + WATCHDOG_INTERVAL;
 		add_timer_local(&watchdog_timer);
 	}
 }

      reply	other threads:[~2026-10-15 18:32 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-10  6:55 [REGRESSION] clocksource: delayed watchdog can mark TSC unstable Karl Mehltretter
2026-10-15 18:32 ` Thomas Gleixner [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87a4oeerwm.ffs@fw13 \
    --to=tglx@kernel.org \
    --cc=daniel@quora.org \
    --cc=jstultz@google.com \
    --cc=jwiesner@suse.de \
    --cc=kmehltretter@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mlichvar@redhat.com \
    --cc=regressions@lists.linux.dev \
    --cc=sboyd@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.