Received: by 10.213.65.68 with SMTP id h4csp1598186imn; Sun, 1 Apr 2018 09:44:49 -0700 (PDT) X-Google-Smtp-Source: AIpwx48MiYkeeJWAfBWILcmI/gTfh9oTn3jNLgsqm4q54wEIKRz27fZe0n25B2CMR+SD5jllAVt9 X-Received: by 10.101.97.205 with SMTP id j13mr4238630pgv.266.1522601089934; Sun, 01 Apr 2018 09:44:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1522601089; cv=none; d=google.com; s=arc-20160816; b=hsbF+WhJaFqGch83Rvtw+iN+sIRZWIcEjtn77/hJloUu3H/eduKP9IuajZMm9Dlw30 /Ta6qPihXKrkXY91G4LGX8k74c3ISlCEGNhPqMcg29Dj/j0t1HAJT5ozh989LxIHy06O gbqbcF7gUeYn3t2xKWHZgTZ3z4MvPuTczqzsbP3kAtYL/0iwvij2Hlpizzh1lxCwFUdO /KQodWgegff1gVbTrWtQLe5CfNOfiGDxj2FoTCJEiMBqt1bg4pPllCTefUR675AzgUZX sYt7DBWgv0xCEd6O14RfkNr7BPrjSY6XZ8ndWAFzA4nj2dEf+hA2UAQGZ/prtvxHxWIo 5J1w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature:arc-authentication-results; bh=PTBkdO1dz/uthYu9owIWOjkcHWyiulZcXL+awfEoBoc=; b=IWnWowKNDBDZXwXjT9djpznRdcVGa2iqOJcRr9uunKY/XzF5NqFENkvDQJ2zXUtFn6 tvWSJU6bF4QVwnHt8cblIPBrTVNGfVt1RkUuFX3bOgAItfJujNpKJOwAv1VALI0K2Xd/ 3hK2btIJiHceuuPcFA+TPqS4I0k5P8sM9LXwf5EgJjtRVEkVBSvyiLUVC79H11ZD0YQk 2kCtzAGpLfjskEdXfxL2lbfGhtHjw9I3PUJKXi2SxUJLOf4y3+pOxq+w7PxgQ4v0WE6I 3tDeMhE1qq1xAMcmEmaQ0qI+c8KSdaD7QZuQaMlE9KYrhEG66XKgh2bXhEG+M5nD0ojj eKXw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=gI5tBRRN; 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 r4si8467898pgt.7.2018.04.01.09.44.36; Sun, 01 Apr 2018 09:44:49 -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=gI5tBRRN; 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 S1753826AbeDAQm7 (ORCPT + 99 others); Sun, 1 Apr 2018 12:42:59 -0400 Received: from mail-wr0-f196.google.com ([209.85.128.196]:45754 "EHLO mail-wr0-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753803AbeDAQm4 (ORCPT ); Sun, 1 Apr 2018 12:42:56 -0400 Received: by mail-wr0-f196.google.com with SMTP id u11so11608411wri.12 for ; Sun, 01 Apr 2018 09:42:56 -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:in-reply-to:references; bh=PTBkdO1dz/uthYu9owIWOjkcHWyiulZcXL+awfEoBoc=; b=gI5tBRRNDk/FTEIZ+qF3LSzYU+IEOYEctn4a5xkEyAaGusY2gjiTE/nYh/tmJNyb0i KJjcC1HQbSSuZc4Wbb+QLOAEAzlWYnWXplVOIN5c2pAxcg3IeN/aKPJc9Va9Cxt+U5RT vtcSjM5YVGwmBtg86mLxOYNCQgyrMPBec03gE= 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:in-reply-to :references; bh=PTBkdO1dz/uthYu9owIWOjkcHWyiulZcXL+awfEoBoc=; b=bJElePF6nZRMCIFmlzOHvsT76eeKDaMtXG2xPXPiAacXjij6erURaGfamWT+znjSQ2 DVtWMu0x4pgcvhA1h8nW4tTrTXq5FylSLUfV2/J2zP8jX7Rvr9FrIWZtYR4L05nQ9cwn yJpRECAW/zBTX6zhd7xr4OdxO0Zh3nNd6h2vUrgmi4qz3gcm8TxbQ099TXn3RE0uAHR5 f5fh2UqDqcA5HG3vtiq9AB1A8vGLi68ea3nY42wVWaqbuEIZp4txOnlRyQ1viitBBvHp zRnte2FlUeRelJ7Z+sOOaKZAvCz8J0vjyRaNRzoDKDweX0k9McYJncn2uP+9ZTHfiOgT AwKw== X-Gm-Message-State: AElRT7HqmnxpIA2/eIjWZzqewiVRihrWS8K5NmQ6C9Gw3cq/DYqsZItf 5Mlwawxc/JxkBReLzimFL8tk1Q== X-Received: by 10.223.177.213 with SMTP id r21mr4727627wra.89.1522600975499; Sun, 01 Apr 2018 09:42:55 -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 a205sm2579302wmf.18.2018.04.01.09.42.53 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Sun, 01 Apr 2018 09:42:54 -0700 (PDT) From: Andrea Parri To: paulmck@linux.vnet.ibm.com, Ingo Molnar , Peter Zijlstra Cc: linux-kernel@vger.kernel.org, Andrea Parri , Catalin Marinas , Will Deacon , Linus Torvalds Subject: [PATCH v3 2/3] arm64: Remove smp_mb() from arch_spin_is_locked() Date: Sun, 1 Apr 2018 18:41:51 +0200 Message-Id: <1522600912-6208-3-git-send-email-andrea.parri@amarulasolutions.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1522600912-6208-1-git-send-email-andrea.parri@amarulasolutions.com> References: <1522600912-6208-1-git-send-email-andrea.parri@amarulasolutions.com> 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 that spin_is_locked() is not required to provide such an ordering guarantee (a guarantee that is currently not provided by all the implementations/archs), and that callers relying 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 callers of {,raw_}spin_is_locked(), revealing that none of them are relying on the ordering guarantee anymore, this commit removes the leading smp_mb() from the primitive thus reverting 38b850a73034f. [1] https://marc.info/?l=linux-kernel&m=151981440005264&w=2 Signed-off-by: Andrea Parri Acked-by: Will Deacon Cc: Catalin Marinas Cc: Will Deacon Cc: Ingo Molnar Cc: Peter Zijlstra Cc: "Paul E. McKenney" 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