Skip to contentSkip to conversation

linux-next: build failure after merge of the random tree

PATCH Stephen Rothwell 2 participants 2 messages Mar 3, 2022

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

Hi all,

After merging the random tree, today's linux-next build (arm64 defconfig) failed like this:

In file included from include/linux/srcu.h:49,

                 from include/linux/notifier.h:16,
                 from include/linux/random.h:10,
                 from arch/arm64/include/asm/pointer_auth.h:7,
                 from arch/arm64/include/asm/processor.h:43,
                 from include/linux/mutex.h:19,
                 from include/linux/kernfs.h:11,
                 from include/linux/sysfs.h:16,
                 from include/linux/kobject.h:20,
                 from include/linux/of.h:17,
                 from include/linux/irqdomain.h:35,
                 from include/linux/acpi.h:13,
                 from include/acpi/apei.h:9,
                 from include/acpi/ghes.h:5,
                 from include/linux/arm_sdei.h:8,
                 from arch/arm64/kernel/asm-offsets.c:10:
include/linux/srcutree.h:67:22: error: field 'srcu_cb_mutex' has incomplete type
   67 |         struct mutex srcu_cb_mutex;             /* Serialize CB preparation. */
      |                      ^~~~~~~~~~~~~
include/linux/srcutree.h:69:22: error: field 'srcu_gp_mutex' has incomplete type
   69 |         struct mutex srcu_gp_mutex;             /* Serialize GP work. */
      |                      ^~~~~~~~~~~~~
include/linux/srcutree.h:80:22: error: field 'srcu_barrier_mutex' has incomplete type
   80 |         struct mutex srcu_barrier_mutex;        /* Serialize barrier ops. */
      |                      ^~~~~~~~~~~~~~~~~~
In file included from include/linux/random.h:10,
                 from arch/arm64/include/asm/pointer_auth.h:7,
                 from arch/arm64/include/asm/processor.h:43,
                 from include/linux/mutex.h:19,
                 from include/linux/kernfs.h:11,
                 from include/linux/sysfs.h:16,
                 from include/linux/kobject.h:20,
                 from include/linux/of.h:17,
                 from include/linux/irqdomain.h:35,
                 from include/linux/acpi.h:13,
                 from include/acpi/apei.h:9,
                 from include/acpi/ghes.h:5,
                 from include/linux/arm_sdei.h:8,
                 from arch/arm64/kernel/asm-offsets.c:10:

include/linux/notifier.h:75:22: error: field 'mutex' has incomplete type
75 | struct mutex mutex;
| ^~~~~

Caused by commit

c3b03baac3f2 ("random: replace custom notifier chain with standard one")

Which added the include of linux/notifier.h to linux/random.h :-(

I have added this patch for today:

From: Stephen Rothwell <[email protected]>
Date: Thu, 3 Mar 2022 18:43:56 +1100
Subject: [PATCH] fix up for "random: replace custom notifier chain with standard one"

Only the forward declaration of struct notifier_block is needed. This prevents a circular include dependency on arm64 (at least).

---
 include/linux/random.h | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
include/linux/random.h +2 -1
index 7fccbc7e5a75..c0baffe7afb1 100644
@@ -7,10 +7,11 @@
 #include <linux/kernel.h>
 #include <linux/list.h>
 #include <linux/once.h>
-#include <linux/notifier.h>
 
 #include <uapi/linux/random.h>
 
+struct notifier_block;
+
 extern void add_device_randomness(const void *, size_t);
 extern void add_bootloader_randomness(const void *, size_t);
 
Signature · 5 lines
2.34.1

-- 
Cheers,
Stephen Rothwell
#1 lore raw

Hi Stephen,

Thanks for the report. My CI barked at me about this too this morning. Seems like a surprising circularity in arm64's headers that maybe should be fixed. But either way, I'll go with your forward declaration approach.

Regards,
Jason