From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1759747AbcHaLcb (ORCPT ); Wed, 31 Aug 2016 07:32:31 -0400 Received: from gate.crashing.org ([63.228.1.57]:34530 "EHLO gate.crashing.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754070AbcHaLc3 (ORCPT ); Wed, 31 Aug 2016 07:32:29 -0400 Message-ID: <1472640977.2388.83.camel@kernel.crashing.org> Subject: Re: [RFC][PATCH] Fix a race between rwsem and the scheduler From: Benjamin Herrenschmidt To: Peter Zijlstra Cc: Oleg Nesterov , Balbir Singh , LKML , Nicholas Piggin Date: Wed, 31 Aug 2016 20:56:17 +1000 In-Reply-To: <20160831071810.GZ10138@twins.programming.kicks-ass.net> References: <4050f2ce-1aee-d2aa-39e3-36e995b56252@gmail.com> <20160830121937.GQ10138@twins.programming.kicks-ass.net> <20160830130426.GA17795@redhat.com> <20160830141321.GB2794@worktop> <20160830165746.GA29218@redhat.com> <20160830183416.GV10138@twins.programming.kicks-ass.net> <1472592498.2388.40.camel@kernel.crashing.org> <20160831071810.GZ10138@twins.programming.kicks-ass.net> Content-Type: text/plain; charset="UTF-8" X-Mailer: Evolution 3.20.5 (3.20.5-1.fc24) Mime-Version: 1.0 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, 2016-08-31 at 09:18 +0200, Peter Zijlstra wrote: > On Wed, Aug 31, 2016 at 07:28:18AM +1000, Benjamin Herrenschmidt > wrote: > > > > It's always been a requirement that if you actually context switch > > a > > full mb() is implied ... > > > > > On powerpc we have a sync deep in _switch to achieve that. > > OK, fair enough. I must've missed it in the x86 switch_to, must be > one > of those implied serializing instructions I'm not too familiar with. > > > > > (though that isn't the case if you don't actually > > switch, ie, you are back to RUNNING before you even hit schedule). > > Right, which invalidates the claim that schedule() implies a full mb, Right, it's only full mb if you actually schedule to another process :- ) > > > > This is necessary so that a process who wakes up on a different CPU > > sees > > all of its own load/stores. > > Don't actually think its needed for that, see the comment from > 8643cda549ca4, the scheduler has enough barriers to guarantee > Program-Order for tasks without that. >