Received: by 10.213.65.68 with SMTP id h4csp247636imn; Wed, 28 Mar 2018 02:49:52 -0700 (PDT) X-Google-Smtp-Source: AIpwx4/IL370QPsXb5mfkJN85tQM+NUGbMIv89e8QOGWfWscXtP3SI4HaTZggIXdVGbJO81Upmsm X-Received: by 2002:a17:902:52ed:: with SMTP id a100-v6mr3186527pli.120.1522230592387; Wed, 28 Mar 2018 02:49:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1522230592; cv=none; d=google.com; s=arc-20160816; b=DC1tnisqfNGlM2weCcVhYknTxbQ5fuXUmm1l2ZWhAfrx2xBFpRPIs5CdKG0v4Zmo5B Oz8bDiYyz3hBcY6KDl5KUTC4cCLihYXmdLom+pOw3P7s+3DMhKcGJHp4z71qcEHbaeew gCAo15IR8330ny1NOewCYOWt28D2A0CGopKkvRLhDDA3nHQ6aNlJ1eMhNK2WpxLLBysN mTqTBwQEBMNeydEgmlb8kOy4cParbrPLqeu/2Tl0EFV/+ktwJH1pQZ5/qNRa9IPr44Ox DxPr9o4o4Y2O28fU2gqFipmESY3wCY5gZpEQXI2Ey1okmrUDhNqyvVeq7zgPKNE5wG9r Wqtw== 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=Fts/hTYQr8yQRxRevNREp/B+pZ3+fpCZDTOear2c6A8gTC0v1fiq/iIiM1hjx0FiCf FalrNaiBauAp3ghsLwzOHCpXudBKZLXa03cT1bucV8TQAEA1zoL0g5NG5KkrpXzRsJxZ BKwyjBAukRbvXF28Mr1xMPAPfUHPqDo9CDX3PHYiKCgFWsLy15gmWiYkMZpIIe2H1saO /e94sGuqsc5etAn6r4OYDgDiaddW8m/6U4ZrKhNzm1cXkWDnbTelKgQ7Xiqg6xUE6ym2 CUXya7o21DXIDS+pfrt3yKpQukWsDJjmNHO8o/wwP05y3fQXEi9e4NbUUGDYCAMTFnQn 7rCg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=Gp0Ct8V0; 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 o10-v6si2158919plk.20.2018.03.28.02.49.38; Wed, 28 Mar 2018 02:49:52 -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=Gp0Ct8V0; 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 S1752322AbeC1Jr4 (ORCPT + 99 others); Wed, 28 Mar 2018 05:47:56 -0400 Received: from mail-wr0-f196.google.com ([209.85.128.196]:47068 "EHLO mail-wr0-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751976AbeC1Jrz (ORCPT ); Wed, 28 Mar 2018 05:47:55 -0400 Received: by mail-wr0-f196.google.com with SMTP id d1so1605366wrj.13 for ; Wed, 28 Mar 2018 02:47:54 -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=Gp0Ct8V0dXXYqxg1S20GY7i/fknemgLbbHzJGMT1+jFKcZxTFfeMgjvaSACkU0agF2 8eRTGLajVJ0m9PW4R3K0cS6K1Hd2yAQW20/4jnvVy/E5MbPbMK/apsDL/8LDrMTtnfua 4fBahjpRVl1ajM4p1ChscZgLoO1zz5nrhuhNA= 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=JvXksPfeqsT83y/GkbggOFX36Cmx2BLwRJ14/9Zqf1ilQ+UetsPeVE5CdNzobHQNGf RsMnnk5ezHA2w58wO1XXZKpObV4vXO/QbtcZDHEbMZAORTaRnXFg19sS7oIA8X8Q9M0n 297T5djuLeTBQXurYpE9pcHxylTlGY/m/rsJzkflOD8CLfkv9D0ekeS52RTouLeTSWiX mLkqXDPm6VAuF6EuzSdEHkrYT/QkLHsgV8vzFT7cnqLTGAx3hC/iD5Eo/vjXWG/09GaF HLHfZBx67N57L+QD33c0jFWauN7tpbMG/JEGI5bCxhEIQP3/A0YjPFp8WKRWgnTLfK0S dxaQ== X-Gm-Message-State: AElRT7GXRWhRuT7yXP4GtOV+XOQuZmnxzotKplA2RW8//FRBAJn+vL99 G5zdSqJKAWw1ky/wLfU83moDWQ== X-Received: by 10.223.136.146 with SMTP id f18mr2357218wrf.57.1522230473873; Wed, 28 Mar 2018 02:47:53 -0700 (PDT) Received: from localhost.localdomain ([213.209.242.222]) by smtp.gmail.com with ESMTPSA id y100sm1575307wmh.2.2018.03.28.02.47.52 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 28 Mar 2018 02:47:53 -0700 (PDT) From: Andrea Parri To: Benjamin Herrenschmidt , Paul Mackerras , Michael Ellerman , Peter Zijlstra , Ingo Molnar Cc: Linus Torvalds , linux-kernel@vger.kernel.org, Andrea Parri Subject: [PATCH v2 for-4.17 2/3] powerpc: Remove smp_mb() from arch_spin_is_locked() Date: Wed, 28 Mar 2018 11:47:37 +0200 Message-Id: <1522230457-12337-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