mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Paul E. McKenney" <paulmck@kernel.org>
To: Hillf Danton <hdanton@sina.com>
Cc: Dmitry Vyukov <dvyukov@google.com>, linux-kernel@vger.kernel.org
Subject: Re: [PATCH rcu 04/11] kernel/smp: Provide boot-time timeout for CSD lock diagnostics
Date: Tue, 19 Apr 2022 06:46:16 -0700	[thread overview]
Message-ID: <20220419134616.GE4285@paulmck-ThinkPad-P17-Gen-1> (raw)
In-Reply-To: <20220419085607.2014-1-hdanton@sina.com>

On Tue, Apr 19, 2022 at 04:56:07PM +0800, Hillf Danton wrote:
> On Mon, 18 Apr 2022 15:53:52 -0700 Paul E. McKenney wrote:
> > Debugging of problems involving insanely long-running SMI handlers
> > proceeds better if the CSD-lock timeout can be adjusted.  This commit
> > therefore provides a new smp.csd_lock_timeout kernel boot parameter
> > that specifies the timeout in milliseconds.  The default remains at the
> > previously hard-coded value of five seconds.
> > 
> > Cc: Rik van Riel <riel@surriel.com>
> > Cc: Peter Zijlstra <peterz@infradead.org>
> > Cc: Ingo Molnar <mingo@kernel.org>
> > Cc: Thomas Gleixner <tglx@linutronix.de>
> > Cc: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
> > Cc: Juergen Gross <jgross@suse.com>
> > Signed-off-by: Paul E. McKenney <paulmck@kernel.org>
> > ---
> >  Documentation/admin-guide/kernel-parameters.txt | 11 +++++++++++
> >  kernel/smp.c                                    |  7 +++++--
> >  2 files changed, 16 insertions(+), 2 deletions(-)
> > 
> > diff --git a/Documentation/admin-guide/kernel-parameters.txt b/Documentation/admin-guide/kernel-parameters.txt
> > index 3f1cc5e317ed..645c4c001b16 100644
> > --- a/Documentation/admin-guide/kernel-parameters.txt
> > +++ b/Documentation/admin-guide/kernel-parameters.txt
> > @@ -5377,6 +5377,17 @@
> >  	smart2=		[HW]
> >  			Format: <io1>[,<io2>[,...,<io8>]]
> >  
> > +	smp.csd_lock_timeout= [KNL]
> > +			Specify the period of time in milliseconds
> > +			that smp_call_function() and friends will wait
> > +			for a CPU to release the CSD lock.  This is
> > +			useful when diagnosing bugs involving CPUs
> > +			disabling interrupts for extended periods
> > +			of time.  Defaults to 5,000 milliseconds, and
> > +			setting a value of zero disables this feature.
> > +			This feature may be more efficiently disabled
> > +			using the csdlock_debug- kernel parameter.
> > +
> 
> Can non-responsive CSD lock detected trigger syzbot (warning) report?

If they enable it by building with CONFIG_CSD_LOCK_WAIT_DEBUG=y, yes.  

							Thanx, Paul

> Hillf
> >  	smsc-ircc2.nopnp	[HW] Don't use PNP to discover SMC devices
> >  	smsc-ircc2.ircc_cfg=	[HW] Device configuration I/O port
> >  	smsc-ircc2.ircc_sir=	[HW] SIR base I/O port
> > diff --git a/kernel/smp.c b/kernel/smp.c
> > index 01a7c1706a58..d82439bac401 100644
> > --- a/kernel/smp.c
> > +++ b/kernel/smp.c
> > @@ -183,7 +183,9 @@ static DEFINE_PER_CPU(smp_call_func_t, cur_csd_func);
> >  static DEFINE_PER_CPU(void *, cur_csd_info);
> >  static DEFINE_PER_CPU(struct cfd_seq_local, cfd_seq_local);
> >  
> > -#define CSD_LOCK_TIMEOUT (5ULL * NSEC_PER_SEC)
> > +static ulong csd_lock_timeout = 5000;  /* CSD lock timeout in milliseconds. */
> > +module_param(csd_lock_timeout, ulong, 0444);
> > +
> >  static atomic_t csd_bug_count = ATOMIC_INIT(0);
> >  static u64 cfd_seq;
> >  
> > @@ -329,6 +331,7 @@ static bool csd_lock_wait_toolong(struct __call_single_data *csd, u64 ts0, u64 *
> >  	u64 ts2, ts_delta;
> >  	call_single_data_t *cpu_cur_csd;
> >  	unsigned int flags = READ_ONCE(csd->node.u_flags);
> > +	unsigned long long csd_lock_timeout_ns = csd_lock_timeout * NSEC_PER_MSEC;
> >  
> >  	if (!(flags & CSD_FLAG_LOCK)) {
> >  		if (!unlikely(*bug_id))
> > @@ -341,7 +344,7 @@ static bool csd_lock_wait_toolong(struct __call_single_data *csd, u64 ts0, u64 *
> >  
> >  	ts2 = sched_clock();
> >  	ts_delta = ts2 - *ts1;
> > -	if (likely(ts_delta <= CSD_LOCK_TIMEOUT))
> > +	if (likely(ts_delta <= csd_lock_timeout_ns || csd_lock_timeout_ns <= 0))
> >  		return false;
> >  
> >  	firsttime = !*bug_id;
> > -- 
> > 2.31.1.189.g2e36527f23

  parent reply	other threads:[~2022-04-19 13:49 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-04-18 22:53 [PATCH rcu 0/11] Miscellaneous fixes for v5.19 Paul E. McKenney
2022-04-18 22:53 ` [PATCH rcu 01/11] rcu: Clarify fill-the-gap comment in rcu_segcblist_advance() Paul E. McKenney
2022-04-18 22:53 ` [PATCH rcu 02/11] rcu: Fix rcu_preempt_deferred_qs_irqrestore() strict QS reporting Paul E. McKenney
2022-04-18 22:53 ` [PATCH rcu 03/11] rcu: Check for jiffies going backwards Paul E. McKenney
2022-04-18 22:53 ` [PATCH rcu 04/11] kernel/smp: Provide boot-time timeout for CSD lock diagnostics Paul E. McKenney
2022-04-19  7:11   ` Juergen Gross
2022-04-19 16:44     ` Paul E. McKenney
2022-04-18 22:53 ` [PATCH rcu 05/11] rcu: Add comments to final rcu_gp_cleanup() "if" statement Paul E. McKenney
2022-04-18 22:53 ` [PATCH rcu 06/11] rcu: Print number of online CPUs in RCU CPU stall-warning messages Paul E. McKenney
2022-04-18 22:53 ` [PATCH rcu 07/11] rcu: Fix preemption mode check on synchronize_rcu[_expedited]() Paul E. McKenney
2022-04-18 22:53 ` [PATCH rcu 08/11] srcu: Drop needless initialization of sdp in srcu_gp_start() Paul E. McKenney
2022-04-18 22:53 ` [PATCH rcu 09/11] rcu: Check for successful spawn of ->boost_kthread_task Paul E. McKenney
2022-04-18 22:53 ` [PATCH rcu 10/11] rcu_sync: Fix comment to properly reflect rcu_sync_exit() behavior Paul E. McKenney
2022-04-18 22:53 ` [PATCH rcu 11/11] rcu: Use IRQ_WORK_INIT_HARD() to avoid rcu_read_unlock() hangs Paul E. McKenney
     [not found] ` <20220419085607.2014-1-hdanton@sina.com>
2022-04-19 13:46   ` Paul E. McKenney [this message]
2022-04-19 14:11     ` [PATCH rcu 04/11] kernel/smp: Provide boot-time timeout for CSD lock diagnostics Dmitry Vyukov
2022-04-19 16:49       ` Paul E. McKenney
     [not found]         ` <20220419231820.2089-1-hdanton@sina.com>
2022-04-20 12:17           ` Dmitry Vyukov
2022-04-20 13:41             ` Paul E. McKenney
2022-04-20 14:00               ` Dmitry Vyukov
2022-04-20 14:12                 ` 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=20220419134616.GE4285@paulmck-ThinkPad-P17-Gen-1 \
    --to=paulmck@kernel.org \
    --cc=dvyukov@google.com \
    --cc=hdanton@sina.com \
    --cc=linux-kernel@vger.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

all inboxes | Powered by JetHome®