public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] exit: skip IRQ disabled warning during power off
@ 2025-04-03 18:01 Breno Leitao
  2025-04-04  5:40 ` Mateusz Guzik
  0 siblings, 1 reply; 10+ messages in thread
From: Breno Leitao @ 2025-04-03 18:01 UTC (permalink / raw)
  To: akpm, brauner
  Cc: linux-kernel, joel.granados, kernel-team, oleg, mjguzik,
	Breno Leitao

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@debian.org>
---
 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@debian.org>


^ permalink raw reply related	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2025-05-11  4:43 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-04-03 18:01 [PATCH] exit: skip IRQ disabled warning during power off Breno Leitao
2025-04-04  5:40 ` Mateusz Guzik
2025-04-04 12:51   ` Breno Leitao
2025-04-04 14:16     ` Oleg Nesterov
2025-04-04 15:14       ` Breno Leitao
2025-04-04 15:31         ` Oleg Nesterov
2025-05-11  4:43           ` Andrew Morton
2025-04-04 14:20     ` Mateusz Guzik
2025-04-04 15:08       ` Breno Leitao
2025-04-04 15:24       ` Oleg Nesterov

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox