Reducing firmware loading timeout

Alexandre Oliva lxoliva at fsfla.org
Sun Dec 7 22:03:17 UTC 2014


Hi, Cristophe,

On Jan  9, 2013, christophe.jarry at ouvaton.org wrote:

> Because linux-libre intends to remove every binary blob from the
> vanilla version of the kernel linux, it is senseless to have to wait
> for the firmware to load.

We remove every binary blob, but not every piece of firmware, and it
makes sense to wait longer for the Free firmware that might really be
there but take long to load.

I have arranged for the deblob script for the upcoming 3.18 release to
time out after 1 second when issuing to userland an unsatisfiable
attempt to load a blob, but to still use the default timeout for Free
firmware.

Sorry it took me so incredibly long to get to this.  I kept hoping the
blobhush implementation would be ready and make this obsolete, but this
time I figured I wouldn't be able to complete the blobhush
implementation, but I had enough time to fix this, so, there you go ;-)

I'll give it a round of testing and then check the scripts in.  I'm not
sure if/when I'll backport this to earlier releases though.

Here's the patch I'm testing to fix this problem, in case you're
interested:

Index: deblob-3.18
===================================================================
--- deblob-3.18	(revision 11729)
+++ deblob-3.18	(working copy)
@@ -370,6 +370,12 @@
 #define NONFREE_FIRMWARE "/*(DEBLOBBED)*/"\
 \
 static inline int\
+is_nonfree_firmware(const char *name)\
+{\
+  return strstr(name, NONFREE_FIRMWARE) != 0;\
+}\
+\
+static inline int\
 report_missing_free_firmware(const char *name, const char *what)\
 {\
 	printk(KERN_ERR "%s: Missing Free %s\\n", name,\
@@ -392,7 +398,7 @@
 maybe_reject_firmware(const struct firmware **fw,\
 		      const char *name, struct device *device)\
 {\
-	if (strstr (name, NONFREE_FIRMWARE))\
+	if (is_nonfree_firmware(name))\
 		return reject_firmware(fw, name, device);\
 	else\
 		return request_firmware(fw, name, device);\
@@ -437,7 +443,7 @@
 			     void (*cont)(const struct firmware *fw,\
 					  void *context))\
 {\
-	if (strstr (name, NONFREE_FIRMWARE))\
+	if (is_nonfree_firmware(name))\
 		return reject_firmware_nowait(module, uevent, name,\
 					      device, gfp, context, cont);\
 	else\
@@ -466,6 +472,11 @@
 #endif /* _LINUX_LIBRE_IHEX_H */\
 ' include/linux/ihex.h 'added non-Free ihex firmware notification support'
 
+clean_sed '
+s,\(timeout = \)\(firmware_loading_timeout()\),\1is_nonfree_firmware(name) ? 1 : \2,
+' drivers/base/firmware_class.c 'shorten non-Free firmware fail-to-load timeout'
+
+
 ########
 # Arch #
 ########


-- 
Alexandre Oliva, freedom fighter    http://FSFLA.org/~lxoliva/
You must be the change you wish to see in the world. -- Gandhi
Be Free! -- http://FSFLA.org/   FSF Latin America board member
Free Software Evangelist|Red Hat Brasil GNU Toolchain Engineer


More information about the linux-libre mailing list