From patchwork Fri Jun 6 17:11:45 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Zijlstra X-Patchwork-Id: 4312711 Return-Path: X-Original-To: patchwork-linux-parisc@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 4CDB59F170 for ; Fri, 6 Jun 2014 17:12:12 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 75A0920222 for ; Fri, 6 Jun 2014 17:12:11 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 8E31220220 for ; Fri, 6 Jun 2014 17:12:10 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751952AbaFFRMK (ORCPT ); Fri, 6 Jun 2014 13:12:10 -0400 Received: from bombadil.infradead.org ([198.137.202.9]:58799 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751624AbaFFRMJ (ORCPT ); Fri, 6 Jun 2014 13:12:09 -0400 Received: from dhcp-077-248-225-117.chello.nl ([77.248.225.117] helo=laptop) by bombadil.infradead.org with esmtpsa (Exim 4.80.1 #2 (Red Hat Linux)) id 1WsxgB-0004tG-Rc; Fri, 06 Jun 2014 17:11:48 +0000 Received: by laptop (Postfix, from userid 1000) id 312AE1035E444; Fri, 6 Jun 2014 19:11:45 +0200 (CEST) Date: Fri, 6 Jun 2014 19:11:45 +0200 From: Peter Zijlstra To: James Bottomley Cc: Davidlohr Bueso , mingo@kernel.org, mpatocka@redhat.com, torvalds@linux-foundation.org, jason.low2@hp.com, waiman.long@hp.com, jejb@parisc-linux.org, paulmck@linux.vnet.ibm.com, dave.anglin@bell.net, aswin@hp.com, linux-kernel@vger.kernel.org, linux-parisc@vger.kernel.org, davem@davemloft.net, james.hogan@imgtec.com, cmetcalf@tilera.com, vgupta@synopsys.com Subject: Re: [PATCH 2/2] locking/rwsem: Disable optimistic spinning for PA-RISC Message-ID: <20140606171145.GU13930@laptop.programming.kicks-ass.net> References: <1402070140-15090-1-git-send-email-davidlohr@hp.com> <1402070140-15090-3-git-send-email-davidlohr@hp.com> <1402070987.2207.75.camel@dabdike.int.hansenpartnership.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <1402070987.2207.75.camel@dabdike.int.hansenpartnership.com> User-Agent: Mutt/1.5.21 (2012-12-30) Sender: linux-parisc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-parisc@vger.kernel.org X-Spam-Status: No, score=-7.5 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP On Fri, Jun 06, 2014 at 09:09:47AM -0700, James Bottomley wrote: > On Fri, 2014-06-06 at 08:55 -0700, Davidlohr Bueso wrote: > > PA-RISC's cmpxchg is not save against normal stores and the code used > > for optimistic spinning is known broken because of this. > > What about all the other identified architectures? The problem is that > unless you can do an atomic Read Modify Write on your architecture, you > have to implement our exchange primitives with locking, and that makes > you unsafe against stores We happen to be the architecture that > detected this, but I thought we agreed sparc32, metag, tile32, arc and > possibly hexagon have this problem. > > Rather than naming all the failing architectures, we probably want an > > ARCH_NO_ATOMIC_RMW The thing is, all these archs are broken beyond this particular problem, Mikulas Patocka found a number of other spots. In any case, sure I can exclude more. Although ideally someone goes do that __atomic sparse thing to flush out all this. Acked-by: Chris Metcalf --- Subject: locking, mutex: Disable optimistic spinning on !RMW archs For some archs a regular store does not play nice with cmpxchg(), the optimistic spinning code (and various other places not caught by this) break this assumption and make things go boom. Until something better is found, disable optimistic spinning for these archs. Cc: James.Bottomley@HansenPartnership.com Cc: davem@davemloft.net Cc: james.hogan@imgtec.com Cc: cmetcalf@tilera.com Cc: vgupta@synopsys.com Reported-by: Mikulas Patocka Signed-off-by: Peter Zijlstra --- kernel/Kconfig.locks | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) -- To unsubscribe from this list: send the line "unsubscribe linux-parisc" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/kernel/Kconfig.locks b/kernel/Kconfig.locks index d2b32ac27a39..b9c132c48bf1 100644 --- a/kernel/Kconfig.locks +++ b/kernel/Kconfig.locks @@ -220,6 +220,10 @@ config INLINE_WRITE_UNLOCK_IRQRESTORE endif +config ARCH_NO_ATOMIC_RMW + def_bool y + depends on PARISC || SPARC32 || METAG_ATOMICITY_LOCK1 || (TILE && !TILEGX) || (ARC && !ARC_HAS_LLSC) + config MUTEX_SPIN_ON_OWNER def_bool y - depends on SMP && !DEBUG_MUTEXES + depends on SMP && !DEBUG_MUTEXES && !ARCH_NO_ATOMIC_RMW