On Tue, Sep 20, 2022 at 02:23:23PM -0500, Jonathon Jongsma wrote:
Rather than listening to 'add' udev events, listen for
'bind' events
instead. When we get an 'add' event, the sysfs tree for the device is
often not ready yet. In that case we sleep in a loop until the sysfs
tree appears, or give up after a timeout.
udev added the 'bind' event to give userspace a signal that indicated
when driver-specific attributes were available to be used. In other
words, the sysfs tree *should* be ready and usable at this point.
But just to be safe, we'll leave the wait loop in the code to handle
corner cases, with the hope that it'll never be used.
The udev 'bind' event was added in kernel 4.14 and the oldest platform
we support has kernel 4.18, so it should be safe to make this change.
Previous discussion on the mailing list:
https://listman.redhat.com/archives/libvir-list/2022-August/233933.html
Signed-off-by: Jonathon Jongsma <jjongsma(a)redhat.com>
---
Unfortunately I don't have an mdev-configured machine at hand anymore to try
this out, but based on the trivial change and assuming you've at least tried
the patch, you can have my:
Reviewed-by: Erik Skultety <eskultet(a)redhat.com>