Re: [PATCH RFC] Make call_srcu() available during very early boot

From: Paul E. McKenney
Date: Tue Aug 14 2018 - 13:50:55 EST


On Tue, Aug 14, 2018 at 01:24:53PM -0400, Steven Rostedt wrote:
> On Tue, 14 Aug 2018 10:06:18 -0700
> "Paul E. McKenney" <paulmck@xxxxxxxxxxxxxxxxxx> wrote:
>
>
> > > > #define __SRCU_STRUCT_INIT(name, pcpu_name) \
> > > > - { \
> > > > - .sda = &pcpu_name, \
> > > > - .lock = __SPIN_LOCK_UNLOCKED(name.lock), \
> > > > - .srcu_gp_seq_needed = 0 - 1, \
> > > > - __SRCU_DEP_MAP_INIT(name) \
> > > > - }
> > > > +{ \
> > > > + .sda = &pcpu_name, \
> > > > + .lock = __SPIN_LOCK_UNLOCKED(name.lock), \
> > > > + .srcu_gp_seq_needed = 0 - 1, \
> > >
> > > Interesting initialization of -1. This was there before, but still
> > > interesting none the less.
> >
> > If I recall correctly, this subterfuge suppresses compiler complaints
> > about initializing an unsigned long with a negative number. :-/
>
> Did you try:
>
> .srcu_gp_seq_needed = -1UL,
>
> ?

Works for my compiler, not sure what set of complaints pushed me in that
direction.

Thanx, Paul