| 1 |
From 60466c067927abbcaff299845abd4b7069963139 Mon Sep 17 00:00:00 2001 |
| 2 |
Message-ID: <60466c067927abbcaff299845abd4b7069963139.1748973068.git.osandov@osandov.com> |
| 3 |
From: Benjamin Bara <[email protected]> |
| 4 |
Date: Sat, 15 Jul 2023 09:53:23 +0200 |
| 5 |
Subject: [PATCH] kernel/reboot: emergency_restart: Set correct system_state |
| 6 |
|
| 7 |
As the emergency restart does not call kernel_restart_prepare(), the |
| 8 |
system_state stays in SYSTEM_RUNNING. |
| 9 |
|
| 10 |
Since bae1d3a05a8b, this hinders i2c_in_atomic_xfer_mode() from becoming |
| 11 |
active, and therefore might lead to avoidable warnings in the restart |
| 12 |
handlers, e.g.: |
| 13 |
|
| 14 |
[ 12.667612] WARNING: CPU: 1 PID: 1 at kernel/rcu/tree_plugin.h:318 rcu_note_context_switch+0x33c/0x6b0 |
| 15 |
[ 12.676926] Voluntary context switch within RCU read-side critical section! |
| 16 |
... |
| 17 |
[ 12.742376] schedule_timeout from wait_for_completion_timeout+0x90/0x114 |
| 18 |
[ 12.749179] wait_for_completion_timeout from tegra_i2c_wait_completion+0x40/0x70 |
| 19 |
... |
| 20 |
[ 12.994527] atomic_notifier_call_chain from machine_restart+0x34/0x58 |
| 21 |
[ 13.001050] machine_restart from panic+0x2a8/0x32c |
| 22 |
|
| 23 |
Avoid these by setting the correct system_state. |
| 24 |
|
| 25 |
Fixes: bae1d3a05a8b ("i2c: core: remove use of in_atomic()") |
| 26 |
Cc: [email protected] # v5.2+ |
| 27 |
Reviewed-by: Dmitry Osipenko <[email protected]> |
| 28 |
Tested-by: Nishanth Menon <[email protected]> |
| 29 |
Signed-off-by: Benjamin Bara <[email protected]> |
| 30 |
Link: https://lore.kernel.org/r/[email protected] |
| 31 |
Signed-off-by: Lee Jones <[email protected]> |
| 32 |
--- |
| 33 |
kernel/reboot.c | 1 + |
| 34 |
1 file changed, 1 insertion(+) |
| 35 |
|
| 36 |
diff --git a/kernel/reboot.c b/kernel/reboot.c |
| 37 |
index 3bba88c7ffc6..6ebef11c8876 100644 |
| 38 |
--- a/kernel/reboot.c |
| 39 |
+++ b/kernel/reboot.c |
| 40 |
@@ -74,6 +74,7 @@ void __weak (*pm_power_off)(void); |
| 41 |
void emergency_restart(void) |
| 42 |
{ |
| 43 |
kmsg_dump(KMSG_DUMP_EMERG); |
| 44 |
+ system_state = SYSTEM_RESTART; |
| 45 |
machine_emergency_restart(); |
| 46 |
} |
| 47 |
EXPORT_SYMBOL_GPL(emergency_restart); |
| 48 |
-- |
| 49 |
2.49.0 |
| 50 |
|