[PATCH v2] stop_machine: Fix rcu_momentary_dyntick_idle() call in multi_cpu_stop()

From: Mukesh Ojha
Date: Fri May 24 2024 - 11:53:09 EST


rcu_momentary_dyntick_idle() is getting called from all the irq disable
path (mention doc section in rcu_momentary_dyntick_idle()) however, in
multi_cpu_stop() it is not called from irq disable path.

"
* Let the RCU core know that this CPU has gone through the scheduler,
* which is a quiescent state. This is called when the need for a
* quiescent state is urgent, so we burn an atomic operation and full
* memory barriers to let the RCU core know about it, regardless of what
* this CPU might (or might not) do in the near future.
*
* We inform the RCU core by emulating a zero-duration dyntick-idle period.
*
* The caller must have disabled interrupts and must not be idle.
"

Signed-off-by: Mukesh Ojha <quic_mojha@xxxxxxxxxxx>
Acked-by: Paul E. McKenney <paulmck@xxxxxxxxxx>
---
Change in v2: https://lore.kernel.org/lkml/1712649736-27058-1-git-send-email-quic_mojha@xxxxxxxxxxx/
- Removed the unnecessary stack trace posted.

kernel/stop_machine.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/kernel/stop_machine.c b/kernel/stop_machine.c
index cedb17ba158a..f93e6deb8150 100644
--- a/kernel/stop_machine.c
+++ b/kernel/stop_machine.c
@@ -250,8 +250,8 @@ static int multi_cpu_stop(void *data)
* be detected and reported on their side.
*/
touch_nmi_watchdog();
+ rcu_momentary_dyntick_idle();
}
- rcu_momentary_dyntick_idle();
} while (curstate != MULTI_STOP_EXIT);

local_irq_restore(flags);
--
2.7.4