All of lore.kernel.org
 help / color / mirror / Atom feed
From: Peter Zijlstra <peterz@infradead.org>
To: Will Deacon <will.deacon@arm.com>
Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>,
	torvalds@linux-foundation.org, oleg@redhat.com,
	paulmck@linux.vnet.ibm.com, mpe@ellerman.id.au,
	npiggin@gmail.com, linux-kernel@vger.kernel.org,
	mingo@kernel.org, stern@rowland.harvard.edu,
	Mel Gorman <mgorman@suse.de>, Rik van Riel <riel@redhat.com>
Subject: Re: [RFC][PATCH 1/5] mm: Rework {set,clear,mm}_tlb_flush_pending()
Date: Wed, 2 Aug 2017 11:18:43 +0200	[thread overview]
Message-ID: <20170802091843.gppcwx27wwf6hd6e@hirez.programming.kicks-ass.net> (raw)
In-Reply-To: <20170802090228.GF15219@arm.com>

On Wed, Aug 02, 2017 at 10:02:28AM +0100, Will Deacon wrote:
> On Wed, Aug 02, 2017 at 10:45:51AM +0200, Peter Zijlstra wrote:
> > On Wed, Aug 02, 2017 at 09:15:23AM +0100, Will Deacon wrote:
> > > On Wed, Aug 02, 2017 at 10:11:06AM +0200, Peter Zijlstra wrote:
> > 
> > > > arm64 looks good too, although it plays silly games with the first
> > > > barrier, but I trust that to be sufficient.
> > > 
> > > The first barrier only orders prior stores for us, because page table
> > > updates are made using stores. A prior load could be reordered past the
> > > invalidation, but can't make it past the second barrier.
> > 
> > So then you rely on the program not having any loads pending to the
> > address you're about to invalidate, right? Otherwise we can do the TLBI
> > and then the load to insta-repopulate the TLB entry you just wanted
> > dead.
> > 
> > That later DSB ISH is too late for that.
> > 
> > Isn't that somewhat fragile?
> 
> We only initiate the TLB invalidation after the page table update is
> observable to the page table walker, so any repopulation will cause a fill
> using the new page table entry.

Ah, indeed. Might be worth a comment tho.

> > > I really think we should avoid defining TLB invalidation in terms of
> > > smp_mb() because it's a lot more subtle than that.
> > 
> > I'm tempted to say stronger, smp_mb() only provides order, we want full
> > serialization. Everything before stays before and _completes_ before.
> > Everything after happens after (if the primitives actually do something
> > at all of course, sparc64 for instance has no-op flush_tlb*).
> > 
> > While such semantics might be slightly too strong for what we currently
> > need, it is what powerpc, x86 and arm currently implement and are fairly
> > easy to reason about. If we weaken it, stuff gets confusing again.
> 
> My problem with this is that we're strengthening the semantics for no actual
> use-case, but at the same time this will have a real performance impact.

Well, you could put in a dmb(ish) in the local case, that's loads
cheaper than the dsb(ish) you need for the !local case. But OK..

Back to staring at dodgy arch code..

  reply	other threads:[~2017-08-02  9:19 UTC|newest]

Thread overview: 41+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-06-07 16:15 [RFC][PATCH 0/5] Getting rid of smp_mb__before_spinlock Peter Zijlstra
2017-06-07 16:15 ` [RFC][PATCH 1/5] mm: Rework {set,clear,mm}_tlb_flush_pending() Peter Zijlstra
2017-06-09 14:45   ` Will Deacon
2017-06-09 18:42     ` Peter Zijlstra
2017-07-28 17:45     ` Peter Zijlstra
2017-08-01 10:31       ` Will Deacon
2017-08-01 12:02         ` Benjamin Herrenschmidt
2017-08-01 12:14           ` Peter Zijlstra
2017-08-01 16:39             ` Peter Zijlstra
2017-08-01 16:44               ` Will Deacon
2017-08-01 16:48                 ` Peter Zijlstra
2017-08-01 22:59                   ` Peter Zijlstra
2017-08-02  1:23                     ` Benjamin Herrenschmidt
2017-08-02  8:11                       ` Peter Zijlstra
2017-08-02  8:15                         ` Will Deacon
2017-08-02  8:43                           ` Will Deacon
2017-08-02  8:51                             ` Peter Zijlstra
2017-08-02  9:02                               ` Will Deacon
2017-08-02 22:54                                 ` Benjamin Herrenschmidt
2017-08-02  8:45                           ` Peter Zijlstra
2017-08-02  9:02                             ` Will Deacon
2017-08-02  9:18                               ` Peter Zijlstra [this message]
2017-08-02 13:57                         ` Benjamin Herrenschmidt
2017-08-02 15:46                           ` Peter Zijlstra
2017-08-02  0:17                   ` Benjamin Herrenschmidt
2017-08-01 22:42             ` Benjamin Herrenschmidt
2017-06-07 16:15 ` [RFC][PATCH 2/5] locking: Introduce smp_mb__after_spinlock() Peter Zijlstra
2017-06-07 16:15 ` [RFC][PATCH 3/5] overlayfs: Remove smp_mb__before_spinlock() usage Peter Zijlstra
2017-06-07 16:15 ` [RFC][PATCH 4/5] locking: Remove smp_mb__before_spinlock() Peter Zijlstra
2017-06-07 16:15 ` [RFC][PATCH 5/5] powerpc: Remove SYNC from _switch Peter Zijlstra
2017-06-08  0:32   ` Nicholas Piggin
2017-06-08  6:54     ` Peter Zijlstra
2017-06-08  7:29       ` Nicholas Piggin
2017-06-08  7:57         ` Peter Zijlstra
2017-06-08  8:21           ` Nicholas Piggin
2017-06-08  9:54           ` Michael Ellerman
2017-06-08 10:00             ` Nicholas Piggin
2017-06-08 12:45               ` Peter Zijlstra
2017-06-08 13:18                 ` Nicholas Piggin
2017-06-08 13:47                   ` Peter Zijlstra
2017-06-09 14:49 ` [RFC][PATCH 0/5] Getting rid of smp_mb__before_spinlock Will Deacon

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=20170802091843.gppcwx27wwf6hd6e@hirez.programming.kicks-ass.net \
    --to=peterz@infradead.org \
    --cc=benh@kernel.crashing.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mgorman@suse.de \
    --cc=mingo@kernel.org \
    --cc=mpe@ellerman.id.au \
    --cc=npiggin@gmail.com \
    --cc=oleg@redhat.com \
    --cc=paulmck@linux.vnet.ibm.com \
    --cc=riel@redhat.com \
    --cc=stern@rowland.harvard.edu \
    --cc=torvalds@linux-foundation.org \
    --cc=will.deacon@arm.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 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.