| From: Breno Leitao <leitao@debian.org> |
| Subject: exit: skip IRQ disabled warning during power off |
| Date: Thu, 03 Apr 2025 11:01:29 -0700 |
| |
| 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. |
| |
| Link: https://lkml.kernel.org/r/20250403-exit-v1-1-8e9266bfc4b7@debian.org |
| Signed-off-by: Breno Leitao <leitao@debian.org> |
| Cc: Christian Brauner <brauner@kernel.org> |
| Cc: Joel Granados <joel.granados@kernel.org> |
| Cc: Mateusz Guzik <mjguzik@gmail.com> |
| Cc: Oleg Nesterov <oleg@redhat.com> |
| Signed-off-by: Andrew Morton <akpm@linux-foundation.org> |
| --- |
| |
| kernel/exit.c | 2 +- |
| 1 file changed, 1 insertion(+), 1 deletion(-) |
| |
| --- a/kernel/exit.c~exit-skip-irq-disabled-warning-during-power-off |
| +++ a/kernel/exit.c |
| @@ -893,7 +893,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); |
| |
| _ |