dax: add PROBE_PREFER_ASYNCHRONOUS to the pmem driver
PATCH 1/1 dax: add PROBE_PREFER_ASYNCHRONOUS to the pmem driver
Comments in linux/device/driver.h say that the goal is to do async probing on all devices. The current behavior unnecessarily slows down the boot by synchronous probing dax_pmem devices, so let's change that.
--- drivers/dax/pmem.c | 1 + 1 file changed, 1 insertion(+)
drivers/dax/pmem.c +1 -0
@@ -77,6 +77,7 @@ static struct nd_device_driver dax_pmem_driver = { .probe = dax_pmem_probe, .drv = { .name = "dax_pmem", + .probe_type = PROBE_PREFER_ASYNCHRONOUS, }, .type = ND_DRIVER_DAX_PMEM, };
Signature · 1 line
2.51.0.618.g983fd99d29-goog
ping
Quoted 25 lines · Michal Clapinski
Comments in
linux/device/driver.hsay that the goal is to do async probing on all devices. The current behavior unnecessarily slows down the boot by synchronous probingdax_pmemdevices, so let's change that.Signed-off-by Michal Clapinski <[email protected]>--- drivers/dax/pmem.c | 1 + 1 file changed, 1 insertion(+)drivers/dax/pmem.c +1
-1@@ -77,6 +77,7 @@ static struct nd_device_driver dax_pmem_driver = { .probe = dax_pmem_probe, .drv = { .name = "dax_pmem", + .probe_type = PROBE_PREFER_ASYNCHRONOUS, }, .type = ND_DRIVER_DAX_PMEM, }; --2.51.0.618.g983fd99d29-goog
Quoted 14 lines · Michal Clapinski
Comments in
linux/device/driver.hsay that the goal is to do async probing on all devices. The current behavior unnecessarily slows down the boot by synchronous probingdax_pmemdevices, so let's change that.Signed-off-by Michal Clapinski <[email protected]>--- drivers/dax/pmem.c | 1 + 1 file changed, 1 insertion(+)drivers/dax/pmem.c +0
-0
drivers/dax/pmem.c static struct nd_device_driver dax_pmem_driver = { · line 83
Quoted 7 lines
drivers/dax/pmem.c +1
-0@@ -77,6 +77,7 @@ static struct nd_device_driver dax_pmem_driver = { .probe = dax_pmem_probe, .drv = { .name = "dax_pmem", + .probe_type = PROBE_PREFER_ASYNCHRONOUS, }, .type = ND_DRIVER_DAX_PMEM, };
Hi Michal,
Apologies for not commenting earlier. When this first flew by I paused because libnvdimm predated some of the driver core work on asynchronous and has some local asynchronous registration.
Can you say a bit more about how this patch in particular helps your case? For example, the pmem devices registered by memmap= (nd_e820 driver), should end up in the nd_async_device_register() path.
So even though the final attach is synchronous with device arrival, it should still be async with respect to other device probing.
However, I believe that falls back to synchronous probing if the driver is loaded after the device has already arrived. Is that the case you are hitting?
I am ok with this in concept, but if we do this it should be done for all dax drivers, not just dax_pmem.
Quoted 34 lines · On Wed, Oct 22, 2025 at 4:38 PM <[email protected]> wrote:
Quoted 14 lines · Michal Clapinski
Comments in
linux/device/driver.hsay that the goal is to do async probing on all devices. The current behavior unnecessarily slows down the boot by synchronous probingdax_pmemdevices, so let's change that.Signed-off-by Michal Clapinski <[email protected]>--- drivers/dax/pmem.c | 1 + 1 file changed, 1 insertion(+)drivers/dax/pmem.c +0
-0drivers/dax/pmem.c static struct nd_device_driver dax_pmem_driver = { · line 83
Quoted 7 lines
drivers/dax/pmem.c +1
-0@@ -77,6 +77,7 @@ static struct nd_device_driver dax_pmem_driver = { .probe = dax_pmem_probe, .drv = { .name = "dax_pmem", + .probe_type = PROBE_PREFER_ASYNCHRONOUS, }, .type = ND_DRIVER_DAX_PMEM, };Hi Michal,
Apologies for not commenting earlier. When this first flew by I paused because libnvdimm predated some of the driver core work on asynchronous and has some local asynchronous registration.
Can you say a bit more about how this patch in particular helps your case? For example, the pmem devices registered by memmap= (
nd_e820driver), should end up in thend_async_device_register()path.
Quoted 6 lines
So even though the final attach is synchronous with device arrival, it should still be async with respect to other device probing.
However, I believe that falls back to synchronous probing if the driver is loaded after the device has already arrived. Is that the case you are hitting?
Yes. I use all pmem/devdax modules built into the kernel so loading them is in the critical path for kernel boot.
I use memmap= with devdax. So first, the pmem device is created asynchronously, which means loading the nd_e820 module is always fast. But then, the dax_pmem driver is loaded. If the dax device has not yet been created by the async code, then loading this module is also fast. But if the dax device has already been created, then attaching it to the dax_pmem driver will be synchronous and on the critical boot path.
For thousands of dax devices, this increases the boot time by more than a second. With the patch it takes ~10ms.
Quoted 2 lines
I am ok with this in concept, but if we do this it should be done for all dax drivers, not just
dax_pmem.
Will do in v2.
Michał Cłapiński wrote:
[..]
Quoted 13 lines
Quoted 3 lines
However, I believe that falls back to synchronous probing if the driver is loaded after the device has already arrived. Is that the case you are hitting?
Yes. I use all pmem/devdax modules built into the kernel so loading them is in the critical path for kernel boot.
I use memmap= with devdax. So first, the pmem device is created asynchronously, which means loading thend_e820module is always fast. But then, thedax_pmemdriver is loaded. If the dax device has not yet been created by the async code, then loading this module is also fast. But if the dax device has already been created, then attaching it to thedax_pmemdriver will be synchronous and on the critical boot path.
Quoted 7 lines
For thousands of dax devices, this increases the boot time by more than a second. With the patch it takes ~10ms.
Quoted 2 lines
I am ok with this in concept, but if we do this it should be done for all dax drivers, not just
dax_pmem.Will do in v2.
Sounds good, include that detail above and I'll ack / poke Ira to pick it up.
Quoted 18 lines · dan.j.williams@ wrote:
Michał Cłapiński wrote:
[..]Quoted 16 lines
Quoted 3 lines
However, I believe that falls back to synchronous probing if the driver is loaded after the device has already arrived. Is that the case you are hitting?
Yes. I use all pmem/devdax modules built into the kernel so loading them is in the critical path for kernel boot.
I use memmap= with devdax. So first, the pmem device is created asynchronously, which means loading thend_e820module is always fast. But then, thedax_pmemdriver is loaded. If the dax device has not yet been created by the async code, then loading this module is also fast. But if the dax device has already been created, then attaching it to thedax_pmemdriver will be synchronous and on the critical boot path.For thousands of dax devices, this increases the boot time by more than a second. With the patch it takes ~10ms.
Quoted 7 lines
Quoted 4 lines
Quoted 2 lines
I am ok with this in concept, but if we do this it should be done for all dax drivers, not just
dax_pmem.Will do in v2.
Sounds good, include that detail above and I'll ack / poke Ira to pick it up.
Yea if you send to me I'll pick it up. Sorry I did not see this before.
Ira