mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Andrew Morton <akpm@linux-foundation.org>
To: Feng Tang <feng.tang@linux.alibaba.com>
Cc: paulmck@kernel.org, Petr Mladek <pmladek@suse.com>,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH] lib/nmi_backtrace: print out the CPUs which fail to respond to NMI
Date: Thu, 21 May 2026 15:37:16 -0700	[thread overview]
Message-ID: <20260521153716.0e6da8366d3e2004e9e7cf97@linux-foundation.org> (raw)
In-Reply-To: <20260521030336.92172-1-feng.tang@linux.alibaba.com>

On Thu, 21 May 2026 11:03:36 +0800 Feng Tang <feng.tang@linux.alibaba.com> wrote:

> When debugging RCU stall cases, usually all CPUs will respond to the
> NMI and print out the backtrace. But in some nasty or hardware related
> cases, some CPUs may fail to respond in 10 seconds, and very likely
> this is sign of severe issues.
> 
> Paul E. McKenney has implemented the NMI backtrace stall check for x86,
> and for other architectures, it should be also helpful to at least
> print out those CPUs which failed to repond to the NMI, so that users
> can get an early heads-up for possible CPU hard stall.

That must be one messed up machine.  Is this something you've
encountered in real life?

> --- a/lib/nmi_backtrace.c
> +++ b/lib/nmi_backtrace.c
> @@ -75,7 +75,13 @@ void nmi_trigger_cpumask_backtrace(const cpumask_t *mask,
>  		mdelay(1);
>  		touch_softlockup_watchdog();
>  	}
> -	nmi_backtrace_stall_check(to_cpumask(backtrace_mask));
> +
> +	if (!cpumask_empty(to_cpumask(backtrace_mask))) {
> +		pr_warn("After 10 seconds, these CPUS still haven't responded to the NMI: %*pbl\n",
> +			cpumask_pr_args(to_cpumask(backtrace_mask)));
> +
> +		nmi_backtrace_stall_check(to_cpumask(backtrace_mask));
> +	}

It's a nitpick, but

: 	/* Wait for up to 10 seconds for all CPUs to do the backtrace */
: 	for (i = 0; i < 10 * 1000; i++) {
: 		if (cpumask_empty(to_cpumask(backtrace_mask)))
: 			break;
: 		mdelay(1);
: 		touch_softlockup_watchdog();
: 	}
: 
: 	if (!cpumask_empty(to_cpumask(backtrace_mask))) {
: 		pr_warn("After 10 seconds, these CPUS still haven't responded to the NMI: %*pbl\n",

Here we're hard-coding "10" in two places and in a comment.  It would
be nicer to do

	#define FOO_TIMEOUT 10

then use that throughout.

(bonus points for figuring out how to paste that "10" into the
pr_warn() control string rather than using %d!)

  reply	other threads:[~2026-05-21 22:37 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-05-21  3:03 Feng Tang
2026-05-21 22:37 ` Andrew Morton [this message]
2026-05-22  1:46   ` Feng Tang
2026-05-22  3:53     ` Andrew Morton
2026-05-22  5:02       ` Feng Tang
2026-05-22  8:06       ` Petr Mladek

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=20260521153716.0e6da8366d3e2004e9e7cf97@linux-foundation.org \
    --to=akpm@linux-foundation.org \
    --cc=feng.tang@linux.alibaba.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=paulmck@kernel.org \
    --cc=pmladek@suse.com \
    /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

Powered by JetHome