mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Petr Mladek <pmladek@suse.com>
To: Andrew Morton <akpm@linux-foundation.org>
Cc: Feng Tang <feng.tang@linux.alibaba.com>,
	paulmck@kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] lib/nmi_backtrace: print out the CPUs which fail to respond to NMI
Date: Fri, 22 May 2026 10:06:35 +0200	[thread overview]
Message-ID: <ahAOi-XS63pWpOPG@pathway.suse.cz> (raw)
In-Reply-To: <20260521205326.06557d667beab85a21fd0a6f@linux-foundation.org>

On Thu 2026-05-21 20:53:26, Andrew Morton wrote:
> On Fri, 22 May 2026 09:46:26 +0800 Feng Tang <feng.tang@linux.alibaba.com> wrote:
> 
> > > 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!)
> > 
> > How about this followon patch?
> 
> Looks great.  But you missed the fun part!
> 
> --- a/lib/nmi_backtrace.c~lib-nmi_backtrace-print-out-the-cpus-which-fail-to-respond-to-nmi-fix-fix
> +++ a/lib/nmi_backtrace.c
> @@ -16,6 +16,7 @@
>  #include <linux/cpumask.h>
>  #include <linux/delay.h>
>  #include <linux/kprobes.h>
> +#include <linux/stringify.h>
>  #include <linux/nmi.h>
>  #include <linux/cpu.h>
>  #include <linux/sched/debug.h>
> @@ -79,8 +80,8 @@ void nmi_trigger_cpumask_backtrace(const
>  	}
>  
>  	if (!cpumask_empty(to_cpumask(backtrace_mask))) {
> -		pr_warn("After %d seconds, these CPUS still haven't responded to the NMI: %*pbl\n",
> -			NMI_BT_TIMEOUT_SEC, cpumask_pr_args(to_cpumask(backtrace_mask)));
> +		pr_warn("After " __stringify(NMI_BT_TIMEOUT_SEC) " 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));
>  	}
> _

With all the followup fixes, LGTM:

Reviewed-by: Petr Mladek <pmladek@suse.com>

Best Regards,
Petr

      parent reply	other threads:[~2026-05-22  8:07 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
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 [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=ahAOi-XS63pWpOPG@pathway.suse.cz \
    --to=pmladek@suse.com \
    --cc=akpm@linux-foundation.org \
    --cc=feng.tang@linux.alibaba.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=paulmck@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

Powered by JetHome