Re: [PATCH RFC] Make call_srcu() available during very early boot
From: Paul E. McKenney
Date: Fri Aug 17 2018 - 12:31:52 EST
On Fri, Aug 17, 2018 at 09:08:42AM -0700, Tejun Heo wrote:
> On Tue, Aug 14, 2018 at 10:06:18AM -0700, Paul E. McKenney wrote:
> > > Is there a way we could make a union, or reuse one of the other fields,
> > > as we know that synchronize_srcu() can't be used yet (and if it is,
> > > either warn, or just make it a nop). And when we call srcu_init() and
> > > remove the srcu_struct from the list, we can then initialize whatever
> > > we used as the temporary boot up list field.
> > I will take a look. If nothing else, I could union it with the
> > struct work_struct, since it cannot be used that early anyway. ;-)
> > Or I could just use the work_struct that is already inside the struct
> > work_struct. Tejun, would you be OK with that?
> Hmm... not super against it given how specialized the whole thing is
> but maybe just making it a union is cleaner?
The problem with making it be a union is that I cannnot determine how
to initialize it due to the possibility that someone will initialize it
early, but not use it until much later. For example, if I initialize my
side of the union, but they don't actually use it until after rcu_init()
is invoked, I will end up passing a bogus work_struct to you.
In theory, I could straighten all this out at rcu_init() time, but that
would require linking all srcu_struct instances initialized at that
point, including the compile-time-initialized instances. This can of
course be done, but not simply.
Or am I missing a trick here somewhere?