[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <af1eed90-a1d5-4da0-84a0-05e61767ab37@rowland.harvard.edu>
Date: Thu, 27 Jul 2023 13:41:17 -0400
From: Alan Stern <stern@...land.harvard.edu>
To: Linus Torvalds <torvalds@...uxfoundation.org>
Cc: Will Deacon <will@...nel.org>, Jann Horn <jannh@...gle.com>,
paulmck@...nel.org, Andrew Morton <akpm@...ux-foundation.org>,
Peter Zijlstra <peterz@...radead.org>,
Suren Baghdasaryan <surenb@...gle.com>,
Matthew Wilcox <willy@...radead.org>,
linux-kernel@...r.kernel.org, linux-mm@...ck.org,
Andrea Parri <parri.andrea@...il.com>,
Boqun Feng <boqun.feng@...il.com>,
Nicholas Piggin <npiggin@...il.com>,
David Howells <dhowells@...hat.com>,
Jade Alglave <j.alglave@....ac.uk>,
Luc Maranget <luc.maranget@...ia.fr>,
Akira Yokosawa <akiyks@...il.com>,
Daniel Lustig <dlustig@...dia.com>,
Joel Fernandes <joel@...lfernandes.org>
Subject: Re: [PATCH 0/2] fix vma->anon_vma check for per-VMA locking; fix
anon_vma memory ordering
On Thu, Jul 27, 2023 at 10:11:29AM -0700, Linus Torvalds wrote:
> On Thu, 27 Jul 2023 at 08:44, Alan Stern <stern@...land.harvard.edu> wrote:
> >
> > This reads a little oddly, perhaps because it's a fragment from a larger
> > piece of code.
>
> Yes. As Jann already said, this is basically a preparatory step in a
> much longer sequence, and the code simply wants to make sure that any
> later code (possibly quite a bit later) will not see a NULL value.
...
> Do we even have the same-location rule in the LKMM?
Yes. The comment in the source file calls it "Sequential Consistency
Per Variable", under the category of "Fundamental coherence ordering".
It applies even to plain accesses, not just to READ_ONCE or stronger.
But in the presence of data races (as in the example that Will posted
earlier), all bets are off. So if you want to use a plain access rather
than READ_ONCE, you need to be certain that it won't race with anything.
Alan Stern
Powered by blists - more mailing lists