All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Paul E. McKenney" <paulmck@kernel.org>
To: Frederic Weisbecker <frederic@kernel.org>
Cc: Zhouyi Zhou <zhouzhouyi@gmail.com>,
	fweisbec@gmail.com, tglx@linutronix.de, mingo@kernel.org,
	dave@stgolabs.net, josh@joshtriplett.org, mpe@ellerman.id.au,
	linuxppc-dev@lists.ozlabs.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH linux-next][RFC]torture: avoid offline tick_do_timer_cpu
Date: Wed, 23 Nov 2022 15:00:31 -0800	[thread overview]
Message-ID: <20221123230031.GL4001@paulmck-ThinkPad-P17-Gen-1> (raw)
In-Reply-To: <20221123222543.GB1395324@lothringen>

On Wed, Nov 23, 2022 at 11:25:43PM +0100, Frederic Weisbecker wrote:
> On Mon, Nov 21, 2022 at 05:37:54PM -0800, Paul E. McKenney wrote:
> > On Mon, Nov 21, 2022 at 11:51:40AM +0800, Zhouyi Zhou wrote:
> > > @@ -358,7 +359,16 @@ torture_onoff(void *arg)
> > >  			schedule_timeout_interruptible(HZ / 10);
> > >  			continue;
> > >  		}
> > > +#ifdef CONFIG_NO_HZ_FULL
> > > +		/* do not offline tick do timer cpu */
> > > +		if (tick_nohz_full_running) {
> > > +			cpu = (torture_random(&rand) >> 4) % maxcpu;
> > > +			if (cpu >= tick_do_timer_cpu)
> > 
> > Why is this ">=" instead of "=="?
> > 
> > > +				cpu = (cpu + 1) % (maxcpu + 1);
> > > +		} else
> > > +#else
> > >  		cpu = (torture_random(&rand) >> 4) % (maxcpu + 1);
> > > +#endif
> > 
> > What happens if the value of tick_do_timer_cpu changes between the time of
> > the check above and the call to torture_offline() below?  Alternatively,
> > how is such a change in value prevented?
> 
> It can't, currently tick_do_timer_cpu is fixed when nohz_full is running.
> It can however have special values at early boot such as TICK_DO_TIMER_NONE.
> But if rcutorture is initialized after smp, it should be ok.

Ah, getting ahead of myself, thank you for the info!

So the thing to do would be to generate only maxcpu-1 choices.

							Thanx, Paul

> Thanks.
> 
> > 
> > 							Thanx, Paul
> > 
> > >  		if (!torture_offline(cpu,
> > >  				     &n_offline_attempts, &n_offline_successes,
> > >  				     &sum_offline, &min_offline, &max_offline))
> > > -- 
> > > 2.34.1
> > > 

WARNING: multiple messages have this Message-ID (diff)
From: "Paul E. McKenney" <paulmck@kernel.org>
To: Frederic Weisbecker <frederic@kernel.org>
Cc: dave@stgolabs.net, Zhouyi Zhou <zhouzhouyi@gmail.com>,
	josh@joshtriplett.org, linux-kernel@vger.kernel.org,
	fweisbec@gmail.com, tglx@linutronix.de,
	linuxppc-dev@lists.ozlabs.org, mingo@kernel.org
Subject: Re: [PATCH linux-next][RFC]torture: avoid offline tick_do_timer_cpu
Date: Wed, 23 Nov 2022 15:00:31 -0800	[thread overview]
Message-ID: <20221123230031.GL4001@paulmck-ThinkPad-P17-Gen-1> (raw)
In-Reply-To: <20221123222543.GB1395324@lothringen>

On Wed, Nov 23, 2022 at 11:25:43PM +0100, Frederic Weisbecker wrote:
> On Mon, Nov 21, 2022 at 05:37:54PM -0800, Paul E. McKenney wrote:
> > On Mon, Nov 21, 2022 at 11:51:40AM +0800, Zhouyi Zhou wrote:
> > > @@ -358,7 +359,16 @@ torture_onoff(void *arg)
> > >  			schedule_timeout_interruptible(HZ / 10);
> > >  			continue;
> > >  		}
> > > +#ifdef CONFIG_NO_HZ_FULL
> > > +		/* do not offline tick do timer cpu */
> > > +		if (tick_nohz_full_running) {
> > > +			cpu = (torture_random(&rand) >> 4) % maxcpu;
> > > +			if (cpu >= tick_do_timer_cpu)
> > 
> > Why is this ">=" instead of "=="?
> > 
> > > +				cpu = (cpu + 1) % (maxcpu + 1);
> > > +		} else
> > > +#else
> > >  		cpu = (torture_random(&rand) >> 4) % (maxcpu + 1);
> > > +#endif
> > 
> > What happens if the value of tick_do_timer_cpu changes between the time of
> > the check above and the call to torture_offline() below?  Alternatively,
> > how is such a change in value prevented?
> 
> It can't, currently tick_do_timer_cpu is fixed when nohz_full is running.
> It can however have special values at early boot such as TICK_DO_TIMER_NONE.
> But if rcutorture is initialized after smp, it should be ok.

Ah, getting ahead of myself, thank you for the info!

So the thing to do would be to generate only maxcpu-1 choices.

							Thanx, Paul

> Thanks.
> 
> > 
> > 							Thanx, Paul
> > 
> > >  		if (!torture_offline(cpu,
> > >  				     &n_offline_attempts, &n_offline_successes,
> > >  				     &sum_offline, &min_offline, &max_offline))
> > > -- 
> > > 2.34.1
> > > 

  reply	other threads:[~2022-11-23 23:00 UTC|newest]

Thread overview: 33+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-11-21  3:51 [PATCH linux-next][RFC]torture: avoid offline tick_do_timer_cpu Zhouyi Zhou
2022-11-22  1:37 ` Paul E. McKenney
2022-11-22  1:37   ` Paul E. McKenney
2022-11-23  2:23   ` Zhouyi Zhou
2022-11-23  2:23     ` Zhouyi Zhou
2022-11-23 18:49     ` Paul E. McKenney
2022-11-23 18:49       ` Paul E. McKenney
2022-11-24  2:35       ` Zhouyi Zhou
2022-11-24  2:35         ` Zhouyi Zhou
2022-11-23 22:25   ` Frederic Weisbecker
2022-11-23 22:25     ` Frederic Weisbecker
2022-11-23 23:00     ` Paul E. McKenney [this message]
2022-11-23 23:00       ` Paul E. McKenney
2022-11-23 22:36 ` Frederic Weisbecker
2022-11-23 22:36   ` Frederic Weisbecker
2022-11-24  2:18   ` Zhouyi Zhou
2022-11-24  2:18     ` Zhouyi Zhou
2022-11-26 17:05 ` Thomas Gleixner
2022-11-27  2:45   ` Zhouyi Zhou
2022-11-27  2:45     ` Zhouyi Zhou
2022-11-27 12:40     ` Thomas Gleixner
2022-11-27 12:40       ` Thomas Gleixner
2022-11-27 17:53       ` Paul E. McKenney
2022-11-27 17:53         ` Paul E. McKenney
2022-11-28  3:00         ` Zhouyi Zhou
2022-11-28  3:00           ` Zhouyi Zhou
2022-11-28  8:12         ` Thomas Gleixner
2022-11-28  8:12           ` Thomas Gleixner
2022-11-28 15:16           ` Paul E. McKenney
2022-11-28 15:16             ` Paul E. McKenney
2023-07-06  7:09 ` Christophe Leroy
2023-07-06  8:13   ` Zhouyi Zhou
2023-07-06  8:13     ` Zhouyi Zhou

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=20221123230031.GL4001@paulmck-ThinkPad-P17-Gen-1 \
    --to=paulmck@kernel.org \
    --cc=dave@stgolabs.net \
    --cc=frederic@kernel.org \
    --cc=fweisbec@gmail.com \
    --cc=josh@joshtriplett.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linuxppc-dev@lists.ozlabs.org \
    --cc=mingo@kernel.org \
    --cc=mpe@ellerman.id.au \
    --cc=tglx@linutronix.de \
    --cc=zhouzhouyi@gmail.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.