public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH stop-machine] Fix rcu_momentary_eqs() call in multi_cpu_stop()
@ 2024-12-12 19:00 Paul E. McKenney
  2025-01-16 13:30 ` Thomas Gleixner
  0 siblings, 1 reply; 2+ messages in thread
From: Paul E. McKenney @ 2024-12-12 19:00 UTC (permalink / raw)
  To: quic_mojha, vschneid, neeraj.upadhyay, frederic; +Cc: linux-kernel, kernel-team

The multi_cpu_stop() contains a loop that can initially be executed with
interrupts enabled (in the MULTI_STOP_NONE and MULTI_STOP_PREPARE states).
Interrupts are guaranteed to be once the MULTI_STOP_DISABLE_IRQ state
is reached.  Unfortunately, the rcu_momentary_eqs() function that is
currently invoked on each pass through this loop requires that interrupts
be disabled.

This commit therefore moves this call to rcu_momentary_eqs() to the body
of the "else if (curstate > MULTI_STOP_PREPARE)" portion of the loop, thus
guaranteeing that interrupts will be disabled on each call, as required.

Kudos to 朱恺乾 (Kaiqian) for noting that this had not made it to mainline.

[ paulmck: Update from rcu_momentary_dyntick_idle() to rcu_momentary_eqs(). ]

Link: https://lore.kernel.org/all/1712649736-27058-1-git-send-email-quic_mojha@quicinc.com/

Signed-off-by: Mukesh Ojha <quic_mojha@quicinc.com>
Signed-off-by: Paul E. McKenney <paulmck@kernel.org>

diff --git a/kernel/stop_machine.c b/kernel/stop_machine.c
index da821ce258ea7..8896d844d738f 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_eqs();
 		}
-		rcu_momentary_eqs();
 	} while (curstate != MULTI_STOP_EXIT);
 
 	local_irq_restore(flags);

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

end of thread, other threads:[~2025-01-16 13:30 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-12-12 19:00 [PATCH stop-machine] Fix rcu_momentary_eqs() call in multi_cpu_stop() Paul E. McKenney
2025-01-16 13:30 ` Thomas Gleixner

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