Received: by 10.223.185.116 with SMTP id b49csp4041304wrg; Mon, 26 Feb 2018 10:07:02 -0800 (PST) X-Google-Smtp-Source: AH8x2264fXSBiQhsBTEjpy4k2VPP05SiV22qPUmw/EGjdbPgwLlohEOJCP8l8NJTLVhoQ1fRq1AI X-Received: by 10.101.80.6 with SMTP id f6mr8967630pgo.272.1519668422555; Mon, 26 Feb 2018 10:07:02 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1519668422; cv=none; d=google.com; s=arc-20160816; b=s9hxz6wNvHBdhRW86f8uMgLHDYSt7qHP24Aie1i0sBb1ioq4QL10ps6fp6gU5ESD2h d6g5nXDKYrSvaRqJfFZbT+fFAx20meXVWjNGEENUL6TPaANecTC/HQspAkS1gKYaqGNP 0elvl3SQagf+83xoo+RSAf9xcHFklY1NoX/pttyMF6pmV7tMMGGamZHrmGanjA2xSP2c G7rnLeG60zf4gY1/FRTsfv5MESMm8m6Pe2OoV+7KHaf/yNI9+DMHtqAZ7u123JgnUcMY Grxr31yIxrnlN6K9d/iwKspgL8TLiOqkauDEJauYukndj15C9IJLEZm/FDiDABmyzJH1 i1OA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:arc-authentication-results; bh=586vD/l9Qzot+ixUGadHxSt01sQVZkTfdLKpAFcwbOI=; b=FQs83Bkgy52oEMmqu3IguqXD5qNFKX9+wkjOuvRBNKJtUE3MFmYeDf7aULKwZ4ICUl 6r7gJC+BP7hXIuuBpzB8hO531nBcBilw/RQXHmfmTHQUAsCNHszkwUsztct9ErfO5GIA Ds5m8MljmR9an85jR6N7Oa6Dfkkwuj1yikgmSlS6+EBDZSFoVsUhZ+gbf6++dLSOVZ60 FbzdaGUwtq2IpaKaDvEixFyXSsOMt9clicuBNUWK4AJYKsRE3IL/pB/DuflQrD8zPVFY Pe8FY1XHKk1H/BJ4Q8/zXFNPRqJn9p1hAdEt9+BvceLDlXqgI4Wp53BEp7dGr/HsNUCS pdtg== 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 p61-v6si7088025plb.584.2018.02.26.10.06.46; Mon, 26 Feb 2018 10:07:02 -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 S1751949AbeBZSFz (ORCPT + 99 others); Mon, 26 Feb 2018 13:05:55 -0500 Received: from usa-sjc-mx-foss1.foss.arm.com ([217.140.101.70]:53932 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751908AbeBZSFv (ORCPT ); Mon, 26 Feb 2018 13:05:51 -0500 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.72.51.249]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 0623B15BE; Mon, 26 Feb 2018 10:05:51 -0800 (PST) Received: from edgewater-inn.cambridge.arm.com (usa-sjc-imap-foss1.foss.arm.com [10.72.51.249]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id CB97E3F24D; Mon, 26 Feb 2018 10:05:50 -0800 (PST) Received: by edgewater-inn.cambridge.arm.com (Postfix, from userid 1000) id 6CC4E1AE53BC; Mon, 26 Feb 2018 18:05:52 +0000 (GMT) Date: Mon, 26 Feb 2018 18:05:52 +0000 From: Will Deacon To: mattst88@gmail.com, rth@twiddle.net, 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 Cc: linux-tip-commits@vger.kernel.org Subject: Re: [tip:locking/urgent] locking/xchg/alpha: Clean up barrier usage by using smp_mb() in place of __ASM__MB Message-ID: <20180226180551.GM26147@arm.com> References: <1519291469-5702-1-git-send-email-parri.andrea@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.23 (2014-03-12) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Andrea, I know this is in mainline now, but I think the way you've got the barriers here: On Fri, Feb 23, 2018 at 12:27:54AM -0800, tip-bot for Andrea Parri wrote: > 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; ends up adding unnecessary barriers to the _local variants, which the previous code took care to avoid. That's why I suggesting adding the smp_mb() into the cmpxchg macro rather than the ____cmpxchg variants. I think it's worth spinning another patch to fix this properly. Will