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 for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Fri, 8 Jan 2016 23:58:40 +0800
From:	Boqun Feng <boqun.feng@...il.com>
To:	"Paul E. McKenney" <paulmck@...ux.vnet.ibm.com>
Cc:	Stephen Rothwell <sfr@...b.auug.org.au>,
	linux-next@...r.kernel.org, linux-kernel@...r.kernel.org,
	Tejun Heo <tj@...nel.org>,
	Christoph Lameter <cl@...ux-foundation.org>
Subject: Re: linux-next: build failure after merge of the rcu tree

On Fri, Jan 08, 2016 at 07:53:41AM -0800, Paul E. McKenney wrote:
> On Fri, Jan 08, 2016 at 12:54:53PM +0800, Boqun Feng wrote:
> > On Thu, Jan 07, 2016 at 08:48:35PM -0800, Paul E. McKenney wrote:
> > > On Fri, Jan 08, 2016 at 03:08:50PM +1100, Stephen Rothwell wrote:
> > > > Hi Paul,
> > > > 
> > > > On Thu, 7 Jan 2016 19:41:57 -0800 "Paul E. McKenney" <paulmck@...ux.vnet.ibm.com> wrote:
> > > > >
> > > > > Indeed, I suspect that SRCU might not be the only thing that would like
> > > > > static per-CPU variables.  ;-)
> > > > 
> > > > from include/linux/percpu-defs.h:
> > > > 
> > > >  * s390 and alpha modules require percpu variables to be defined as
> > > >  * weak to force the compiler to generate GOT based external
> > > >  * references for them.  This is necessary because percpu sections
> > > >  * will be located outside of the usually addressable area.
> > > >  *
> > > >  * This definition puts the following two extra restrictions when
> > > >  * defining percpu variables.
> > > >  *
> > > >  * 1. The symbol must be globally unique, even the static ones.
> > > >  * 2. Static percpu variables cannot be defined inside a function.
> > > >  *
> > > >  * Archs which need weak percpu definitions should define
> > > >  * ARCH_NEEDS_WEAK_PER_CPU in asm/percpu.h when necessary.
> > > >  *
> > > >  * To ensure that the generic code observes the above two
> > > >  * restrictions, if CONFIG_DEBUG_FORCE_WEAK_PER_CPU is set weak
> > > >  * definition is used for all cases.
> > > > 
> > > > so they can be static, but must be globally unique.
> > 
> > Interesting ;-) Thank you.
> > 
> > > Thank you for the tutorial!  I have updated the patch to use a unique
> > > name for the srcu_struct added by rcuperf.c.
> > 
> > Plus a comment for DEFINE_STATIC_SRCU saying srcu can be defined as
> > static but must have a unique name for this reason?
> 
> Yes, plus some words about how to work around the limitation.  How about
> the patch below?
> 

Looks very good to me ;-)

Regards,
Boqun

> 							Thanx, Paul
> 
> ------------------------------------------------------------------------
> 
> commit 61822ff81839ee3c5b6094ce348944d972b87892
> Author: Paul E. McKenney <paulmck@...ux.vnet.ibm.com>
> Date:   Fri Jan 8 07:43:50 2016 -0800
> 
>     rcu: Document unique-name limitation for DEFINE_STATIC_SRCU()
>     
>     SRCU uses per-CPU variables, and DEFINE_STATIC_SRCU() uses a static
>     per-CPU variable.  However, per-CPU variables have significant
>     restrictions, for example, names of per-CPU variables must be globally
>     unique, even if declared static.  These restrictions carry over to
>     DEFINE_STATIC_SRCU(), and this commit therefore documents these
>     restrictions.
>     
>     Reported-by: Stephen Rothwell <sfr@...b.auug.org.au>
>     Reported-by: kbuild test robot <fengguang.wu@...el.com>
>     Suggested-by: Boqun Feng <boqun.feng@...il.com>
>     Signed-off-by: Paul E. McKenney <paulmck@...ux.vnet.ibm.com>
> 
> diff --git a/include/linux/srcu.h b/include/linux/srcu.h
> index f5f80c5643ac..dc8eb63c6568 100644
> --- a/include/linux/srcu.h
> +++ b/include/linux/srcu.h
> @@ -99,8 +99,23 @@ void process_srcu(struct work_struct *work);
>  	}
>  
>  /*
> - * define and init a srcu struct at build time.
> - * dont't call init_srcu_struct() nor cleanup_srcu_struct() on it.
> + * Define and initialize a srcu struct at build time.
> + * Do -not- call init_srcu_struct() nor cleanup_srcu_struct() on it.
> + *
> + * Note that although DEFINE_STATIC_SRCU() hides the name from other
> + * files, the per-CPU variable rules nevertheless require that the
> + * chosen name be globally unique.  These rules also prohibit use of
> + * DEFINE_STATIC_SRCU() within a function.  If these rules are too
> + * restrictive, declare the srcu_struct manually.  For example, in
> + * each file:
> + *
> + *	static struct srcu_struct my_srcu;
> + *
> + * Then, before the first use of each my_srcu, manually initialize it:
> + *
> + *	init_srcu_struct(&my_srcu);
> + *
> + * See include/linux/percpu-defs.h for the rules on per-CPU variables.
>   */
>  #define __DEFINE_SRCU(name, is_static)					\
>  	static DEFINE_PER_CPU(struct srcu_struct_array, name##_srcu_array);\
> 

Download attachment "signature.asc" of type "application/pgp-signature" (474 bytes)

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ