All of lore.kernel.org
 help / color / mirror / Atom feed
From: Nick Alcock <nick.alcock@oracle.com>
To: Rob Herring <robh@kernel.org>
Cc: mcgrof@kernel.org, linux-modules@vger.kernel.org,
	linux-kernel@vger.kernel.org, linux-pci@vger.kernel.org,
	linux-arm-kernel@lists.infradead.org
Subject: Re: [PATCH 1/8] kbuild, PCI: generic,versatile: comment out MODULE_LICENSE in non-modules
Date: Fri, 10 Feb 2023 18:43:45 +0000	[thread overview]
Message-ID: <87a61l1hum.fsf@esperi.org.uk> (raw)
In-Reply-To: <CAL_JsqJ_VhesDZO336tw=KAp88jCLdW9C6y6QDkTF7WpLkr3+w@mail.gmail.com> (Rob Herring's message of "Fri, 10 Feb 2023 11:36:16 -0600")

On 10 Feb 2023, Rob Herring uttered the following:

> On Fri, Feb 10, 2023 at 11:05 AM Nick Alcock <nick.alcock@oracle.com> wrote:
>>
>> Since commit 8b41fc4454e ("kbuild: create modules.builtin without
>> Makefile.modbuiltin or tristate.conf"), MODULE_LICENSE declarations
>> are used to identify modules. As a consequence, uses of the macro
>> in non-modules will cause modprobe to misidentify their containing
>> object file as a module when it is not (false positives), and modprobe
>> might succeed rather than failing with a suitable error message.
>
> How is there an issue when any given module could be built-in instead?

"modprobe module-that-might-be-built-in" is always meant to succeed if
the module is built-in; but "modprobe thing-that-can't-be-a-module-at-all"
is meant to fail. e.g. on a system in which ext4 is built in, I see

loom:~# modprobe ext4
loom:~# lsmod | grep ext4

(with either reporting any answer, and the modprobe returning exitcode 0).

But trying to modprobe something that cannot be a module says, e.g.
(sorry for old kernel, just happens to be what I can lay my hands on
easily right now):

loom:~# modprobe slab
modprobe: FATAL: Module slab not found in directory /lib/modules/5.16.19-00037-ge8dfda4e77fb-dirty
[exitcode nonzero]

This is what is expected, even though slab is built in. It's not a
module, it cannot be a module, so trying to modprobe it should fail.

But right now we have things like this:

silk:~# modprobe zswap
[nothing, exitcode 0]

zswap cannot be built as a module, so this output is wrong (and
inconsistent with the slab attempt above). (Sure, this isn't exactly a
disastrous consequence, but I have other things I'm going to contribute
after this series that depend on this being got right consistently.)

> The general trend is to make all PCI host drivers modules, the primary
> reason this one, IIRC, is not a module is because it is missing
> remove() hook to de-init the PCI bus. Not too hard to add, but I
> wanted to do a common devm hook to do that instead of an explicit
> .remove() hook in each driver. I suppose we could just ignore that and
> allow building as a module. Unloading is optional anyways.

That's perfectly acceptable for me -- I'm not saying that these things
should not be modular, only that *as long as* they are not modular, they
should not have a MODULE_LICENSE. Making it possible to build them as
modules again is fine!

-- 
NULL && (void)

WARNING: multiple messages have this Message-ID (diff)
From: Nick Alcock <nick.alcock@oracle.com>
To: Rob Herring <robh@kernel.org>
Cc: mcgrof@kernel.org, linux-modules@vger.kernel.org,
	linux-kernel@vger.kernel.org, linux-pci@vger.kernel.org,
	linux-arm-kernel@lists.infradead.org
Subject: Re: [PATCH 1/8] kbuild, PCI: generic,versatile: comment out MODULE_LICENSE in non-modules
Date: Fri, 10 Feb 2023 18:43:45 +0000	[thread overview]
Message-ID: <87a61l1hum.fsf@esperi.org.uk> (raw)
In-Reply-To: <CAL_JsqJ_VhesDZO336tw=KAp88jCLdW9C6y6QDkTF7WpLkr3+w@mail.gmail.com> (Rob Herring's message of "Fri, 10 Feb 2023 11:36:16 -0600")

On 10 Feb 2023, Rob Herring uttered the following:

> On Fri, Feb 10, 2023 at 11:05 AM Nick Alcock <nick.alcock@oracle.com> wrote:
>>
>> Since commit 8b41fc4454e ("kbuild: create modules.builtin without
>> Makefile.modbuiltin or tristate.conf"), MODULE_LICENSE declarations
>> are used to identify modules. As a consequence, uses of the macro
>> in non-modules will cause modprobe to misidentify their containing
>> object file as a module when it is not (false positives), and modprobe
>> might succeed rather than failing with a suitable error message.
>
> How is there an issue when any given module could be built-in instead?

"modprobe module-that-might-be-built-in" is always meant to succeed if
the module is built-in; but "modprobe thing-that-can't-be-a-module-at-all"
is meant to fail. e.g. on a system in which ext4 is built in, I see

loom:~# modprobe ext4
loom:~# lsmod | grep ext4

(with either reporting any answer, and the modprobe returning exitcode 0).

But trying to modprobe something that cannot be a module says, e.g.
(sorry for old kernel, just happens to be what I can lay my hands on
easily right now):

loom:~# modprobe slab
modprobe: FATAL: Module slab not found in directory /lib/modules/5.16.19-00037-ge8dfda4e77fb-dirty
[exitcode nonzero]

This is what is expected, even though slab is built in. It's not a
module, it cannot be a module, so trying to modprobe it should fail.

But right now we have things like this:

silk:~# modprobe zswap
[nothing, exitcode 0]

zswap cannot be built as a module, so this output is wrong (and
inconsistent with the slab attempt above). (Sure, this isn't exactly a
disastrous consequence, but I have other things I'm going to contribute
after this series that depend on this being got right consistently.)

> The general trend is to make all PCI host drivers modules, the primary
> reason this one, IIRC, is not a module is because it is missing
> remove() hook to de-init the PCI bus. Not too hard to add, but I
> wanted to do a common devm hook to do that instead of an explicit
> .remove() hook in each driver. I suppose we could just ignore that and
> allow building as a module. Unloading is optional anyways.

That's perfectly acceptable for me -- I'm not saying that these things
should not be modular, only that *as long as* they are not modular, they
should not have a MODULE_LICENSE. Making it possible to build them as
modules again is fine!

-- 
NULL && (void)

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

  reply	other threads:[~2023-02-10 18:53 UTC|newest]

Thread overview: 49+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-02-10 16:47 [PATCH 0/8] MODULE_LICENSE removals, first tranche Nick Alcock
2023-02-10 16:47 ` [PATCH 1/8] kbuild, PCI: generic,versatile: comment out MODULE_LICENSE in non-modules Nick Alcock
2023-02-10 16:47   ` Nick Alcock
2023-02-10 17:36   ` Rob Herring
2023-02-10 17:36     ` Rob Herring
2023-02-10 18:43     ` Nick Alcock [this message]
2023-02-10 18:43       ` Nick Alcock
2023-02-13 22:57   ` Bjorn Helgaas
2023-02-13 22:57     ` Bjorn Helgaas
2023-02-14 15:41     ` Nick Alcock
2023-02-14 15:41       ` Nick Alcock
2023-02-14 17:20       ` Bjorn Helgaas
2023-02-14 17:20         ` Bjorn Helgaas
2023-02-16 13:34         ` Nick Alcock
2023-02-16 13:34           ` Nick Alcock
2023-02-10 16:47 ` [PATCH 2/8] kbuild, PCI: mobiveil: " Nick Alcock
2023-02-10 16:47 ` [PATCH 3/8] kbuild, ARM: tegra: " Nick Alcock
2023-02-10 16:47 ` [PATCH 4/8] kbuild, PCI: endpoint: " Nick Alcock
2023-02-10 16:47 ` [PATCH 5/8] kbuild, PCI: hip: " Nick Alcock
2023-02-10 16:47 ` [PATCH 6/8] kbuild, shpchp: " Nick Alcock
2023-02-10 16:47 ` [PATCH 7/8] kbuild, PCI: dwc: histb: " Nick Alcock
2023-02-10 16:47 ` [PATCH 8/8] kbuild, PCI: microchip: " Nick Alcock
2023-02-10 16:47   ` Nick Alcock
2023-02-10 18:27   ` Conor Dooley
2023-02-10 18:27     ` Conor Dooley
2023-02-10 19:26     ` Nick Alcock
2023-02-10 19:26       ` Nick Alcock
2023-02-10 20:10       ` Conor Dooley
2023-02-10 20:10         ` Conor Dooley
2023-02-12 18:37         ` Leon Romanovsky
2023-02-12 18:37           ` Leon Romanovsky
2023-02-12 19:52           ` Nick Alcock
2023-02-12 19:52             ` Nick Alcock
2023-02-13 15:53           ` Nick Alcock
2023-02-13 15:53             ` Nick Alcock
2023-02-13 16:13           ` Nick Alcock
2023-02-13 16:13             ` Nick Alcock
2023-02-13 16:51             ` Conor Dooley
2023-02-13 16:51               ` Conor Dooley
2023-02-13 17:06             ` Leon Romanovsky
2023-02-13 17:06               ` Leon Romanovsky
2023-02-15 19:06               ` Nick Alcock
2023-02-15 19:06                 ` Nick Alcock
2023-02-13 17:30           ` Jonathan Corbet
2023-02-13 17:30             ` Jonathan Corbet
2023-02-13 19:23             ` Leon Romanovsky
2023-02-13 19:23               ` Leon Romanovsky
2023-02-16 12:05               ` Nick Alcock
2023-02-16 12:05                 ` Nick Alcock

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=87a61l1hum.fsf@esperi.org.uk \
    --to=nick.alcock@oracle.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-modules@vger.kernel.org \
    --cc=linux-pci@vger.kernel.org \
    --cc=mcgrof@kernel.org \
    --cc=robh@kernel.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.