Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752257AbdGaNgh (ORCPT ); Mon, 31 Jul 2017 09:36:37 -0400 Received: from bombadil.infradead.org ([65.50.211.133]:43738 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752044AbdGaNge (ORCPT ); Mon, 31 Jul 2017 09:36:34 -0400 Date: Mon, 31 Jul 2017 15:36:19 +0200 From: Peter Zijlstra To: Michael Ellerman Cc: Mathieu Desnoyers , "Paul E . McKenney" , linux-kernel@vger.kernel.org, Boqun Feng , Andrew Hunter , Maged Michael , gromer@google.com, Avi Kivity , Nicholas Piggin , Benjamin Herrenschmidt , Palmer Dabbelt Subject: Re: [RFC PATCH v2] membarrier: expedited private command Message-ID: <20170731133619.dj7z4gjw7gdfx7wb@hirez.programming.kicks-ass.net> References: <20170727211314.32666-1-mathieu.desnoyers@efficios.com> <20170728085532.ylhuz2irwmgpmejv@hirez.programming.kicks-ass.net> <20170728115702.5vgnvwhmbbmyrxbf@hirez.programming.kicks-ass.net> <87tw1s4u9w.fsf@concordia.ellerman.id.au> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <87tw1s4u9w.fsf@concordia.ellerman.id.au> User-Agent: NeoMutt/20170609 (1.8.3) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1410 Lines: 34 On Mon, Jul 31, 2017 at 11:20:59PM +1000, Michael Ellerman wrote: > Peter Zijlstra writes: > > In fact, I'm fairly sure its only PPC. > > > > Because only ARM64 and PPC actually implement ACQUIRE/RELEASE with > > anything other than smp_mb() (for now, Risc-V is in this same boat and > > MIPS could be if they ever sort out their fancy barriers). > > > > TSO archs use a regular STORE for RELEASE, but all their atomics imply a > > smp_mb() and there are enough around to make one happen (typically > > mm_cpumask updates). > > > > Everybody else, aside from ARM64 and PPC must use smp_mb() for > > ACQUIRE/RELEASE. > > > > ARM64 has a super duper barrier in switch_to(). > > > > Which only leaves PPC stranded.. but the 'good' news is that mpe says > > they'll probably need a barrier in switch_mm() in any case. > > I may have been sleep deprived. We have a patch, probably soon to be > merged, which will add a smp_mb() in switch_mm() but *only* when we add > a CPU to mm_cpumask, ie. when we run on a CPU we haven't run on before. > > I'm not across membarrier enough to know if that's sufficient, but it > seems unlikely? Correct, that would be insufficient. We'd need it every time switch_mm() does indeed change the effective mm. Now you also spoke of looking at clearing bits in mm_cpumask(), and I suspect that if you do that, you end up having to do a barrier every time.