lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20190819164420.GA28441@linux.ibm.com>
Date:   Mon, 19 Aug 2019 09:44:20 -0700
From:   "Paul E. McKenney" <paulmck@...ux.ibm.com>
To:     Frederic Weisbecker <frederic@...nel.org>
Cc:     "Joel Fernandes (Google)" <joel@...lfernandes.org>,
        linux-kernel@...r.kernel.org, rcu@...r.kernel.org
Subject: Re: [PATCH -rcu dev 1/3] rcu/tree: tick_dep_set/clear_cpu should
 accept bits instead of masks

On Mon, Aug 19, 2019 at 06:32:27PM +0200, Frederic Weisbecker wrote:
> On Mon, Aug 19, 2019 at 07:46:32AM -0700, Paul E. McKenney wrote:
> > On Mon, Aug 19, 2019 at 02:38:38PM +0200, Frederic Weisbecker wrote:
> > > On Thu, Aug 15, 2019 at 10:53:09PM -0400, Joel Fernandes (Google) wrote:
> > > > This commit fixes the issue.
> > > > 
> > > > Signed-off-by: Joel Fernandes (Google) <joel@...lfernandes.org>
> > > > ---
> > > >  kernel/rcu/tree.c | 29 +++++++++++++++++------------
> > > >  1 file changed, 17 insertions(+), 12 deletions(-)
> > > > 
> > > > diff --git a/kernel/rcu/tree.c b/kernel/rcu/tree.c
> > > > index 0512de9ead20..322b1b57967c 100644
> > > > --- a/kernel/rcu/tree.c
> > > > +++ b/kernel/rcu/tree.c
> > > > @@ -829,7 +829,7 @@ static __always_inline void rcu_nmi_enter_common(bool irq)
> > > >  		   !rdp->dynticks_nmi_nesting &&
> > > >  		   rdp->rcu_urgent_qs && !rdp->rcu_forced_tick) {
> > > >  		rdp->rcu_forced_tick = true;
> > > > -		tick_dep_set_cpu(rdp->cpu, TICK_DEP_MASK_RCU);
> > > > +		tick_dep_set_cpu(rdp->cpu, TICK_DEP_BIT_RCU);
> > > 
> > > Did I suggest you to use the _MASK_ value? That was a bit mean.
> > > Sorry for all that lost debugging time :-(
> > 
> > At some point, I should have looked at the other calls to these
> > functions.  :-/
> > 
> > But would the following patch make sense?  This would not help for (say)
> > use of TICK_MASK_BIT_POSIX_TIMER instead of TICK_DEP_BIT_POSIX_TIMER, but
> > would help for any new values that might be added later on.  And currently
> > for TICK_DEP_MASK_CLOCK_UNSTABLE and TICK_DEP_MASK_RCU.
> 
> I'd rather make the TICK_DEP_MASK_* values private to kernel/time/tick-sched.c but
> that means I need to re-arrange a bit include/trace/events/timer.h

That would be even better!  For one thing, it would detect misuse of
-all- of the _MASK_ values.  ;-)

> I'm looking into it. Meanwhile, your below patch that checks for the max value is
> still valuable.

If I were to push it, it would be v5.5 before it showed up.  My guess
is therefore that I should keep it for my own internal use in the near
term, but not push it.  If you would like to take it, feel free to use
my Signed-off-by.

							Thanx, Paul

> Thanks.
> 
> > 
> > 							Thanx, Paul
> > 
> > ------------------------------------------------------------------------
> > 
> > diff --git a/include/linux/tick.h b/include/linux/tick.h
> > index 39eb44564058..4ed788ce5762 100644
> > --- a/include/linux/tick.h
> > +++ b/include/linux/tick.h
> > @@ -111,6 +111,7 @@ enum tick_dep_bits {
> >  	TICK_DEP_BIT_CLOCK_UNSTABLE	= 3,
> >  	TICK_DEP_BIT_RCU		= 4
> >  };
> > +#define TICK_DEP_BIT_MAX TICK_DEP_BIT_RCU
> >  
> >  #define TICK_DEP_MASK_NONE		0
> >  #define TICK_DEP_MASK_POSIX_TIMER	(1 << TICK_DEP_BIT_POSIX_TIMER)
> > @@ -215,24 +216,28 @@ extern void tick_nohz_dep_clear_signal(struct signal_struct *signal,
> >   */
> >  static inline void tick_dep_set(enum tick_dep_bits bit)
> >  {
> > +	WARN_ON_ONCE(bit > TICK_DEP_BIT_MAX);
> >  	if (tick_nohz_full_enabled())
> >  		tick_nohz_dep_set(bit);
> >  }
> >  
> >  static inline void tick_dep_clear(enum tick_dep_bits bit)
> >  {
> > +	WARN_ON_ONCE(bit > TICK_DEP_BIT_MAX);
> >  	if (tick_nohz_full_enabled())
> >  		tick_nohz_dep_clear(bit);
> >  }
> >  
> >  static inline void tick_dep_set_cpu(int cpu, enum tick_dep_bits bit)
> >  {
> > +	WARN_ON_ONCE(bit > TICK_DEP_BIT_MAX);
> >  	if (tick_nohz_full_cpu(cpu))
> >  		tick_nohz_dep_set_cpu(cpu, bit);
> >  }
> >  
> >  static inline void tick_dep_clear_cpu(int cpu, enum tick_dep_bits bit)
> >  {
> > +	WARN_ON_ONCE(bit > TICK_DEP_BIT_MAX);
> >  	if (tick_nohz_full_cpu(cpu))
> >  		tick_nohz_dep_clear_cpu(cpu, bit);
> >  }
> > @@ -240,24 +245,28 @@ static inline void tick_dep_clear_cpu(int cpu, enum tick_dep_bits bit)
> >  static inline void tick_dep_set_task(struct task_struct *tsk,
> >  				     enum tick_dep_bits bit)
> >  {
> > +	WARN_ON_ONCE(bit > TICK_DEP_BIT_MAX);
> >  	if (tick_nohz_full_enabled())
> >  		tick_nohz_dep_set_task(tsk, bit);
> >  }
> >  static inline void tick_dep_clear_task(struct task_struct *tsk,
> >  				       enum tick_dep_bits bit)
> >  {
> > +	WARN_ON_ONCE(bit > TICK_DEP_BIT_MAX);
> >  	if (tick_nohz_full_enabled())
> >  		tick_nohz_dep_clear_task(tsk, bit);
> >  }
> >  static inline void tick_dep_set_signal(struct signal_struct *signal,
> >  				       enum tick_dep_bits bit)
> >  {
> > +	WARN_ON_ONCE(bit > TICK_DEP_BIT_MAX);
> >  	if (tick_nohz_full_enabled())
> >  		tick_nohz_dep_set_signal(signal, bit);
> >  }
> >  static inline void tick_dep_clear_signal(struct signal_struct *signal,
> >  					 enum tick_dep_bits bit)
> >  {
> > +	WARN_ON_ONCE(bit > TICK_DEP_BIT_MAX);
> >  	if (tick_nohz_full_enabled())
> >  		tick_nohz_dep_clear_signal(signal, bit);
> >  }
> 

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ