public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Thomas Gleixner <tglx@linutronix.de>
To: paulmck@kernel.org, linux-kernel@vger.kernel.org
Cc: jstultz@google.com, sboyd@kernel.org, christian@heusel.eu,
	kernel-team@meta.com, "Peter Zijlstra" <peterz@infradead.org>,
	"Yafang Shao" <laoar.shao@gmail.com>,
	"Michal Koutný" <mkoutny@suse.com>,
	"Vincent Guittot" <vincent.guittot@linaro.org>
Subject: Re: [PATCH v2] clocksource: Defer marking clocksources unstable to kthread
Date: Sat, 08 Mar 2025 17:38:51 +0100	[thread overview]
Message-ID: <87plir32as.ffs@tglx> (raw)
In-Reply-To: <11d36fdd-55c2-4f3b-96b1-dd442f759ba0@paulmck-laptop>

On Thu, Mar 06 2025 at 08:06, Paul E. McKenney wrote:
> The clocksource watchdog marks clocksources unstable from within a timer
> handler.  On x86, this marking involves an on_each_cpu_cond_mask(),
> which in turn invokes smp_call_function_many_cond(), which may not be
> invoked from a timer handler.  Doing so results in:
>
> WARNING: CPU: 3 PID: 0 at kernel/smp.c:815 smp_call_function_many_cond+0x46b/0x4c0
>
> Fix this by deferring the marking to the clocksource watchdog kthread.
> Note that marking unstable is already deferred, so deferring it a bit
> more should be just fine.

While this can be done, that's papering over the underlying problem,
which was introduced with:

  8722903cbb8f ("sched: Define sched_clock_irqtime as static key")

That added the static key switch, which is causing the problem. And
"fixing" this in the clocksource watchdog is incomplete because the same
problem exists during CPU hotplug when the TSC synchronization declares
the TSC unstable. It's the exactly same problem as was fixed via:

 6577e42a3e16 ("sched/clock: Fix up clear_sched_clock_stable()")

So as this got introduced in the 6.14 merge window, the proper fix is to
revert commit 8722903cbb8f and send it back to the drawing board. It was
clearly never tested with the various possibilities which invoke
mark_tsc*_unstable().

Thanks,

        tglx



  reply	other threads:[~2025-03-08 16:38 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-03-06 16:06 [PATCH v2] clocksource: Defer marking clocksources unstable to kthread Paul E. McKenney
2025-03-08 16:38 ` Thomas Gleixner [this message]
2025-03-09 11:36   ` Yafang Shao
2025-03-09 15:58     ` Paul E. McKenney
2025-03-09 16:07     ` Thomas Gleixner
2025-03-10  8:57       ` Peter Zijlstra

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=87plir32as.ffs@tglx \
    --to=tglx@linutronix.de \
    --cc=christian@heusel.eu \
    --cc=jstultz@google.com \
    --cc=kernel-team@meta.com \
    --cc=laoar.shao@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mkoutny@suse.com \
    --cc=paulmck@kernel.org \
    --cc=peterz@infradead.org \
    --cc=sboyd@kernel.org \
    --cc=vincent.guittot@linaro.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox