[PATCH v3 00/13] drm/display: Convert helpers Kconfig symbols to depends on

Geert Uytterhoeven geert at linux-m68k.org
Tue Apr 9 15:24:21 UTC 2024


Hi Jani,

On Tue, Apr 9, 2024 at 1:13 PM Jani Nikula <jani.nikula at linux.intel.com> wrote:
> On Tue, 09 Apr 2024, Geert Uytterhoeven <geert at linux-m68k.org> wrote:
> > On Tue, Apr 9, 2024 at 12:04 PM Jani Nikula <jani.nikula at linux.intel.com> wrote:
> >> On Tue, 09 Apr 2024, Geert Uytterhoeven <geert at linux-m68k.org> wrote:
> >> > The user should not need to know which helpers are needed for the driver
> >> > he is interested in.  When a symbol selects another symbol, it should
> >> > just make sure the dependencies of the target symbol are met.
> >>
> >> It's really not "just make sure". This leads to perpetual illegal
> >> configurations, and duct tape fixes. Select should not be used for
> >> visible symbols or symbols with dependencies [1].
> >
> > In other words: none of these helpers should be visible...
>
> ...and should have no dependencies? :p

Unless they do have dependencies.

> >> What we'd need for usability is not more abuse of select, but rather 1)
> >> warnings for selecting symbols with dependencies, and 2) a way to enable
> >
> > Kconfig already warns if dependencies of selected symbols are not met.
>
> But it does lead to cases where a builtin tries to use a symbol from a
> module, failing at link time, not config time. Then I regularly see
> patches trying to fix this with IS_REACHABLE(), making it a silent
> runtime failure instead, when it should've been a config issue.

If a symbol for a builtin selects a symbol for a module, the latter
becomes builtin, too, so that does not cause such issues?
You can get such issues when a boolean symbol depends on a tristate
symbol...

> >> a kconfig option with all its dependencies, recursively. This is what we
> >> lack.
> >
> > You cannot force-enable all dependencies of the target symbol, as some
> > of these dependencies may be impossible to meet on the system you are
> > configuring a kernel for.
>
> Surely kconfig should be able to figure out if they're possible or not.
>
> > The current proper way is to add these dependencies to the source
> > symbol, which is what we have been doing everywhere else.  Another
> > solution may be to teach Kconfig to ignore any symbols that select a
> > symbol with unmet dependencies.
>
> ...
>
> It seems like your main argument in favour of using select is that it's
> more convenient for people who configure the kernel. Because the user
> should be able to just enable a driver, and that would select everything
> that's needed. But where do we draw the line? Then what qualifies for
> "depends on"?

Hard (platform and subsystem) dependencies.

> Look at config DRM_I915 and where select abuse has lead us. Like, why
> don't we just select DRM, PCI and X86 as well instead of depend. :p

X86 and PCI are hard platform dependencies.
DRM is a subsystem dependency.

> A lot of things we have to select because it appears to generally be the
> case that if some places select and some places depends on a symbol,
> it'll lead to circular dependencies.

True.  So all library code (incl. helpers) should be selected, and
not be used as a dependency.
The user shouldn't be aware that the driver uses library code (or not).

> Sure there may be a usability issue with using depends on. But the
> proper fix isn't hacking in kconfig files, it's to fix the usability in
> kconfig the tool UI. But nobody steps up, because at least I find the
> kconfig source to be inpenetrable. I've tried many times, and given up.

As long as Kconfig does not handle dependencies of selected symbols
automatically, adding explicit dependencies to the origin symbols is
the only workable solution.

> I mean, if you want to enable a driver D, it could, at a minimum, show
> you a tree of (possibly alternative) things you also need to enable. But

And this series is actually making that harder, by turning all these
selects of helpers into dependencies...

> if the dependencies aren't there, you won't even see the config for
> D. That's not something that should be "fixed" by abusing select in
> kconfig files.

I consider not seeing symbols when a hard dependency is not met as
a good thing.  If everything was visible all the time, you would
have a very hard (well, harder than the current already-hard ;-)
time configuring your kernel.

Gr{oetje,eeting}s,

                        Geert

-- 
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert at linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds


More information about the dri-devel mailing list