Received: by 10.223.185.116 with SMTP id b49csp1699341wrg; Thu, 22 Feb 2018 01:26:39 -0800 (PST) X-Google-Smtp-Source: AH8x227mBrA/gJ+S7AxKuTzu431xSeby3eAiQnwCxRodl9JATYN4/Is0Dpujkd9BsE8KXu4P38k7 X-Received: by 10.101.85.15 with SMTP id f15mr5092785pgr.153.1519291599060; Thu, 22 Feb 2018 01:26:39 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1519291599; cv=none; d=google.com; s=arc-20160816; b=OWvQLJDitZ+vj8brY2kMj8XXmt79Oubt2HS7NoydkeSk3sqwwVDRGMJgvxQBYcyodV 1Lxip6mGURiUSX14d9RMyLu5lPulX/fGp8hYb+OuEO8PLLuJgaGoTP0VDlKcIsKO+/45 Q6vGaklouPpCd3KVYV95lcqhFhQfg4lMrevJQDc25xbk5H/LU8QTJ+vwlX0xjnXw0XZm x4scTYWm4PGEFWEqlsI8YSO/XsTUR8jVtuMM7q2rJ72i3JYsyHEfEM6QxY8bvIJt+dp7 MNDFfiJdmQjuvJDyknXFeUpmyOw8o5go5YJfFKvC4KYeFEp/yZ7puYNdYU/nCQEUP5Gb CnOg== 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=3iR+uW3XHTPjym7rvrSGWkvP4lGiBG6gpqYXD/7jbAA=; b=UYA6OiKc0hcpxBSGeVuGRsShEwfUFAmwgmIyRX0ZYmO5r+7NJV7o9fBMyVQmrIH9Lr C2RQpaUj06rV57uTTD08d4BL3Ws/l3HxExDOBab2yPeWa59igyBypEHyTDTWuU5FsBWo VYv4KhIGwPzTtHGuE8oM2yxSSOx35sTLfn4FLNXzE+p/oSpvj9TimRydBFRVEh7gUk2v F7tzzUSNNQHiDOu5SRQ4u87LwpRW26oYYZx7mfu3QOoviE4Y0VgVMzGW4hoCoaX2zwIQ kExNOGlX9an4rLqSzp0NjMOWRUs2ViOlfVR2YygZT/iIXV0ZO26NW+e4pOG0Jr702the pADw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=MuCyxSSA; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id e16si4695889pgv.581.2018.02.22.01.26.24; Thu, 22 Feb 2018 01:26:39 -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; dkim=pass header.i=@gmail.com header.s=20161025 header.b=MuCyxSSA; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753174AbeBVJYq (ORCPT + 99 others); Thu, 22 Feb 2018 04:24:46 -0500 Received: from mail-wm0-f66.google.com ([74.125.82.66]:38585 "EHLO mail-wm0-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752991AbeBVJYp (ORCPT ); Thu, 22 Feb 2018 04:24:45 -0500 Received: by mail-wm0-f66.google.com with SMTP id z9so2372860wmb.3; Thu, 22 Feb 2018 01:24:44 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id; bh=3iR+uW3XHTPjym7rvrSGWkvP4lGiBG6gpqYXD/7jbAA=; b=MuCyxSSAsBvdReCh9MI+yYoWjWP/bXtiz1jtHXr319r90hQYftHozM6kjQOVPYh5me 8Y//qwk5oD+kdQWnWBBNIA7/1T0+F6T+qAEn1xd9+xvp0x840OJ4/zJCXawddv0PUwx2 Ik3GM7XLgoX7rhacTyLkzf7ZnKUUvC/azaTyHlj9eVqnaog9niLuOkgMjGgsg2mm7TQ2 vJ3SQPDMiel0sa2jJM73zwj2TOIblqrsfA95VWAxlfNP7m1jRbwE2UeMEUJ0rrUPZdsY myoMtmOfIDh6qYDmWWhGEEQ30OOkc88O4NxDHQjoiXXLq9C2/Pmh/b/OWx6hr0uo7gR6 69wA== 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=3iR+uW3XHTPjym7rvrSGWkvP4lGiBG6gpqYXD/7jbAA=; b=ZQo9MA90UQ30ULnrwgRt3iylFlKpgcgSVe4zdn8k5NyFt5sx5+ge9mjLtRh5rZ4KZt wi8IqZIBKBQwT8C2v5Y8lURtt4FPULBBOC053hj61wq0BlVZgyCVnMwpKqiXnm+1OCW3 R+0Ih3mB4Wilbg4DCcBGBa5EtccYXXtGbMpm5EeIGkLxzVSO+QRkHMvsVZiv9KhkR04W Ce6aFNOajyj/KIyS75zfJRcUskauFhhsI5VtUCEu/cFScuglLTe1wsNMRpadERH1xkqx jeYSlq3li/R7ds9ofm3tx+AjQyEm5qQ1ZafrYGpnKVgB2g6FFhZRVrj/EKu231hRdN6C P1Bw== X-Gm-Message-State: APf1xPBGD/Z5jTRJcrVX/xoX/mEio40oTml6M7FUmzxgrpXIzK7aNwP1 GiCegGXWWzfqp70c8yCTlIKGEp5S X-Received: by 10.28.63.81 with SMTP id m78mr4725549wma.102.1519291483515; Thu, 22 Feb 2018 01:24:43 -0800 (PST) Received: from andrea.amarulasolutions.com (85.100.broadband17.iol.cz. [109.80.100.85]) by smtp.gmail.com with ESMTPSA id r1sm30815398wmg.22.2018.02.22.01.24.42 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 22 Feb 2018 01:24:43 -0800 (PST) From: Andrea Parri To: Ingo Molnar , Peter Zijlstra Cc: Andrea Parri , "Paul E . McKenney" , Alan Stern , Ivan Kokshaysky , Matt Turner , Richard Henderson , linux-alpha@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 1/2] locking/xchg/alpha: Use smp_mb() in place of __ASM__MB Date: Thu, 22 Feb 2018 10:24:29 +0100 Message-Id: <1519291469-5702-1-git-send-email-parri.andrea@gmail.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 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 Cc: Peter Zijlstra Cc: Paul E. McKenney Cc: Alan Stern Cc: Ivan Kokshaysky Cc: Matt Turner Cc: Richard Henderson Cc: linux-alpha@vger.kernel.org Cc: linux-kernel@vger.kernel.org --- 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 46ebf14aed4e5..8a2b331e43feb 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 e2660866ce972..e1facf6fc2446 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; } -- 2.7.4