Received: by 2002:a25:ab43:0:0:0:0:0 with SMTP id u61csp4387771ybi; Mon, 3 Jun 2019 10:02:01 -0700 (PDT) X-Google-Smtp-Source: APXvYqwTujxrwvXDMQqXfR7mg80dGmDDQbRcpU+V6K46frGe84hYYiQfCGgtgEaz2uRNOyOklhR/ X-Received: by 2002:a63:18e:: with SMTP id 136mr29631458pgb.277.1559581321454; Mon, 03 Jun 2019 10:02:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1559581321; cv=none; d=google.com; s=arc-20160816; b=XHcBgkKRG6UsSCgLl3wk88OleZBOperRaszWeswkz0nYfyx8jTf5QDVEVc4siStOBG 8etYInf5NV3YHweGZT/p4sEO3W+Qxr1kmS+vLMEzy6YWM91+JbmuCrsFcEk8v3Uwol51 lq3Nw35klO9SxB1Rm6P4TdukgpAN9y9Vwj9g4CwxBOwelEccx6JWPmONRYdXnih00qCG fNVPrYIaNBCqt9zK3qkd7GQ4G0zIrIAMPCr0BY0LaoP73B5mutyAwmThSOhAM9J9kHIz qyuiA3lHWVm4lcyp0OqcwNnWBUZm6HcjMI2+kEp+XRUdYxKzAeUsWw8aPyLOXkzkyeZz w0Bg== 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:dkim-signature:dkim-filter; bh=Ow0nLH85zbe48djOl9pgog+NLxZAOuEj5tFHoEAJb3U=; b=s+ISKXpB67FHnzijYDFcMXGxi2bOazzULVtLYIn2IG04V11l15i+sp9tcPckAyyTWK EpyBLk2YBFaNyBh79x1MGuRgjlAgHggB85vllteHiL2t0a2eY+rVn/pN/MVOpc3iity4 SzQ+c+IjyXFw9wDo3cRdwphRfXU3DqP9CnaiVyWYAD4jzpG3CwD7h7B5f6R3K+bEONVi dJPMeXzQVwF3PYb8PDEr68k/ebG7AjGlBJAQ7+IVb9Iyzi8B3kpM8/AvRARrLNzoMfrm 3Mw2GzUmsHEvMGcubCWRvfrgS5bdv4r1cLt677tUvp/Fj15K2kkpcHs/TyF8AqDhCi1C RMGg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@zytor.com header.s=2019051801 header.b="WkAHh/SA"; 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=NONE dis=NONE) header.from=zytor.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id f1si19200511pfb.177.2019.06.03.10.01.43; Mon, 03 Jun 2019 10:02:01 -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=@zytor.com header.s=2019051801 header.b="WkAHh/SA"; 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=NONE dis=NONE) header.from=zytor.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728809AbfFCNhL (ORCPT + 99 others); Mon, 3 Jun 2019 09:37:11 -0400 Received: from terminus.zytor.com ([198.137.202.136]:33487 "EHLO terminus.zytor.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726635AbfFCNhL (ORCPT ); Mon, 3 Jun 2019 09:37:11 -0400 Received: from terminus.zytor.com (localhost [127.0.0.1]) by terminus.zytor.com (8.15.2/8.15.2) with ESMTPS id x53DatYu611218 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NO); Mon, 3 Jun 2019 06:36:55 -0700 DKIM-Filter: OpenDKIM Filter v2.11.0 terminus.zytor.com x53DatYu611218 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=zytor.com; s=2019051801; t=1559569016; bh=Ow0nLH85zbe48djOl9pgog+NLxZAOuEj5tFHoEAJb3U=; h=Date:From:Cc:Reply-To:In-Reply-To:References:To:Subject:From; b=WkAHh/SAoC3f5rbQ3W1LUiV9IbGLex8HI7irAKNpBJuonzJzxgf5mXZnQqW3uBpU3 zeMFL69m83bJtBNkM1/zHJCw7BCuQIDc6e7MAfR0vilgtLGC5D8DuSgTGhUTE646nZ W6x0M6cXTMxdBYCdAdTfPO4MWqD8o6PRZoWOC/6g78kvJ7SmqWScgWnd2yYnAJP6kC rrY8J4/TtRD50JpGBSbUP305DMxn/XS46YM3Iph0Udi+DQG9bVI79C07IQVWrlGxrT RozGQDUpfbDEOWymCo+hw/3Ry29+dCz0kO4tJsOfawMZTJMll48RQgP+W6W6x8PP/6 jlm8Sc/JvwTCg== Received: (from tipbot@localhost) by terminus.zytor.com (8.15.2/8.15.2/Submit) id x53DatD5611215; Mon, 3 Jun 2019 06:36:55 -0700 Date: Mon, 3 Jun 2019 06:36:55 -0700 X-Authentication-Warning: terminus.zytor.com: tipbot set sender to tipbot@zytor.com using -f From: tip-bot for Mark Rutland Message-ID: Cc: hpa@zytor.com, peterz@infradead.org, mark.rutland@arm.com, torvalds@linux-foundation.org, vgupta@synopsys.com, will.deacon@arm.com, linux-kernel@vger.kernel.org, mingo@kernel.org, tglx@linutronix.de Reply-To: vgupta@synopsys.com, will.deacon@arm.com, linux-kernel@vger.kernel.org, hpa@zytor.com, peterz@infradead.org, torvalds@linux-foundation.org, mark.rutland@arm.com, tglx@linutronix.de, mingo@kernel.org In-Reply-To: <20190522132250.26499-6-mark.rutland@arm.com> References: <20190522132250.26499-6-mark.rutland@arm.com> To: linux-tip-commits@vger.kernel.org Subject: [tip:locking/core] locking/atomic, arc: Use s64 for atomic64 Git-Commit-ID: 16fbad086976574b99ea7019c0504d0194e95dc3 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=-2.4 required=5.0 tests=ALL_TRUSTED,BAYES_00, DATE_IN_FUTURE_96_Q,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF autolearn=no autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) 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: 16fbad086976574b99ea7019c0504d0194e95dc3 Gitweb: https://git.kernel.org/tip/16fbad086976574b99ea7019c0504d0194e95dc3 Author: Mark Rutland AuthorDate: Wed, 22 May 2019 14:22:37 +0100 Committer: Ingo Molnar CommitDate: Mon, 3 Jun 2019 12:32:56 +0200 locking/atomic, arc: Use s64 for atomic64 As a step towards making the atomic64 API use consistent types treewide, let's have the arc atomic64 implementation use s64 as the underlying type for atomic64_t, rather than u64, matching the generated headers. Otherwise, there should be no functional change as a result of this patch. Acked-By: Vineet Gupta Signed-off-by: Mark Rutland Signed-off-by: Peter Zijlstra (Intel) Cc: Linus Torvalds Cc: Peter Zijlstra Cc: Thomas Gleixner Cc: Will Deacon Cc: aou@eecs.berkeley.edu Cc: arnd@arndb.de Cc: bp@alien8.de Cc: catalin.marinas@arm.com Cc: davem@davemloft.net Cc: fenghua.yu@intel.com Cc: heiko.carstens@de.ibm.com Cc: herbert@gondor.apana.org.au Cc: ink@jurassic.park.msu.ru Cc: jhogan@kernel.org Cc: linux@armlinux.org.uk Cc: mattst88@gmail.com Cc: mpe@ellerman.id.au Cc: palmer@sifive.com Cc: paul.burton@mips.com Cc: paulus@samba.org Cc: ralf@linux-mips.org Cc: rth@twiddle.net Cc: tony.luck@intel.com Link: https://lkml.kernel.org/r/20190522132250.26499-6-mark.rutland@arm.com Signed-off-by: Ingo Molnar --- arch/arc/include/asm/atomic.h | 41 ++++++++++++++++++++--------------------- 1 file changed, 20 insertions(+), 21 deletions(-) diff --git a/arch/arc/include/asm/atomic.h b/arch/arc/include/asm/atomic.h index 158af079838d..2c75df55d0d2 100644 --- a/arch/arc/include/asm/atomic.h +++ b/arch/arc/include/asm/atomic.h @@ -324,14 +324,14 @@ ATOMIC_OPS(xor, ^=, CTOP_INST_AXOR_DI_R2_R2_R3) */ typedef struct { - aligned_u64 counter; + s64 __aligned(8) counter; } atomic64_t; #define ATOMIC64_INIT(a) { (a) } -static inline long long atomic64_read(const atomic64_t *v) +static inline s64 atomic64_read(const atomic64_t *v) { - unsigned long long val; + s64 val; __asm__ __volatile__( " ldd %0, [%1] \n" @@ -341,7 +341,7 @@ static inline long long atomic64_read(const atomic64_t *v) return val; } -static inline void atomic64_set(atomic64_t *v, long long a) +static inline void atomic64_set(atomic64_t *v, s64 a) { /* * This could have been a simple assignment in "C" but would need @@ -362,9 +362,9 @@ static inline void atomic64_set(atomic64_t *v, long long a) } #define ATOMIC64_OP(op, op1, op2) \ -static inline void atomic64_##op(long long a, atomic64_t *v) \ +static inline void atomic64_##op(s64 a, atomic64_t *v) \ { \ - unsigned long long val; \ + s64 val; \ \ __asm__ __volatile__( \ "1: \n" \ @@ -375,13 +375,13 @@ static inline void atomic64_##op(long long a, atomic64_t *v) \ " bnz 1b \n" \ : "=&r"(val) \ : "r"(&v->counter), "ir"(a) \ - : "cc"); \ + : "cc"); \ } \ #define ATOMIC64_OP_RETURN(op, op1, op2) \ -static inline long long atomic64_##op##_return(long long a, atomic64_t *v) \ +static inline s64 atomic64_##op##_return(s64 a, atomic64_t *v) \ { \ - unsigned long long val; \ + s64 val; \ \ smp_mb(); \ \ @@ -402,9 +402,9 @@ static inline long long atomic64_##op##_return(long long a, atomic64_t *v) \ } #define ATOMIC64_FETCH_OP(op, op1, op2) \ -static inline long long atomic64_fetch_##op(long long a, atomic64_t *v) \ +static inline s64 atomic64_fetch_##op(s64 a, atomic64_t *v) \ { \ - unsigned long long val, orig; \ + s64 val, orig; \ \ smp_mb(); \ \ @@ -444,10 +444,10 @@ ATOMIC64_OPS(xor, xor, xor) #undef ATOMIC64_OP_RETURN #undef ATOMIC64_OP -static inline long long -atomic64_cmpxchg(atomic64_t *ptr, long long expected, long long new) +static inline s64 +atomic64_cmpxchg(atomic64_t *ptr, s64 expected, s64 new) { - long long prev; + s64 prev; smp_mb(); @@ -467,9 +467,9 @@ atomic64_cmpxchg(atomic64_t *ptr, long long expected, long long new) return prev; } -static inline long long atomic64_xchg(atomic64_t *ptr, long long new) +static inline s64 atomic64_xchg(atomic64_t *ptr, s64 new) { - long long prev; + s64 prev; smp_mb(); @@ -495,9 +495,9 @@ static inline long long atomic64_xchg(atomic64_t *ptr, long long new) * the atomic variable, v, was not decremented. */ -static inline long long atomic64_dec_if_positive(atomic64_t *v) +static inline s64 atomic64_dec_if_positive(atomic64_t *v) { - long long val; + s64 val; smp_mb(); @@ -528,10 +528,9 @@ static inline long long atomic64_dec_if_positive(atomic64_t *v) * Atomically adds @a to @v, if it was not @u. * Returns the old value of @v */ -static inline long long atomic64_fetch_add_unless(atomic64_t *v, long long a, - long long u) +static inline s64 atomic64_fetch_add_unless(atomic64_t *v, s64 a, s64 u) { - long long old, temp; + s64 old, temp; smp_mb();