Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754975AbbHCSh5 (ORCPT ); Mon, 3 Aug 2015 14:37:57 -0400 Received: from bombadil.infradead.org ([198.137.202.9]:51980 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754292AbbHCSh4 (ORCPT ); Mon, 3 Aug 2015 14:37:56 -0400 Date: Mon, 3 Aug 2015 20:37:45 +0200 From: Peter Zijlstra To: Davidlohr Bueso Cc: Waiman Long , Ingo Molnar , Thomas Gleixner , "H. Peter Anvin" , x86@kernel.org, linux-kernel@vger.kernel.org, Scott J Norton , Douglas Hatch Subject: Re: [PATCH v4 1/7] locking/pvqspinlock: Unconditional PV kick with _Q_SLOW_VAL Message-ID: <20150803183745.GY25159@twins.programming.kicks-ass.net> References: <1438395724-25910-1-git-send-email-Waiman.Long@hp.com> <1438395724-25910-2-git-send-email-Waiman.Long@hp.com> <20150801222903.GC25159@twins.programming.kicks-ass.net> <1438626129.17146.9.camel@stgolabs.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1438626129.17146.9.camel@stgolabs.net> User-Agent: Mutt/1.5.21 (2012-12-30) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2067 Lines: 49 On Mon, Aug 03, 2015 at 11:22:09AM -0700, Davidlohr Bueso wrote: > On Sun, 2015-08-02 at 00:29 +0200, Peter Zijlstra wrote: > > That's just gibberish, even in the same cacheline stuff can get > > reordered. > > true dat > > > > > So either we insert > > > + * memory barrier here and in the corresponding pv_wait_head() > > > + * function or we do an unconditional kick which is what is done here. > > > > why, why why ? You've added words, but you've not actually described > > what the problem is you're trying to fix. > > > > AFAICT the only thing we really care about here is that the load in > > question happens _after_ we observe SLOW, and that is still true. > > > > The order against the unlock is irrelevant. > > > > So we set ->state before we hash and before we set SLOW. Given that > > we've seen SLOW, we must therefore also see ->state. > > > > If ->state == halted, this means the CPU in question is blocked and the > > pv_node will not get re-used -- if it does get re-used, it wasn't > > blocked and we don't care either. > > Right, if it does get re-used, we were burning SPIN_THRESHOLD and racing > only wastes a few spins, afaict. In fact this is explicitly stated: > > /* > * The unlocker should have freed the lock before kicking the > * CPU. So if the lock is still not free, it is a spurious > * wakeup and so the vCPU should wait again after spinning for > * a while. > */ > > The thing I like about this patch is that it simplifies the > pv_kick/pv_wait flow, not having to depend on minutia like ->state > checking. But the condition about spurious wakeups is already there, so > really nothing changes. OK, so there's no 'fix'? The patch claims we can loose a wakeup and I just don't see how that is true. -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/