kmodloader: load_modprobe: abort after 2 attempts
authorStijn Tintel <stijn@linux-ipv6.be>
Tue, 18 Dec 2018 19:24:28 +0000 (21:24 +0200)
committerStijn Tintel <stijn@linux-ipv6.be>
Tue, 18 Dec 2018 20:04:23 +0000 (22:04 +0200)
The loop in load_modprobe causes dmesg to be flooded with errors when a
module fails to load; e.g.:
- gpio-nct5104d: Unsupported device 0xffff (246 times on x86 in Qemu)
- jitterentropy: Initialization failed with host not compliant with
  requirements: 2 (229 times on brcm2708/bcm2708)

On brcm2708/bcm2708 this also causes vmalloc allocation failures with
kernel 4.14 when running headless. If kmod-drm-vc4 and
kmod-video-bcm2835 are included in the image, they will be loaded before
brcmfmac, and brcmfmac will fail to load:

kmodloader: vmalloc: allocation failure: 249856 bytes,
mode:0x14000c0(GFP_KERNEL), nodemask=(null)

Break the loop after 2 failed attempts to fix these issues.

Signed-off-by: Jo-Philipp Wich <jo@mein.io>
Signed-off-by: Stijn Tintel <stijn@linux-ipv6.be>
kmodloader.c

index 1b6488f0ff4b8f28f4039346660d01afac58c12d..3196deb94e17c6fab7e8810b51f9b0be8469f5c8 100644 (file)
@@ -637,14 +637,16 @@ static int load_modprobe(void)
                        if (mn->is_alias)
                                continue;
                        m = mn->m;
-                       if ((m->state == PROBE) && (!deps_available(m, 0))) {
+                       if ((m->state == PROBE) && (!deps_available(m, 0)) && m->error < 2) {
                                if (!insert_module(get_module_path(m->name), (m->opts) ? (m->opts) : (""))) {
                                        m->state = LOADED;
                                        m->error = 0;
                                        loaded++;
                                        continue;
                                }
-                               m->error = 1;
+
+                               if (++m->error > 1)
+                                       ULOG_ERR("failed to load %s\n", m->name);
                        }
 
                        if ((m->state == PROBE) || m->error)