driver core: Add cmdline option to force probe type
Subsystems (2)
PATCH 1/1 driver core: Add cmdline option to force probe type
From: Jianlin Lv <[email protected]>
Device drivers that use asynchronous probing can cause non-deterministic device ordering and naming across reboots. A typical example is storage drivers (like sd/nvme): asynchronous probing can lead to inconsistent disk logical names after reboot. In scenarios where disk naming consistency is critical, the probe type should be set to synchronous.
This patch introduces a driver_probe kernel parameter that overrides any driver's hard-coded probe type settings and allows runtime control without requiring kernel recompilation:
driver_probe=PROBE_TYPE_SYNC,nvme,sd # Force specific drivers sync driver_probe=PROBE_TYPE_ASYNC,*,usb # Force all async except usb driver_probe=PROBE_TYPE_SYNC,* # Force all drivers synchronous
The implementation replaces the limited driver_async_probe parameter with a more flexible interface that can force either synchronous or asynchronous probing as needed.
--- .../admin-guide/kernel-parameters.txt | 27 +++++-- drivers/base/dd.c | 71 ++++++++++++++----- 2 files changed, 74 insertions(+), 24 deletions(-)
Documentation/admin-guide/kernel-parameters.txt +21 -6
@@ -1377,12 +1377,27 @@ Kernel parameters it becomes active and is searched during signature verification. - driver_async_probe= [KNL] - List of driver names to be probed asynchronously. * - matches with all driver names. If * is specified, the - rest of the listed driver names are those that will NOT - match the *. - Format: <driver_name1>,<driver_name2>... + driver_probe= [KNL] + Control device driver probe types. This parameter takes + precedence over driver hard-coded probe_type settings. + Format: <probe_type>,<driver_name1>,<driver_name2>,... + + <probe_type>: + PROBE_TYPE_SYNC - Force synchronous probing + PROBE_TYPE_ASYNC - Force asynchronous probing + + Driver name patterns: + driver1,driver2 - Apply to specific drivers only + *,driver1,driver2 - Apply to all drivers except listed ones + * (alone) - Apply to all drivers + + Examples: + driver_probe=PROBE_TYPE_SYNC,nvme,sd + Force synchronous probe for nvme and sd drivers + driver_probe=PROBE_TYPE_SYNC,*,graphics,usb-storage + Force sync for all drivers except graphics and usb-storage + driver_probe=PROBE_TYPE_ASYNC,* + Force async probe for all drivers drm.edid_firmware=[<connector>:]<file>[,[<connector>:]<file>] Broken monitors, graphic adapters, KVMs and EDIDless
drivers/base/dd.c +53 -18
101 lines not on this page · raw message
Signature · 1 line
2.43.0
Greg KH
maintainerQuoted 31 lines · Jianlin Lv
From: Jianlin Lv <[email protected]>
Device drivers that use asynchronous probing can cause non-deterministic device ordering and naming across reboots. A typical example is storage drivers (like sd/nvme): asynchronous probing can lead to inconsistent disk logical names after reboot. In scenarios where disk naming consistency is critical, the probe type should be set to synchronous.
This patch introduces a
driver_probekernel parameter that overrides any driver's hard-coded probe type settings and allows runtime control without requiring kernel recompilation:driver_probe=PROBE_TYPE_SYNC,nvme,sd # Force specific drivers sync driver_probe=PROBE_TYPE_ASYNC,*,usb # Force all async except usb driver_probe=PROBE_TYPE_SYNC,* # Force all drivers synchronousThe implementation replaces the limited
driver_async_probeparameter with a more flexible interface that can force either synchronous or asynchronous probing as needed.Signed-off-by Jianlin Lv <[email protected]>--- .../admin-guide/kernel-parameters.txt | 27 +++++-- drivers/base/dd.c | 71 ++++++++++++++----- 2 files changed, 74 insertions(+), 24 deletions(-)Documentation/admin-guide/kernel-parameters.txt +0
-0
Documentation/admin-guide/kernel-parameters.txt Kernel parameters · line 1385
Quoted 9 lines
Documentation/admin-guide/kernel-parameters.txt +0
-6@@ -1377,12 +1377,27 @@ Kernel parameters it becomes active and is searched during signature verification. - driver_async_probe= [KNL] - List of driver names to be probed asynchronously. * - matches with all driver names. If * is specified, the - rest of the listed driver names are those that will NOT - match the *. - Format: <driver_name1>,<driver_name2>...
You can not remove an existing user/kernel api, sorry, that is not allowed as you just broke all systems that were relying on this :(
thanks,
greg k-h
Quoted 36 lines · Greg KH
Quoted 34 lines · Jianlin Lv
From: Jianlin Lv <[email protected]>
Device drivers that use asynchronous probing can cause non-deterministic device ordering and naming across reboots. A typical example is storage drivers (like sd/nvme): asynchronous probing can lead to inconsistent disk logical names after reboot. In scenarios where disk naming consistency is critical, the probe type should be set to synchronous.
This patch introduces a
driver_probekernel parameter that overrides any driver's hard-coded probe type settings and allows runtime control without requiring kernel recompilation:driver_probe=PROBE_TYPE_SYNC,nvme,sd # Force specific drivers sync driver_probe=PROBE_TYPE_ASYNC,*,usb # Force all async except usb driver_probe=PROBE_TYPE_SYNC,* # Force all drivers synchronousThe implementation replaces the limited
driver_async_probeparameter with a more flexible interface that can force either synchronous or asynchronous probing as needed.Signed-off-by Jianlin Lv <[email protected]>--- .../admin-guide/kernel-parameters.txt | 27 +++++-- drivers/base/dd.c | 71 ++++++++++++++----- 2 files changed, 74 insertions(+), 24 deletions(-)Documentation/admin-guide/kernel-parameters.txt +0
-0@@ -1377,12 +1377,27 @@ Kernel parameters it becomes active and is searched during signature verification.
Quoted 10 lines
Documentation/admin-guide/kernel-parameters.txt Kernel parameters · line 1385
Quoted 6 lines
Documentation/admin-guide/kernel-parameters.txt +0
-6- driver_async_probe= [KNL] - List of driver names to be probed asynchronously. * - matches with all driver names. If * is specified, the - rest of the listed driver names are those that will NOT - match the *. - Format: <driver_name1>,<driver_name2>...You can not remove an existing user/kernel api, sorry, that is not allowed as you just broke all systems that were relying on this :(
Could you provide more suggestions on how to improve this patch? If extend driver_async_probe to implement a 'force synchronous probe' feature, that doesn’t really match the name driver_async_probe and may feel ambiguous.
If add a new 'driver_probe' parameter while keeping driver_async_probe, then their functionality would partially overlap.
Regards,
Jianlin
Quoted 3 lines
thanks,
greg k-h
Greg KH
maintainerQuoted 47 lines · Jianlin Lv
Quoted 36 lines · Greg KH
Quoted 34 lines · Jianlin Lv
From: Jianlin Lv <[email protected]>
Device drivers that use asynchronous probing can cause non-deterministic device ordering and naming across reboots. A typical example is storage drivers (like sd/nvme): asynchronous probing can lead to inconsistent disk logical names after reboot. In scenarios where disk naming consistency is critical, the probe type should be set to synchronous.
This patch introduces a
driver_probekernel parameter that overrides any driver's hard-coded probe type settings and allows runtime control without requiring kernel recompilation:driver_probe=PROBE_TYPE_SYNC,nvme,sd # Force specific drivers sync driver_probe=PROBE_TYPE_ASYNC,*,usb # Force all async except usb driver_probe=PROBE_TYPE_SYNC,* # Force all drivers synchronousThe implementation replaces the limited
driver_async_probeparameter with a more flexible interface that can force either synchronous or asynchronous probing as needed.Signed-off-by Jianlin Lv <[email protected]>--- .../admin-guide/kernel-parameters.txt | 27 +++++-- drivers/base/dd.c | 71 ++++++++++++++----- 2 files changed, 74 insertions(+), 24 deletions(-)Documentation/admin-guide/kernel-parameters.txt +0
-0@@ -1377,12 +1377,27 @@ Kernel parameters it becomes active and is searched during signature verification.Quoted 10 lines
Documentation/admin-guide/kernel-parameters.txt Kernel parameters · line 1385
Quoted 6 lines
Documentation/admin-guide/kernel-parameters.txt +0
-6- driver_async_probe= [KNL] - List of driver names to be probed asynchronously. * - matches with all driver names. If * is specified, the - rest of the listed driver names are those that will NOT - match the *. - Format: <driver_name1>,<driver_name2>...You can not remove an existing user/kernel api, sorry, that is not allowed as you just broke all systems that were relying on this :(
Quoted 1 line
Could you provide more suggestions on how to improve this patch?
Not really, sorry, I don't think this is a change that should be done at all. disk naming is a long-solved issue, to think that you can fix that by doing sync/async device probing is not understanding both the issues involved, and how we solved it already :)
Hint, never count on block device, or any device, names to be the same across reboots. That has NEVER been guaranteed on systems built in the past 20+ years.
Please, just use the existing solutions, no new command line option should ever be needed here.
thanks,
greg k-h
Quoted 49 lines · Greg KH
Quoted 47 lines · Jianlin Lv
Quoted 46 lines · Greg KH
Quoted 31 lines · Jianlin Lv
From: Jianlin Lv <[email protected]>
Device drivers that use asynchronous probing can cause non-deterministic device ordering and naming across reboots. A typical example is storage drivers (like sd/nvme): asynchronous probing can lead to inconsistent disk logical names after reboot. In scenarios where disk naming consistency is critical, the probe type should be set to synchronous.
This patch introduces a
driver_probekernel parameter that overrides any driver's hard-coded probe type settings and allows runtime control without requiring kernel recompilation:driver_probe=PROBE_TYPE_SYNC,nvme,sd # Force specific drivers sync driver_probe=PROBE_TYPE_ASYNC,*,usb # Force all async except usb driver_probe=PROBE_TYPE_SYNC,* # Force all drivers synchronousThe implementation replaces the limited
driver_async_probeparameter with a more flexible interface that can force either synchronous or asynchronous probing as needed.Signed-off-by Jianlin Lv <[email protected]>--- .../admin-guide/kernel-parameters.txt | 27 +++++-- drivers/base/dd.c | 71 ++++++++++++++----- 2 files changed, 74 insertions(+), 24 deletions(-)Documentation/admin-guide/kernel-parameters.txt +0
-0Documentation/admin-guide/kernel-parameters.txt Kernel parameters · line 1385
Quoted 9 lines
Documentation/admin-guide/kernel-parameters.txt +0
-6@@ -1377,12 +1377,27 @@ Kernel parameters it becomes active and is searched during signature verification. - driver_async_probe= [KNL] - List of driver names to be probed asynchronously. * - matches with all driver names. If * is specified, the - rest of the listed driver names are those that will NOT - match the *. - Format: <driver_name1>,<driver_name2>...You can not remove an existing user/kernel api, sorry, that is not allowed as you just broke all systems that were relying on this :(
Quoted 6 lines
Quoted 1 line
Could you provide more suggestions on how to improve this patch?
Not really, sorry, I don't think this is a change that should be done at all. disk naming is a long-solved issue, to think that you can fix that by doing sync/async device probing is not understanding both the issues involved, and how we solved it already :)
Do you mean referencing disks via by-path/by-id? In our production env they can also be unstable; this is an example I encountered before:
https://lore.kernel.org/all/CAFA-uR_jk6jCmf9DTebSVBRwtoLuXuyvf1Biq+OObqRVAOZbBw@mail.gmail.com/
I understand that device naming in the kernel can change at any time. However, Is it necessary to provide an interface that allows users to choose the probe mode themselves?
Currently, driver_async_probe has lower priority than the drivers’ hard-coded probe_type settings.
Could we adjust the code as follows so that driver_async_probe has the highest priority?
static bool driver_allows_async_probing(const struct device_driver *drv) {
+ if (cmdline_requested_async_probing(drv->name))
+ return true;
+
switch (drv->probe_type) {
case PROBE_PREFER_ASYNCHRONOUS:
return true;
@@ -876,9 +879,6 @@ static bool driver_allows_async_probing(const
struct device_driver *drv)
return false;
default:
- if (cmdline_requested_async_probing(drv->name))
- return true;
-
if (module_requested_async_probing(drv->owner))Jianlin
Quoted 11 lines
Hint, never count on block device, or any device, names to be the same across reboots. That has NEVER been guaranteed on systems built in the past 20+ years.
Please, just use the existing solutions, no new command line option should ever be needed here.
thanks,
greg k-h
Greg KH
maintainerQuoted 50 lines · Jianlin Lv
Quoted 49 lines · Greg KH
Quoted 47 lines · Jianlin Lv
Quoted 46 lines · Greg KH
Quoted 31 lines · Jianlin Lv
From: Jianlin Lv <[email protected]>
Device drivers that use asynchronous probing can cause non-deterministic device ordering and naming across reboots. A typical example is storage drivers (like sd/nvme): asynchronous probing can lead to inconsistent disk logical names after reboot. In scenarios where disk naming consistency is critical, the probe type should be set to synchronous.
This patch introduces a
driver_probekernel parameter that overrides any driver's hard-coded probe type settings and allows runtime control without requiring kernel recompilation:driver_probe=PROBE_TYPE_SYNC,nvme,sd # Force specific drivers sync driver_probe=PROBE_TYPE_ASYNC,*,usb # Force all async except usb driver_probe=PROBE_TYPE_SYNC,* # Force all drivers synchronousThe implementation replaces the limited
driver_async_probeparameter with a more flexible interface that can force either synchronous or asynchronous probing as needed.Signed-off-by Jianlin Lv <[email protected]>--- .../admin-guide/kernel-parameters.txt | 27 +++++-- drivers/base/dd.c | 71 ++++++++++++++----- 2 files changed, 74 insertions(+), 24 deletions(-)Documentation/admin-guide/kernel-parameters.txt +0
-0Documentation/admin-guide/kernel-parameters.txt Kernel parameters · line 1385
Quoted 9 lines
Documentation/admin-guide/kernel-parameters.txt +0
-6@@ -1377,12 +1377,27 @@ Kernel parameters it becomes active and is searched during signature verification. - driver_async_probe= [KNL] - List of driver names to be probed asynchronously. * - matches with all driver names. If * is specified, the - rest of the listed driver names are those that will NOT - match the *. - Format: <driver_name1>,<driver_name2>...You can not remove an existing user/kernel api, sorry, that is not allowed as you just broke all systems that were relying on this :(
Quoted 8 lines
Quoted 6 lines
Quoted 1 line
Could you provide more suggestions on how to improve this patch?
Not really, sorry, I don't think this is a change that should be done at all. disk naming is a long-solved issue, to think that you can fix that by doing sync/async device probing is not understanding both the issues involved, and how we solved it already :)
Do you mean referencing disks via by-path/by-id?
No, use something that does not change, like filesystem labels or serial numbers, or something else that is guaranteed unique.
Quoted 3 lines
In our production env
they can also be unstable; this is an example I encountered before:
https://lore.kernel.org/all/CAFA-uR_jk6jCmf9DTebSVBRwtoLuXuyvf1Biq+OObqRVAOZbBw@mail.gmail.com/
Yes, paths can, and will, change. Don't use them.
Why not use a UUID, that is explicitly what those are designed for.
Quoted 3 lines
I understand that device naming in the kernel can change at any time. However, Is it necessary to provide an interface that allows users to choose the probe mode themselves?
It's not going to solve your problem, so I wouldn't worry about it. And you can't remove it, although I really would like to :)
thanks,
greg k-h
Quoted 64 lines · Greg KH
Quoted 50 lines · Jianlin Lv
Quoted 49 lines · Greg KH
Quoted 47 lines · Jianlin Lv
Quoted 46 lines · Greg KH
Quoted 31 lines · Jianlin Lv
From: Jianlin Lv <[email protected]>
Device drivers that use asynchronous probing can cause non-deterministic device ordering and naming across reboots. A typical example is storage drivers (like sd/nvme): asynchronous probing can lead to inconsistent disk logical names after reboot. In scenarios where disk naming consistency is critical, the probe type should be set to synchronous.
This patch introduces a
driver_probekernel parameter that overrides any driver's hard-coded probe type settings and allows runtime control without requiring kernel recompilation:driver_probe=PROBE_TYPE_SYNC,nvme,sd # Force specific drivers sync driver_probe=PROBE_TYPE_ASYNC,*,usb # Force all async except usb driver_probe=PROBE_TYPE_SYNC,* # Force all drivers synchronousThe implementation replaces the limited
driver_async_probeparameter with a more flexible interface that can force either synchronous or asynchronous probing as needed.Signed-off-by Jianlin Lv <[email protected]>--- .../admin-guide/kernel-parameters.txt | 27 +++++-- drivers/base/dd.c | 71 ++++++++++++++----- 2 files changed, 74 insertions(+), 24 deletions(-)Documentation/admin-guide/kernel-parameters.txt +0
-0Documentation/admin-guide/kernel-parameters.txt Kernel parameters · line 1385
Quoted 9 lines
Documentation/admin-guide/kernel-parameters.txt +0
-6@@ -1377,12 +1377,27 @@ Kernel parameters it becomes active and is searched during signature verification. - driver_async_probe= [KNL] - List of driver names to be probed asynchronously. * - matches with all driver names. If * is specified, the - rest of the listed driver names are those that will NOT - match the *. - Format: <driver_name1>,<driver_name2>...You can not remove an existing user/kernel api, sorry, that is not allowed as you just broke all systems that were relying on this :(
Quoted 8 lines
Quoted 6 lines
Quoted 1 line
Could you provide more suggestions on how to improve this patch?
Not really, sorry, I don't think this is a change that should be done at all. disk naming is a long-solved issue, to think that you can fix that by doing sync/async device probing is not understanding both the issues involved, and how we solved it already :)
Do you mean referencing disks via by-path/by-id?
No, use something that does not change, like filesystem labels or serial numbers, or something else that is guaranteed unique.
Quoted 7 lines
Quoted 3 lines
In our production env
they can also be unstable; this is an example I encountered before:
https://lore.kernel.org/all/CAFA-uR_jk6jCmf9DTebSVBRwtoLuXuyvf1Biq+OObqRVAOZbBw@mail.gmail.com/Yes, paths can, and will, change. Don't use them.
Why not use a UUID, that is explicitly what those are designed for.
For cloud deployment, the local volume provisioner detects
and creates PVs for each local disk on the host, and it cleans up the disks when they are released.
The local volume provisioner is deployed in the cluster as DaemonSet. For the same SKU, it uses a single, unified configuration file to initialize local disks. In this scenario, UUIDs are not applicable. In our case, logical names are used to identify the disk.
Quoted 7 lines
Quoted 4 lines
I understand that device naming in the kernel can change at any time. However, Is it necessary to provide an interface that allows users to choose the probe mode themselves?
It's not going to solve your problem, so I wouldn't worry about it. And you can't remove it, although I really would like to :)
OK,Is the reason we can’t change the priority of driver_async_probe setting that the original logic has changed, i.e. it would alter the original behavior?
Regards,
Jianlin
Quoted 4 lines
thanks,
greg k-h
Greg KH
maintainerQuoted 73 lines · Jianlin Lv
Quoted 64 lines · Greg KH
Quoted 50 lines · Jianlin Lv
Quoted 49 lines · Greg KH
Quoted 47 lines · Jianlin Lv
Quoted 46 lines · Greg KH
Quoted 31 lines · Jianlin Lv
From: Jianlin Lv <[email protected]>
Device drivers that use asynchronous probing can cause non-deterministic device ordering and naming across reboots. A typical example is storage drivers (like sd/nvme): asynchronous probing can lead to inconsistent disk logical names after reboot. In scenarios where disk naming consistency is critical, the probe type should be set to synchronous.
This patch introduces a
driver_probekernel parameter that overrides any driver's hard-coded probe type settings and allows runtime control without requiring kernel recompilation:driver_probe=PROBE_TYPE_SYNC,nvme,sd # Force specific drivers sync driver_probe=PROBE_TYPE_ASYNC,*,usb # Force all async except usb driver_probe=PROBE_TYPE_SYNC,* # Force all drivers synchronousThe implementation replaces the limited
driver_async_probeparameter with a more flexible interface that can force either synchronous or asynchronous probing as needed.Signed-off-by Jianlin Lv <[email protected]>--- .../admin-guide/kernel-parameters.txt | 27 +++++-- drivers/base/dd.c | 71 ++++++++++++++----- 2 files changed, 74 insertions(+), 24 deletions(-)Documentation/admin-guide/kernel-parameters.txt +0
-0Documentation/admin-guide/kernel-parameters.txt Kernel parameters · line 1385
Quoted 9 lines
Documentation/admin-guide/kernel-parameters.txt +0
-6@@ -1377,12 +1377,27 @@ Kernel parameters it becomes active and is searched during signature verification. - driver_async_probe= [KNL] - List of driver names to be probed asynchronously. * - matches with all driver names. If * is specified, the - rest of the listed driver names are those that will NOT - match the *. - Format: <driver_name1>,<driver_name2>...You can not remove an existing user/kernel api, sorry, that is not allowed as you just broke all systems that were relying on this :(
Quoted 8 lines
Quoted 6 lines
Quoted 1 line
Could you provide more suggestions on how to improve this patch?
Not really, sorry, I don't think this is a change that should be done at all. disk naming is a long-solved issue, to think that you can fix that by doing sync/async device probing is not understanding both the issues involved, and how we solved it already :)
Do you mean referencing disks via by-path/by-id?
No, use something that does not change, like filesystem labels or serial numbers, or something else that is guaranteed unique.
Quoted 7 lines
Quoted 3 lines
In our production env
they can also be unstable; this is an example I encountered before:
https://lore.kernel.org/all/CAFA-uR_jk6jCmf9DTebSVBRwtoLuXuyvf1Biq+OObqRVAOZbBw@mail.gmail.com/Yes, paths can, and will, change. Don't use them.
Why not use a UUID, that is explicitly what those are designed for.
Quoted 7 lines
For cloud deployment, the local volume provisioner detects
and creates PVs for each local disk on the host, and it cleans up the disks when they are released.
The local volume provisioner is deployed in the cluster as DaemonSet. For the same SKU, it uses a single, unified configuration file to initialize local disks. In this scenario, UUIDs are not applicable. In our case, logical names are used to identify the disk.
Ok, but again, there is NEVER a guarantee that those logical names are going to be the same across boots. Please NEVER rely on them if you wish to mount things properly. Use a label on the filesystem instead. Or something else, you have loads of possibilities here. Attempting to manipulate driver sync/async order is not going to solve your problem at all.
Quoted 9 lines
Quoted 6 lines
Quoted 3 lines
I understand that device naming in the kernel can change at any time. However, Is it necessary to provide an interface that allows users to choose the probe mode themselves?
It's not going to solve your problem, so I wouldn't worry about it. And you can't remove it, although I really would like to :)
OK,Is the reason we can’t change the priority of
driver_async_probesetting that the original logic has changed, i.e. it would alter the original behavior?
Because it is a user api that people might be relying on for various unknown reasons.
thanks,
greg k-h