linux-modules.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Nick Alcock <nick.alcock@oracle.com>
To: Luis Chamberlain <mcgrof@kernel.org>
Cc: Christoph Hellwig <hch@lst.de>,
	Thomas Gleixner <tglx@linutronix.de>,
	Masahiro Yamada <masahiroy@kernel.org>,
	linux-modules@vger.kernel.org, linux-kernel@vger.kernel.org,
	Hitomi Hasegawa <hasegawa-hitomi@fujitsu.com>,
	Marek Szyprowski <m.szyprowski@samsung.com>,
	iommu@lists.linux.dev
Subject: Re: [PATCH 21/27] kbuild, dma-mapping: benchmark: remove MODULE_LICENSE in non-modules
Date: Thu, 23 Feb 2023 15:31:50 +0000	[thread overview]
Message-ID: <878rgopfdl.fsf@esperi.org.uk> (raw)
In-Reply-To: <Y/acoc6MDKNnrG+g@bombadil.infradead.org> (Luis Chamberlain's message of "Wed, 22 Feb 2023 14:52:17 -0800")

On 22 Feb 2023, Luis Chamberlain spake thusly:

> On Wed, Feb 22, 2023 at 03:48:56PM +0100, Christoph Hellwig wrote:
>> Looks good:
>> 
>> Reviewed-by: Christoph Hellwig <hch@lst.de>
>> 
>> On Wed, Feb 22, 2023 at 12:14:47PM +0000, Nick Alcock wrote:
>> > Since commit 8b41fc4454e ("kbuild: create modules.builtin without
>> > Makefile.modbuiltin or tristate.conf"), MODULE_LICENSE declarations
>> > are used to identify modules.
>> 
>> .. but this seems like a really odd design.  How is this going to
>> continue working once we can autogenerate the module license section
>> from the SPDX tags, which we eventually really should?
>
> Yes I totally agree we should. But I think we should take this by steps.
> First, we ensure we have only MODULE_LICENSE() macros upstream on things which
> are really possible modules, ie we remove the false positives. We then put a
> stop-gap script which can complain if it finds new usecases which are buggy.

(and we have such a script already, though it's not in-tree: I used it
to generate the list of affected files that make up this series. I'll
keep running it at least once per release cycle to identify regressions
in this area, and fix them as they come up.)

> Then we look for an optimal way to address the final step:
>
>  * remove all MODULE_LICENSE() and autogenerate them from SPDX

Ooh that would be nice!

> The difficulty in this will be that we want to upkeep existing build
> heuristics and avoid to have to traverse the tree twice (see details
> on commit 8b41fc4454e). I can't think of an easy way to do this that
> does not involve using kconfig tristate somehow.

Nor can I -- and more generally I can't figure out a way to get from the
Kconfig symbols to the source files that constitute them without
retraversing the tree, since the only place the relationship is recorded
is in makefiles, and those makefiles use a lot of make functionality
(including more or less arbitrary make functions).

(restating the underlying difficulty here in case, like me, you lost
 track of it over the last few months)

Of course the build process is doing that traversal anyway -- the
problem is that the only approach we have to get from tristate to a list
of modules-or-builtins involves emitting *different values* for CONFIG_
symbols (uppercase rather than lowercase) and then triggering on those
to do things -- and if you do that you can't simultaneously use those
CONFIG_ variables for their normal purpose.

We can't rename those variables for this purpose because we're depending
on makefiles all across the tree expanding them. I tried to arrange for
their expansion to have side effects (so that evaluating $(CONFIG_FOO)
produced both 'y' or 'm' and *also* did... *something* that produced an
object file list for our consumption) but that also doesn't work because
unfortunately the tristate determination code needs a *mapping* from
CONFIG_ variable value to the result of the variable expansion, and a
line like

foo-$(CONFIG_FOO) := x y z

doesn't let the expansion of CONFIG_FOO have any sort of access to the
result of the assignment to foo-y / foo-m, and after the assignment's
happened there's no way to tell that the $(foo-m) -> x y z mapping was
generated by the expansion of CONFIG_FOO in particlar. So multiple
evaluations (which means, in effect, multiple make invocations) seems to
be the only way.

I do hope Masahiro has some brilliant idea here. Mind you I'm not sure
I'm clever enough to have come up with the original Makefile.modbuiltin
scheme either...

  reply	other threads:[~2023-02-23 15:32 UTC|newest]

Thread overview: 53+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20230222121453.91915-1-nick.alcock@oracle.com>
2023-02-22 12:14 ` [PATCH 01/27] kbuild, power: reset: keystone-reset: remove MODULE_LICENSE in non-modules Nick Alcock
2023-02-22 12:14 ` [PATCH 02/27] kbuild, video: fbdev: " Nick Alcock
2023-02-22 12:14 ` [PATCH 03/27] kbuild, KEYS: " Nick Alcock
2023-02-22 12:14 ` [PATCH 04/27] kbuild, soc: bcm: raspberrypi-power: " Nick Alcock
2023-02-24 21:26   ` Florian Fainelli
2023-02-22 12:14 ` [PATCH 05/27] kbuild, soc: bcm: bcm2835-power: " Nick Alcock
2023-02-24 21:26   ` Florian Fainelli
2023-02-22 12:14 ` [PATCH 06/27] kbuild, pinctrl: bcm: ns: " Nick Alcock
2023-02-22 12:14 ` [PATCH 07/27] kbuild, MIPS: BCM47XX: " Nick Alcock
2023-02-26 22:14   ` Philippe Mathieu-Daudé
2023-02-22 12:14 ` [PATCH 08/27] kbuild, clocksource: " Nick Alcock
2023-02-22 12:14 ` [PATCH 09/27] kbuild, clocksource/drivers/timer-tegra186: " Nick Alcock
2023-02-22 12:14 ` [PATCH 10/27] kbuild, clocksource: " Nick Alcock
2023-02-22 12:14 ` [PATCH 11/27] kbuild, clk: bcm2835: " Nick Alcock
2023-02-22 23:43   ` Stephen Boyd
2023-02-23  1:36     ` Luis Chamberlain
2023-03-06 19:29   ` Stephen Boyd
2023-02-22 12:14 ` [PATCH 12/27] kbuild, clk: " Nick Alcock
2023-02-22 12:41   ` Conor Dooley
2023-02-22 23:43   ` Stephen Boyd
2023-03-06 19:29   ` [PATCH 12/27] kbuild, clk: remove MODULE_LICENSE in non-modules Stephen Boyd
2023-02-22 12:14 ` [PATCH 13/27] kbuild, vgacon: " Nick Alcock
2023-02-22 12:14 ` [PATCH 14/27] kbuild, cpufreq: tegra124: " Nick Alcock
2023-02-23  4:20   ` Viresh Kumar
2023-02-22 12:14 ` [PATCH 15/27] kbuild, cpufreq: " Nick Alcock
2023-02-23  4:20   ` Viresh Kumar
2023-02-22 12:14 ` [PATCH 16/27] kbuild, crypto: " Nick Alcock
2023-02-23 10:18   ` Herbert Xu
2023-02-22 12:14 ` [PATCH 17/27] " Nick Alcock
2023-02-23 10:21   ` Herbert Xu
2023-02-22 12:14 ` [PATCH 18/27] kbuild, mfd: " Nick Alcock
2023-02-22 22:38   ` DLG Adam Ward
2023-02-23 13:48     ` Lee Jones
2023-02-23 19:24       ` Nick Alcock
2023-02-24 15:03         ` DLG Adam Ward
2023-02-27 13:15           ` Nick Alcock
2023-03-01  9:04             ` Lee Jones
2023-02-22 12:14 ` [PATCH 19/27] kbuild, dmaengine: stm32-mdma: " Nick Alcock
2023-02-22 12:14 ` [PATCH 20/27] kbuild, dmaengine: " Nick Alcock
2023-02-22 12:14 ` [PATCH 21/27] kbuild, dma-mapping: benchmark: " Nick Alcock
2023-02-22 14:48   ` Christoph Hellwig
2023-02-22 22:52     ` Luis Chamberlain
2023-02-23 15:31       ` Nick Alcock [this message]
2023-02-23 20:51         ` Luis Chamberlain
2023-02-24 14:20           ` Nick Alcock
2023-02-24 17:18             ` Luis Chamberlain
2023-02-22 12:14 ` [PATCH 22/27] kbuild, dma-buf: heaps: " Nick Alcock
2023-02-22 12:14 ` [PATCH 23/27] kbuild, drm/dsi: " Nick Alcock
2023-02-22 12:14 ` [PATCH 24/27] kbuild, binfmt_elf: " Nick Alcock
2023-02-22 12:14 ` [PATCH 25/27] kbuild, video: fbdev: " Nick Alcock
2023-02-22 12:14 ` [PATCH 26/27] kbuild, phy: intel: " Nick Alcock
2023-02-22 12:14 ` [PATCH 27/27] kbuild, gpio: gpio-aspeed-sgpio: " Nick Alcock
2023-03-06  9:59   ` Bartosz Golaszewski

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=878rgopfdl.fsf@esperi.org.uk \
    --to=nick.alcock@oracle.com \
    --cc=hasegawa-hitomi@fujitsu.com \
    --cc=hch@lst.de \
    --cc=iommu@lists.linux.dev \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-modules@vger.kernel.org \
    --cc=m.szyprowski@samsung.com \
    --cc=masahiroy@kernel.org \
    --cc=mcgrof@kernel.org \
    --cc=tglx@linutronix.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).