Received: by 10.213.65.68 with SMTP id h4csp1232775imn; Mon, 26 Mar 2018 03:39:44 -0700 (PDT) X-Google-Smtp-Source: AG47ELvc3G4IGjCCvXNcAul6XcjGkbgBLKAfYBGbSphIWxzlfDykJ2T3G6rpcd87P1RzhWKAA3pv X-Received: by 10.101.85.71 with SMTP id t7mr28065758pgr.386.1522060784545; Mon, 26 Mar 2018 03:39:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1522060784; cv=none; d=google.com; s=arc-20160816; b=C8WiTZGsn1p4IzBap0pgcFol2qraUpeVckJQTpq5aRp3FfvKniuY0I1qbXbo6DUMdp 0z++QzxBBRwe816Ywaf+IcartAyjjlCl90aECqu4UoUWjJiG0ddMaUmj9oOHfnH4jgvn b/dTT/wds+QsxBp2x/bWjrKLcYJRMy5cZwz1tXWyY/zgM0diAYbMDub48W3kGIKLF+wn gqHnVgJcSPZLIS/H9yXobui7Kxj7vpg+s5Dgxwql6ksUn0mZQfXXf9vBx+sIURnl749O 4bFMITNafh29lKpBdg3kBr/dNk2w1MNSQlKyCY0DeO1nSv9Iraiy1Eo4ZmcCpvHciPMh e2Hg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from :dkim-signature:arc-authentication-results; bh=FbYhFsnZxjUOLElRTf0Gwk3uAbxSkWGhkftzp4DGzM0=; b=NxMlyBRUTQ+QmaWHb+EnPdQZgrBmHtpY5b/3aIpajhBmJ+gpymGdAyw14OK6wdESh9 TuJ3fyYH4iEbLRZqwzVal5Khg5dANsMuMCTAedm7Ja+6UK7s0JpTUgUxfOo0Z4VHpfvK L9H6G3Q13RTanuEl97V30E6sgi1n0CD/sGrPtaCMpKudbLpJhjcqn+WJsNN2VVF0XUyh VSGGSfHoN+LiMyMGKoLxLy2m1n7DUBlmZXGI78mOgo1ee2Ql5rSoOTj9xxDei+MDIpaj 7hY2OPGUKSKqua3FihoFPdXQVDu+jqvFt35ZVdXTKlbizH44UOwfskIp9fM9OPH6YJB5 8DyA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=ZuyXTWgP; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 59-v6si14558657plp.436.2018.03.26.03.39.30; Mon, 26 Mar 2018 03:39:44 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=ZuyXTWgP; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751380AbeCZKiC (ORCPT + 99 others); Mon, 26 Mar 2018 06:38:02 -0400 Received: from mail-wr0-f193.google.com ([209.85.128.193]:38790 "EHLO mail-wr0-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751076AbeCZKiB (ORCPT ); Mon, 26 Mar 2018 06:38:01 -0400 Received: by mail-wr0-f193.google.com with SMTP id m13so5053633wrj.5 for ; Mon, 26 Mar 2018 03:38:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amarulasolutions.com; s=google; h=from:to:cc:subject:date:message-id; bh=FbYhFsnZxjUOLElRTf0Gwk3uAbxSkWGhkftzp4DGzM0=; b=ZuyXTWgPs+j/etFDsPjVyUqvjup2NyO/t1AyQL+dxiEdYV9z3lE1jyr3tKYFWhHB6H 9SHz1Jtis7iDN3sLANSsVahn3nSkYTVj4JoIJIYSrHR2lauxt1LF30sfPvarN9DEKxL1 n3e/0NlVZCBFMxEmxSM1fw5RYq0F0PdkeMc88= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=FbYhFsnZxjUOLElRTf0Gwk3uAbxSkWGhkftzp4DGzM0=; b=O5capJ03n8QX9YJLIX9tZrRZeSbkmftKl/VZCo8C7mBwqKfqeHieyKRlF7RBiUxdQe 8ADWXcB/DnbOL3RnnORS1QBXt9S+3JMoHNA8HNkzgpaJRanaWK6zDAEzMaHJwa+hbiSR H9QhAxxypO/Boo8eZ6hMgW4dNz1KwRlTsMC8zzQddSWMvExeLFhtDIpSKaHT7aA8v0U/ 6C4tYHUlOBuXRyfzCmrJmtAlICKYsA23/HdNsX43Xx0lTnXKjjYQ7RfY/ZGi9c1t6KWq qqWH2mJ+5t26t3NOdVIeTZgtPq6MhmVDbEtBHaNK3YEguOnDPr4i3SsUBWct+A+rQ7j4 xRZQ== X-Gm-Message-State: AElRT7E6WQie+i/2hNGW9dCUu+dfqMiPmC5ThEeohEATluRUglpapEcu Z6qYwtl31m5nmBN3iuFmNhC5kjoq1U4= X-Received: by 10.223.210.82 with SMTP id o18mr10207023wri.85.1522060679919; Mon, 26 Mar 2018 03:37:59 -0700 (PDT) Received: from localhost.localdomain (host187-49-dynamic.250-95-r.retail.telecomitalia.it. [95.250.49.187]) by smtp.gmail.com with ESMTPSA id e27sm16204840wre.86.2018.03.26.03.37.58 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 26 Mar 2018 03:37:59 -0700 (PDT) From: Andrea Parri To: Benjamin Herrenschmidt , Paul Mackerras , Michael Ellerman , Peter Zijlstra , Ingo Molnar Cc: linux-kernel@vger.kernel.org, Andrea Parri , Linus Torvalds Subject: [PATCH for-4.17 2/2] powerpc: Remove smp_mb() from arch_spin_is_locked() Date: Mon, 26 Mar 2018 12:37:47 +0200 Message-Id: <1522060667-7034-1-git-send-email-andrea.parri@amarulasolutions.com> X-Mailer: git-send-email 2.7.4 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Commit 51d7d5205d338 ("powerpc: Add smp_mb() to arch_spin_is_locked()") added an smp_mb() to arch_spin_is_locked(), in order to ensure that Thread 0 Thread 1 spin_lock(A); spin_lock(B); r0 = spin_is_locked(B) r1 = spin_is_locked(A); never ends up with r0 = r1 = 0, and reported one example (in ipc/sem.c) relying on such guarantee. It's however understood (and undocumented) that spin_is_locked() is not required to ensure such ordering guarantee, guarantee that is currently _not_ provided by all implementations/arch, and that callers relying on such ordering should instead use suitable memory barriers before acting on the result of spin_is_locked(). Following a recent auditing[1] of the callers of {,raw_}spin_is_locked() revealing that none of them are relying on this guarantee anymore, this commit removes the leading smp_mb() from the primitive thus effectively reverting 51d7d5205d338. [1] https://marc.info/?l=linux-kernel&m=151981440005264&w=2 Signed-off-by: Andrea Parri Cc: Benjamin Herrenschmidt Cc: Paul Mackerras Cc: Michael Ellerman Cc: Peter Zijlstra Cc: Ingo Molnar Cc: Linus Torvalds --- arch/powerpc/include/asm/spinlock.h | 1 - 1 file changed, 1 deletion(-) diff --git a/arch/powerpc/include/asm/spinlock.h b/arch/powerpc/include/asm/spinlock.h index b9ebc3085fb79..ecc141e3f1a73 100644 --- a/arch/powerpc/include/asm/spinlock.h +++ b/arch/powerpc/include/asm/spinlock.h @@ -67,7 +67,6 @@ static __always_inline int arch_spin_value_unlocked(arch_spinlock_t lock) static inline int arch_spin_is_locked(arch_spinlock_t *lock) { - smp_mb(); return !arch_spin_value_unlocked(*lock); } -- 2.7.4