Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
[systemd] Fix firmware events handling by udev. Contributes to JB#52636
Backport removed piece of udev's "firmware" builting code allowing to skip
parent device's dependencies for firmware events. This fixes initialization
of some devices where loaded kernel module expects firmware to be loaded
within a minute, but the firmware event doesn't processed because the parent
device doesn't yet initialized (because of loop dependencies).

See systemd/systemd#18259

Signed-off-by: Igor Zhbanov <i.zhbanov@omprussia.ru>
  • Loading branch information
izh1979 committed Jan 15, 2021
1 parent d355cb5 commit e5b3b6c
Show file tree
Hide file tree
Showing 2 changed files with 47 additions and 0 deletions.
46 changes: 46 additions & 0 deletions rpm/systemd-Fix-udev-firmware-events-dependencies.patch
@@ -0,0 +1,46 @@
Fix udev firmware events dependencies

The "firmware" udev builtin command was dropped from the systemd by the commit:
https://github.com/systemd/systemd/commit/be2ea723b1d023b3d385d3b791ee4607cbfb20ca

But because of that the firmware loading events can be triggered too late,
waiting for other events, e.g. module loading, to be processed first. But the
device driver can in turn wait for the firmware to be loaded. So a timeout could
happen and the device initialization will be aborted.

Therefore let's bring back the code that skips dependency on the parent devices
for firmware loading events.

See: https://github.com/systemd/systemd/issues/18259

diff -purN systemd/src/udev/udevd.c systemd-izh/src/udev/udevd.c
--- systemd/src/udev/udevd.c 2021-01-15 16:29:27.280576575 +0000
+++ systemd-izh/src/udev/udevd.c 2021-01-15 16:39:27.146112548 +0000
@@ -125,6 +125,7 @@ struct event {
dev_t devnum;
int ifindex;
bool is_block;
+ bool nodelay;
sd_event_source *timeout_warning;
sd_event_source *timeout;
};
@@ -609,6 +610,8 @@ static int event_queue_insert(Manager *m
event->devnum = udev_device_get_devnum(dev);
event->is_block = streq("block", udev_device_get_subsystem(dev));
event->ifindex = udev_device_get_ifindex(dev);
+ if (streq(udev_device_get_subsystem(dev), "firmware"))
+ event->nodelay = true;

log_debug("seq %llu queued, '%s' '%s'", udev_device_get_seqnum(dev),
udev_device_get_action(dev), udev_device_get_subsystem(dev));
@@ -692,6 +695,10 @@ static bool is_devpath_busy(Manager *man
return true;
}

+ /* allow to bypass the dependency tracking */
+ if (event->nodelay)
+ continue;
+
/* parent device event found */
if (event->devpath[common] == '/') {
event->delaying_seqnum = loop_event->seqnum;
1 change: 1 addition & 0 deletions rpm/systemd.spec
Expand Up @@ -57,6 +57,7 @@ Patch56: systemd-239-core-when-reloading-delay-any-actions-on-journal-and
Patch57: systemd-revert-PID-file-hardening-for-booster-silica-qt5.diff
Patch58: systemd-240-core-remove-support-for-API-bus-started-outside-our-.patch
Patch59: systemd-240-units-add-new-system-update-pre.target.patch
Patch60: systemd-Fix-udev-firmware-events-dependencies.patch
# This patch serves two purposes: it adds needed "#include <sys/sysmacros.h>"
# and initializes variables with automatic cleanup functions to silence
# compiler warnings.
Expand Down

0 comments on commit e5b3b6c

Please sign in to comment.