Skip to contentSkip to conversation

mei: vsc: Probe synchronously to not stall all module loading

PATCH In review Paul Menzel 2 participants 2 messages Nov 25 – Dec 3

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 mei: vsc: Probe synchronously to not stall all module loading

On a Dell XPS 9315 (Alder Lake, IVSC behind an LJCA USB-to-SPI bridge, Debian’s 7.3.5 kernel), mei_vsc_probe() takes about 11 seconds, because mei_start() boots the IVSC and downloads its firmware (about 1.7 MB) over SPI in 60 byte chunks:

    [    5.144743] intel_vsc intel_vsc: silicon stepping version is 0:2
    …
    [   16.541339] intel-ipu6 0000:00:05.0: Found supported sensor OVTI01A0:00

The driver asks for asynchronous probing, so the probe runs from async_schedule(). But do_init_module() calls async_synchronize_full() for every module not loaded with the async_probe parameter, so during these 11 seconds every other module load blocks, too. Writing w to /proc/sysrq-trigger two seconds after systemd started shows the probe, and 14 udev workers, a mount and a modprobe waiting for it:

    task:kworker/u48:5   state:D stack:0     pid:93    tgid:93    ppid:2
     wait_for_completion_timeout+0x97/0x180
     ljca_send+0x1ac/0x1f0 [usb_ljca]
     ljca_transfer+0x36/0x40 [usb_ljca]
     ljca_spi_transfer_one+0x179/0x304 [spi_ljca]
     …
     vsc_tp_rom_xfer+0x160/0x170 [mei_vsc_hw]
     mei_reset+0xc2/0x4a0 [mei]
     mei_start+0x75/0x180 [mei]
     mei_vsc_probe+0x11d/0x180 [mei_vsc]
     …
     __driver_attach_async_helper+0x60/0xf0
     async_run_entry_fn+0x34/0x150
    task:(udev-worker)   state:D stack:0     pid:445   tgid:445   ppid:420
     async_synchronize_cookie_domain+0x114/0x160
     do_init_module+0x1c2/0x290
     init_module_from_file+0xc8/0x180
     idempotent_init_module+0x23e/0x360

So the vfat module for /boot/efi, dell-wmi, btusb, the sound drivers and the other coldplug modules wait for the IVSC, and boot-efi.mount takes 12.5 seconds.

The modprobe of mei_vsc itself waits for the probe anyway, for the same reason, so asynchronous probing gains nothing for the module, but costs every module loaded in parallel. Drop PROBE_PREFER_ASYNCHRONOUS, so that only the context binding the device waits for the firmware download.

Debian’s config builds the IVSC drivers as modules. The probe then runs from the modprobe of mei_vsc, or, if mei_vsc is loaded first, from the modprobe of the driver registering the SPI controller (spi-ljca). With everything built in, the probe now runs in the context registering the LJCA device instead of an async worker.

On the Dell XPS 9315, from the start of the kernel:

async probe sync probe
7.3.5, only mei-vsc.ko rebuilt (one boot each):
/boot/efi mounted 17.52 s 5.76 s
graphical.target 21.89 s 11.37 s
7.4.0-rc3, same config (two boots each):
/boot/efi mounted 16.84/16.51 s 5.39/5.24 s
graphical.target 21.16/20.75 s 10.85/11.30 s

With spi-ljca loaded last by hand, its modprobe takes 9 s, while loading other modules in parallel takes as long as usual (dummy 0.02 s, xfs 0.45 s). In all cases the IPU6 finds both sensors, and the ov01a10 driver binds to them.

The firmware download itself is not faster, so the 10 second deferred probe timeout can still expire for the IPU6, which waits for the IVSC:

pci 0000:00:05.0: deferred probe pending: intel-ipu6: IPU6 bridge init failed

An alternative would be to keep the probe short and run mei_start() from a work item, so that also a built-in configuration does not block the context that registers the device. Go for the one-line change, as the asynchronous probe already blocks the modprobe of mei_vsc.

Fixes 386a766c4169 ("mei: Add MEI hardware support for IVSC device")

---

Notes:
The analysis (sysrq-w dump, timings), the patch and this commit message were drafted with claude-opus-5-5 (Claude Code), asked to fix the errors and warnings in the boot log of this laptop, see Documentation/process/generated-content.rst. The tests are in the commit message; the IVSC was only tested with Debian’s modular configuration, not built in.

 drivers/misc/mei/platform-vsc.c | 1 -
 1 file changed, 1 deletion(-)
drivers/misc/mei/platform-vsc.c +0 -1
index ef6dcc0438620..030291e7cd744 100644
@@ -447,7 +447,6 @@ static struct platform_driver mei_vsc_drv = {
 	.driver = {
 		.name = MEI_VSC_DRV_NAME,
 		.pm = &mei_vsc_pm_ops,
-		.probe_type = PROBE_PREFER_ASYNCHRONOUS,
 	},
 };
 module_platform_driver(mei_vsc_drv);
Signature · 1 line
2.54.0
maintainer Acked-by on v1 1/1
#1 lore raw
Quoted 73 lines

Subject: [PATCH] mei: vsc: Probe synchronously to not stall all module loading

On a Dell XPS 9315 (Alder Lake, IVSC behind an LJCA USB-to-SPI bridge, Debian’s 7.3.5 kernel), mei_vsc_probe() takes about 11 seconds, because mei_start() boots the IVSC and downloads its firmware (about 1.7 MB) over SPI in 60 byte chunks:

    [    5.144743] intel_vsc intel_vsc: silicon stepping version is 0:2
    …
    [   16.541339] intel-ipu6 0000:00:05.0: Found supported sensor

OVTI01A0:00

The driver asks for asynchronous probing, so the probe runs from async_schedule(). But do_init_module() calls async_synchronize_full() for every module not loaded with the async_probe parameter, so during these 11 seconds every other module load blocks, too. Writing w to /proc/sysrq-trigger two seconds after systemd started shows the probe, and 14 udev workers, a mount and a modprobe waiting for it:

    task:kworker/u48:5   state:D stack:0     pid:93    tgid:93    ppid:2
     wait_for_completion_timeout+0x97/0x180
     ljca_send+0x1ac/0x1f0 [usb_ljca]
     ljca_transfer+0x36/0x40 [usb_ljca]
     ljca_spi_transfer_one+0x179/0x304 [spi_ljca]
     …
     vsc_tp_rom_xfer+0x160/0x170 [mei_vsc_hw]
     mei_reset+0xc2/0x4a0 [mei]
     mei_start+0x75/0x180 [mei]
     mei_vsc_probe+0x11d/0x180 [mei_vsc]
     …
     __driver_attach_async_helper+0x60/0xf0
     async_run_entry_fn+0x34/0x150
    task:(udev-worker)   state:D stack:0     pid:445   tgid:445   ppid:420
     async_synchronize_cookie_domain+0x114/0x160
     do_init_module+0x1c2/0x290
     init_module_from_file+0xc8/0x180
     idempotent_init_module+0x23e/0x360

So the vfat module for /boot/efi, dell-wmi, btusb, the sound drivers and the other coldplug modules wait for the IVSC, and boot-efi.mount takes 12.5 seconds.

The modprobe of mei_vsc itself waits for the probe anyway, for the same reason, so asynchronous probing gains nothing for the module, but costs every module loaded in parallel. Drop PROBE_PREFER_ASYNCHRONOUS, so that only the context binding the device waits for the firmware download.

Debian’s config builds the IVSC drivers as modules. The probe then runs from the modprobe of mei_vsc, or, if mei_vsc is loaded first, from the modprobe of the driver registering the SPI controller (spi-ljca). With everything built in, the probe now runs in the context registering the LJCA device instead of an async worker.

On the Dell XPS 9315, from the start of the kernel:

async probe sync probe
7.3.5, only mei-vsc.ko rebuilt (one boot each):
/boot/efi mounted 17.52 s 5.76 s
graphical.target 21.89 s 11.37 s
7.4.0-rc3, same config (two boots each):
/boot/efi mounted 16.84/16.51 s 5.39/5.24 s
graphical.target 21.16/20.75 s 10.85/11.30 s

With spi-ljca loaded last by hand, its modprobe takes 9 s, while loading other modules in parallel takes as long as usual (dummy 0.02 s, xfs 0.45 s). In all cases the IPU6 finds both sensors, and the ov01a10 driver binds to them.

The firmware download itself is not faster, so the 10 second deferred probe timeout can still expire for the IPU6, which waits for the IVSC:

Quoted 7 lines

pci 0000:00:05.0: deferred probe pending: intel-ipu6: IPU6 bridge init failed

An alternative would be to keep the probe short and run mei_start() from a work item, so that also a built-in configuration does not block the context that registers the device. Go for the one-line change, as the asynchronous probe already blocks the modprobe of mei_vsc.

Quoted 29 lines
Fixes 386a766c4169 ("mei: Add MEI hardware support for IVSC device")

---

Notes:
The analysis (sysrq-w dump, timings), the patch and this commit message were drafted with claude-opus-5-5 (Claude Code), asked to fix the errors and warnings in the boot log of this laptop, see Documentation/process/generated-content.rst. The tests are in the commit message; the IVSC was only tested with Debian’s modular configuration, not built in.

 drivers/misc/mei/platform-vsc.c | 1 -
 1 file changed, 1 deletion(-)
drivers/misc/mei/platform-vsc.c +0 -2
index ef6dcc0438620..030291e7cd744 100644
@@ -447,7 +447,6 @@ static struct platform_driver mei_vsc_drv = {
 	.driver = {
 		.name = MEI_VSC_DRV_NAME,
 		.pm = &mei_vsc_pm_ops,
-		.probe_type = PROBE_PREFER_ASYNCHRONOUS,
 	},
 };
 module_platform_driver(mei_vsc_drv);
--

2.54.0