[RFC PATCH 2/3] init: Require archs call start_kernel with arch irqs disabled

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Let's require start_kernel() is called with arch_irqs_disabled. For now,
just correct that condition and print a warning if CONFIG_DEBUG_IRQFLAGS
is set.

This prevents core code from disabling irqs when they are already
disabled, in aid of eventually adding a debug check to catch that
condition.

Signed-off-by: Nicholas Piggin <npiggin@xxxxxxxxx>
---
 init/main.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/init/main.c b/init/main.c
index af50044deed5..f3979628943e 100644
--- a/init/main.c
+++ b/init/main.c
@@ -889,7 +889,11 @@ asmlinkage __visible void __init __no_sanitize_address __noreturn start_kernel(v
 
 	cgroup_init_early();
 
-	local_irq_disable();
+	if (!raw_irqs_disabled()) {
+		raw_local_irq_disable();
+		if (IS_ENABLED(CONFIG_DEBUG_IRQFLAGS))
+			WARN_ONCE(1, "arch should call start_kernel with arch_irqs_disabled\n");
+	}
 	early_boot_irqs_disabled = true;
 
 	/*
-- 
2.40.1




[Index of Archives]     [Linux Kernel]     [Kernel Newbies]     [x86 Platform Driver]     [Netdev]     [Linux Wireless]     [Netfilter]     [Bugtraq]     [Linux Filesystems]     [Yosemite Discussion]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Device Mapper]

  Powered by Linux