Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752396AbdG1Qq7 (ORCPT ); Fri, 28 Jul 2017 12:46:59 -0400 Received: from merlin.infradead.org ([205.233.59.134]:45066 "EHLO merlin.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751949AbdG1Qq5 (ORCPT ); Fri, 28 Jul 2017 12:46:57 -0400 Date: Fri, 28 Jul 2017 18:46:42 +0200 From: Peter Zijlstra To: Mathieu Desnoyers Cc: "Paul E. McKenney" , linux-kernel , Boqun Feng , Andrew Hunter , maged michael , gromer , Avi Kivity , Michael Ellerman , Nicholas Piggin , Benjamin Herrenschmidt , Palmer Dabbelt Subject: Re: [RFC PATCH v2] membarrier: expedited private command Message-ID: <20170728164642.jolhwyqs3swhzmrb@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> <2118431661.29566.1501256295573.JavaMail.zimbra@efficios.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <2118431661.29566.1501256295573.JavaMail.zimbra@efficios.com> 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: 1085 Lines: 29 On Fri, Jul 28, 2017 at 03:38:15PM +0000, Mathieu Desnoyers wrote: > > 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. > > As I pointed out in my other email, I plan to do this: > > --- a/kernel/sched/core.c > +++ b/kernel/sched/core.c > @@ -2636,6 +2636,11 @@ static struct rq *finish_task_switch(struct task_struct *prev) > vtime_task_switch(prev); > perf_event_task_sched_in(prev, current); Here would place it _inside_ the rq->lock, which seems to make more sense given the purpose of the barrier, but either way works given its definition. > finish_lock_switch(rq, prev); You could put the whole thing inside IS_ENABLED(CONFIG_SYSMEMBARRIER) or something. > + /* > + * The membarrier system call requires a full memory barrier > + * after storing to rq->curr, before going back to user-space. > + */ > + smp_mb__after_unlock_lock(); > finish_arch_post_lock_switch(); > > fire_sched_in_preempt_notifiers(current);