[PATCH] exit: skip IRQ disabled warning during power off
From: Breno Leitao
Date: Thu Apr 03 2025 - 14:01:56 EST
When the system is shutting down due to pid 1 exiting, which is common
on virtual machines, a warning message is printed.
WARNING: CPU: 0 PID: 1 at kernel/exit.c:897 do_exit+0x7e3/0xab0
This occurs because do_exit() is called after kernel_power_off(), which
disables interrupts. native_machine_shutdown() expliclty disable
interrupt to avoid receiving the timer interrupt, forcing scheduler load
balance during the power off phase.
This is the simplified code path:
kernel_power_off()
- native_machine_shutdown()
- local_irq_disable()
do_exit()
Modify the warning condition in do_exit() to only trigger the warning if
the system is not powering off, since it is expected to have the irq
disabled in that case.
Signed-off-by: Breno Leitao <leitao@xxxxxxxxxx>
---
kernel/exit.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/kernel/exit.c b/kernel/exit.c
index 3485e5fc499e4..97ec4f8bfd98f 100644
--- a/kernel/exit.c
+++ b/kernel/exit.c
@@ -878,7 +878,7 @@ void __noreturn do_exit(long code)
struct task_struct *tsk = current;
int group_dead;
- WARN_ON(irqs_disabled());
+ WARN_ON(irqs_disabled() && system_state != SYSTEM_POWER_OFF);
synchronize_group_exit(tsk, code);
---
base-commit: bfc17c1658353f22843c7c13e27c2d31950f1887
change-id: 20250403-exit-bf815877a1cd
Best regards,
--
Breno Leitao <leitao@xxxxxxxxxx>