Received: by 10.213.65.68 with SMTP id h4csp1232128imn; Mon, 26 Mar 2018 03:38:51 -0700 (PDT) X-Google-Smtp-Source: AG47ELvaQnGkBdhReft52Z7XAzuw0OlF6230ICuUvZf4C5y8I4O4Qliez3JsJqNQPX6ADXsnUol9 X-Received: by 2002:a17:902:8206:: with SMTP id x6-v6mr33773314pln.256.1522060731754; Mon, 26 Mar 2018 03:38:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1522060731; cv=none; d=google.com; s=arc-20160816; b=WZKjvGNXWwLislIHPH0igvw1Gi8u7GZNyG/CMqb24A7Yq/c8KgOMzFcDLrmyehauTT p40SThiTQV5ruw0FHwiJh5cfmiB/KjfloAJ6Ra0jrX+WhpVRyQIO0DNnsb9/ivfv3MrX 6iUtTzgIgOb8h+pTEL+CPKHetGlmkgt4WZy1mtXnCULRCiBRaTmy3xafoet6HuiShL83 ye65Ric/lkE0LdD+TOumg8SetTT5DrfAPhisRfS9hXdLEzv0VmJJPxnSSLwb1R7TNq42 TCoXNsilDf7c9UwHokdR9QmWARQQS+4IR9HiWOFi6yZm8B2ux/cA9mdWr+FRXs+S0Pli UpRw== 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=8yMI/dvwp7UQpLC9nivK4kSktMrlptu05B6M/Kz8kVI=; b=GUVT1NRI463N31X8sZj93DGPqdaUh+vP81OAp+5n1Vge9ZVWLy59SMs8yVY9JsjAHB 1Xa2RJKS5PQJ50t2u6ZLPhcUWAv6aSnhG2teV0vCSL6KjZLPlHtAgveR2oXW1nCRYnFh 7WdovG8MgFCp/PRV1pWRojQkLNZjbAfLdqqIym/09q2QYdchqdXjSVxJuglbenuO/SHC 4Csg8IW22sgacNnl9phYLEU6znhP1GxeTVgUh4UmSPYQPnVvcjm7rtC+ydLOFcpO+eo8 JMHrArdydy0jH1OOoFHOGk3exvKgIWMD0iorXLFSxAQ8/QrvTFfersd6LC89Rqk2RAu8 nVdw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=f40fyClt; 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 b22si11324941pfi.244.2018.03.26.03.38.37; Mon, 26 Mar 2018 03:38:51 -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=f40fyClt; 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 S1751138AbeCZKhn (ORCPT + 99 others); Mon, 26 Mar 2018 06:37:43 -0400 Received: from mail-wr0-f196.google.com ([209.85.128.196]:32973 "EHLO mail-wr0-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750984AbeCZKhl (ORCPT ); Mon, 26 Mar 2018 06:37:41 -0400 Received: by mail-wr0-f196.google.com with SMTP id z73so18391513wrb.0 for ; Mon, 26 Mar 2018 03:37:41 -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=8yMI/dvwp7UQpLC9nivK4kSktMrlptu05B6M/Kz8kVI=; b=f40fyCltMURY3FjXC2YZfbO8oHghu1Cvt2I0Jvrzfbi9cn/VaI0kCaa4JyzQsrIBUN DYaeMadx+qS9Tg2qlA7WvgROlxoic/MXOiDnlF/7XdmtVZbxYL4OLc1B1sDNQG5GdWRB Pal7UEjViatu41SI5fBFp5D0Zl1GxG32zLa7w= 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=8yMI/dvwp7UQpLC9nivK4kSktMrlptu05B6M/Kz8kVI=; b=iJmUH3YV/Xbu3wzO1HfXixFjySmD6mVrR+RJ9zyUUGo4r1vfmk1XtcHC+Wzb8wH28P RMCEzKGixaaFapYrN78BJZpSeU4hHltF5xOYB6R2Y+ycwGk/BY8CJY7+bi6XLpbTfTYO QjfAa5IU40acYpW1nnBN+Tjb11mUYRer4YZVkHNVr80s630Hf8n1Z7YPSBPpfqg+WjPk GE7Vr1R8mDETOqOqz8Iikfri06HO8Rayqzui/h4mPUBtEHaJtqJq8rDPvdT0OD1Shdym Hqj/bDFrLstgzgzB+NvLJ4UIf/wL78EngmOGkXc3g+tPMiTVS6wcYu2kd9NAdaSy2iov 4wmw== X-Gm-Message-State: AElRT7G7LQ21wQxv1OqQxS59UcrfruzG3QNz+x+VyUEtB/PV9YgS7aMx tKS9ed9UxFyltXMRhSWwAXvIFQ== X-Received: by 10.223.226.71 with SMTP id n7mr3059437wri.117.1522060660751; Mon, 26 Mar 2018 03:37:40 -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 s26sm16357461wrb.10.2018.03.26.03.37.39 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 26 Mar 2018 03:37:40 -0700 (PDT) From: Andrea Parri To: Will Deacon , Catalin Marinas , Peter Zijlstra , Ingo Molnar Cc: linux-kernel@vger.kernel.org, Andrea Parri , Linus Torvalds Subject: [PATCH for-4.17 1/2] arm64: Remove smp_mb() from arch_spin_is_locked() Date: Mon, 26 Mar 2018 12:37:21 +0200 Message-Id: <1522060641-6986-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 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