Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1030832AbbD1OeQ (ORCPT ); Tue, 28 Apr 2015 10:34:16 -0400 Received: from bombadil.infradead.org ([198.137.202.9]:50370 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S965902AbbD1OeM (ORCPT ); Tue, 28 Apr 2015 10:34:12 -0400 Date: Tue, 28 Apr 2015 16:33:57 +0200 From: Peter Zijlstra To: "Paul E. McKenney" Cc: Manfred Spraul , Oleg Nesterov , Kirill Tkhai , linux-kernel@vger.kernel.org, Ingo Molnar , Josh Poimboeuf , Chris Metcalf Subject: Re: [PATCH 2/2] [PATCH] sched: Add smp_rmb() in task rq locking cycles Message-ID: <20150428143357.GF23123@twins.programming.kicks-ass.net> References: <20150217183636.GR5029@twins.programming.kicks-ass.net> <20150217215231.GK4166@linux.vnet.ibm.com> <20150218155904.GA27687@redhat.com> <54E4E479.4050003@colorfullife.com> <20150218224317.GC5029@twins.programming.kicks-ass.net> <20150219141905.GA11018@redhat.com> <54E77CC0.5030401@colorfullife.com> <20150220184551.GQ2896@worktop.programming.kicks-ass.net> <20150425195602.GA26676@linux.vnet.ibm.com> <20150426105213.GA27191@linux.vnet.ibm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20150426105213.GA27191@linux.vnet.ibm.com> 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: 1467 Lines: 32 On Sun, Apr 26, 2015 at 03:52:13AM -0700, Paul E. McKenney wrote: > And then an smp_read_barrier_depends() would be needed either here > or embedded in apin_unlock_wait(). But we also need to check the > spin_unlock_wait() implementations to see if any are potentially > vulnerable to compiler misbehavior due to lack of ACCESS_ONCE(), > READ_ONCE(), or other sources of the required volatility: > > o tile: For 32-bit, looks like a bug. Compares ->current_ticket and > ->next_ticket with no obvious protection. The compiler is free to > load them in either order, so it is possible that the two fields > could compare equal despite never having actually been equal at > any given time. Needs something like arm, arm64, mips, or x86 > to do single fetch, then compare fields in quantity fetched. > > Except that this appears to be using int on a 32-bit system, > thus might not have a 64-bit load. If that is the case, the > trick would be to load them in order. Except that this can be > defeated by overflow. Are there really 32-bit tile systems with > enough CPUs to overflow an unsigned short? > > For 64-bit, a READ_ONCE() appears to be in order -- no obvious > volatility present. > Chris? -- 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/