From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751729AbdFHGyP (ORCPT ); Thu, 8 Jun 2017 02:54:15 -0400 Received: from bombadil.infradead.org ([65.50.211.133]:35133 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750822AbdFHGyO (ORCPT ); Thu, 8 Jun 2017 02:54:14 -0400 Date: Thu, 8 Jun 2017 08:54:00 +0200 From: Peter Zijlstra To: Nicholas Piggin Cc: torvalds@linux-foundation.org, will.deacon@arm.com, oleg@redhat.com, paulmck@linux.vnet.ibm.com, benh@kernel.crashing.org, mpe@ellerman.id.au, linux-kernel@vger.kernel.org, mingo@kernel.org, stern@rowland.harvard.edu Subject: Re: [RFC][PATCH 5/5] powerpc: Remove SYNC from _switch Message-ID: <20170608065400.zhfao5lba6i3s7j6@hirez.programming.kicks-ass.net> References: <20170607161501.819948352@infradead.org> <20170607162013.905320602@infradead.org> <20170608103244.1b4b24c9@roar.ozlabs.ibm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20170608103244.1b4b24c9@roar.ozlabs.ibm.com> User-Agent: NeoMutt/20170113 (1.7.2) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Jun 08, 2017 at 10:32:44AM +1000, Nicholas Piggin wrote: > On Wed, 07 Jun 2017 18:15:06 +0200 > Peter Zijlstra wrote: > > > Now that the scheduler's rq->lock is RCsc and thus provides full > > transitivity between scheduling actions. And since we cannot migrate > > current, a task needs a switch-out and a switch-in in order to > > migrate, in which case the RCsc provides all the ordering we need. > > Hi Peter, > > I'm actually just working on removing this right now too, so > good timing. > > I think we can't "just" remove it, because it is required to order > MMIO on powerpc as well. How is MMIO special? That is, there is only MMIO before we call into schedule() right? So the rq->lock should be sufficient to order that too. > > But what I have done is to comment that some other primitives are > already providing the hwsync for other, so we don't have to add > another one in _switch. Right, so this patch relies on the smp_mb__before_spinlock -> smp_mb__after_spinlock conversion that makes the rq->lock RCsc and should thus provide the required SYNC for migrations. That said, I think you can already use the smp_mb__before_spinlock() as that is done with IRQs disabled, but its a more difficult argument. The rq->lock RCsc property should be more obvious.