Re: loading firmware while usermodehelper disabled.

Ingo Molnar
2012-01-03T08:28:57Z

* Alan Cox <alan@lxorguk.ukuu.org.uk> wrote:

> > You mensioned earlier about not being able to tell the
> > difference between a device that needs firmware and one that
> > needs flash (e.g. they use exactly the same ids). It doesn't
> > really matter - we just assume that it might need firmware
> > and load it anyway. It uses more memory but is robust.
>
> We only need to do that for the devices where order and not
> blocking matters. There are a few (and some are video) where
> the firmware sizes is megabytes, which on an embedded
> controlling device is not acceptable. I don't believe any of
> them are things where simply delaying the restoration will
> cause problems however - its video, and DVB and the like not
> wireless or serial.

Here's the size histogram/analysis of all *.fw, *.bin, *.dat,
*.ucode, etc. files in /lib/firmware on a fully populated
distro:

476 firmware blobs total

The toplist:

-rw-r--r--. 1 root root 2786404 Jul 24 2010 ./bcm70012fw.bin
-rw-r--r--. 1 root root 1781048 Feb 9 2011 ./phanfw.bin
-rw-r--r--. 1 root root 864276 Jul 24 2010 ./bcm70015fw.bin
-rw-r--r--. 1 root root 844980 Feb 8 2011 ./asihpi/dsp6200.bin
-rw-r--r--. 1 root root 636980 Feb 8 2011 ./asihpi/dsp6600.bin
-rw-r--r--. 1 root root 627696 Feb 8 2011 ./asihpi/dsp6400.bin
-rw-r--r--. 1 root root 563592 Aug 4 22:04 ./myri10ge_rss_ethp_z8e.dat
-rw-r--r--. 1 root root 553192 Aug 4 22:04 ./myri10ge_rss_eth_z8e.dat
-rw-r--r--. 1 root root 504916 Feb 8 2011 ./asihpi/dsp8900.bin
-rw-r--r--. 1 root root 498128 Sep 7 20:14 ./ct2fw.bin

- 2% of them, i.e. just a tiny fraction is over 512 KB.
- 80% of the firmware blobs are below 100K.
- 50% of them are below 16K.

So loading them into RAM is the obviously right solution.

Those few devices that absolutely want to load the firmware blob
dynamically on some weird low-RAM system can do so *BEFORE*
suspending.

There is nothing that prevents a low-RAM system from loading the
firmware blob in an early suspend callback and making sure it's
there at resume time - and then unloading it from RAM after
resume.

I.e. large blobs can manage their RAM usage just fine - but the
obscenity of the 1% should not control the design and sanity of
the 99% case ...

> [...]
>
> The world is heading this way more and more. It's moving from
> the old PC model of 'user closes lid, clunk for 15 seconds,
> enter suspend, user opens lid, churn churn, video, churn
> clunk. resume' to suspend/resume being so fast it happens
> between keystrokes.

Exactly!

Thanks,

Ingo