Skip to content

firmware_class: Fix problem with async requests (was: Re: [RFC] firmware loader: retry ...)

Rafael J. Wysocki lkml 1 version New

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest3 patches 0 repliesNew

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/3firmware_class: Rework usermodehelper checkdrivers/base/firmware_class.c include/linux/kmod.h kernel/kmod.c+18 -220 replies
2/3firmware_class: Split _request_firmware() into three functionsdrivers/base/firmware_class.c+40 -170 replies
3/3firmware_class: Do not warn that system is not ready for async loadsdrivers/base/firmware_class.c include/linux/kmod.h kernel/kmod.c+77 -340 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v1 yet.

Read the v1 thread

Cover letter [PATCH 0/3] firmware_class: Fix problem with async requests (was: Re: [RFC] firmware loader: retry ...)
Quoted 17 lines · Christian Lamparter
Quoted 16 lines · On Sunday 18 March 2012 01:29:38 Rafael J. Wysocki wrote:

The patch below (untested) goes slightly into that direction, although not as far as to modify fw_create_instance(). It does, however, split _request_firmware() into "prepare", "load" and "cleanup" parts and moves the usermodehelper check along with the read-locking of umhelper_sem down to the callers, ie. request_firmware() and request_firmware_work_func().

The difference between them is that request_firmware() fails immediately with a WARN_ON() if it sees usermodehelper_disabled set after acquiring umhelper_sem, while request_firmware_work_func() waits for usermodehelper_disabled to be unset, with a timeout (the wait time is subtracted from the _request_firmware() timeout). The reason why request_firmware_work_func() does it this way is that it can't wait for usermodehelper_disabled to be unset with umhelper_sem held and it has to call _request_firmware() under umhelper_sem (otherwise user space might be frozen out from under it).

Quoted 4 lines
Quoted 2 lines

I'm falling asleep now, but hopefully the patch isn't totally busted. :-) It should be split into a series of patches, though.

I'm happy to report that my test system [with the patch applied] suspended and resumed without any incidents.

Thanks for testing!

The following three patches should result in analogous code, although slightly cleaned up.

Thanks,
Rafael