All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] smp: Do not warn if smp_call_function_single() is doing a self call.
@ 2019-04-12 23:53 Dexuan Cui
  2019-04-14  6:58 ` Vitaly Kuznetsov
  2019-04-15 12:21 ` Peter Zijlstra
  0 siblings, 2 replies; 8+ messages in thread
From: Dexuan Cui @ 2019-04-12 23:53 UTC (permalink / raw)
  To: tglx, riel, peterz, jpoimboe, luto, Stephen Hemminger,
	Sasha Levin, Haiyang Zhang, KY Srinivasan, linux-kernel,
	Michael Kelley
  Cc: marcelo.cerri, apw, olaf, vkuznets, jasowang, Dexuan Cui

If smp_call_function_single() is calling the function for itself, it's safe
to run with irqs_disabled() == true.

I hit the warning because I'm in the below path in the .suspend callback of
a "syscore_ops" to support hibernation for a VM running on Hyper-V:

  hv_synic_cleanup() ->
    clockevents_unbind_device() ->
      clockevents_unbind() ->
        smp_call_function_single().

When the .suspend callback runs, only CPU0 is online and irqs_disabled() is
true.

Signed-off-by: Dexuan Cui <decui@microsoft.com>
---
 kernel/smp.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/kernel/smp.c b/kernel/smp.c
index f4cf1b0bb3b8..4fdf6a378def 100644
--- a/kernel/smp.c
+++ b/kernel/smp.c
@@ -288,7 +288,7 @@ int smp_call_function_single(int cpu, smp_call_func_t func, void *info,
 	 * can't happen.
 	 */
 	WARN_ON_ONCE(cpu_online(this_cpu) && irqs_disabled()
-		     && !oops_in_progress);
+		     && cpu != smp_processor_id() && !oops_in_progress);
 
 	csd = &csd_stack;
 	if (!wait) {
-- 
2.19.1


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

end of thread, other threads:[~2019-04-17 23:50 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-04-12 23:53 [PATCH] smp: Do not warn if smp_call_function_single() is doing a self call Dexuan Cui
2019-04-14  6:58 ` Vitaly Kuznetsov
2019-04-15 12:21 ` Peter Zijlstra
2019-04-15 23:39   ` Dexuan Cui
2019-04-16  9:31     ` Peter Zijlstra
2019-04-16 11:20       ` Vitaly Kuznetsov
2019-04-16 20:13         ` Thomas Gleixner
2019-04-17 23:50           ` Dexuan Cui

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.