linux-kbuild.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* netfilter Kconfig question
@ 2018-11-19 20:50 Randy Dunlap
  2018-11-26  7:30 ` Masahiro Yamada
  0 siblings, 1 reply; 13+ messages in thread
From: Randy Dunlap @ 2018-11-19 20:50 UTC (permalink / raw)
  To: Masahiro Yamada, linux-kbuild; +Cc: Taehee Yoo

Hi Yamada-san,

There was recently a netfilter build error in linux-next for which
a patch was posted by Taehee Yoo.  The patch works (fixes the build
error) but I don't see how or why.

My build error report is here:
https://lore.kernel.org/lkml/fa7a7824-44df-c058-dba2-ec29c5028361@infradead.org/T/#u


Would you take a look at it and try to explain why the patch works?

The patch's email thread begins here:
https://www.spinics.net/lists/netfilter-devel/msg56985.html

Thanks.
-- 
~Randy

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: netfilter Kconfig question
  2018-11-19 20:50 netfilter Kconfig question Randy Dunlap
@ 2018-11-26  7:30 ` Masahiro Yamada
  2018-11-26 19:49   ` Ulf Magnusson
  0 siblings, 1 reply; 13+ messages in thread
From: Masahiro Yamada @ 2018-11-26  7:30 UTC (permalink / raw)
  To: Randy Dunlap; +Cc: Linux Kbuild mailing list, Taehee Yoo

Hi Randy,


On Tue, Nov 20, 2018 at 5:51 AM Randy Dunlap <rdunlap@infradead.org> wrote:
>
> Hi Yamada-san,
>
> There was recently a netfilter build error in linux-next for which
> a patch was posted by Taehee Yoo.  The patch works (fixes the build
> error) but I don't see how or why.
>
> My build error report is here:
> https://lore.kernel.org/lkml/fa7a7824-44df-c058-dba2-ec29c5028361@infradead.org/T/#u
>
>
> Would you take a look at it and try to explain why the patch works?
>
> The patch's email thread begins here:
> https://www.spinics.net/lists/netfilter-devel/msg56985.html


I think this is a bug of Kconfig.

I sent a patch.
https://patchwork.kernel.org/patch/10697637/


-- 
Best Regards
Masahiro Yamada

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: netfilter Kconfig question
  2018-11-26  7:30 ` Masahiro Yamada
@ 2018-11-26 19:49   ` Ulf Magnusson
  2018-11-26 20:49     ` Ulf Magnusson
  2018-11-27  1:32     ` Masahiro Yamada
  0 siblings, 2 replies; 13+ messages in thread
From: Ulf Magnusson @ 2018-11-26 19:49 UTC (permalink / raw)
  To: Masahiro Yamada; +Cc: Randy Dunlap, Linux Kbuild mailing list, ap420073

On Mon, Nov 26, 2018 at 8:31 AM Masahiro Yamada
<yamada.masahiro@socionext.com> wrote:
>
> Hi Randy,
>
>
> On Tue, Nov 20, 2018 at 5:51 AM Randy Dunlap <rdunlap@infradead.org> wrote:
> >
> > Hi Yamada-san,
> >
> > There was recently a netfilter build error in linux-next for which
> > a patch was posted by Taehee Yoo.  The patch works (fixes the build
> > error) but I don't see how or why.
> >
> > My build error report is here:
> > https://lore.kernel.org/lkml/fa7a7824-44df-c058-dba2-ec29c5028361@infradead.org/T/#u
> >
> >
> > Would you take a look at it and try to explain why the patch works?
> >
> > The patch's email thread begins here:
> > https://www.spinics.net/lists/netfilter-devel/msg56985.html
>
>
> I think this is a bug of Kconfig.
>
> I sent a patch.
> https://patchwork.kernel.org/patch/10697637/
>
>
> --
> Best Regards
> Masahiro Yamada

I always understood this behavior as intentional.

Say that a high-level arch symbol has 'select FOO_HELPERS if FOO' for
example, where both FOO and FOO_HELPERS can be compiled as modules.

The intention there is probably to make sure that FOO_HELPERS is
available whenever FOO is (FOO_HELPERS must be >= FOO). If FOO is y,
then FOO_HELPERS must be y. If FOO is m, then it's fine for
FOO_HELPERS to be m (but not n), because it can be loaded as needed
whenever FOO is.

Forcing FOO_HELPERS to y would remove the possibility to compile it as
a module. I suspect some things rely on this (and that some other
symbols just automagically act in a reasonable way even though it
wasn't planned).

And yeah, there might be better ways to handle that particular case,
but going for concepts. :)

Cheers,
Ulf

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: netfilter Kconfig question
  2018-11-26 19:49   ` Ulf Magnusson
@ 2018-11-26 20:49     ` Ulf Magnusson
  2018-11-27  1:33       ` Masahiro Yamada
  2018-11-27  1:32     ` Masahiro Yamada
  1 sibling, 1 reply; 13+ messages in thread
From: Ulf Magnusson @ 2018-11-26 20:49 UTC (permalink / raw)
  To: Masahiro Yamada; +Cc: Randy Dunlap, Linux Kbuild mailing list, ap420073

On Mon, Nov 26, 2018 at 8:49 PM Ulf Magnusson <ulfalizer@gmail.com> wrote:
>
> On Mon, Nov 26, 2018 at 8:31 AM Masahiro Yamada
> <yamada.masahiro@socionext.com> wrote:
> >
> > Hi Randy,
> >
> >
> > On Tue, Nov 20, 2018 at 5:51 AM Randy Dunlap <rdunlap@infradead.org> wrote:
> > >
> > > Hi Yamada-san,
> > >
> > > There was recently a netfilter build error in linux-next for which
> > > a patch was posted by Taehee Yoo.  The patch works (fixes the build
> > > error) but I don't see how or why.
> > >
> > > My build error report is here:
> > > https://lore.kernel.org/lkml/fa7a7824-44df-c058-dba2-ec29c5028361@infradead.org/T/#u
> > >
> > >
> > > Would you take a look at it and try to explain why the patch works?
> > >
> > > The patch's email thread begins here:
> > > https://www.spinics.net/lists/netfilter-devel/msg56985.html
> >
> >
> > I think this is a bug of Kconfig.
> >
> > I sent a patch.
> > https://patchwork.kernel.org/patch/10697637/
> >
> >
> > --
> > Best Regards
> > Masahiro Yamada
>
> I always understood this behavior as intentional.
>
> Say that a high-level arch symbol has 'select FOO_HELPERS if FOO' for
> example, where both FOO and FOO_HELPERS can be compiled as modules.
>
> The intention there is probably to make sure that FOO_HELPERS is
> available whenever FOO is (FOO_HELPERS must be >= FOO). If FOO is y,
> then FOO_HELPERS must be y. If FOO is m, then it's fine for
> FOO_HELPERS to be m (but not n), because it can be loaded as needed
> whenever FOO is.
>
> Forcing FOO_HELPERS to y would remove the possibility to compile it as
> a module. I suspect some things rely on this (and that some other
> symbols just automagically act in a reasonable way even though it
> wasn't planned).
>
> And yeah, there might be better ways to handle that particular case,
> but going for concepts. :)
>
> Cheers,
> Ulf

A random real-life example is SND_SOC_ALL_CODECS
(sound/soc/codecs/Kconfig). It has stuff like 'select SND_SOC_AK4458
if I2C', where SND_SOC_AK4458 also has a 'depends on I2C' (the 'if' on
the select is just there to avoid selecting a symbol with unsatisfied
dependencies).

If the behavior of 'select' was changed so that SND_SOC_AK4458 would
get set to y instead of m when I2C is m, then you'd be y-selecting a
symbol with m dependencies, which would generate a warning and
probably break the build, as I2C isn't compiled-in.

The behavior makes sense I think, though it can be a bit unexpected.
It makes a lot of stuff magically do the right thing.

People tend to overuse select though. :)

Cheers,
Ulf

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: netfilter Kconfig question
  2018-11-26 19:49   ` Ulf Magnusson
  2018-11-26 20:49     ` Ulf Magnusson
@ 2018-11-27  1:32     ` Masahiro Yamada
  2018-11-27  7:34       ` Ulf Magnusson
  1 sibling, 1 reply; 13+ messages in thread
From: Masahiro Yamada @ 2018-11-27  1:32 UTC (permalink / raw)
  To: Ulf Magnusson; +Cc: Randy Dunlap, Linux Kbuild mailing list, Taehee Yoo

On Tue, Nov 27, 2018 at 4:49 AM Ulf Magnusson <ulfalizer@gmail.com> wrote:
>
> On Mon, Nov 26, 2018 at 8:31 AM Masahiro Yamada
> <yamada.masahiro@socionext.com> wrote:
> >
> > Hi Randy,
> >
> >
> > On Tue, Nov 20, 2018 at 5:51 AM Randy Dunlap <rdunlap@infradead.org> wrote:
> > >
> > > Hi Yamada-san,
> > >
> > > There was recently a netfilter build error in linux-next for which
> > > a patch was posted by Taehee Yoo.  The patch works (fixes the build
> > > error) but I don't see how or why.
> > >
> > > My build error report is here:
> > > https://lore.kernel.org/lkml/fa7a7824-44df-c058-dba2-ec29c5028361@infradead.org/T/#u
> > >
> > >
> > > Would you take a look at it and try to explain why the patch works?
> > >
> > > The patch's email thread begins here:
> > > https://www.spinics.net/lists/netfilter-devel/msg56985.html
> >
> >
> > I think this is a bug of Kconfig.
> >
> > I sent a patch.
> > https://patchwork.kernel.org/patch/10697637/
> >
> >
> > --
> > Best Regards
> > Masahiro Yamada
>
> I always understood this behavior as intentional.
>
> Say that a high-level arch symbol has 'select FOO_HELPERS if FOO' for
> example, where both FOO and FOO_HELPERS can be compiled as modules.
>
> The intention there is probably to make sure that FOO_HELPERS is
> available whenever FOO is (FOO_HELPERS must be >= FOO). If FOO is y,
> then FOO_HELPERS must be y. If FOO is m, then it's fine for
> FOO_HELPERS to be m (but not n), because it can be loaded as needed
> whenever FOO is.

If we find such an example, it should be rewritten to:


config FOO
        tristate "foo"
        select FOO_HELPERS




> Forcing FOO_HELPERS to y would remove the possibility to compile it as
> a module.

This depends on the selector if you write like this:


config OTHER_OPTION
       tristate "?"
       select FOO_HELPERS if FOO


although "FOO_HELPERS >= FOO" is not met.



> I suspect some things rely on this (and that some other
> symbols just automagically act in a reasonable way even though it
> wasn't planned).
>
> And yeah, there might be better ways to handle that particular case,
> but going for concepts. :)
>
> Cheers,
> Ulf



-- 
Best Regards
Masahiro Yamada

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: netfilter Kconfig question
  2018-11-26 20:49     ` Ulf Magnusson
@ 2018-11-27  1:33       ` Masahiro Yamada
  0 siblings, 0 replies; 13+ messages in thread
From: Masahiro Yamada @ 2018-11-27  1:33 UTC (permalink / raw)
  To: Ulf Magnusson; +Cc: Randy Dunlap, Linux Kbuild mailing list, Taehee Yoo

On Tue, Nov 27, 2018 at 5:51 AM Ulf Magnusson <ulfalizer@gmail.com> wrote:
>
> On Mon, Nov 26, 2018 at 8:49 PM Ulf Magnusson <ulfalizer@gmail.com> wrote:
> >
> > On Mon, Nov 26, 2018 at 8:31 AM Masahiro Yamada
> > <yamada.masahiro@socionext.com> wrote:
> > >
> > > Hi Randy,
> > >
> > >
> > > On Tue, Nov 20, 2018 at 5:51 AM Randy Dunlap <rdunlap@infradead.org> wrote:
> > > >
> > > > Hi Yamada-san,
> > > >
> > > > There was recently a netfilter build error in linux-next for which
> > > > a patch was posted by Taehee Yoo.  The patch works (fixes the build
> > > > error) but I don't see how or why.
> > > >
> > > > My build error report is here:
> > > > https://lore.kernel.org/lkml/fa7a7824-44df-c058-dba2-ec29c5028361@infradead.org/T/#u
> > > >
> > > >
> > > > Would you take a look at it and try to explain why the patch works?
> > > >
> > > > The patch's email thread begins here:
> > > > https://www.spinics.net/lists/netfilter-devel/msg56985.html
> > >
> > >
> > > I think this is a bug of Kconfig.
> > >
> > > I sent a patch.
> > > https://patchwork.kernel.org/patch/10697637/
> > >
> > >
> > > --
> > > Best Regards
> > > Masahiro Yamada
> >
> > I always understood this behavior as intentional.
> >
> > Say that a high-level arch symbol has 'select FOO_HELPERS if FOO' for
> > example, where both FOO and FOO_HELPERS can be compiled as modules.
> >
> > The intention there is probably to make sure that FOO_HELPERS is
> > available whenever FOO is (FOO_HELPERS must be >= FOO). If FOO is y,
> > then FOO_HELPERS must be y. If FOO is m, then it's fine for
> > FOO_HELPERS to be m (but not n), because it can be loaded as needed
> > whenever FOO is.
> >
> > Forcing FOO_HELPERS to y would remove the possibility to compile it as
> > a module. I suspect some things rely on this (and that some other
> > symbols just automagically act in a reasonable way even though it
> > wasn't planned).
> >
> > And yeah, there might be better ways to handle that particular case,
> > but going for concepts. :)
> >
> > Cheers,
> > Ulf
>
> A random real-life example is SND_SOC_ALL_CODECS
> (sound/soc/codecs/Kconfig). It has stuff like 'select SND_SOC_AK4458
> if I2C', where SND_SOC_AK4458 also has a 'depends on I2C' (the 'if' on
> the select is just there to avoid selecting a symbol with unsatisfied
> dependencies).

It should be written to:

config SND_SOC_ALL_CODECS
        tristate "Build all ASoC CODEC drivers"
        depends on COMPILE_TEST
        imply SND_SOC_88PM860X
        imply SND_SOC_L3
        imply SND_SOC_AB8500_CODEC
        imply SND_SOC_AC97_CODEC
        imply SND_SOC_AD1836
        imply SND_SOC_AD193X_SPI
        imply SND_SOC_AD193X_I2C
        imply SND_SOC_AD1980
        ...


This is more concise because
we can drop redundant 'if ...' parts.





> If the behavior of 'select' was changed so that SND_SOC_AK4458 would
> get set to y instead of m when I2C is m, then you'd be y-selecting a
> symbol with m dependencies, which would generate a warning and
> probably break the build, as I2C isn't compiled-in.
>
> The behavior makes sense I think, though it can be a bit unexpected.
> It makes a lot of stuff magically do the right thing.
>
> People tend to overuse select though. :)
>
> Cheers,
> Ulf



-- 
Best Regards
Masahiro Yamada

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: netfilter Kconfig question
  2018-11-27  1:32     ` Masahiro Yamada
@ 2018-11-27  7:34       ` Ulf Magnusson
  2018-11-27  7:47         ` Masahiro Yamada
  0 siblings, 1 reply; 13+ messages in thread
From: Ulf Magnusson @ 2018-11-27  7:34 UTC (permalink / raw)
  To: Masahiro Yamada; +Cc: Randy Dunlap, Linux Kbuild mailing list, ap420073

On Tue, Nov 27, 2018 at 2:33 AM Masahiro Yamada
<yamada.masahiro@socionext.com> wrote:
>
> On Tue, Nov 27, 2018 at 4:49 AM Ulf Magnusson <ulfalizer@gmail.com> wrote:
> >
> > On Mon, Nov 26, 2018 at 8:31 AM Masahiro Yamada
> > <yamada.masahiro@socionext.com> wrote:
> > >
> > > Hi Randy,
> > >
> > >
> > > On Tue, Nov 20, 2018 at 5:51 AM Randy Dunlap <rdunlap@infradead.org> wrote:
> > > >
> > > > Hi Yamada-san,
> > > >
> > > > There was recently a netfilter build error in linux-next for which
> > > > a patch was posted by Taehee Yoo.  The patch works (fixes the build
> > > > error) but I don't see how or why.
> > > >
> > > > My build error report is here:
> > > > https://lore.kernel.org/lkml/fa7a7824-44df-c058-dba2-ec29c5028361@infradead.org/T/#u
> > > >
> > > >
> > > > Would you take a look at it and try to explain why the patch works?
> > > >
> > > > The patch's email thread begins here:
> > > > https://www.spinics.net/lists/netfilter-devel/msg56985.html
> > >
> > >
> > > I think this is a bug of Kconfig.
> > >
> > > I sent a patch.
> > > https://patchwork.kernel.org/patch/10697637/
> > >
> > >
> > > --
> > > Best Regards
> > > Masahiro Yamada
> >
> > I always understood this behavior as intentional.
> >
> > Say that a high-level arch symbol has 'select FOO_HELPERS if FOO' for
> > example, where both FOO and FOO_HELPERS can be compiled as modules.
> >
> > The intention there is probably to make sure that FOO_HELPERS is
> > available whenever FOO is (FOO_HELPERS must be >= FOO). If FOO is y,
> > then FOO_HELPERS must be y. If FOO is m, then it's fine for
> > FOO_HELPERS to be m (but not n), because it can be loaded as needed
> > whenever FOO is.
>
> If we find such an example, it should be rewritten to:
>
>
> config FOO
>         tristate "foo"
>         select FOO_HELPERS

Yup, almost always cleaner ways to do it.

>
>
>
>
> > Forcing FOO_HELPERS to y would remove the possibility to compile it as
> > a module.
>
> This depends on the selector if you write like this:
>
>
> config OTHER_OPTION
>        tristate "?"
>        select FOO_HELPERS if FOO
>
>
> although "FOO_HELPERS >= FOO" is not met.

Yeah, that's why I mentioned "high-level arch symbol", because it gets
more confusing for other symbols. Think boards and the like too.

If you think of 'config A ... select C if B' as "A needs C if B", then
the current behavior still does the right thing in all cases:

  A B     | C
  --------+-----
  n n/m/y | n(+)  (A not enabled, irrelevant)
  m n     | n(+)  (B not enabled, irrelevant)
  m m     | m(+)  (Fine, C can be loaded if A and B are)
  m y     | m(+)  (Ditto)
  y n     | n(+)  (B not enabled, irrelevant)
  y m     | m(+)  (Fine, C can be loaded if B is)
  y y     | y     (Fine, C is available whenever B is)

The big if there is whether you think of select that way. Just trying
to show why I think it was designed that way.

Cheers,
Ulf

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: netfilter Kconfig question
  2018-11-27  7:34       ` Ulf Magnusson
@ 2018-11-27  7:47         ` Masahiro Yamada
  2018-11-27  8:07           ` Ulf Magnusson
  0 siblings, 1 reply; 13+ messages in thread
From: Masahiro Yamada @ 2018-11-27  7:47 UTC (permalink / raw)
  To: Ulf Magnusson; +Cc: Randy Dunlap, Linux Kbuild mailing list, Taehee Yoo

On Tue, Nov 27, 2018 at 4:36 PM Ulf Magnusson <ulfalizer@gmail.com> wrote:
>
> On Tue, Nov 27, 2018 at 2:33 AM Masahiro Yamada
> <yamada.masahiro@socionext.com> wrote:
> >
> > On Tue, Nov 27, 2018 at 4:49 AM Ulf Magnusson <ulfalizer@gmail.com> wrote:
> > >
> > > On Mon, Nov 26, 2018 at 8:31 AM Masahiro Yamada
> > > <yamada.masahiro@socionext.com> wrote:
> > > >
> > > > Hi Randy,
> > > >
> > > >
> > > > On Tue, Nov 20, 2018 at 5:51 AM Randy Dunlap <rdunlap@infradead.org> wrote:
> > > > >
> > > > > Hi Yamada-san,
> > > > >
> > > > > There was recently a netfilter build error in linux-next for which
> > > > > a patch was posted by Taehee Yoo.  The patch works (fixes the build
> > > > > error) but I don't see how or why.
> > > > >
> > > > > My build error report is here:
> > > > > https://lore.kernel.org/lkml/fa7a7824-44df-c058-dba2-ec29c5028361@infradead.org/T/#u
> > > > >
> > > > >
> > > > > Would you take a look at it and try to explain why the patch works?
> > > > >
> > > > > The patch's email thread begins here:
> > > > > https://www.spinics.net/lists/netfilter-devel/msg56985.html
> > > >
> > > >
> > > > I think this is a bug of Kconfig.
> > > >
> > > > I sent a patch.
> > > > https://patchwork.kernel.org/patch/10697637/
> > > >
> > > >
> > > > --
> > > > Best Regards
> > > > Masahiro Yamada
> > >
> > > I always understood this behavior as intentional.
> > >
> > > Say that a high-level arch symbol has 'select FOO_HELPERS if FOO' for
> > > example, where both FOO and FOO_HELPERS can be compiled as modules.
> > >
> > > The intention there is probably to make sure that FOO_HELPERS is
> > > available whenever FOO is (FOO_HELPERS must be >= FOO). If FOO is y,
> > > then FOO_HELPERS must be y. If FOO is m, then it's fine for
> > > FOO_HELPERS to be m (but not n), because it can be loaded as needed
> > > whenever FOO is.
> >
> > If we find such an example, it should be rewritten to:
> >
> >
> > config FOO
> >         tristate "foo"
> >         select FOO_HELPERS
>
> Yup, almost always cleaner ways to do it.
>
> >
> >
> >
> >
> > > Forcing FOO_HELPERS to y would remove the possibility to compile it as
> > > a module.
> >
> > This depends on the selector if you write like this:
> >
> >
> > config OTHER_OPTION
> >        tristate "?"
> >        select FOO_HELPERS if FOO
> >
> >
> > although "FOO_HELPERS >= FOO" is not met.
>
> Yeah, that's why I mentioned "high-level arch symbol", because it gets
> more confusing for other symbols. Think boards and the like too.
>
> If you think of 'config A ... select C if B' as "A needs C if B", then
> the current behavior still does the right thing in all cases:
>
>   A B     | C
>   --------+-----
>   n n/m/y | n(+)  (A not enabled, irrelevant)
>   m n     | n(+)  (B not enabled, irrelevant)
>   m m     | m(+)  (Fine, C can be loaded if A and B are)
>   m y     | m(+)  (Ditto)
>   y n     | n(+)  (B not enabled, irrelevant)
>   y m     | m(+)  (Fine, C can be loaded if B is)
>   y y     | y     (Fine, C is available whenever B is)
>
> The big if there is whether you think of select that way. Just trying
> to show why I think it was designed that way.


No.



  y m     | m(+)  (Fine, C can be loaded if B is)


is not fine.



If 'A' is builtin, 'C' must be builtin as well.



How can 'A' resolve references to 'C'
for the combination A=y and C=m ?




-- 
Best Regards
Masahiro Yamada

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: netfilter Kconfig question
  2018-11-27  7:47         ` Masahiro Yamada
@ 2018-11-27  8:07           ` Ulf Magnusson
  2018-11-27  8:21             ` Ulf Magnusson
  0 siblings, 1 reply; 13+ messages in thread
From: Ulf Magnusson @ 2018-11-27  8:07 UTC (permalink / raw)
  To: Masahiro Yamada; +Cc: Randy Dunlap, Linux Kbuild mailing list, ap420073

On Tue, Nov 27, 2018 at 8:48 AM Masahiro Yamada
<yamada.masahiro@socionext.com> wrote:
>
> On Tue, Nov 27, 2018 at 4:36 PM Ulf Magnusson <ulfalizer@gmail.com> wrote:
> >
> > On Tue, Nov 27, 2018 at 2:33 AM Masahiro Yamada
> > <yamada.masahiro@socionext.com> wrote:
> > >
> > > On Tue, Nov 27, 2018 at 4:49 AM Ulf Magnusson <ulfalizer@gmail.com> wrote:
> > > >
> > > > On Mon, Nov 26, 2018 at 8:31 AM Masahiro Yamada
> > > > <yamada.masahiro@socionext.com> wrote:
> > > > >
> > > > > Hi Randy,
> > > > >
> > > > >
> > > > > On Tue, Nov 20, 2018 at 5:51 AM Randy Dunlap <rdunlap@infradead.org> wrote:
> > > > > >
> > > > > > Hi Yamada-san,
> > > > > >
> > > > > > There was recently a netfilter build error in linux-next for which
> > > > > > a patch was posted by Taehee Yoo.  The patch works (fixes the build
> > > > > > error) but I don't see how or why.
> > > > > >
> > > > > > My build error report is here:
> > > > > > https://lore.kernel.org/lkml/fa7a7824-44df-c058-dba2-ec29c5028361@infradead.org/T/#u
> > > > > >
> > > > > >
> > > > > > Would you take a look at it and try to explain why the patch works?
> > > > > >
> > > > > > The patch's email thread begins here:
> > > > > > https://www.spinics.net/lists/netfilter-devel/msg56985.html
> > > > >
> > > > >
> > > > > I think this is a bug of Kconfig.
> > > > >
> > > > > I sent a patch.
> > > > > https://patchwork.kernel.org/patch/10697637/
> > > > >
> > > > >
> > > > > --
> > > > > Best Regards
> > > > > Masahiro Yamada
> > > >
> > > > I always understood this behavior as intentional.
> > > >
> > > > Say that a high-level arch symbol has 'select FOO_HELPERS if FOO' for
> > > > example, where both FOO and FOO_HELPERS can be compiled as modules.
> > > >
> > > > The intention there is probably to make sure that FOO_HELPERS is
> > > > available whenever FOO is (FOO_HELPERS must be >= FOO). If FOO is y,
> > > > then FOO_HELPERS must be y. If FOO is m, then it's fine for
> > > > FOO_HELPERS to be m (but not n), because it can be loaded as needed
> > > > whenever FOO is.
> > >
> > > If we find such an example, it should be rewritten to:
> > >
> > >
> > > config FOO
> > >         tristate "foo"
> > >         select FOO_HELPERS
> >
> > Yup, almost always cleaner ways to do it.
> >
> > >
> > >
> > >
> > >
> > > > Forcing FOO_HELPERS to y would remove the possibility to compile it as
> > > > a module.
> > >
> > > This depends on the selector if you write like this:
> > >
> > >
> > > config OTHER_OPTION
> > >        tristate "?"
> > >        select FOO_HELPERS if FOO
> > >
> > >
> > > although "FOO_HELPERS >= FOO" is not met.
> >
> > Yeah, that's why I mentioned "high-level arch symbol", because it gets
> > more confusing for other symbols. Think boards and the like too.
> >
> > If you think of 'config A ... select C if B' as "A needs C if B", then
> > the current behavior still does the right thing in all cases:
> >
> >   A B     | C
> >   --------+-----
> >   n n/m/y | n(+)  (A not enabled, irrelevant)
> >   m n     | n(+)  (B not enabled, irrelevant)
> >   m m     | m(+)  (Fine, C can be loaded if A and B are)
> >   m y     | m(+)  (Ditto)
> >   y n     | n(+)  (B not enabled, irrelevant)
> >   y m     | m(+)  (Fine, C can be loaded if B is)
> >   y y     | y     (Fine, C is available whenever B is)
> >
> > The big if there is whether you think of select that way. Just trying
> > to show why I think it was designed that way.
>
>
> No.
>
>
>
>   y m     | m(+)  (Fine, C can be loaded if B is)
>
>
> is not fine.
>
>
>
> If 'A' is builtin, 'C' must be builtin as well.
>
>
>
> How can 'A' resolve references to 'C'
> for the combination A=y and C=m ?

If A needs to resolve references to C even when it's a module, then
that's a different kind of dependency: A needs C if B != n.

I guess you're arguing that that's the only kind of dependency you'd
ever want with select.

Cheers,
Ulf

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: netfilter Kconfig question
  2018-11-27  8:07           ` Ulf Magnusson
@ 2018-11-27  8:21             ` Ulf Magnusson
  2018-11-27  8:31               ` Masahiro Yamada
  0 siblings, 1 reply; 13+ messages in thread
From: Ulf Magnusson @ 2018-11-27  8:21 UTC (permalink / raw)
  To: Masahiro Yamada; +Cc: Randy Dunlap, Linux Kbuild mailing list, ap420073

On Tue, Nov 27, 2018 at 9:07 AM Ulf Magnusson <ulfalizer@gmail.com> wrote:
>
> On Tue, Nov 27, 2018 at 8:48 AM Masahiro Yamada
> <yamada.masahiro@socionext.com> wrote:
> >
> > On Tue, Nov 27, 2018 at 4:36 PM Ulf Magnusson <ulfalizer@gmail.com> wrote:
> > >
> > > On Tue, Nov 27, 2018 at 2:33 AM Masahiro Yamada
> > > <yamada.masahiro@socionext.com> wrote:
> > > >
> > > > On Tue, Nov 27, 2018 at 4:49 AM Ulf Magnusson <ulfalizer@gmail.com> wrote:
> > > > >
> > > > > On Mon, Nov 26, 2018 at 8:31 AM Masahiro Yamada
> > > > > <yamada.masahiro@socionext.com> wrote:
> > > > > >
> > > > > > Hi Randy,
> > > > > >
> > > > > >
> > > > > > On Tue, Nov 20, 2018 at 5:51 AM Randy Dunlap <rdunlap@infradead.org> wrote:
> > > > > > >
> > > > > > > Hi Yamada-san,
> > > > > > >
> > > > > > > There was recently a netfilter build error in linux-next for which
> > > > > > > a patch was posted by Taehee Yoo.  The patch works (fixes the build
> > > > > > > error) but I don't see how or why.
> > > > > > >
> > > > > > > My build error report is here:
> > > > > > > https://lore.kernel.org/lkml/fa7a7824-44df-c058-dba2-ec29c5028361@infradead.org/T/#u
> > > > > > >
> > > > > > >
> > > > > > > Would you take a look at it and try to explain why the patch works?
> > > > > > >
> > > > > > > The patch's email thread begins here:
> > > > > > > https://www.spinics.net/lists/netfilter-devel/msg56985.html
> > > > > >
> > > > > >
> > > > > > I think this is a bug of Kconfig.
> > > > > >
> > > > > > I sent a patch.
> > > > > > https://patchwork.kernel.org/patch/10697637/
> > > > > >
> > > > > >
> > > > > > --
> > > > > > Best Regards
> > > > > > Masahiro Yamada
> > > > >
> > > > > I always understood this behavior as intentional.
> > > > >
> > > > > Say that a high-level arch symbol has 'select FOO_HELPERS if FOO' for
> > > > > example, where both FOO and FOO_HELPERS can be compiled as modules.
> > > > >
> > > > > The intention there is probably to make sure that FOO_HELPERS is
> > > > > available whenever FOO is (FOO_HELPERS must be >= FOO). If FOO is y,
> > > > > then FOO_HELPERS must be y. If FOO is m, then it's fine for
> > > > > FOO_HELPERS to be m (but not n), because it can be loaded as needed
> > > > > whenever FOO is.
> > > >
> > > > If we find such an example, it should be rewritten to:
> > > >
> > > >
> > > > config FOO
> > > >         tristate "foo"
> > > >         select FOO_HELPERS
> > >
> > > Yup, almost always cleaner ways to do it.
> > >
> > > >
> > > >
> > > >
> > > >
> > > > > Forcing FOO_HELPERS to y would remove the possibility to compile it as
> > > > > a module.
> > > >
> > > > This depends on the selector if you write like this:
> > > >
> > > >
> > > > config OTHER_OPTION
> > > >        tristate "?"
> > > >        select FOO_HELPERS if FOO
> > > >
> > > >
> > > > although "FOO_HELPERS >= FOO" is not met.
> > >
> > > Yeah, that's why I mentioned "high-level arch symbol", because it gets
> > > more confusing for other symbols. Think boards and the like too.
> > >
> > > If you think of 'config A ... select C if B' as "A needs C if B", then
> > > the current behavior still does the right thing in all cases:
> > >
> > >   A B     | C
> > >   --------+-----
> > >   n n/m/y | n(+)  (A not enabled, irrelevant)
> > >   m n     | n(+)  (B not enabled, irrelevant)
> > >   m m     | m(+)  (Fine, C can be loaded if A and B are)
> > >   m y     | m(+)  (Ditto)
> > >   y n     | n(+)  (B not enabled, irrelevant)
> > >   y m     | m(+)  (Fine, C can be loaded if B is)
> > >   y y     | y     (Fine, C is available whenever B is)
> > >
> > > The big if there is whether you think of select that way. Just trying
> > > to show why I think it was designed that way.
> >
> >
> > No.
> >
> >
> >
> >   y m     | m(+)  (Fine, C can be loaded if B is)
> >
> >
> > is not fine.
> >
> >
> >
> > If 'A' is builtin, 'C' must be builtin as well.
> >
> >
> >
> > How can 'A' resolve references to 'C'
> > for the combination A=y and C=m ?
>
> If A needs to resolve references to C even when it's a module, then
> that's a different kind of dependency: A needs C if B != n.

Even when B is a module that is.

Cheers,
Ulf

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: netfilter Kconfig question
  2018-11-27  8:21             ` Ulf Magnusson
@ 2018-11-27  8:31               ` Masahiro Yamada
  2018-11-27  9:09                 ` Ulf Magnusson
  0 siblings, 1 reply; 13+ messages in thread
From: Masahiro Yamada @ 2018-11-27  8:31 UTC (permalink / raw)
  To: Ulf Magnusson; +Cc: Randy Dunlap, Linux Kbuild mailing list, Taehee Yoo

On Tue, Nov 27, 2018 at 5:26 PM Ulf Magnusson <ulfalizer@gmail.com> wrote:
>
> On Tue, Nov 27, 2018 at 9:07 AM Ulf Magnusson <ulfalizer@gmail.com> wrote:
> >
> > On Tue, Nov 27, 2018 at 8:48 AM Masahiro Yamada
> > <yamada.masahiro@socionext.com> wrote:
> > >
> > > On Tue, Nov 27, 2018 at 4:36 PM Ulf Magnusson <ulfalizer@gmail.com> wrote:
> > > >
> > > > On Tue, Nov 27, 2018 at 2:33 AM Masahiro Yamada
> > > > <yamada.masahiro@socionext.com> wrote:
> > > > >
> > > > > On Tue, Nov 27, 2018 at 4:49 AM Ulf Magnusson <ulfalizer@gmail.com> wrote:
> > > > > >
> > > > > > On Mon, Nov 26, 2018 at 8:31 AM Masahiro Yamada
> > > > > > <yamada.masahiro@socionext.com> wrote:
> > > > > > >
> > > > > > > Hi Randy,
> > > > > > >
> > > > > > >
> > > > > > > On Tue, Nov 20, 2018 at 5:51 AM Randy Dunlap <rdunlap@infradead.org> wrote:
> > > > > > > >
> > > > > > > > Hi Yamada-san,
> > > > > > > >
> > > > > > > > There was recently a netfilter build error in linux-next for which
> > > > > > > > a patch was posted by Taehee Yoo.  The patch works (fixes the build
> > > > > > > > error) but I don't see how or why.
> > > > > > > >
> > > > > > > > My build error report is here:
> > > > > > > > https://lore.kernel.org/lkml/fa7a7824-44df-c058-dba2-ec29c5028361@infradead.org/T/#u
> > > > > > > >
> > > > > > > >
> > > > > > > > Would you take a look at it and try to explain why the patch works?
> > > > > > > >
> > > > > > > > The patch's email thread begins here:
> > > > > > > > https://www.spinics.net/lists/netfilter-devel/msg56985.html
> > > > > > >
> > > > > > >
> > > > > > > I think this is a bug of Kconfig.
> > > > > > >
> > > > > > > I sent a patch.
> > > > > > > https://patchwork.kernel.org/patch/10697637/
> > > > > > >
> > > > > > >
> > > > > > > --
> > > > > > > Best Regards
> > > > > > > Masahiro Yamada
> > > > > >
> > > > > > I always understood this behavior as intentional.
> > > > > >
> > > > > > Say that a high-level arch symbol has 'select FOO_HELPERS if FOO' for
> > > > > > example, where both FOO and FOO_HELPERS can be compiled as modules.
> > > > > >
> > > > > > The intention there is probably to make sure that FOO_HELPERS is
> > > > > > available whenever FOO is (FOO_HELPERS must be >= FOO). If FOO is y,
> > > > > > then FOO_HELPERS must be y. If FOO is m, then it's fine for
> > > > > > FOO_HELPERS to be m (but not n), because it can be loaded as needed
> > > > > > whenever FOO is.
> > > > >
> > > > > If we find such an example, it should be rewritten to:
> > > > >
> > > > >
> > > > > config FOO
> > > > >         tristate "foo"
> > > > >         select FOO_HELPERS
> > > >
> > > > Yup, almost always cleaner ways to do it.
> > > >
> > > > >
> > > > >
> > > > >
> > > > >
> > > > > > Forcing FOO_HELPERS to y would remove the possibility to compile it as
> > > > > > a module.
> > > > >
> > > > > This depends on the selector if you write like this:
> > > > >
> > > > >
> > > > > config OTHER_OPTION
> > > > >        tristate "?"
> > > > >        select FOO_HELPERS if FOO
> > > > >
> > > > >
> > > > > although "FOO_HELPERS >= FOO" is not met.
> > > >
> > > > Yeah, that's why I mentioned "high-level arch symbol", because it gets
> > > > more confusing for other symbols. Think boards and the like too.
> > > >
> > > > If you think of 'config A ... select C if B' as "A needs C if B", then
> > > > the current behavior still does the right thing in all cases:
> > > >
> > > >   A B     | C
> > > >   --------+-----
> > > >   n n/m/y | n(+)  (A not enabled, irrelevant)
> > > >   m n     | n(+)  (B not enabled, irrelevant)
> > > >   m m     | m(+)  (Fine, C can be loaded if A and B are)
> > > >   m y     | m(+)  (Ditto)
> > > >   y n     | n(+)  (B not enabled, irrelevant)
> > > >   y m     | m(+)  (Fine, C can be loaded if B is)
> > > >   y y     | y     (Fine, C is available whenever B is)
> > > >
> > > > The big if there is whether you think of select that way. Just trying
> > > > to show why I think it was designed that way.
> > >
> > >
> > > No.
> > >
> > >
> > >
> > >   y m     | m(+)  (Fine, C can be loaded if B is)
> > >
> > >
> > > is not fine.
> > >
> > >
> > >
> > > If 'A' is builtin, 'C' must be builtin as well.
> > >
> > >
> > >
> > > How can 'A' resolve references to 'C'
> > > for the combination A=y and C=m ?
> >
> > If A needs to resolve references to C even when it's a module, then
> > that's a different kind of dependency: A needs C if B != n.
>
> Even when B is a module that is.


'A needs C' absolutely requires 'C >= A'.

Why is it loosened when B is a module?





-- 
Best Regards
Masahiro Yamada

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: netfilter Kconfig question
  2018-11-27  8:31               ` Masahiro Yamada
@ 2018-11-27  9:09                 ` Ulf Magnusson
  2018-11-28  1:11                   ` Masahiro Yamada
  0 siblings, 1 reply; 13+ messages in thread
From: Ulf Magnusson @ 2018-11-27  9:09 UTC (permalink / raw)
  To: Masahiro Yamada; +Cc: Randy Dunlap, Linux Kbuild mailing list, ap420073

On Tue, Nov 27, 2018 at 9:32 AM Masahiro Yamada
<yamada.masahiro@socionext.com> wrote:
>
> On Tue, Nov 27, 2018 at 5:26 PM Ulf Magnusson <ulfalizer@gmail.com> wrote:
> >
> > On Tue, Nov 27, 2018 at 9:07 AM Ulf Magnusson <ulfalizer@gmail.com> wrote:
> > >
> > > On Tue, Nov 27, 2018 at 8:48 AM Masahiro Yamada
> > > <yamada.masahiro@socionext.com> wrote:
> > > >
> > > > On Tue, Nov 27, 2018 at 4:36 PM Ulf Magnusson <ulfalizer@gmail.com> wrote:
> > > > >
> > > > > On Tue, Nov 27, 2018 at 2:33 AM Masahiro Yamada
> > > > > <yamada.masahiro@socionext.com> wrote:
> > > > > >
> > > > > > On Tue, Nov 27, 2018 at 4:49 AM Ulf Magnusson <ulfalizer@gmail.com> wrote:
> > > > > > >
> > > > > > > On Mon, Nov 26, 2018 at 8:31 AM Masahiro Yamada
> > > > > > > <yamada.masahiro@socionext.com> wrote:
> > > > > > > >
> > > > > > > > Hi Randy,
> > > > > > > >
> > > > > > > >
> > > > > > > > On Tue, Nov 20, 2018 at 5:51 AM Randy Dunlap <rdunlap@infradead.org> wrote:
> > > > > > > > >
> > > > > > > > > Hi Yamada-san,
> > > > > > > > >
> > > > > > > > > There was recently a netfilter build error in linux-next for which
> > > > > > > > > a patch was posted by Taehee Yoo.  The patch works (fixes the build
> > > > > > > > > error) but I don't see how or why.
> > > > > > > > >
> > > > > > > > > My build error report is here:
> > > > > > > > > https://lore.kernel.org/lkml/fa7a7824-44df-c058-dba2-ec29c5028361@infradead.org/T/#u
> > > > > > > > >
> > > > > > > > >
> > > > > > > > > Would you take a look at it and try to explain why the patch works?
> > > > > > > > >
> > > > > > > > > The patch's email thread begins here:
> > > > > > > > > https://www.spinics.net/lists/netfilter-devel/msg56985.html
> > > > > > > >
> > > > > > > >
> > > > > > > > I think this is a bug of Kconfig.
> > > > > > > >
> > > > > > > > I sent a patch.
> > > > > > > > https://patchwork.kernel.org/patch/10697637/
> > > > > > > >
> > > > > > > >
> > > > > > > > --
> > > > > > > > Best Regards
> > > > > > > > Masahiro Yamada
> > > > > > >
> > > > > > > I always understood this behavior as intentional.
> > > > > > >
> > > > > > > Say that a high-level arch symbol has 'select FOO_HELPERS if FOO' for
> > > > > > > example, where both FOO and FOO_HELPERS can be compiled as modules.
> > > > > > >
> > > > > > > The intention there is probably to make sure that FOO_HELPERS is
> > > > > > > available whenever FOO is (FOO_HELPERS must be >= FOO). If FOO is y,
> > > > > > > then FOO_HELPERS must be y. If FOO is m, then it's fine for
> > > > > > > FOO_HELPERS to be m (but not n), because it can be loaded as needed
> > > > > > > whenever FOO is.
> > > > > >
> > > > > > If we find such an example, it should be rewritten to:
> > > > > >
> > > > > >
> > > > > > config FOO
> > > > > >         tristate "foo"
> > > > > >         select FOO_HELPERS
> > > > >
> > > > > Yup, almost always cleaner ways to do it.
> > > > >
> > > > > >
> > > > > >
> > > > > >
> > > > > >
> > > > > > > Forcing FOO_HELPERS to y would remove the possibility to compile it as
> > > > > > > a module.
> > > > > >
> > > > > > This depends on the selector if you write like this:
> > > > > >
> > > > > >
> > > > > > config OTHER_OPTION
> > > > > >        tristate "?"
> > > > > >        select FOO_HELPERS if FOO
> > > > > >
> > > > > >
> > > > > > although "FOO_HELPERS >= FOO" is not met.
> > > > >
> > > > > Yeah, that's why I mentioned "high-level arch symbol", because it gets
> > > > > more confusing for other symbols. Think boards and the like too.
> > > > >
> > > > > If you think of 'config A ... select C if B' as "A needs C if B", then
> > > > > the current behavior still does the right thing in all cases:
> > > > >
> > > > >   A B     | C
> > > > >   --------+-----
> > > > >   n n/m/y | n(+)  (A not enabled, irrelevant)
> > > > >   m n     | n(+)  (B not enabled, irrelevant)
> > > > >   m m     | m(+)  (Fine, C can be loaded if A and B are)
> > > > >   m y     | m(+)  (Ditto)
> > > > >   y n     | n(+)  (B not enabled, irrelevant)
> > > > >   y m     | m(+)  (Fine, C can be loaded if B is)
> > > > >   y y     | y     (Fine, C is available whenever B is)
> > > > >
> > > > > The big if there is whether you think of select that way. Just trying
> > > > > to show why I think it was designed that way.
> > > >
> > > >
> > > > No.
> > > >
> > > >
> > > >
> > > >   y m     | m(+)  (Fine, C can be loaded if B is)
> > > >
> > > >
> > > > is not fine.
> > > >
> > > >
> > > >
> > > > If 'A' is builtin, 'C' must be builtin as well.
> > > >
> > > >
> > > >
> > > > How can 'A' resolve references to 'C'
> > > > for the combination A=y and C=m ?
> > >
> > > If A needs to resolve references to C even when it's a module, then
> > > that's a different kind of dependency: A needs C if B != n.
> >
> > Even when B is a module that is.
>
>
> 'A needs C' absolutely requires 'C >= A'.
>
> Why is it loosened when B is a module?

Because I read 'select C if B' as "C must be available whenever B is available".

You restrict "available" down to "compiled-in". I take "available" as
either compiled-in or a module (so that C be made available, if
needed).

If you assume that there'll always a compile-time dependency between C
and A (like in the NF_DUP_IPV6 case, and usually in Linux), then it
makes sense. Otherwise, it's restricting generality.

Cheers,
Ulf

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: netfilter Kconfig question
  2018-11-27  9:09                 ` Ulf Magnusson
@ 2018-11-28  1:11                   ` Masahiro Yamada
  0 siblings, 0 replies; 13+ messages in thread
From: Masahiro Yamada @ 2018-11-28  1:11 UTC (permalink / raw)
  To: Ulf Magnusson; +Cc: Randy Dunlap, Linux Kbuild mailing list, Taehee Yoo

On Tue, Nov 27, 2018 at 6:10 PM Ulf Magnusson <ulfalizer@gmail.com> wrote:
>
> On Tue, Nov 27, 2018 at 9:32 AM Masahiro Yamada
> <yamada.masahiro@socionext.com> wrote:
> >
> > On Tue, Nov 27, 2018 at 5:26 PM Ulf Magnusson <ulfalizer@gmail.com> wrote:
> > >
> > > On Tue, Nov 27, 2018 at 9:07 AM Ulf Magnusson <ulfalizer@gmail.com> wrote:
> > > >
> > > > On Tue, Nov 27, 2018 at 8:48 AM Masahiro Yamada
> > > > <yamada.masahiro@socionext.com> wrote:
> > > > >
> > > > > On Tue, Nov 27, 2018 at 4:36 PM Ulf Magnusson <ulfalizer@gmail.com> wrote:
> > > > > >
> > > > > > On Tue, Nov 27, 2018 at 2:33 AM Masahiro Yamada
> > > > > > <yamada.masahiro@socionext.com> wrote:
> > > > > > >
> > > > > > > On Tue, Nov 27, 2018 at 4:49 AM Ulf Magnusson <ulfalizer@gmail.com> wrote:
> > > > > > > >
> > > > > > > > On Mon, Nov 26, 2018 at 8:31 AM Masahiro Yamada
> > > > > > > > <yamada.masahiro@socionext.com> wrote:
> > > > > > > > >
> > > > > > > > > Hi Randy,
> > > > > > > > >
> > > > > > > > >
> > > > > > > > > On Tue, Nov 20, 2018 at 5:51 AM Randy Dunlap <rdunlap@infradead.org> wrote:
> > > > > > > > > >
> > > > > > > > > > Hi Yamada-san,
> > > > > > > > > >
> > > > > > > > > > There was recently a netfilter build error in linux-next for which
> > > > > > > > > > a patch was posted by Taehee Yoo.  The patch works (fixes the build
> > > > > > > > > > error) but I don't see how or why.
> > > > > > > > > >
> > > > > > > > > > My build error report is here:
> > > > > > > > > > https://lore.kernel.org/lkml/fa7a7824-44df-c058-dba2-ec29c5028361@infradead.org/T/#u
> > > > > > > > > >
> > > > > > > > > >
> > > > > > > > > > Would you take a look at it and try to explain why the patch works?
> > > > > > > > > >
> > > > > > > > > > The patch's email thread begins here:
> > > > > > > > > > https://www.spinics.net/lists/netfilter-devel/msg56985.html
> > > > > > > > >
> > > > > > > > >
> > > > > > > > > I think this is a bug of Kconfig.
> > > > > > > > >
> > > > > > > > > I sent a patch.
> > > > > > > > > https://patchwork.kernel.org/patch/10697637/
> > > > > > > > >
> > > > > > > > >
> > > > > > > > > --
> > > > > > > > > Best Regards
> > > > > > > > > Masahiro Yamada
> > > > > > > >
> > > > > > > > I always understood this behavior as intentional.
> > > > > > > >
> > > > > > > > Say that a high-level arch symbol has 'select FOO_HELPERS if FOO' for
> > > > > > > > example, where both FOO and FOO_HELPERS can be compiled as modules.
> > > > > > > >
> > > > > > > > The intention there is probably to make sure that FOO_HELPERS is
> > > > > > > > available whenever FOO is (FOO_HELPERS must be >= FOO). If FOO is y,
> > > > > > > > then FOO_HELPERS must be y. If FOO is m, then it's fine for
> > > > > > > > FOO_HELPERS to be m (but not n), because it can be loaded as needed
> > > > > > > > whenever FOO is.
> > > > > > >
> > > > > > > If we find such an example, it should be rewritten to:
> > > > > > >
> > > > > > >
> > > > > > > config FOO
> > > > > > >         tristate "foo"
> > > > > > >         select FOO_HELPERS
> > > > > >
> > > > > > Yup, almost always cleaner ways to do it.
> > > > > >
> > > > > > >
> > > > > > >
> > > > > > >
> > > > > > >
> > > > > > > > Forcing FOO_HELPERS to y would remove the possibility to compile it as
> > > > > > > > a module.
> > > > > > >
> > > > > > > This depends on the selector if you write like this:
> > > > > > >
> > > > > > >
> > > > > > > config OTHER_OPTION
> > > > > > >        tristate "?"
> > > > > > >        select FOO_HELPERS if FOO
> > > > > > >
> > > > > > >
> > > > > > > although "FOO_HELPERS >= FOO" is not met.
> > > > > >
> > > > > > Yeah, that's why I mentioned "high-level arch symbol", because it gets
> > > > > > more confusing for other symbols. Think boards and the like too.
> > > > > >
> > > > > > If you think of 'config A ... select C if B' as "A needs C if B", then
> > > > > > the current behavior still does the right thing in all cases:
> > > > > >
> > > > > >   A B     | C
> > > > > >   --------+-----
> > > > > >   n n/m/y | n(+)  (A not enabled, irrelevant)
> > > > > >   m n     | n(+)  (B not enabled, irrelevant)
> > > > > >   m m     | m(+)  (Fine, C can be loaded if A and B are)
> > > > > >   m y     | m(+)  (Ditto)
> > > > > >   y n     | n(+)  (B not enabled, irrelevant)
> > > > > >   y m     | m(+)  (Fine, C can be loaded if B is)
> > > > > >   y y     | y     (Fine, C is available whenever B is)
> > > > > >
> > > > > > The big if there is whether you think of select that way. Just trying
> > > > > > to show why I think it was designed that way.
> > > > >
> > > > >
> > > > > No.
> > > > >
> > > > >
> > > > >
> > > > >   y m     | m(+)  (Fine, C can be loaded if B is)
> > > > >
> > > > >
> > > > > is not fine.
> > > > >
> > > > >
> > > > >
> > > > > If 'A' is builtin, 'C' must be builtin as well.
> > > > >
> > > > >
> > > > >
> > > > > How can 'A' resolve references to 'C'
> > > > > for the combination A=y and C=m ?
> > > >
> > > > If A needs to resolve references to C even when it's a module, then
> > > > that's a different kind of dependency: A needs C if B != n.
> > >
> > > Even when B is a module that is.
> >
> >
> > 'A needs C' absolutely requires 'C >= A'.
> >
> > Why is it loosened when B is a module?
>
> Because I read 'select C if B' as "C must be available whenever B is available".
>
> You restrict "available" down to "compiled-in". I take "available" as
> either compiled-in or a module (so that C be made available, if
> needed).


Right. I am talking about "compile-in"

For the case A=y, C=m,
functions in 'A' cannot call functions provided by 'C'.

"dangling function pointers will be resolved after you load modules"
does not work in Linux.


> If you assume that there'll always a compile-time dependency between C
> and A (like in the NF_DUP_IPV6 case, and usually in Linux), then it
> makes sense. Otherwise, it's restricting generality.
>

Yes, this is checked compile-time by scripts/mod/modpost.






-- 
Best Regards
Masahiro Yamada

^ permalink raw reply	[flat|nested] 13+ messages in thread

end of thread, other threads:[~2018-11-28 12:12 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-11-19 20:50 netfilter Kconfig question Randy Dunlap
2018-11-26  7:30 ` Masahiro Yamada
2018-11-26 19:49   ` Ulf Magnusson
2018-11-26 20:49     ` Ulf Magnusson
2018-11-27  1:33       ` Masahiro Yamada
2018-11-27  1:32     ` Masahiro Yamada
2018-11-27  7:34       ` Ulf Magnusson
2018-11-27  7:47         ` Masahiro Yamada
2018-11-27  8:07           ` Ulf Magnusson
2018-11-27  8:21             ` Ulf Magnusson
2018-11-27  8:31               ` Masahiro Yamada
2018-11-27  9:09                 ` Ulf Magnusson
2018-11-28  1:11                   ` Masahiro Yamada

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).