nvme: make core.nvme_multipath configurable
cover nvme: make core.nvme_multipath configurable
These patches propose an alternative to outright removing the multipath module parameter. Rather than deleting this module parameter we control its appearance with a new Kconfig option named NVME_MULTIPATH_PARAM
Note that the default kernel config settings produce a kernel with no change in functionality. By default both NVME_MULTIPATH and NVME_MULTIPATH_PARAM are enabled and there are no user visable changes.
To remove the core.nvme_multipath parameter simply compile with NVME_MULTIPATH_PARAM=n.
Hopefully this compromise gives everyone what they want.
John Meneghini (4):
nvme-multipath: change the NVME_MULTIPATH config option
nvme-multipath: add the NVME_MULTIPATH_PARAM config option
nvme: update the multipath warning in nvme_init_ns_head
nvme: add mulitipath warning to nvme_alloc_ns
drivers/nvme/host/Kconfig | 28 ++++++++++++++++++++++++---- drivers/nvme/host/core.c | 19 ++++++++++++++++++- drivers/nvme/host/multipath.c | 3 ++- 3 files changed, 44 insertions(+), 6 deletions(-)
Signature · 1 line
2.48.1
PATCH 1/4 nvme-multipath: change the NVME_MULTIPATH config option
Fix up the NVME_MULTIPATH config description so that it accurately describes what it does.
--- drivers/nvme/host/Kconfig | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-)
drivers/nvme/host/Kconfig +9 -4
@@ -18,10 +18,15 @@ config NVME_MULTIPATH bool "NVMe multipath support" depends on NVME_CORE help - This option enables support for multipath access to NVMe - subsystems. If this option is enabled only a single - /dev/nvmeXnY device will show up for each NVMe namespace, - even if it is accessible through multiple controllers. + This option controls support for multipath access to NVMe + subsystems. If this option is enabled support for NVMe multipath + access is included in the kernel. If this option is disabled support + for NVMe multipath access is excluded from the kernel. When this + option is disabled each controller/namespace receives its + own /dev/nvmeXnY device entry and NVMe multipath access is + not supported. + + If unsure, say Y. config NVME_VERBOSE_ERRORS bool "NVMe verbose error reporting"
Signature · 1 line
2.48.1
Re: [PATCH 1/4] nvme-multipath: change the NVME_MULTIPATH config option
Looks good:
PATCH 2/4 nvme-multipath: add the NVME_MULTIPATH_PARAM config option
In reply to John MeneghiniThe NVME_MULTIPATH_PARAM option controls the core.nvme_multipath module parameter. When NVME_MULTIPATH_PARAM=n the multipath parameter is removed and core nvme multipathing is enabled. When NVME_MULTIPATH_PARAM=y the multipath parameter is added and multipath support becomes configurable with the core.nvme_multipath parameter.
By default NVME_MULTIPATH_PARAM=y
--- drivers/nvme/host/Kconfig | 15 +++++++++++++++ drivers/nvme/host/multipath.c | 3 ++- 2 files changed, 17 insertions(+), 1 deletion(-)
drivers/nvme/host/Kconfig +15 -0
@@ -28,6 +28,21 @@ config NVME_MULTIPATH If unsure, say Y. +config NVME_MULTIPATH_PARAM + bool "NVMe multipath param" + depends on NVME_CORE && NVME_MULTIPATH + help + This option enables configurable support for multipath access with + NVMe subsystems. If this option is enabled NVMe multipath support is + configured by the nvme core module parameter named "multipath". If + this option is disabled the nvme core module "multipath" parameter + is removed and support for NVMe multipath access can not be + configured. When this option is disabled a single /dev/nvmeXnY + device entry will be seen for each NVMe namespace, even if the + namespace is accessible through multiple controllers. + + If unsure, say Y. + config NVME_VERBOSE_ERRORS bool "NVMe verbose error reporting" depends on NVME_CORE
drivers/nvme/host/multipath.c +2 -1
@@ -10,10 +10,11 @@#include "nvme.h" bool multipath = true; +#ifdef NVME_MULTIPATH_PARAM module_param (multipath, bool,0444 );MODULE_PARM_DESC (multipath,"turn on native support for multiple controllers per subsystem" ); - +#endif static const char *nvme_iopolicy_names[] = { [NVME_IOPOLICY_NUMA ] ="numa" , [NVME_IOPOLICY_RR ] ="round-robin" ,
Signature · 1 line
2.48.1
Re: [PATCH 2/4] nvme-multipath: add the NVME_MULTIPATH_PARAM config option
Quoted 27 lines · John Meneghini
The
NVME_MULTIPATH_PARAMoption controls the core.nvme_multipath module parameter. When NVME_MULTIPATH_PARAM=n the multipath parameter is removed and core nvme multipathing is enabled. When NVME_MULTIPATH_PARAM=y the multipath parameter is added and multipath support becomes configurable with the core.nvme_multipath parameter.By default NVME_MULTIPATH_PARAM=y
Signed-off-by John Meneghini <[email protected]>--- drivers/nvme/host/Kconfig | 15 +++++++++++++++ drivers/nvme/host/multipath.c | 3 ++- 2 files changed, 17 insertions(+), 1 deletion(-)drivers/nvme/host/Kconfig +5
-0@@ -28,6 +28,21 @@ config NVME_MULTIPATH If unsure, say Y. +config NVME_MULTIPATH_PARAM + bool "NVMe multipath param" + depends on NVME_CORE && NVME_MULTIPATH + help + This option enables configurable support for multipath access with
drivers/nvme/host/Kconfig config NVME_MULTIPATH · line 45
Quoted 10 lines
drivers/nvme/host/Kconfig +10
-0+ NVMe subsystems. If this option is enabled NVMe multipath support is + configured by the nvme core module parameter named "multipath". If + this option is disabled the nvme core module "multipath" parameter + is removed and support for NVMe multipath access can not be + configured. When this option is disabled a single /dev/nvmeXnY + device entry will be seen for each NVMe namespace, even if the + namespace is accessible through multiple controllers. + + If unsure, say Y. +
If we want to make NVME_MULTIPATH_PARAM default on then I think we need to add "default y" under config NVME_MULTIPATH_PARAM.
drivers/nvme/host/multipath.c line 13
Quoted 12 lines
drivers/nvme/host/Kconfig +0
-0config NVME_VERBOSE_ERRORS bool "NVMe verbose error reporting" depends on NVME_COREdrivers/nvme/host/multipath.c +1
-0@@ -10,10 +10,11 @@#include "nvme.h" bool multipath = true; +#ifdef NVME_MULTIPATH_PARAM
Shouldn't it be CONFIG_NVME_MULTIPATH_PARAM instead of NVME_MULTIPATH_PARAM?
Thanks,
--Nilay
Re: [PATCH 2/4] nvme-multipath: add the NVME_MULTIPATH_PARAM config option
Quoted 18 lines · Nilay Shroff
Quoted 17 lines · John Meneghini
drivers/nvme/host/Kconfig +9
-0@@ -28,6 +28,21 @@ config NVME_MULTIPATH If unsure, say Y. +config NVME_MULTIPATH_PARAM + bool "NVMe multipath param" + depends on NVME_CORE && NVME_MULTIPATH + help + This option enables configurable support for multipath access with + NVMe subsystems. If this option is enabled NVMe multipath support is + configured by the nvme core module parameter named "multipath". If + this option is disabled the nvme core module "multipath" parameter + is removed and support for NVMe multipath access can not be
Quoted 8 lines
drivers/nvme/host/Kconfig config NVME_MULTIPATH · line 45
Quoted 6 lines
drivers/nvme/host/Kconfig +6
-0+ configured. When this option is disabled a single /dev/nvmeXnY + device entry will be seen for each NVMe namespace, even if the + namespace is accessible through multiple controllers. + + If unsure, say Y. +If we want to make
NVME_MULTIPATH_PARAMdefault on then I think we need to add "default y" under configNVME_MULTIPATH_PARAM.
OK. I've tested all of the config options.
make mod2noconfig
make allyesconfig
make allmodconfig
make oldconfig
And is all seems to be working correctly, but I'll add the "default y" as you've suggested.
Quoted 10 lines
Quoted 10 lines
drivers/nvme/host/Kconfig +0
-0config NVME_VERBOSE_ERRORS bool "NVMe verbose error reporting" depends on NVME_COREdrivers/nvme/host/multipath.c +0
-0@@ -10,10 +10,11 @@#include "nvme.h"
Quoted 4 lines
drivers/nvme/host/multipath.c line 13
Quoted 2 lines
drivers/nvme/host/multipath.c +1
-0bool multipath = true; +#ifdef NVME_MULTIPATH_PARAM Shouldn't it be
CONFIG_NVME_MULTIPATH_PARAMinstead ofNVME_MULTIPATH_PARAM?
Oops. As you can tell, I haven't tested this yet. I'll fix this up and test these changes before sending a version 2 patch.
/John
Quoted 3 lines
Thanks,
--Nilay
Christoph Hellwig
maintainerRe: [PATCH 2/4] nvme-multipath: add the NVME_MULTIPATH_PARAM config option
In reply to John MeneghiniQuoted 5 lines · John Meneghini
The
NVME_MULTIPATH_PARAMoption controls the core.nvme_multipath module parameter. When NVME_MULTIPATH_PARAM=n the multipath parameter is removed and core nvme multipathing is enabled. When NVME_MULTIPATH_PARAM=y the multipath parameter is added and multipath support becomes configurable with the core.nvme_multipath parameter.
What's the point of adding yet another confusing option?
Re: [PATCH 2/4] nvme-multipath: add the NVME_MULTIPATH_PARAM config option
Quoted 8 lines · Christoph Hellwig
Quoted 5 lines · John Meneghini
The
NVME_MULTIPATH_PARAMoption controls the core.nvme_multipath module parameter. When NVME_MULTIPATH_PARAM=n the multipath parameter is removed and core nvme multipathing is enabled. When NVME_MULTIPATH_PARAM=y the multipath parameter is added and multipath support becomes configurable with the core.nvme_multipath parameter.What's the point of adding yet another confusing option?
If you'll read the kConfig description, hopefully it's not confusing.
The whole point of this patch series is to remove the core.nvme_mulipath parameter.
This is what the patch at: https://lore.kernel.org/linux-nvme/[email protected]/
does, and this is what this patch does. Since people didn't want to remove core.nvme_multipath parameter in https://lore.kernel.org/linux-nvme/[email protected]/ I've proposed this patch as an alternative.
It provides a kConfig option to remove the core.nvme_multipath parameter so those who want it can keep it, and those who don't and compile it out.
/John
Christoph Hellwig
maintainerRe: [PATCH 2/4] nvme-multipath: add the NVME_MULTIPATH_PARAM config option
Quoted 3 lines · John Meneghini
Quoted 1 line
What's the point of adding yet another confusing option?
If you'll read the kConfig description, hopefully it's not confusing.
It still is.
Quoted 1 line
The whole point of this patch series is to remove the core.nvme_mulipath parameter.
Why would a compile time option be preferable over a runtime one?
Re: [PATCH 2/4] nvme-multipath: add the NVME_MULTIPATH_PARAM config option
Quoted 6 lines · Christoph Hellwig
Quoted 3 lines · John Meneghini
Quoted 1 line
What's the point of adding yet another confusing option?
If you'll read the kConfig description, hopefully it's not confusing.
It still is.
OK. I can fix that.
Quoted 3 lines
Quoted 1 line
The whole point of this patch series is to remove the core.nvme_mulipath parameter.
Why would a compile time option be preferable over a runtime one?
Because distos like RHEL don't allow customers to recompile their kernel. And including this runtime switch in the kernel let's users turn nvme-multipath off w/out recompiling the kernel.
Our RHEL customers do this all of the time to enable DMMP with their NVMe devices. This has caused tremendous confusion and turmoil with our RHEL customers who keep on turning nvme-multipath off even when we ship RHEL with nvme-multipath on and we tell them turning it off is not supported.
I finally decided that there is no good way to control this situation w/out removing the core.nvme_multipath parameter while CONFIG_NVME_MULTIPATH is enabled.
This patch enables distros like RHEL simply config out the parameter w/out impacting all of the people out there who currently want and use the run time switch when CONFIG_NVME_MULTIPATH is enabled.
Please let me know what I need to do to make these patches less confusing and get them accepted upstream.
/John
Keith Busch
maintainerRe: [PATCH 2/4] nvme-multipath: add the NVME_MULTIPATH_PARAM config option
Quoted 11 lines · John Meneghini
Our RHEL customers do this all of the time to enable DMMP with their NVMe devices. This has caused tremendous confusion and turmoil with our RHEL customers who keep on turning nvme-multipath off even when we ship RHEL with nvme-multipath on and we tell them turning it off is not supported.
I finally decided that there is no good way to control this situation w/out removing the core.nvme_multipath parameter while
CONFIG_NVME_MULTIPATHis enabled.This patch enables distros like RHEL simply config out the parameter w/out impacting all of the people out there who currently want and use the run time switch when
CONFIG_NVME_MULTIPATHis enabled.Please let me know what I need to do to make these patches less confusing and get them accepted upstream.
It'd be one thing if it was just me lamenting the loss of the parameter, but Hannes has customers with a very real and obvious use case for it, even if Christoph hasn't encountered many (or any?) devices that fall into that trap. So, from my perspective, I really think pcie hotplug handling needs to be sorted out before we can just force these to subscribe to the native mulitpath virtual device hierarchy.
In the meantime, I know RHEL has done out of tree patches for many reasons, so it shouldn't be a big deal to change the module_param type from "bool" to "bool_enable_only" in your kernel releases.
PATCH 3/4 nvme: update the multipath warning in nvme_init_ns_head
In reply to John MeneghiniThe new NVME_MULTIPATH_PARAM config option requires updates to the warning message in nvme_init_ns_head(). Remove the old warning message and add new ones.
--- drivers/nvme/host/core.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-)
drivers/nvme/host/core.c +9 -1
@@ -3823,8 +3823,16 @@ static int nvme_init_ns_head(struct nvme_ns *ns, struct nvme_ns_info *info)dev_warn (ctrl->device,"Found shared namespace %d, but multipathing not supported.\n" , info->nsid); +#ifdef CONFIG_NVME_MULTIPATH +#ifdef CONFIG_NVME_MULTIPATH_PARAM +dev_warn_once (ctrl->device, +"Shared namespace support requires core.nvme_multipath=Y.\n" ); + +#endif +#else dev_warn_once (ctrl->device, -"Support for shared namespaces without CONFIG_NVME_MULTIPATH is deprecated and will be removed in Linux 6.0.\n" ); +"Shared namespace support requires CONFIG_NVME_MULTIPATH.\n" ); +#endif } }
Signature · 1 line
2.48.1
Re: [PATCH 3/4] nvme: update the multipath warning in nvme_init_ns_head
Quoted 21 lines · John Meneghini
The new
NVME_MULTIPATH_PARAMconfig option requires updates to the warning message innvme_init_ns_head(). Remove the old warning message and add new ones.Signed-off-by John Meneghini <[email protected]>--- drivers/nvme/host/core.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-)drivers/nvme/host/core.c +4
-0@@ -3823,8 +3823,16 @@ static int nvme_init_ns_head(struct nvme_ns *ns, struct nvme_ns_info *info)dev_warn (ctrl->device,"Found shared namespace %d, but multipathing not supported.\n" , info->nsid); +#ifdef CONFIG_NVME_MULTIPATH +#ifdef CONFIG_NVME_MULTIPATH_PARAM +dev_warn_once (ctrl->device, +"Shared namespace support requires core.nvme_multipath=Y.\n" );
drivers/nvme/host/core.c static int nvme_init_ns_head(struct nvme_ns *ns, struct nvme_ns_info *info) · line 3838
Quoted 10 lines
drivers/nvme/host/core.c +5
-1+ +#endif +#else dev_warn_once (ctrl->device, -"Support for shared namespaces without CONFIG_NVME_MULTIPATH is deprecated and will be removed in Linux 6.0.\n" ); +"Shared namespace support requires CONFIG_NVME_MULTIPATH.\n" ); +#endif } }
As NVME_MULTIPATH_PARAM depends on NVME_MULTIPATH, it implicitly implies that if NVME_MULTIPATH_PARAM is enabled then NVME_MULTIPATH has to be on. So above logic could be simplified.
However on another note, I really don't understand why do we need to add new warning here as there's already a warning present just above your changes.
Thanks,
--Nilay
Re: [PATCH 3/4] nvme: update the multipath warning in nvme_init_ns_head
Quoted 37 lines · Nilay Shroff
Quoted 21 lines · John Meneghini
The new
NVME_MULTIPATH_PARAMconfig option requires updates to the warning message innvme_init_ns_head(). Remove the old warning message and add new ones.Signed-off-by John Meneghini <[email protected]>--- drivers/nvme/host/core.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-)drivers/nvme/host/core.c +4
-0@@ -3823,8 +3823,16 @@ static int nvme_init_ns_head(struct nvme_ns *ns, struct nvme_ns_info *info)dev_warn (ctrl->device,"Found shared namespace %d, but multipathing not supported.\n" , info->nsid); +#ifdef CONFIG_NVME_MULTIPATH +#ifdef CONFIG_NVME_MULTIPATH_PARAM +dev_warn_once (ctrl->device, +"Shared namespace support requires core.nvme_multipath=Y.\n" );drivers/nvme/host/core.c static int nvme_init_ns_head(struct nvme_ns *ns, struct nvme_ns_info *info) · line 3838
Quoted 10 lines
drivers/nvme/host/core.c +5
-1+ +#endif +#else dev_warn_once (ctrl->device, -"Support for shared namespaces without CONFIG_NVME_MULTIPATH is deprecated and will be removed in Linux 6.0.\n" ); +"Shared namespace support requires CONFIG_NVME_MULTIPATH.\n" ); +#endif } }As
NVME_MULTIPATH_PARAMdepends onNVME_MULTIPATH, it implicitly implies that ifNVME_MULTIPATH_PARAMis enabled thenNVME_MULTIPATHhas to be on. So above logic could be simplified.
Quoted 3 lines
However on another note, I really don't understand why do we need to add new warning here as there's already a warning present just above your changes.
Agreed. How about if we just remove the
dev_warn_once(ctrl->device,
"Support for shared namespaces without CONFIG_NVME_MULTIPATH is deprecated and will be removed in Linux 6.0.\n");
This is real problem. This is a confusing message since there is no now plan to remove any of these config options from the kernel.
/John
Quoted 4 lines
Thanks,
--Nilay
Re: [PATCH 3/4] nvme: update the multipath warning in nvme_init_ns_head
Quoted 42 lines · John Meneghini
Quoted 37 lines · Nilay Shroff
Quoted 30 lines · John Meneghini
The new
NVME_MULTIPATH_PARAMconfig option requires updates to the warning message innvme_init_ns_head(). Remove the old warning message and add new ones.Signed-off-by John Meneghini <[email protected]>---
drivers/nvme/host/core.c| 10 +++++++++-1 file changed, 9 insertions(+), 1 deletion(-)drivers/nvme/host/core.c +9
-1@@ -3823,8 +3823,16 @@ static int nvme_init_ns_head(struct nvme_ns *ns, struct nvme_ns_info *info) dev_warn(ctrl->device, "Found shared namespace %d, but multipathing not supported.\n", info->nsid); +#ifdef CONFIG_NVME_MULTIPATH +#ifdef CONFIG_NVME_MULTIPATH_PARAM + dev_warn_once(ctrl->device, + "Shared namespace support requires core.nvme_multipath=Y.\n"); + +#endif +#else dev_warn_once(ctrl->device, - "Support for shared namespaces without CONFIG_NVME_MULTIPATH is deprecated and will be removed in Linux 6.0.\n"); + "Shared namespace support requires CONFIG_NVME_MULTIPATH.\n"); +#endif } }Quoted 1 line
As
NVME_MULTIPATH_PARAMdepends onNVME_MULTIPATH, it implicitly implies that ifNVME_MULTIPATH_PARAMis enabled thenNVME_MULTIPATHhas to be on. So above logic could be simplified.Quoted 3 lines
However on another note, I really don't understand why do we need to add new warning here as there's already a warning present just above your changes.
Quoted 6 lines
Agreed. How about if we just remove the
dev_warn_once(ctrl->device,
"Support for shared namespaces withoutCONFIG_NVME_MULTIPATHis deprecated and will be removed in Linux 6.0.\n");
This is real problem. This is a confusing message since there is no now plan to remove any of these config options from the kernel.
I read it as "NVMe (native) multipathing is only supported when CONFIG_NVME_MULTIPATH is configured".
So personally, I find existing warning messages (we print two warning messages when multipath is false but shared namespace is detected) sufficient, however lets see what others suggest.
Thanks,
--Nilay
PATCH 4/4 nvme: add mulitipath warning to nvme_alloc_ns
In reply to John MeneghiniWhen CONFIG_NVME_MULTIPATH is disabled, add a warning if we discover a multipath enabled controller with an attached shared namespace.
--- drivers/nvme/host/core.c | 9 +++++++++ 1 file changed, 9 insertions(+)
drivers/nvme/host/core.c +9 -0
@@ -3938,6 +3938,15 @@ static void nvme_alloc_ns(struct nvme_ctrl *ctrl, struct nvme_ns_info *info) }else {sprintf (disk->disk_name,"nvme%dn%d" , ctrl->instance, ns->head->instance); +#ifndef CONFIG_NVME_MULTIPATH +if ((ctrl->subsys->cmic &NVME_CTRL_CMIC_MULTI_CTRL ) && info->is_shared) { +dev_warn (ctrl->device, +"Found shared namespace %d but multipathing not supported.\n" , + info->nsid); +dev_warn_once (ctrl->device, +"Shared namespace support requires CONFIG_NVME_MULTIPATH.\n" ); + } +#endif }if (nvme_update_ns_info (ns, info))
Signature · 1 line
2.48.1
Christoph Hellwig
maintainerRe: [PATCH 4/4] nvme: add mulitipath warning to nvme_alloc_ns
Quoted 14 lines · John Meneghini
When
CONFIG_NVME_MULTIPATHis disabled, add a warning if we discover a multipath enabled controller with an attached shared namespace.Signed-off-by John Meneghini <[email protected]>--- drivers/nvme/host/core.c | 9 +++++++++ 1 file changed, 9 insertions(+)drivers/nvme/host/core.c +0
-0
drivers/nvme/host/core.c static void nvme_alloc_ns(struct nvme_ctrl *ctrl, struct nvme_ns_info *info) · line 3941
Quoted 4 lines
drivers/nvme/host/core.c +1
-0@@ -3938,6 +3938,15 @@ static void nvme_alloc_ns(struct nvme_ctrl *ctrl, struct nvme_ns_info *info) }else {sprintf (disk->disk_name,"nvme%dn%d" , ctrl->instance, ns->head->instance); +#ifndef CONFIG_NVME_MULTIPATH
This can use IS_ENABLED to clean the code up a bit.
drivers/nvme/host/core.c static void nvme_alloc_ns(struct nvme_ctrl *ctrl, struct nvme_ns_info *info) · line 3942
Quoted 1 line
drivers/nvme/host/core.c +1
-0+if ((ctrl->subsys->cmic &NVME_CTRL_CMIC_MULTI_CTRL ) && info->is_shared) {
overly long line.