Skip to contentSkip to conversation

Fix for nvme quirks module parameter

PATCH Applied Maurizio Lombardi 3 participants 5 messages Oct 23 NVMe

lore
Share & tools
lore
#0 lore raw

cover Fix for nvme quirks module parameter

The first patch fixes a boot hang when nvme-pci is built-in in the kernel, reported by Ramon Jesus Miranda here:
https://lore.kernel.org/linux-nvme/[email protected]/

The second patch increases the quirks parameter's buffer.

Maurizio Lombardi (2):
nvme-pci: fix early boot hang with nvme.quirks= parameter
nvme-pci: increase quirks_param buffer size to 256 bytes

 drivers/nvme/host/pci.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
Signature · 1 line
2.56.0
#1 lore raw

PATCH 1/2 nvme-pci: fix early boot hang with nvme.quirks parameter

Passing nvme.quirks on the kernel command line causes a silent boot hang when the NVMe driver is compiled as a built-in module.

This happens because the parameter is currently registered using module_param_cb(). For built-in modules, this macro flags the parameter to be evaluated at initcall level -1. Consequently, quirks_param_set() is called before the memory allocators are initialized.

Fix this by replacing module_param_cb() with device_param_cb(). This defers the parameter parsing to initcall level 6, guaranteeing that the system memory allocators are fully functional before the quirk string is parsed and allocated.

Fixes 7bb8c40f5ad8 ("nvme: add support for dynamic quirk configuration via module parameter")
---
 drivers/nvme/host/pci.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/nvme/host/pci.c +1 -1
index 77317e5d00f9..6699c7da4b5a 100644
@@ -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");
 
Signature · 1 line
2.56.0
#2 lore raw

PATCH 2/2 nvme-pci: increase quirks_param buffer size to 256 bytes

In reply to Maurizio Lombardi

The current 128 byte buffer for the nvme.quirks command line parameter is a bit too small. If a user needs to specify multiple quirks or use multiple VID:DID combinations, the configuration string can easily exceed this limit.

Increase the size of the quirks_param array from 128 to 256 bytes to comfortably accommodate longer and more complex quirk configurations.

---
 drivers/nvme/host/pci.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/nvme/host/pci.c +1 -1
index 6699c7da4b5a..d6c8fcc6151a 100644
@@ -232,7 +232,7 @@ static int quirks_param_set(const char *value, const struct kernel_param *kp)
 	return err;
 }
 
-static char quirks_param[128];
+static char quirks_param[256];
 static const struct kernel_param_ops quirks_param_ops = {
 	.set = quirks_param_set,
 	.get = param_get_string,
Signature · 1 line
2.56.0
Reviewed-by on the v1 series
#3 lore raw
In reply to Maurizio Lombardi
Quoted 4 lines · Maurizio Lombardi

The first patch fixes a boot hang when nvme-pci is built-in in the kernel, reported by Ramon Jesus Miranda here:
https://lore.kernel.org/linux-nvme/[email protected]/

Quoted 8 lines

The second patch increases the quirks parameter's buffer.

Maurizio Lombardi (2):
  nvme-pci: fix early boot hang with nvme.quirks= parameter
  nvme-pci: increase quirks_param buffer size to 256 bytes

 drivers/nvme/host/pci.c | 4 ++--

 1 file changed, 2 insertions(+), 2 deletions(-)

Unless I am missing something, this looks good to me and i know it was already tested.

For the series