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

From: Stephen Rothwell
Date: Thu Mar 03 2022 - 03:04:57 EST


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 <sfr@xxxxxxxxxxxxxxxx>
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).

Signed-off-by: Stephen Rothwell <sfr@xxxxxxxxxxxxxxxx>
---
include/linux/random.h | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/include/linux/random.h b/include/linux/random.h
index 7fccbc7e5a75..c0baffe7afb1 100644
--- a/include/linux/random.h
+++ b/include/linux/random.h
@@ -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);

--
2.34.1

--
Cheers,
Stephen Rothwell

Attachment: pgpWrDDUGmisc.pgp
Description: OpenPGP digital signature