Fix for nvme quirks module parameter
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
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.
--- drivers/nvme/host/pci.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/nvme/host/pci.c +1 -1
@@ -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
PATCH 2/2 nvme-pci: increase quirks_param buffer size to 256 bytes
In reply to Maurizio LombardiThe 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
@@ -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
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: increasequirks_parambuffer size to 256 bytesdrivers/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
Quoted 5 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]/The second patch increases the quirks parameter's buffer.
Thanks, applied to nvme-7.4.