All of lore.kernel.org
 help / color / mirror / Atom feed
From: Linus Torvalds <torvalds@linux-foundation.org>
To: Ingo Molnar <mingo@kernel.org>
Cc: Guenter Roeck <linux@roeck-us.net>, Rabin Vincent <rabin@rab.in>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
	Peter Zijlstra <peterz@infradead.org>,
	Thomas Gleixner <tglx@linutronix.de>,
	"Paul E. McKenney" <paulmck@us.ibm.com>
Subject: Re: qemu:arm test failure due to commit 8053871d0f7f (smp: Fix smp_call_function_single_async() locking)
Date: Mon, 20 Apr 2015 08:53:58 -0700	[thread overview]
Message-ID: <CA+55aFyQhmxX-BAPXpNrwK2U4qjG8PCptykNAJUKMpHGe8=j3A@mail.gmail.com> (raw)
In-Reply-To: <20150420053954.GA9923@gmail.com>

On Sun, Apr 19, 2015 at 10:39 PM, Ingo Molnar <mingo@kernel.org> wrote:
>
>>
>> So I _could_ imagine that somebody would want to do optimistic "prod
>> other cpu" calls that in all normal cases are for existing cpus, but
>> could be racy in theory.
>
> Yes, and I don't disagree with such optimizations in principle (it
> allows less references to be taken in the fast path), but is it really
> safe?
>
> If a CPU is going down and we potentially race against that, and send
> off an IPI, the IPI might be 'in flight' for an indeterminate amount
> of time, especially on wildly non-deterministic hardware like virtual
> platforms.

Well, it should be easy enough to handle that race in the cpu
offlining: after the cpu is marked "not present", just call
flush_smp_call_function_queue(), In fact, I thought we did exactly
that - it's the reason for the "warn_cpu_offline" argument, isn't it)?

So I don't think there should be any real race.  Sure, the HW IPI
itself might be in flight, but from a sw perspective isn't all done.

No, I was talking about something even more optimistic - the CPU
number we optimisitcally loaded and sent an IPI to might be completely
bogus just because we loaded it using some unlocked sequence, and
maybe the memory got re-assigned. So it might not even be a CPU number
that is "stale", it could be entirely invalid.

And no, I don't claim that we should do this, I'm just saying that I
could imagine this being a valid thing to do. But it might be a good
idea to add a WARN_ON_ONCE() for now to find the users that are not
being clever like this, they are just being stupid and wrong-headed,
and sending IPI's to bogus CPU's not because they are doing really
subtle smart stuff, but just because they never noticed how stupid
they are..

                      Linus

  parent reply	other threads:[~2015-04-20 15:54 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-04-18 23:23 qemu:arm test failure due to commit 8053871d0f7f (smp: Fix smp_call_function_single_async() locking) Guenter Roeck
2015-04-18 23:40 ` Guenter Roeck
2015-04-19  0:04   ` Linus Torvalds
2015-04-19  0:36     ` Guenter Roeck
2015-04-19  1:56     ` Guenter Roeck
2015-04-19  3:39       ` Rabin Vincent
2015-04-19  4:03         ` Guenter Roeck
     [not found]         ` <CA+55aFw4FSja+VBuCYJ7wLXKVRQZ7w6vOUaUJ4B=FXyBmNkrUg@mail.gmail.com>
2015-04-19  8:56           ` Linus Torvalds
2015-04-19  9:31             ` Ingo Molnar
2015-04-19 14:08               ` Guenter Roeck
2015-04-19 18:01                 ` Ingo Molnar
2015-04-19 20:34                   ` Linus Torvalds
2015-04-20  5:39                     ` Ingo Molnar
2015-04-20 12:17                       ` Paul E. McKenney
2015-04-20 15:53                       ` Linus Torvalds [this message]
2015-04-20 15:41                   ` Rabin Vincent
2015-04-20 10:46                 ` Geert Uytterhoeven
2015-04-20 10:46                   ` Geert Uytterhoeven

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='CA+55aFyQhmxX-BAPXpNrwK2U4qjG8PCptykNAJUKMpHGe8=j3A@mail.gmail.com' \
    --to=torvalds@linux-foundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux@roeck-us.net \
    --cc=mingo@kernel.org \
    --cc=paulmck@us.ibm.com \
    --cc=peterz@infradead.org \
    --cc=rabin@rab.in \
    --cc=tglx@linutronix.de \
    /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 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.