From: Benjamin Herrenschmidt <benh@kernel.crashing.org>
To: Peter Zijlstra <peterz@infradead.org>, Oleg Nesterov <oleg@redhat.com>
Cc: Balbir Singh <bsingharora@gmail.com>,
LKML <linux-kernel@vger.kernel.org>,
Nicholas Piggin <nicholas.piggin@gmail.com>
Subject: Re: [RFC][PATCH] Fix a race between rwsem and the scheduler
Date: Wed, 31 Aug 2016 07:28:18 +1000 [thread overview]
Message-ID: <1472592498.2388.40.camel@kernel.crashing.org> (raw)
In-Reply-To: <20160830183416.GV10138@twins.programming.kicks-ass.net>
On Tue, 2016-08-30 at 20:34 +0200, Peter Zijlstra wrote:
>
> I'm not actually sure it does. There is the comment from 8643cda549ca4
> which explain the program order guarantees.
>
> But I'm not sure who or what would simply a full smp_mb() when you call
> schedule() -- I mean, its true on x86, but that's 'trivial'.
It's always been a requirement that if you actually context switch a
full mb() is implied (though that isn't the case if you don't actually
switch, ie, you are back to RUNNING before you even hit schedule).
On powerpc we have a sync deep in _switch to achieve that.
This is necessary so that a process who wakes up on a different CPU sees
all of its own load/stores.
> > I mean, I thought that the LOAD/STORE's done by some task can't
> > be re-ordered with LOAD/STORE's done by another task which was
> > running on the same CPU. Wrong?
>
> If so, I'm not sure how :/
>
> So smp_mb__before_spinlock() stops stores from @prev, and the ACQUIRE
> from spin_lock(&rq->lock) stops both loads/stores from @next, but afaict
> nothing stops the loads from @prev seeing stores from @next.
>
> Also not sure this matters though, if they're threads in the same
> process its a data race already and nobody cares. If they're not threads
> in the same process, they're separated by address space and can't 'see'
> each other anyway.
The architecture switch_to() has to do the right thing.
Cheers,
Ben.
next prev parent reply other threads:[~2016-08-30 21:29 UTC|newest]
Thread overview: 27+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-08-30 8:49 [RFC][PATCH] Fix a race between rwsem and the scheduler Balbir Singh
2016-08-30 9:13 ` Nicholas Piggin
2016-08-30 12:19 ` Peter Zijlstra
2016-08-30 13:04 ` Oleg Nesterov
2016-08-30 14:13 ` Peter Zijlstra
2016-08-30 16:57 ` Oleg Nesterov
2016-08-30 18:34 ` Peter Zijlstra
2016-08-30 21:28 ` Benjamin Herrenschmidt [this message]
2016-08-31 7:18 ` Peter Zijlstra
2016-08-31 10:56 ` Benjamin Herrenschmidt
2016-08-31 13:31 ` Peter Zijlstra
2016-08-31 21:47 ` Benjamin Herrenschmidt
2016-09-01 6:49 ` Balbir Singh
2016-09-01 6:57 ` Peter Zijlstra
2016-09-01 14:17 ` Boqun Feng
2016-09-01 15:33 ` Peter Zijlstra
2016-08-30 21:25 ` Benjamin Herrenschmidt
2016-08-31 7:20 ` Peter Zijlstra
2016-08-31 10:55 ` Benjamin Herrenschmidt
2016-08-31 3:41 ` Balbir Singh
2016-08-31 7:28 ` Peter Zijlstra
2016-08-31 10:17 ` Balbir Singh
2016-08-31 10:57 ` Benjamin Herrenschmidt
2016-09-01 1:48 ` Alexey Kardashevskiy
2016-09-01 12:16 ` Alexey Kardashevskiy
2016-08-30 12:58 ` Oleg Nesterov
2016-08-31 3:25 ` Balbir Singh
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=1472592498.2388.40.camel@kernel.crashing.org \
--to=benh@kernel.crashing.org \
--cc=bsingharora@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=nicholas.piggin@gmail.com \
--cc=oleg@redhat.com \
--cc=peterz@infradead.org \
/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).