mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* nvme-pci: nvme.quirks= on the kernel command line hangs early boot when nvme-pci is built in
@ 2026-10-18 15:54 Ramón Jesús Miranda
  2026-10-19 10:33 ` Maurizio Lombardi
  0 siblings, 1 reply; 3+ messages in thread
From: Ramón Jesús Miranda @ 2026-10-18 15:54 UTC (permalink / raw)
  To: Keith Busch, Jens Axboe, Christoph Hellwig, Sagi Grimberg
  Cc: linux-nvme, linux-kernel

Hi,

Passing nvme.quirks=VID:DID:QUIRKS on the kernel command line with
CONFIG_BLK_DEV_NVME=y hangs the kernel immediately, before any console
output, on arm64 (Microsoft Surface Pro 11, X1E80100, 7.2.8).

As far as I can tell, quirks_param_set() runs during parse_args() for
built-in modules, i.e. before memory management is initialised, and it
allocates there. As a module (nvme.quirks= handled at module load) it
works.

Removing the parameter boots normally. I have not checked other
architectures.

Ramón Jesús Miranda

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

* Re: nvme-pci: nvme.quirks= on the kernel command line hangs early boot when nvme-pci is built in
  2026-10-18 15:54 nvme-pci: nvme.quirks= on the kernel command line hangs early boot when nvme-pci is built in Ramón Jesús Miranda
@ 2026-10-19 10:33 ` Maurizio Lombardi
       [not found]   ` <CAP08=V2Kqo8OFrKe7rEk3+J3W65rS8vKpA5a_PBC8qwxvQaKGg@mail.gmail.com>
  0 siblings, 1 reply; 3+ messages in thread
From: Maurizio Lombardi @ 2026-10-19 10:33 UTC (permalink / raw)
  To: Ramón Jesús Miranda, Keith Busch, Jens Axboe,
	Christoph Hellwig, Sagi Grimberg
  Cc: linux-nvme, linux-kernel

On Sun Oct 18, 2026 at 5:54 PM CEST, Ramón Jesús Miranda wrote:
> Hi,
>
> Passing nvme.quirks=VID:DID:QUIRKS on the kernel command line with
> CONFIG_BLK_DEV_NVME=y hangs the kernel immediately, before any console
> output, on arm64 (Microsoft Surface Pro 11, X1E80100, 7.2.8).
>
> As far as I can tell, quirks_param_set() runs during parse_args() for
> built-in modules, i.e. before memory management is initialised, and it
> allocates there. As a module (nvme.quirks= handled at module load) it
> works.
>
> Removing the parameter boots normally. I have not checked other
> architectures.
>

Hello, USB also allocates memory in that callback... but there is
a small difference...

Could you please test the following patch? (Compile-tested only)

diff --git a/drivers/nvme/host/pci.c b/drivers/nvme/host/pci.c
index 77317e5d00f9..6699c7da4b5a 100644
--- a/drivers/nvme/host/pci.c
+++ b/drivers/nvme/host/pci.c
@@ -243,7 +243,7 @@ static struct kparam_string quirks_param_string = {
        .string = quirks_param,
 };

-module_param_cb(quirks, &quirks_param_ops, &quirks_param_string, 0444);
+device_param_cb(quirks, &quirks_param_ops, &quirks_param_string, 0444);
 MODULE_PARM_DESC(quirks, "Enable/disable NVMe quirks by specifying "
                                                "quirks=VID:DID:quirk_names");


Thanks,
Maurizio

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

* Re: nvme-pci: nvme.quirks= on the kernel command line hangs early boot when nvme-pci is built in
       [not found]   ` <CAP08=V2Kqo8OFrKe7rEk3+J3W65rS8vKpA5a_PBC8qwxvQaKGg@mail.gmail.com>
@ 2026-10-19 15:59     ` Maurizio Lombardi
  0 siblings, 0 replies; 3+ messages in thread
From: Maurizio Lombardi @ 2026-10-19 15:59 UTC (permalink / raw)
  To: Ramón Jesús Miranda Hernández, mlombard
  Cc: kbusch, axboe, hch, sagi, linux-nvme, linux-kernel

On Mon Oct 19, 2026 at 5:48 PM CEST, Ramón Jesús Miranda Hernández wrote:
> Hi Maurizio,
>
> Thanks for the quick look and the patch. I tested device_param_cb() on the
> Surface Pro 11 (X1E80100) with CONFIG_BLK_DEV_NVME=y: kernel 7.2.8 built
> from 616a9f22 plus your change, booted with the parameter on the command
> line.
>
> Result: with the patch the kernel boots with
> nvme.quirks=0xffff:0xffff:bogus_nid
> It reaches login with no hang, and the parameter is visible afterwards in
> /sys/module/nvme/parameters/quirks. The nvme0 controller probes normally
> (pci 0006:01:00.0, 64 MiB HMB, 12 queues).
>
> Caveat: I used a placeholder VID:DID that matches no device, so this shows
> the parameter is parsed at boot without hanging. It does not show a real
> quirk being applied to a matching controller. I can retry with the VID:DID
> of the Surface's NVMe if that is useful for your review.

Thanks for testing!

It's not necessary to test a real quirk, just be sure the callback gets
called and doesn't hang the kernel.

A useful thing is to re-test if the quirks parameter still works
as before when CONFIG_BLK_DEV_NVME=M, to be sure we are not introducing
a regression.

Maurizio



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

end of thread, other threads:[~2026-10-19 15:59 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-10-18 15:54 nvme-pci: nvme.quirks= on the kernel command line hangs early boot when nvme-pci is built in Ramón Jesús Miranda
2026-10-19 10:33 ` Maurizio Lombardi
     [not found]   ` <CAP08=V2Kqo8OFrKe7rEk3+J3W65rS8vKpA5a_PBC8qwxvQaKGg@mail.gmail.com>
2026-10-19 15:59     ` Maurizio Lombardi

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®