linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Dexuan Cui <decui@microsoft.com>
To: "tglx@linutronix.de" <tglx@linutronix.de>,
	"riel@surriel.com" <riel@surriel.com>,
	"peterz@infradead.org" <peterz@infradead.org>,
	"jpoimboe@redhat.com" <jpoimboe@redhat.com>,
	"luto@kernel.org" <luto@kernel.org>,
	Stephen Hemminger <sthemmin@microsoft.com>,
	Sasha Levin <Alexander.Levin@microsoft.com>,
	Haiyang Zhang <haiyangz@microsoft.com>,
	KY Srinivasan <kys@microsoft.com>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	Michael Kelley <mikelley@microsoft.com>
Cc: "marcelo.cerri@canonical.com" <marcelo.cerri@canonical.com>,
	"apw@canonical.com" <apw@canonical.com>,
	"olaf@aepfle.de" <olaf@aepfle.de>, vkuznets <vkuznets@redhat.com>,
	"jasowang@redhat.com" <jasowang@redhat.com>,
	Dexuan Cui <decui@microsoft.com>
Subject: [PATCH] smp: Do not warn if smp_call_function_single() is doing a self call.
Date: Fri, 12 Apr 2019 23:53:57 +0000	[thread overview]
Message-ID: <20190412235341.29379-1-decui@microsoft.com> (raw)

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


             reply	other threads:[~2019-04-12 23:54 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-04-12 23:53 Dexuan Cui [this message]
2019-04-14  6:58 ` [PATCH] smp: Do not warn if smp_call_function_single() is doing a self call 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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190412235341.29379-1-decui@microsoft.com \
    --to=decui@microsoft.com \
    --cc=Alexander.Levin@microsoft.com \
    --cc=apw@canonical.com \
    --cc=haiyangz@microsoft.com \
    --cc=jasowang@redhat.com \
    --cc=jpoimboe@redhat.com \
    --cc=kys@microsoft.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=luto@kernel.org \
    --cc=marcelo.cerri@canonical.com \
    --cc=mikelley@microsoft.com \
    --cc=olaf@aepfle.de \
    --cc=peterz@infradead.org \
    --cc=riel@surriel.com \
    --cc=sthemmin@microsoft.com \
    --cc=tglx@linutronix.de \
    --cc=vkuznets@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).