Re: [PATCH 1/2] media: si2168: request caching of firmware to make it available on resume

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 09/04/2021 13:29, Mauro Carvalho Chehab wrote:
Well, I fail to see why si2168 is so special that it would require it...

The special case here is that si2168 does (try to) load the firmware for the first time during resume. Most other drivers that use firmware do it for the first time at boot (or when connecting the device) and therefore will automatically have their firmware cached for use on resume.

on a quick check, it sounds that there's just a single driver using this
kAPI:

	drivers/net/wireless/mediatek/mt7601u/mcu.c:            return firmware_request_cache(dev->dev, MT7601U_FIRMWARE);

while there are several drivers on media that require firmware.

Any other driver that might load the firmware for the first time during resume also has to be fixed. On a quick glance it looks like the si2165 for example might have the same problem. I think that at least all dvb frontends which load the firmware in init callback but not during probe are problematic.

The possible patch with the usermode helper lock by Luis causes uncached firmware loading on resume to fail very noisily instead of just stalling the system. That would show up other non-conformant drivers. There likely would be some more bug reports coming in from users which dislike the backtraces coming up in dmesg. You will likely want to fix the drivers before that happens. The fact that this bug is only exposed now that btrfs is seeing more wide spread adoption does not make it less of a bug.

Btw, IMHO, the better would be to reload the firmware at resume
time, instead of caching it, just like other media drivers.

Loading the firmware on resume without it being cached is exactly what causes problems (see Luis' explanation). The caching is set up implicitly if the normal request_firmware() is used before suspend. The firmware does not stay in cache permanently. The firmware is just cached by the firmware loader api during suspend and cleaned again at the end of resume when proper file system access is possible again.

A really better solution would be to not load the firmware on resume in case it has not been previously loaded to the device (or not load it at all on resume since playback has to be restarted after suspend anyway). But it seems like the same init callback of the si2168 driver is called both at resume and when the device is being used and therefore does not easily allow for this. Likely the dvb_frontend api would have to be extended to have a separate callback for resume.



[Index of Archives]     [Linux Input]     [Video for Linux]     [Gstreamer Embedded]     [Mplayer Users]     [Linux USB Devel]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]

  Powered by Linux