Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751860AbdHALyc (ORCPT ); Tue, 1 Aug 2017 07:54:32 -0400 Received: from mail-pf0-f195.google.com ([209.85.192.195]:34692 "EHLO mail-pf0-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751115AbdHALya (ORCPT ); Tue, 1 Aug 2017 07:54:30 -0400 Date: Tue, 1 Aug 2017 21:54:08 +1000 From: Nicholas Piggin To: Peter Zijlstra Cc: Mathieu Desnoyers , Michael Ellerman , "Paul E. McKenney" , linux-kernel , Boqun Feng , Andrew Hunter , maged michael , gromer , Avi Kivity , Benjamin Herrenschmidt , Palmer Dabbelt , Dave Watson Subject: Re: [RFC PATCH v2] membarrier: expedited private command Message-ID: <20170801215408.12a621d6@roar.ozlabs.ibm.com> In-Reply-To: <20170801110023.nawaxnwg7b7iag33@hirez.programming.kicks-ass.net> References: <20170728085532.ylhuz2irwmgpmejv@hirez.programming.kicks-ass.net> <20170728115702.5vgnvwhmbbmyrxbf@hirez.programming.kicks-ass.net> <87tw1s4u9w.fsf@concordia.ellerman.id.au> <20170731233731.32e68f6d@roar.ozlabs.ibm.com> <973223324.694.1501551189603.JavaMail.zimbra@efficios.com> <20170801120047.61c59064@roar.ozlabs.ibm.com> <20170801081230.GF6524@worktop.programming.kicks-ass.net> <20170801195717.7a675cc2@roar.ozlabs.ibm.com> <20170801102203.urldoripgbh2ohun@hirez.programming.kicks-ass.net> <20170801203928.4b24d786@roar.ozlabs.ibm.com> <20170801110023.nawaxnwg7b7iag33@hirez.programming.kicks-ass.net> Organization: IBM X-Mailer: Claws Mail 3.14.1 (GTK+ 2.24.31; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1977 Lines: 50 On Tue, 1 Aug 2017 13:00:23 +0200 Peter Zijlstra wrote: > On Tue, Aug 01, 2017 at 08:39:28PM +1000, Nicholas Piggin wrote: > > Right, I just don't see what real problem this opens up that you don't > > already have when you are not hard partitioned, therefore it doesn't > > make sense to add a slowdown to the context switch fastpath to close > > one hole in the sieve. > > > > Completely recognizing that other architectures can do it without > > taking rq lock at all and will not be forced to do so. > > If we can limit this to hard partitioned, that would be good indeed. > > I'm just trying to avoid having two implementation of this thing. At the > same time I very much understand your reluctance to add this barrier. Well I think we could have some kind of for_each_cpu_where_this_process_is_running macro that is needed to abstract the arch details. Presumably we're already going to get two implementations of that one -- I can't imagine x86 would be happy with doing a for_all_cpus iteration just because arm does not have the cpumask. powerpc will only make that 3 :) > > In any case, supposing we can do that intent thing. How horrible would > something like: > > > context_switch() > if (unlikely(mm->needs_barrier)) > smp_mb__after_unlock_lock(); > > > be? We only need the extra barrier when we switch _into_ mm's that care > about sys_membarrier() in the first place. At which point they pay the > price. Not beautiful :) and it would also have to have an arch speicific bit on the other side. Although yes it gives a different way to reduce cost without rq. So Paul and googling filled me in on the importance of this syscall. Also I do appreciate the concern about taking rq lock. I just think maybe we (powerpc) pay a few more cycles in the new syscall rather than context switch. It will take a little while to get a good idea of performance and behaviour on bigger systems where this will matter most.