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]
Date:   Thu, 17 Feb 2022 07:11:43 -0800
From:   "Paul E. McKenney" <paulmck@...nel.org>
To:     Frederic Weisbecker <frederic@...nel.org>
Cc:     LKML <linux-kernel@...r.kernel.org>,
        Neeraj Upadhyay <quic_neeraju@...cinc.com>,
        Boqun Feng <boqun.feng@...il.com>,
        Uladzislau Rezki <uladzislau.rezki@...y.com>,
        Joel Fernandes <joel@...lfernandes.org>
Subject: Re: [PATCH 2/5] rcu/nocb: Move rcu_nocb_is_setup to rcu_state

On Thu, Feb 17, 2022 at 12:30:12PM +0100, Frederic Weisbecker wrote:
> On Wed, Feb 16, 2022 at 09:28:04PM -0800, Paul E. McKenney wrote:
> > On Wed, Feb 16, 2022 at 05:53:32PM -0800, Paul E. McKenney wrote:
> > > On Wed, Feb 16, 2022 at 01:30:35PM -0800, Paul E. McKenney wrote:
> > > > On Wed, Feb 16, 2022 at 04:42:05PM +0100, Frederic Weisbecker wrote:
> > > > > In order to avoid scattering the global RCU states, move the RCU nocb
> > > > > initialization witness within rcu_state.
> > > > > 
> > > > > Reported-by: Paul E. McKenney <paulmck@...nel.org>
> > > > > Cc: Neeraj Upadhyay <quic_neeraju@...cinc.com>
> > > > > Cc: Uladzislau Rezki <uladzislau.rezki@...y.com>
> > > > > Cc: Joel Fernandes <joel@...lfernandes.org>
> > > > > Cc: Boqun Feng <boqun.feng@...il.com>
> > > > > Signed-off-by: Frederic Weisbecker <frederic@...nel.org>
> > > > 
> > > > Build testing for CONFIG_NO_HZ_FULL=n kernels suggested the following
> > > > patch be merged into this one.  Or does this variable need to be used
> > > > somewhere?  Either way, please let me know!
> > > 
> > > TASKS03, TREE04, and TREE07 don't like this much, according to git
> > > bisect.  They are the ones with nohz_full CPUs, in case that is crucial.
> > > Trying again after reverting this commit locally.
> > > 
> > > If that works, I would be tempted to try the modification shown below.
> > 
> > And that does pass significant rcutorture testing, but over to you.  ;-)
> 
> Ah no we still need that variable, but I screwed up and wrongly converted
> need_rcu_nocb_mask to rcu_state.nocb_is_setup somewhere.
> 
> Here is the v2 of the culprit patch (sorry):

Been there, done that!  ;-)

I pulled this one in and I will let you know how it goes.

							Thanx, Paul

> ---
> From: Frederic Weisbecker <frederic@...nel.org>
> Date: Mon, 14 Feb 2022 14:23:39 +0100
> Subject: [PATCH] rcu/nocb: Move rcu_nocb_is_setup to rcu_state
> 
> In order to avoid scattering the global RCU states, move the RCU nocb
> initialization witness within rcu_state.
> 
> Reported-by: Paul E. McKenney <paulmck@...nel.org>
> Cc: Neeraj Upadhyay <quic_neeraju@...cinc.com>
> Cc: Uladzislau Rezki <uladzislau.rezki@...y.com>
> Cc: Joel Fernandes <joel@...lfernandes.org>
> Cc: Boqun Feng <boqun.feng@...il.com>
> Signed-off-by: Frederic Weisbecker <frederic@...nel.org>
> ---
>  kernel/rcu/tree.h      |  1 +
>  kernel/rcu/tree_nocb.h | 13 +++++--------
>  2 files changed, 6 insertions(+), 8 deletions(-)
> 
> diff --git a/kernel/rcu/tree.h b/kernel/rcu/tree.h
> index 19fc9acce3ce..735fc410d76a 100644
> --- a/kernel/rcu/tree.h
> +++ b/kernel/rcu/tree.h
> @@ -368,6 +368,7 @@ struct rcu_state {
>  	arch_spinlock_t ofl_lock ____cacheline_internodealigned_in_smp;
>  						/* Synchronize offline with */
>  						/*  GP pre-initialization. */
> +	int nocb_is_setup;			/* nocb is setup from boot */
>  };
>  
>  /* Values for rcu_state structure's gp_flags field. */
> diff --git a/kernel/rcu/tree_nocb.h b/kernel/rcu/tree_nocb.h
> index 02e1d05a11fc..3c00240833d6 100644
> --- a/kernel/rcu/tree_nocb.h
> +++ b/kernel/rcu/tree_nocb.h
> @@ -60,9 +60,6 @@ static inline bool rcu_current_is_nocb_kthread(struct rcu_data *rdp)
>   * Parse the boot-time rcu_nocb_mask CPU list from the kernel parameters.
>   * If the list is invalid, a warning is emitted and all CPUs are offloaded.
>   */
> -
> -static bool rcu_nocb_is_setup;
> -
>  static int __init rcu_nocb_setup(char *str)
>  {
>  	alloc_bootmem_cpumask_var(&rcu_nocb_mask);
> @@ -72,7 +69,7 @@ static int __init rcu_nocb_setup(char *str)
>  			cpumask_setall(rcu_nocb_mask);
>  		}
>  	}
> -	rcu_nocb_is_setup = true;
> +	rcu_state.nocb_is_setup = true;
>  	return 1;
>  }
>  __setup("rcu_nocbs", rcu_nocb_setup);
> @@ -1172,10 +1169,10 @@ void __init rcu_init_nohz(void)
>  				return;
>  			}
>  		}
> -		rcu_nocb_is_setup = true;
> +		rcu_state.nocb_is_setup = true;
>  	}
>  
> -	if (!rcu_nocb_is_setup)
> +	if (!rcu_state.nocb_is_setup)
>  		return;
>  
>  #if defined(CONFIG_NO_HZ_FULL)
> @@ -1233,7 +1230,7 @@ static void rcu_spawn_cpu_nocb_kthread(int cpu)
>  	struct task_struct *t;
>  	struct sched_param sp;
>  
> -	if (!rcu_scheduler_fully_active || !rcu_nocb_is_setup)
> +	if (!rcu_scheduler_fully_active || !rcu_state.nocb_is_setup)
>  		return;
>  
>  	/* If there already is an rcuo kthread, then nothing to do. */
> @@ -1279,7 +1276,7 @@ static void __init rcu_spawn_nocb_kthreads(void)
>  {
>  	int cpu;
>  
> -	if (rcu_nocb_is_setup) {
> +	if (rcu_state.nocb_is_setup) {
>  		for_each_online_cpu(cpu)
>  			rcu_spawn_cpu_nocb_kthread(cpu);
>  	}
> -- 
> 2.25.1

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ