Re: [PATCH RFC tip/core/rcu] Make SRCU be once again optional

From: Josh Triplett
Date: Wed Jan 17 2018 - 11:32:50 EST


On Wed, Jan 17, 2018 at 11:29:26AM +0100, Arnd Bergmann wrote:
> On Wed, Jan 17, 2018 at 12:57 AM, Paul E. McKenney
> <paulmck@xxxxxxxxxxxxxxxxxx> wrote:
> > On Wed, Jan 17, 2018 at 12:03:18AM +0100, Arnd Bergmann wrote:
> >> Evidently there is at least one driver that uses SRCU but doesn't 'select SRCU'
> >> in Kconfig. There are probably others that just haven't been found.
> >
> > Does adding "select SRCU" on "config PM_SLEEP" in kernel/power/Kconfig
> > fix this?
>
> I'm sure it does, but the point I was making is that we probably have a number
> of those, and would never find the other ones through the current build test
> setup.
>
> I've now tried disabling a ridiculous number of options to come up with a
> setup that never enables SRCU. Interestingly, that also means we don't
> get the drivers/base/power/wakeup.c problem in 'allmodconfig', though
> I did get a link-time error:
[...]
> Turning off lockdep and kmemleak gives me a working allmodconfig build.
> I'm doing some more testing on ARM, but it looks like this is a dark corner
> of the randconfig state space that I'm not sure I want to explore more.
>
> Doing an hour of randconfig builds, I already found exactly two missing
> 'select SRCU':
>
> ERROR: "__srcu_read_unlock" [drivers/infiniband/core/ib_uverbs.ko] undefined!
> drivers/base/power/wakeup.c:68:1: error: type defaults to 'int' in
> declaration of 'DEFINE_STATIC_SRCU' [-Werror=implicit-int]

I've found that, when trying to make something optional, it doesn't
suffice to do randconfigs. You need a configuration with *everything*
enabled, except for the option you want to test disabling, and anything
that depends on or selects that option. And, conversely, when testing
if a specific option has all the dependencies it needs, you want a
configuration with that option and its dependencies/selects enabled
and everything else disabled.

I wonder how easily we could make a kconfig option for an "all except"
or "none except" config? Such an option would read a minimal config
snippet containing only specific options, and then act like
allyesconfig/allmodconfig/allnoconfig as long as doing so doesn't
change anything from the minimal config snippet.

- Josh Triplett