Received: by 10.213.65.68 with SMTP id h4csp294801imn; Wed, 28 Mar 2018 03:51:26 -0700 (PDT) X-Google-Smtp-Source: AIpwx49JKLGtps75aRcvRZL7dv2l0+2uf0F6oQ0v9TQoialNCVmyo10q2R1JXEK62h5lmWojNoAh X-Received: by 2002:a17:902:b2c6:: with SMTP id x6-v6mr3361447plw.197.1522234286610; Wed, 28 Mar 2018 03:51:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1522234286; cv=none; d=google.com; s=arc-20160816; b=RePYkyn9KAYmPLzLwnvJqFnSBro8chgmavKF4F/c+HQHulTlQw+Qgy3Ze9zW69yDUh xM9dcMvaObfXFP9wjuZNM4fgzCeh0hf5f8oXXJp1+nvoJu1WsqrQe6jjDws+j50bQKGJ 31DPBbOeWGeggioR9/QmRGRBuiWNjJoOW13gdMiYuiCW9EhRWxkAOaa9fkzuiahu5isf GbNtOdc9WBomye4vfiZvEHQmRcaH5ZNF5vABl+01aae5GbByxmXWRZLN7b5HycfGcTif /YPRfpfdmR1cRfHIXO8IPCJ29ECbGX6coWmfCenq+ocZIVpQvE0AigzAlQRAsrEqvkCB KP7g== 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=9VTcz/76Q2FOcINxNe2iFp9+xJb8T+p6z8eH/0HQz08=; b=kWdS7VyNQQjTMNEdjTmuRPbpup9E6FE0ECUHwW6vfk+aQbXKQMdNKTOitVtXIUkm7N 6s9Apo4USaaYFOPv14olWEgIxswfN17NzX5pVo/8ZWEVrni7GbF+RCpzknCe7U/vI7iE 87ljiN0RCR9Q5JnjP2hju+01LnZeD2d65hf+hH2ltgZkilGdDjIA0XJbiA2vVncLcpK8 CpPrNgssqNafvzSACxH5WIrlEGodg5uomHEKEppq9iX2GzWHCojeVXxPnU+AWlwIR80e wwbSRg2rA56KN83HcIKwQJ9+lbCgPG3VJZkiA37popOyJyz5bTfT06BmfnkkOH2LDnCS pw0w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=ZasoOII8; 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 j2-v6si3790510pli.501.2018.03.28.03.51.11; Wed, 28 Mar 2018 03:51:26 -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=ZasoOII8; 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 S1752269AbeC1JrS (ORCPT + 99 others); Wed, 28 Mar 2018 05:47:18 -0400 Received: from mail-wm0-f66.google.com ([74.125.82.66]:55957 "EHLO mail-wm0-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751224AbeC1JrQ (ORCPT ); Wed, 28 Mar 2018 05:47:16 -0400 Received: by mail-wm0-f66.google.com with SMTP id b127so2863893wmf.5 for ; Wed, 28 Mar 2018 02:47:16 -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=9VTcz/76Q2FOcINxNe2iFp9+xJb8T+p6z8eH/0HQz08=; b=ZasoOII8r3iA7KIuMBFeokQh5RDMYLed7m31pQhiKEVmt4kItNpPfBWr+V6+Ka+M/b IBsK4lJ8zb8y4Ix8gtx6jbJ3bTt6e2TdS6k/wXUnsApyWsSHtyDFcRVHWKv73bc6Af1z BXBMq4UrG8AB0ZcJ+tVG3LgIh8NO378UPnLeI= 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=9VTcz/76Q2FOcINxNe2iFp9+xJb8T+p6z8eH/0HQz08=; b=t9LK2TdHJXgttC6j5yHFKA96vUSHGTcHR3kUnBHp3CHU2TZ1UCchPbB/uBONoCJ8O8 rGbLqxNhkB/qlx0KfiPYFhBMWfaRmrj0rDImjCJGbq8Jpula7eNYOss8ICKk5ZBEOTzH e4kSkp5ezRUk9nohXLXazcXoRQDyVKgNCtJb7cVQNxZD/MEAcJtRD3L1ncaRZYoJRVUA kVgeZc1KftShHWK5bRn/+aQZhctfY78lpcqhwzwrnO0zsr7g8NusQEfH0fPbt0pkN3TI sELrmKc8H5pAdWWkF1MntyExwGkX30VLdUI3V3q1L54vqz+PiFU6BklMDDERFipUQl7X hZyg== X-Gm-Message-State: AElRT7FxDX9oCog3eERotaNg7n3OC2e/UVxhGj7HqpoqVVz1savgplEN OVaUH2/dzJK8bF8PLkJSQTNfxA== X-Received: by 10.28.142.1 with SMTP id q1mr2261057wmd.0.1522230435679; Wed, 28 Mar 2018 02:47:15 -0700 (PDT) Received: from localhost.localdomain ([213.209.242.222]) by smtp.gmail.com with ESMTPSA id 14sm5713378wml.41.2018.03.28.02.47.14 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 28 Mar 2018 02:47:15 -0700 (PDT) From: Andrea Parri To: Will Deacon , Catalin Marinas , Peter Zijlstra , Ingo Molnar Cc: Linus Torvalds , linux-kernel@vger.kernel.org, Andrea Parri Subject: [PATCH v2 for-4.17 1/3] arm64: Remove smp_mb() from arch_spin_is_locked() Date: Wed, 28 Mar 2018 11:46:59 +0200 Message-Id: <1522230419-12275-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 38b850a73034f ("arm64: spinlock: order spin_{is_locked,unlock_wait} against local locks") added an smp_mb() to arch_spin_is_locked(), in order "to ensure that the lock value is always loaded after any other locks have been taken by the current CPU", and reported one example (the "insane case" in ipc/sem.c) relying on such guarantee. It is however understood (and not documented) that spin_is_locked() is not required to ensure such an ordering guarantee, guarantee that is currently _not_ provided by all implementations/architectures, and that callers rely- ing on such ordering should instead insert suitable memory barriers before acting on the result of spin_is_locked(). Following a recent auditing[1] of the callsites of {,raw_}spin_is_locked() revealing that none of these callers are relying on the ordering guarantee anymore, this commit removes the leading smp_mb() from this primitive thus effectively reverting 38b850a73034f. [1] https://marc.info/?l=linux-kernel&m=151981440005264&w=2 Signed-off-by: Andrea Parri Acked-by: Will Deacon Cc: Will Deacon Cc: Catalin Marinas Cc: Peter Zijlstra Cc: Ingo Molnar Cc: Linus Torvalds --- arch/arm64/include/asm/spinlock.h | 5 ----- 1 file changed, 5 deletions(-) diff --git a/arch/arm64/include/asm/spinlock.h b/arch/arm64/include/asm/spinlock.h index ebdae15d665de..26c5bd7d88d8d 100644 --- a/arch/arm64/include/asm/spinlock.h +++ b/arch/arm64/include/asm/spinlock.h @@ -122,11 +122,6 @@ static inline int arch_spin_value_unlocked(arch_spinlock_t lock) static inline int arch_spin_is_locked(arch_spinlock_t *lock) { - /* - * Ensure prior spin_lock operations to other locks have completed - * on this CPU before we test whether "lock" is locked. - */ - smp_mb(); /* ^^^ */ return !arch_spin_value_unlocked(READ_ONCE(*lock)); } -- 2.7.4