From patchwork Tue Nov 13 23:39:23 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ard Biesheuvel X-Patchwork-Id: 10681655 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 9E65C13BF for ; Tue, 13 Nov 2018 23:41:19 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 8EDA02B486 for ; Tue, 13 Nov 2018 23:41:19 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 82EB82B49F; Tue, 13 Nov 2018 23:41:19 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-3.6 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_LOW autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id D8FC82B486 for ; Tue, 13 Nov 2018 23:41:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:References: In-Reply-To:Message-Id:Date:Subject:To:From:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Owner; bh=bF9tcY2E0/I0ycLbBst7NgTwjKnLcqobY8N5NmEcid8=; b=UFomlP9q4AF9GJ8Xdq21cCoxU7 lHh0QLR5yAn56zfbpIzvp5srRPiwcvHfMdFp5OGnot+6Eyc/6DqJOsPNjDZk8G0Icm6VhIL5knNYc EsitCBlyxIGKIY7rju6wOoho1qp3F42Aq0QHaD/dYiOOlY9YOnzjGmGmpPuxkDxbfcD1a13/7rhLu NNS1Df9RjY65Md8wF1tI3GC8DGs4v5omh44bz2q49dlMbZzvvh1FFO53jNJ7OWkKEGpZ3uvBtakx2 QOxnINzaDFAQEKXBQbsibxttQ+zfWrUlYnL9cwg7XiuVKYEq+rXkrMTIyTxhN12Xd7H0trpk0pPth lt20UriQ==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1gMiJ1-0002mN-Qw; Tue, 13 Nov 2018 23:41:15 +0000 Received: from mail-pl1-x644.google.com ([2607:f8b0:4864:20::644]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1gMiIR-000267-MP for linux-arm-kernel@lists.infradead.org; Tue, 13 Nov 2018 23:40:41 +0000 Received: by mail-pl1-x644.google.com with SMTP id x21-v6so4081596pln.9 for ; Tue, 13 Nov 2018 15:40:29 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=EiWHU7WDmlm14ae/CoWEFjcUGETgN/vGzRmX463/lV8=; b=WlPKPnwR5mDnvLp+iF2xRjiN7mYVZ1Wb+YA5VrKJDBj8XIZIk8tnG/2pVmMdUlA5bV QqM/3TQ9a0i8+TNDyu4Sm57Hg449lhAJ6Yy+78ZHwyaDeCiHhJHsqRq/jsQlIFr+UBS5 nwy+h6hZA+gETLWRKm/6cy6YAhZq09fN6axLc= 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:in-reply-to :references; bh=EiWHU7WDmlm14ae/CoWEFjcUGETgN/vGzRmX463/lV8=; b=NIihxcg80Ztcdl+URvEcNhztundo68T1bhsTCiGJQAdUm3yEbQy0h/q+PKKGa9O7LD 0G3OonyefOQJ7k9kAWnaB6+JZV3iPyv6/ftydb+8JOBcttiGpI9LVSbAKlnzmyWRsnyp WH1I47qTWtnxm4NXqLfbAC7kAKTw32nWlfcpFXRQR9GMbmXXI2NC1bL6cn+kYWQjxujE QtKl1HvOz9/N78Q2KGQg3RsS9khfLW25Z/Z3GkyW0lY9lDiRUobQ/h7v4M8ejJYA6Swr 1+h6cp2mwITeMCrYoS+fUol8OMNX9MkW885Mgec919IOV/J8ciYgwjxn+mDLmvc3L3Ag pwiQ== X-Gm-Message-State: AGRZ1gJK38uBfl4THqLbWLfuSPYtD5Acyy7Pw+ArwTvZLMnImeHxRVkF OaSHD8Cwxr2Mih1buLlYjux37X/BxyKGyg== X-Google-Smtp-Source: AJdET5dxFD0guvO6Gh98FYBN6f5X7OTieOzXz568JuSTUq6+jv3Gxl+Xkm2Zhou/rm7QJegwbT/xGw== X-Received: by 2002:a17:902:3084:: with SMTP id v4-v6mr6992884plb.326.1542152428352; Tue, 13 Nov 2018 15:40:28 -0800 (PST) Received: from mba13.psav.com ([64.114.255.97]) by smtp.gmail.com with ESMTPSA id c7-v6sm26270493pfh.25.2018.11.13.15.40.27 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 13 Nov 2018 15:40:27 -0800 (PST) From: Ard Biesheuvel To: linux-arm-kernel@lists.infradead.org Subject: [PATCH 3/3] arm64/atomics: remove out of line LL/SC alternatives Date: Tue, 13 Nov 2018 15:39:23 -0800 Message-Id: <20181113233923.20098-4-ard.biesheuvel@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20181113233923.20098-1-ard.biesheuvel@linaro.org> References: <20181113233923.20098-1-ard.biesheuvel@linaro.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20181113_154039_726777_E016F177 X-CRM114-Status: GOOD ( 13.53 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: mark.rutland@arm.com, catalin.marinas@arm.com, Ard Biesheuvel , will.deacon@arm.com, marc.zyngier@arm.com MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP Now that we are no longer emitting calls to the out of line LL/SC alternatives from the LSE implementation, drop the exports, the prototype decorations and the Makefile rules that build the object file that contains them. Signed-off-by: Ard Biesheuvel --- arch/arm64/include/asm/atomic_ll_sc.h | 48 ++++++-------------- arch/arm64/include/asm/lse.h | 9 ---- arch/arm64/lib/Makefile | 19 -------- arch/arm64/lib/atomic_ll_sc.c | 3 -- 4 files changed, 15 insertions(+), 64 deletions(-) diff --git a/arch/arm64/include/asm/atomic_ll_sc.h b/arch/arm64/include/asm/atomic_ll_sc.h index 10d0b7360747..0aa65d7a9f27 100644 --- a/arch/arm64/include/asm/atomic_ll_sc.h +++ b/arch/arm64/include/asm/atomic_ll_sc.h @@ -85,8 +85,7 @@ #if !(defined(CONFIG_ARM64_LSE_ATOMICS) && defined(CONFIG_AS_LSE)) #define ATOMIC_OP(op, asm_op) \ -__LL_SC_INLINE void \ -__LL_SC_PREFIX(atomic_##op(int i, atomic_t *v)) \ +static inline void atomic_##op(int i, atomic_t *v)) \ { \ unsigned long tmp; \ int result; \ @@ -96,11 +95,9 @@ __LL_SC_PREFIX(atomic_##op(int i, atomic_t *v)) \ : [res]"=&r" (result), [tmp]"=&r" (tmp), [v]"+Q" (v->counter) \ : [i]"Ir" (i)); \ } \ -__LL_SC_EXPORT(atomic_##op); #define ATOMIC_OP_RETURN(name, mb, acq, rel, cl, op, asm_op) \ -__LL_SC_INLINE int \ -__LL_SC_PREFIX(atomic_##op##_return##name(int i, atomic_t *v)) \ +static inline int atomic_##op##_return##name(int i, atomic_t *v) \ { \ unsigned long tmp; \ int result; \ @@ -113,11 +110,9 @@ __LL_SC_PREFIX(atomic_##op##_return##name(int i, atomic_t *v)) \ \ return result; \ } \ -__LL_SC_EXPORT(atomic_##op##_return##name); #define ATOMIC_FETCH_OP(name, mb, acq, rel, cl, op, asm_op) \ -__LL_SC_INLINE int \ -__LL_SC_PREFIX(atomic_fetch_##op##name(int i, atomic_t *v)) \ +static inline int atomic_fetch_##op##name(int i, atomic_t *v) \ { \ unsigned long tmp; \ int val, result; \ @@ -131,7 +126,6 @@ __LL_SC_PREFIX(atomic_fetch_##op##name(int i, atomic_t *v)) \ \ return result; \ } \ -__LL_SC_EXPORT(atomic_fetch_##op##name); #define ATOMIC_OPS(...) \ ATOMIC_OP(__VA_ARGS__) \ @@ -166,8 +160,7 @@ ATOMIC_OPS(xor, eor) #undef ATOMIC_OP #define ATOMIC64_OP(op, asm_op) \ -__LL_SC_INLINE void \ -__LL_SC_PREFIX(atomic64_##op(long i, atomic64_t *v)) \ +static inline void atomic64_##op(long i, atomic64_t *v) \ { \ long result; \ unsigned long tmp; \ @@ -177,11 +170,9 @@ __LL_SC_PREFIX(atomic64_##op(long i, atomic64_t *v)) \ : [res]"=&r" (result), [tmp]"=&r" (tmp), [v]"+Q" (v->counter) \ : [i]"Ir" (i)); \ } \ -__LL_SC_EXPORT(atomic64_##op); #define ATOMIC64_OP_RETURN(name, mb, acq, rel, cl, op, asm_op) \ -__LL_SC_INLINE long \ -__LL_SC_PREFIX(atomic64_##op##_return##name(long i, atomic64_t *v)) \ +static inline long atomic64_##op##_return##name(long i, atomic64_t *v) \ { \ long result; \ unsigned long tmp; \ @@ -194,11 +185,9 @@ __LL_SC_PREFIX(atomic64_##op##_return##name(long i, atomic64_t *v)) \ \ return result; \ } \ -__LL_SC_EXPORT(atomic64_##op##_return##name); #define ATOMIC64_FETCH_OP(name, mb, acq, rel, cl, op, asm_op) \ -__LL_SC_INLINE long \ -__LL_SC_PREFIX(atomic64_fetch_##op##name(long i, atomic64_t *v)) \ +static inline long atomic64_fetch_##op##name(long i, atomic64_t *v) \ { \ long result, val; \ unsigned long tmp; \ @@ -212,7 +201,6 @@ __LL_SC_PREFIX(atomic64_fetch_##op##name(long i, atomic64_t *v)) \ \ return result; \ } \ -__LL_SC_EXPORT(atomic64_fetch_##op##name); #define ATOMIC64_OPS(...) \ ATOMIC64_OP(__VA_ARGS__) \ @@ -246,8 +234,7 @@ ATOMIC64_OPS(xor, eor) #undef ATOMIC64_OP_RETURN #undef ATOMIC64_OP -__LL_SC_INLINE long -__LL_SC_PREFIX(atomic64_dec_if_positive(atomic64_t *v)) +static inline long atomic64_dec_if_positive(atomic64_t *v) { long result; unsigned long tmp; @@ -267,13 +254,11 @@ __LL_SC_PREFIX(atomic64_dec_if_positive(atomic64_t *v)) return result; } -__LL_SC_EXPORT(atomic64_dec_if_positive); #define __CMPXCHG_CASE(w, sz, name, mb, acq, rel, cl) \ -__LL_SC_INLINE unsigned long \ -__LL_SC_PREFIX(__cmpxchg_case_##name(volatile void *ptr, \ - unsigned long old, \ - unsigned long new)) \ +static inline unsigned long __cmpxchg_case_##name(volatile void *ptr, \ + unsigned long old, \ + unsigned long new) \ { \ unsigned long tmp, oldval; \ \ @@ -286,7 +271,6 @@ __LL_SC_PREFIX(__cmpxchg_case_##name(volatile void *ptr, \ \ return oldval; \ } \ -__LL_SC_EXPORT(__cmpxchg_case_##name); __CMPXCHG_CASE(w, b, 1, , , , ) __CMPXCHG_CASE(w, h, 2, , , , ) @@ -308,12 +292,11 @@ __CMPXCHG_CASE( , , mb_8, dmb ish, , l, "memory") #undef __CMPXCHG_CASE #define __CMPXCHG_DBL(name, mb, rel, cl) \ -__LL_SC_INLINE long \ -__LL_SC_PREFIX(__cmpxchg_double##name(unsigned long old1, \ - unsigned long old2, \ - unsigned long new1, \ - unsigned long new2, \ - volatile void *ptr)) \ +static inline long __cmpxchg_double##name(unsigned long old1, \ + unsigned long old2, \ + unsigned long new1, \ + unsigned long new2, \ + volatile void *ptr) \ { \ unsigned long tmp, ret; \ \ @@ -327,7 +310,6 @@ __LL_SC_PREFIX(__cmpxchg_double##name(unsigned long old1, \ \ return ret; \ } \ -__LL_SC_EXPORT(__cmpxchg_double##name); __CMPXCHG_DBL( , , , ) __CMPXCHG_DBL(_mb, dmb ish, l, "memory") diff --git a/arch/arm64/include/asm/lse.h b/arch/arm64/include/asm/lse.h index ef70f62ea25e..3ae4f9a6c207 100644 --- a/arch/arm64/include/asm/lse.h +++ b/arch/arm64/include/asm/lse.h @@ -22,11 +22,6 @@ __asm__(".arch_extension lse"); -/* Move the ll/sc atomics out-of-line */ -#define __LL_SC_INLINE notrace -#define __LL_SC_PREFIX(x) __ll_sc_##x -#define __LL_SC_EXPORT(x) EXPORT_SYMBOL(__LL_SC_PREFIX(x)) - /* In-line patching at runtime */ #define ARM64_LSE_ATOMIC_INSN(llsc, lse) \ ALTERNATIVE(llsc, lse, ARM64_HAS_LSE_ATOMICS) @@ -42,10 +37,6 @@ __asm__(".arch_extension lse"); #else /* __ASSEMBLER__ */ -#define __LL_SC_INLINE static inline -#define __LL_SC_PREFIX(x) x -#define __LL_SC_EXPORT(x) - #define ARM64_LSE_ATOMIC_INSN(llsc, lse) llsc #endif /* __ASSEMBLER__ */ diff --git a/arch/arm64/lib/Makefile b/arch/arm64/lib/Makefile index 69ff9887f724..39be2f7f0084 100644 --- a/arch/arm64/lib/Makefile +++ b/arch/arm64/lib/Makefile @@ -5,25 +5,6 @@ lib-y := clear_user.o delay.o copy_from_user.o \ memcmp.o strcmp.o strncmp.o strlen.o strnlen.o \ strchr.o strrchr.o tishift.o -# Tell the compiler to treat all general purpose registers (with the -# exception of the IP registers, which are already handled by the caller -# in case of a PLT) as callee-saved, which allows for efficient runtime -# patching of the bl instruction in the caller with an atomic instruction -# when supported by the CPU. Result and argument registers are handled -# correctly, based on the function prototype. -lib-$(CONFIG_ARM64_LSE_ATOMICS) += atomic_ll_sc.o -CFLAGS_atomic_ll_sc.o := -ffixed-x1 -ffixed-x2 \ - -ffixed-x3 -ffixed-x4 -ffixed-x5 -ffixed-x6 \ - -ffixed-x7 -fcall-saved-x8 -fcall-saved-x9 \ - -fcall-saved-x10 -fcall-saved-x11 -fcall-saved-x12 \ - -fcall-saved-x13 -fcall-saved-x14 -fcall-saved-x15 \ - -fcall-saved-x18 -fomit-frame-pointer -CFLAGS_REMOVE_atomic_ll_sc.o := -pg -GCOV_PROFILE_atomic_ll_sc.o := n -KASAN_SANITIZE_atomic_ll_sc.o := n -KCOV_INSTRUMENT_atomic_ll_sc.o := n -UBSAN_SANITIZE_atomic_ll_sc.o := n - lib-$(CONFIG_ARCH_HAS_UACCESS_FLUSHCACHE) += uaccess_flushcache.o obj-$(CONFIG_CRC32) += crc32.o diff --git a/arch/arm64/lib/atomic_ll_sc.c b/arch/arm64/lib/atomic_ll_sc.c deleted file mode 100644 index b0c538b0da28..000000000000 --- a/arch/arm64/lib/atomic_ll_sc.c +++ /dev/null @@ -1,3 +0,0 @@ -#include -#define __ARM64_IN_ATOMIC_IMPL -#include