Received: by 2002:ac0:a581:0:0:0:0:0 with SMTP id m1-v6csp1003078imm; Wed, 4 Jul 2018 09:38:28 -0700 (PDT) X-Google-Smtp-Source: AAOMgpfAFDw5tpWThvHuwTyoBUY0GhR1FVqRgFPEqlyFETOT4oe7+LvDlEZuGEwrNPu7zcznb066 X-Received: by 2002:a62:c410:: with SMTP id y16-v6mr2903469pff.161.1530722308415; Wed, 04 Jul 2018 09:38:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1530722308; cv=none; d=google.com; s=arc-20160816; b=r61wpPNhDU3/4UAgheJ804AmpyN2HNB0pJ3zDir6WTNUg1C+Y3x990ZCSh4KHIm773 XeVcOeJofgFHmmhvlVyTK4PqjpWkyGPP3QPAmSce4yyRsDRYQ+pvw9UMsXMclJMqBJNP grdSGXSeybrsp4BfSbRj8mqcv38Q43b/5B8YJKGZBYV8SBUG27ZnRPnauQFwrr8cC/5Y j2mVPAE669dJcmtzuWL2cOorD5/p47pw5JXQ0Lhv/Ty3shfvrurpK1GpLxxKTigXN4X4 l6YE1RJ6EOZZSFePd/Gh+lqHugHQW1ZCF1xMGF/9HRYhVHk3O9SzwwSdhsKHh7BJrekA L6Eg== 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=3IRnSKGJyG02MHIZJJiy+kZtQSatvUzmVIJAh8eu6Yk=; b=OSqDXBZKCDnsTm1XVBYNxu5xEzQIWpxaLKK0r3CVz8oqjI/jGlm7RdpUNAiYjRtAws EHwX37eESuT6TpgOnkJqEb9ZM8Z4CWzUiIJ0LtQIhc/qqhgiNDUTQ174u187N6NV8htq feAFE6uffReYER1FZ9Y8wOA5WkWsnMVRwka16+saXZ7EkI3K+FPUQQLuuKqHPdyPELMf WjMJTsAVLL7oLPHSX/GlbcPxN34e5Zt8r6HSYr5UpF0lfNvUvDt22m6cxJA2WHsNk9Fn 5zGWhq/qFvFi799seCJcpZdTy5gzKV+wPMoO7/OYWoAqb12FePmjAGFQyDk3NqcYRFPx 0XzQ== 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 n15-v6si3889770pgc.309.2018.07.04.09.38.13; Wed, 04 Jul 2018 09:38:28 -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; 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 S1752496AbeGDQh2 (ORCPT + 99 others); Wed, 4 Jul 2018 12:37:28 -0400 Received: from foss.arm.com ([217.140.101.70]:40574 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752019AbeGDQh1 (ORCPT ); Wed, 4 Jul 2018 12:37:27 -0400 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 021BE1595; Wed, 4 Jul 2018 09:37:27 -0700 (PDT) Received: from lakrids.cambridge.arm.com (usa-sjc-imap-foss1.foss.arm.com [10.72.51.249]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id E845F3F5AD; Wed, 4 Jul 2018 09:37:25 -0700 (PDT) Date: Wed, 4 Jul 2018 17:37:23 +0100 From: Mark Rutland To: Will Deacon Cc: linux-kernel@vger.kernel.org, peterz@infradead.org, boqun.feng@gmail.com, Catalin Marinas Subject: Re: [PATCHv2 11/11] arm64: use instrumented atomics Message-ID: <20180704163721.lxuynjd4dflcyucm@lakrids.cambridge.arm.com> References: <20180625105952.3756-1-mark.rutland@arm.com> <20180625105952.3756-12-mark.rutland@arm.com> <20180704152422.GK4828@arm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20180704152422.GK4828@arm.com> User-Agent: NeoMutt/20170113 (1.7.2) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Jul 04, 2018 at 04:24:22PM +0100, Will Deacon wrote: > On Mon, Jun 25, 2018 at 11:59:52AM +0100, Mark Rutland wrote: > > Now that the generic atomic headers provide instrumented wrappers of all > > the atomics implemented by arm64, let's migrate arm64 over to these. > > > > The additional instrumentation will help to find bugs (e.g. when fuzzing > > with Syzkaller). > > > > Mostly this change involes adding an arch_ prefix to a number of > > function names and macro definitions. Due to the way we call the LL/SC > > atomics via the LSE atomic wrappers, this requires adding an arch_ > > prefix to some arm64-specific atomic primitives. > > > > Some unusual whitespace in the cmpxchg wrappers is fixed up as part of > > the change. > > > > Signed-off-by: Mark Rutland > > Cc: Catalin Marinas > > Cc: Will Deacon > > --- > > arch/arm64/include/asm/atomic.h | 237 ++++++++++++++++++----------------- > > arch/arm64/include/asm/atomic_lse.h | 51 ++++---- > > arch/arm64/include/asm/cmpxchg.h | 106 ++++++++-------- > > arch/arm64/include/asm/lse.h | 2 +- > > arch/arm64/include/asm/sync_bitops.h | 16 +-- > > 5 files changed, 212 insertions(+), 200 deletions(-) > > This is mostly straightforward, but the cmpxchg/cmpxchg_double cases grow > an 'arch' prefix which suggests that they're part of the API with the core > atomics and also makes them horribly ugly. I agree this isn't nice. > This just looks to be an artifact of __LL_SC_CALL pasting that in. Can > you drop that auto pasting of 'arch', and instead change the > non-cmpxchg-case callers of the macro to include the arch prefix > instead, please? That leads to having an arch___llsc_ prefix in some cases, which is equally hideous. How about I remove the prefix mangling entirely, and always give functions an __llsc_ or __lse_ prefix. Then, unify the two in our atomic.h with: #ifdef CONFIG_ARM64_LSE #define ATOMIC_PFX __lse_ #else #define ATOMIC_PFX __ll_sc_ #endif #define arch_atomic_foo ATOMIC_PFX##atomic_foo #define arch_atomic_bar ATOMIC_PFX##atomic_bar ... which clearly delineates the implementation from core API. Does that sound ok to you? Thanks, Mark.