From: Peter Zijlstra <peterz@infradead.org>
To: Rik van Riel <riel@surriel.com>
Cc: "Paul E. McKenney" <paulmck@kernel.org>,
linux-kernel@vger.kernel.org, kernel-team@meta.com,
neeraj.upadhyay@kernel.org, mingo@kernel.org,
rostedt@goodmis.org, Leonardo Bras <leobras@redhat.com>
Subject: Re: [PATCH] smp: print only local CPU info when sched_clock goes backward
Date: Tue, 16 Jul 2024 11:04:43 +0200 [thread overview]
Message-ID: <20240716090443.GQ14400@noisy.programming.kicks-ass.net> (raw)
In-Reply-To: <20240715134941.7ac59eb9@imladris.surriel.com>
On Mon, Jul 15, 2024 at 01:49:41PM -0400, Rik van Riel wrote:
> About 40% of all csd_lock warnings observed in our fleet appear to
> be due to sched_clock() going backward in time (usually only a little
> bit), resulting in ts0 being larger than ts2.
>
> When the local CPU is at fault, we should print out a message reflecting
> that, rather than trying to get the remote CPU's stack trace.
>
> Signed-off-by: Rik van Riel <riel@surriel.com>
> ---
> kernel/smp.c | 8 ++++++++
> 1 file changed, 8 insertions(+)
>
> diff --git a/kernel/smp.c b/kernel/smp.c
> index f085ebcdf9e7..5656ef63ea82 100644
> --- a/kernel/smp.c
> +++ b/kernel/smp.c
> @@ -237,6 +237,14 @@ static bool csd_lock_wait_toolong(call_single_data_t *csd, u64 ts0, u64 *ts1, in
> if (likely(ts_delta <= csd_lock_timeout_ns || csd_lock_timeout_ns == 0))
> return false;
>
> + if (ts0 > ts2) {
> + /* Our own sched_clock went backward; don't blame another CPU. */
> + ts_delta = ts0 - ts2;
> + pr_alert("sched_clock on CPU %d went backward by %llu ns\n", raw_smp_processor_id(), ts_delta);
> + *ts1 = ts2;
> + return false;
> + }
So I've seen some chatter about this on IRC and was WTF, seeing this
patch I'm still WTF. What is going on with those machines?!?!
next prev parent reply other threads:[~2024-07-16 9:04 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-07-15 17:49 [PATCH] smp: print only local CPU info when sched_clock goes backward Rik van Riel
2024-07-15 18:07 ` Paul E. McKenney
2024-07-24 17:19 ` Neeraj Upadhyay
2024-07-16 9:04 ` Peter Zijlstra [this message]
2024-07-16 13:10 ` Rik van Riel
2024-07-16 13:47 ` Paul E. McKenney
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=20240716090443.GQ14400@noisy.programming.kicks-ass.net \
--to=peterz@infradead.org \
--cc=kernel-team@meta.com \
--cc=leobras@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@kernel.org \
--cc=neeraj.upadhyay@kernel.org \
--cc=paulmck@kernel.org \
--cc=riel@surriel.com \
--cc=rostedt@goodmis.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