Received: by 10.223.185.116 with SMTP id b49csp417052wrg; Fri, 23 Feb 2018 00:29:55 -0800 (PST) X-Google-Smtp-Source: AH8x227uQC5d4kiN90KIGs6OT5fVdf1XLe0A0+6rCnNnyf0Qw5SUG6WmM+OwKHoFgD4PBeeeyr3l X-Received: by 10.101.90.203 with SMTP id d11mr820905pgt.366.1519374595289; Fri, 23 Feb 2018 00:29:55 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1519374595; cv=none; d=google.com; s=arc-20160816; b=v2FmZ5rVLsEF9Z3jQfuyKeQfL3jI3QRa8M+3okmq9l17Fq+iccGm093s0Iv4Tc/7ZC gRzmMW55H9R0RkD3yglqNWbQIjQzyBD0V9G2MF7/QwyI9RJE/OuNXFCHCzvKykagAmKl OyugDCIRbKt2d9CHl7F0t/RFVUiGBnYe1GrfEByqLvuK3+UsRAFJnwcCgDh+r9MtJ4G+ PXHlVtcVLefD3tUA7M6CIcsgAmvlV96TQsrOBaVpl+dr8o4fMU/OUg1fNYO8FMzKMrC3 4BSUSkVtQlk8+jK8nSo4ElAZDDuZi0KrkmN9PFP7Ksmlha7VpsNZ/g7vW+bqD2xYULwd 9Mvg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-disposition :content-transfer-encoding:mime-version:robot-unsubscribe:robot-id :git-commit-id:subject:to:references:in-reply-to:reply-to:cc :message-id:from:date:arc-authentication-results; bh=ptB7jQr31/5JdSEadqjyJFmUaZ34SoT6+CrlqZBk4V8=; b=k7wOkkM0Y5aeTz0s7Jl7/e50aykEfKj5vMXbdhgkvtwjW+3QdZTZsBvP4wFlpIL3Z5 S7GP4kNNJBq0zqJSovp1+Hp30KrVDKyjSLg5BFvv8tp/+qhBPrCpUtAOCZ2hAEuim7ho g0N3UtzB1wp59u/JMZdaBRdWFP3jpaeYAFBNY+g2pup2xjiN1Sgl3KNqMYXBWijo+XK8 8QZsDch8Ycong3yDIqlpV7lYKDaTS4kksXfLT1JgMZCyYUfu44YZGmgjYIvGz4q85LHN Av426qqbX8go6MnjH8xsw17SgZj8hZ08OmbOJxqXOw3NE0HKcmIFmmlk+uJMckJ9TH7C 6KRA== ARC-Authentication-Results: i=1; mx.google.com; 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 i13si1207333pgq.508.2018.02.23.00.29.39; Fri, 23 Feb 2018 00:29:55 -0800 (PST) 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; 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 S1751674AbeBWI2f (ORCPT + 99 others); Fri, 23 Feb 2018 03:28:35 -0500 Received: from terminus.zytor.com ([198.137.202.136]:56683 "EHLO terminus.zytor.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750796AbeBWI2d (ORCPT ); Fri, 23 Feb 2018 03:28:33 -0500 Received: from terminus.zytor.com (localhost [127.0.0.1]) by terminus.zytor.com (8.15.2/8.15.2) with ESMTP id w1N8Rugv010880; Fri, 23 Feb 2018 00:27:56 -0800 Received: (from tipbot@localhost) by terminus.zytor.com (8.15.2/8.15.2/Submit) id w1N8Rsew010873; Fri, 23 Feb 2018 00:27:54 -0800 Date: Fri, 23 Feb 2018 00:27:54 -0800 X-Authentication-Warning: terminus.zytor.com: tipbot set sender to tipbot@zytor.com using -f From: tip-bot for Andrea Parri Message-ID: Cc: will.deacon@arm.com, rth@twiddle.net, mattst88@gmail.com, tglx@linutronix.de, hpa@zytor.com, parri.andrea@gmail.com, ink@jurassic.park.msu.ru, stern@rowland.harvard.edu, paulmck@linux.vnet.ibm.com, mingo@kernel.org, linux-kernel@vger.kernel.org, peterz@infradead.org, torvalds@linux-foundation.org, akpm@linux-foundation.org Reply-To: mattst88@gmail.com, rth@twiddle.net, will.deacon@arm.com, tglx@linutronix.de, hpa@zytor.com, stern@rowland.harvard.edu, parri.andrea@gmail.com, ink@jurassic.park.msu.ru, akpm@linux-foundation.org, paulmck@linux.vnet.ibm.com, torvalds@linux-foundation.org, linux-kernel@vger.kernel.org, peterz@infradead.org, mingo@kernel.org In-Reply-To: <1519291469-5702-1-git-send-email-parri.andrea@gmail.com> References: <1519291469-5702-1-git-send-email-parri.andrea@gmail.com> To: linux-tip-commits@vger.kernel.org Subject: [tip:locking/urgent] locking/xchg/alpha: Clean up barrier usage by using smp_mb() in place of __ASM__MB Git-Commit-ID: 79d442461df7478cdd0c50d9b8a76f431f150fa3 X-Mailer: tip-git-log-daemon Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset=UTF-8 Content-Disposition: inline X-Spam-Status: No, score=-0.6 required=5.0 tests=ALL_TRUSTED,BAYES_00, FREEMAIL_FORGED_REPLYTO,FREEMAIL_REPLYTO_END_DIGIT autolearn=no autolearn_force=no version=3.4.1 X-Spam-Checker-Version: SpamAssassin 3.4.1 (2015-04-28) on terminus.zytor.com Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Commit-ID: 79d442461df7478cdd0c50d9b8a76f431f150fa3 Gitweb: https://git.kernel.org/tip/79d442461df7478cdd0c50d9b8a76f431f150fa3 Author: Andrea Parri AuthorDate: Thu, 22 Feb 2018 10:24:29 +0100 Committer: Ingo Molnar CommitDate: Fri, 23 Feb 2018 08:38:15 +0100 locking/xchg/alpha: Clean up barrier usage by using smp_mb() in place of __ASM__MB Replace each occurrence of __ASM__MB with a (trailing) smp_mb() in xchg(), cmpxchg(), and remove the now unused __ASM__MB definitions; this improves readability, with no additional synchronization cost. Suggested-by: Will Deacon Signed-off-by: Andrea Parri Acked-by: Paul E. McKenney Cc: Alan Stern Cc: Andrew Morton Cc: Ivan Kokshaysky Cc: Linus Torvalds Cc: Matt Turner Cc: Peter Zijlstra Cc: Richard Henderson Cc: Thomas Gleixner Cc: linux-alpha@vger.kernel.org Link: http://lkml.kernel.org/r/1519291469-5702-1-git-send-email-parri.andrea@gmail.com Signed-off-by: Ingo Molnar --- arch/alpha/include/asm/cmpxchg.h | 6 ------ arch/alpha/include/asm/xchg.h | 16 ++++++++-------- 2 files changed, 8 insertions(+), 14 deletions(-) diff --git a/arch/alpha/include/asm/cmpxchg.h b/arch/alpha/include/asm/cmpxchg.h index 46ebf14aed4e..8a2b331e43fe 100644 --- a/arch/alpha/include/asm/cmpxchg.h +++ b/arch/alpha/include/asm/cmpxchg.h @@ -6,7 +6,6 @@ * Atomic exchange routines. */ -#define __ASM__MB #define ____xchg(type, args...) __xchg ## type ## _local(args) #define ____cmpxchg(type, args...) __cmpxchg ## type ## _local(args) #include @@ -33,10 +32,6 @@ cmpxchg_local((ptr), (o), (n)); \ }) -#ifdef CONFIG_SMP -#undef __ASM__MB -#define __ASM__MB "\tmb\n" -#endif #undef ____xchg #undef ____cmpxchg #define ____xchg(type, args...) __xchg ##type(args) @@ -64,7 +59,6 @@ cmpxchg((ptr), (o), (n)); \ }) -#undef __ASM__MB #undef ____cmpxchg #endif /* _ALPHA_CMPXCHG_H */ diff --git a/arch/alpha/include/asm/xchg.h b/arch/alpha/include/asm/xchg.h index e2660866ce97..e1facf6fc244 100644 --- a/arch/alpha/include/asm/xchg.h +++ b/arch/alpha/include/asm/xchg.h @@ -28,12 +28,12 @@ ____xchg(_u8, volatile char *m, unsigned long val) " or %1,%2,%2\n" " stq_c %2,0(%3)\n" " beq %2,2f\n" - __ASM__MB ".subsection 2\n" "2: br 1b\n" ".previous" : "=&r" (ret), "=&r" (val), "=&r" (tmp), "=&r" (addr64) : "r" ((long)m), "1" (val) : "memory"); + smp_mb(); return ret; } @@ -52,12 +52,12 @@ ____xchg(_u16, volatile short *m, unsigned long val) " or %1,%2,%2\n" " stq_c %2,0(%3)\n" " beq %2,2f\n" - __ASM__MB ".subsection 2\n" "2: br 1b\n" ".previous" : "=&r" (ret), "=&r" (val), "=&r" (tmp), "=&r" (addr64) : "r" ((long)m), "1" (val) : "memory"); + smp_mb(); return ret; } @@ -72,12 +72,12 @@ ____xchg(_u32, volatile int *m, unsigned long val) " bis $31,%3,%1\n" " stl_c %1,%2\n" " beq %1,2f\n" - __ASM__MB ".subsection 2\n" "2: br 1b\n" ".previous" : "=&r" (val), "=&r" (dummy), "=m" (*m) : "rI" (val), "m" (*m) : "memory"); + smp_mb(); return val; } @@ -92,12 +92,12 @@ ____xchg(_u64, volatile long *m, unsigned long val) " bis $31,%3,%1\n" " stq_c %1,%2\n" " beq %1,2f\n" - __ASM__MB ".subsection 2\n" "2: br 1b\n" ".previous" : "=&r" (val), "=&r" (dummy), "=m" (*m) : "rI" (val), "m" (*m) : "memory"); + smp_mb(); return val; } @@ -150,12 +150,12 @@ ____cmpxchg(_u8, volatile char *m, unsigned char old, unsigned char new) " stq_c %2,0(%4)\n" " beq %2,3f\n" "2:\n" - __ASM__MB ".subsection 2\n" "3: br 1b\n" ".previous" : "=&r" (prev), "=&r" (new), "=&r" (tmp), "=&r" (cmp), "=&r" (addr64) : "r" ((long)m), "Ir" (old), "1" (new) : "memory"); + smp_mb(); return prev; } @@ -177,12 +177,12 @@ ____cmpxchg(_u16, volatile short *m, unsigned short old, unsigned short new) " stq_c %2,0(%4)\n" " beq %2,3f\n" "2:\n" - __ASM__MB ".subsection 2\n" "3: br 1b\n" ".previous" : "=&r" (prev), "=&r" (new), "=&r" (tmp), "=&r" (cmp), "=&r" (addr64) : "r" ((long)m), "Ir" (old), "1" (new) : "memory"); + smp_mb(); return prev; } @@ -200,12 +200,12 @@ ____cmpxchg(_u32, volatile int *m, int old, int new) " stl_c %1,%2\n" " beq %1,3f\n" "2:\n" - __ASM__MB ".subsection 2\n" "3: br 1b\n" ".previous" : "=&r"(prev), "=&r"(cmp), "=m"(*m) : "r"((long) old), "r"(new), "m"(*m) : "memory"); + smp_mb(); return prev; } @@ -223,12 +223,12 @@ ____cmpxchg(_u64, volatile long *m, unsigned long old, unsigned long new) " stq_c %1,%2\n" " beq %1,3f\n" "2:\n" - __ASM__MB ".subsection 2\n" "3: br 1b\n" ".previous" : "=&r"(prev), "=&r"(cmp), "=m"(*m) : "r"((long) old), "r"(new), "m"(*m) : "memory"); + smp_mb(); return prev; }