From patchwork Mon Sep 9 20:21:35 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 173419 Delivered-To: patch@linaro.org Received: by 2002:a05:6e02:ce:0:0:0:0 with SMTP id r14csp4852589ilq; Mon, 9 Sep 2019 13:22:12 -0700 (PDT) X-Google-Smtp-Source: APXvYqzmiFoukenrtPOp+Gznawk99q8Ui07E01Vzhmw31vNJS++oHFn6dAeTEqOoN7SkDBijJbQK X-Received: by 2002:aa7:c1c5:: with SMTP id d5mr26293437edp.46.1568060532197; Mon, 09 Sep 2019 13:22:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1568060532; cv=none; d=google.com; s=arc-20160816; b=Afse5jNg0HXah3xJpB9E9mV8FJlYa+6hJPirjV99FsjEkMMU7j3hpTmo7BwbPRilwq D72QkdidVMLamFo55FIdQMM1PGXVqSa1YHR8yNPQFBQE679Gq2U8XVeaWjX/Bua1d0xM iFvoUe0dXl+26Lh/k4xXWlGsv/1bWIjGg0ZYda5cFTq93lSNknvv/Ixu8YFHkqL66Lgw JxqrzxFNpo8VdDB8tRWjaMBNKXczfAnlL0oXr+rk8y8PH/gXwu4lTUyomUnc0neShLY6 it2pTdCjx+7TgqHbIECJcoz43Vs/qIGQz0tjb9SCFgTRxWmQK+cq90ODC/g3bq8JZnb3 qfJA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from; bh=PrYpFTZqKwq9LuEhuvqFSJRfjP9K1zUCcYGWKsSq1SI=; b=vVHMUliCqXhVfZeVvZfaVUw29xKElroQlCu8n4Nchft6NaYCCPoJ8rckWKsS+NtDE6 zsHqbdtTMKPVrGd7c5EoBonfG7wyvIRcNNwDSVLdgD3Xak+AHUL/XpvVOwaOIDW8f3EY bBTsbF0CeNHCelQJX6yJWh6WIHDaMdSYVCknFJjpHWleY8ALVKFommf45vRGxWav4N3E kWq5evgUODWQ2CDLQ9UhawDiZg9a7UiX4Mxark+QKLq0o8NdA6JY/jbidutU/hBW0KZ5 fC1xA1p8uawrvVDfQQFYi/Z/ZIWu3pzazhLjQ5LioWTXE6JLlFClEqb+sFHZJ4wt2H9O z+dg== 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 y37si9283493edc.437.2019.09.09.13.22.11; Mon, 09 Sep 2019 13:22:12 -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 S2387867AbfIIUWH (ORCPT + 28 others); Mon, 9 Sep 2019 16:22:07 -0400 Received: from mout.kundenserver.de ([212.227.126.133]:54997 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728204AbfIIUWH (ORCPT ); Mon, 9 Sep 2019 16:22:07 -0400 Received: from threadripper.lan ([149.172.19.189]) by mrelayeu.kundenserver.de (mreue011 [212.227.15.129]) with ESMTPA (Nemesis) id 1MtwIW-1iQ3WI0jXQ-00uGVx; Mon, 09 Sep 2019 22:21:54 +0200 From: Arnd Bergmann To: Catalin Marinas , Will Deacon Cc: Arnd Bergmann , Andrew Murray , Mark Rutland , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, clang-built-linux@googlegroups.com Subject: [PATCH] arm64: fix unreachable code issue with cmpxchg Date: Mon, 9 Sep 2019 22:21:35 +0200 Message-Id: <20190909202153.144970-1-arnd@arndb.de> X-Mailer: git-send-email 2.20.0 MIME-Version: 1.0 X-Provags-ID: V03:K1:6HbGcOwcgeWZk7saAnF44EQwGRc5qar4XnbwhsGQ9AeeGtgVJQ0 jJnqy2N1qSE1vkSfHW+ITZ7JxZVOzcynaRgSnRdUR27uZBdiqKyQncb1oAb8ZmA2gUv7jjt 9E5l4E7yQRz5TcvxGRo3Byc/2TanVmuFGegAxsPoUXDoqNQZvQci40d1brApPysfW7fOesk VdklBj8+v4Gsa+toV+uVA== X-Spam-Flag: NO X-UI-Out-Filterresults: notjunk:1; V03:K0:C1d7SlUsv+A=:Lj2/wQb1QrZDoyfBBvZrvm 370fWlMX2geahYOibVfa+G1FGva5/fqlJYl7pkjy5dnYfjEbNUm/+ebrQMN41Q3qJwKd1dR6z T5nAheJ+Bemia9f4GTp5E9bIF9eAa1l/DZ0/hiSWcmpl/qlS8usEHW+fll9VTLZiqHz+K5rsH CVzTI1MUnIsseeoRFpmrkVxOY4Dg/I0T4gB2D7T55wdtiAZK5dZiiCFTT617FfryJyGsccUeJ galX2PFrtBenOyO9SHS0SFas5EM01nQKILKNxUuN1poDQ1DMjPrFTUZMu8u53UiYfJCDlpbqV Lt1K1uItp4HOfBi1N2GQeu0BwevjsxeMdl7/PJvSTy/ScRvhqeZlxl+g+ngoLtv4joHKsprp6 L4ncVos7HATxanCI4uLoC/0AM0c/TL20KycRzkr+RV5/HJAVk7DIKmEBhsSnSQI07pLbvTm4i uxGCxUvLIsC/yU5IoULbklys2QD31uxuYBoehErQlLpIA/bKB49f42U4sTGrdcPUwf51X2VxS 6Q4aiW2htlXlrNx3mmyQklCtGo1VX7ri28iXwcVmnIha0JUy/8FRU1mUTbLd2TQgmv1nPV5ad fqE8m3GuJeVauXjoIGNJ/+L4kMPqgaYvq/TImckjqaEaWkijR2TOPMPMC9rTBjZs3LBtis8TV obr9Oy1Ade2++k7MJKQUK3B90LC2/EZaiidkjrsicmaYQBmiCzsLKzJuDqcDONc3xy7+fMe4O 5oSIifTYUg0VTTDWzObdc/TaeMd91zbiSNRFyfXCnCBXz/vQozBvvaPpcmC82YeojyaSB0AUF lGjKB9e0veJsRu1LPHIYcnlGukAoNUw4q5Eo7jmuJQ1f9oU2g0= Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On arm64 build with clang, sometimes the __cmpxchg_mb is not inlined when CONFIG_OPTIMIZE_INLINING is set. Clang then fails a compile-time assertion, because it cannot tell at compile time what the size of the argument is: mm/memcontrol.o: In function `__cmpxchg_mb': memcontrol.c:(.text+0x1a4c): undefined reference to `__compiletime_assert_175' memcontrol.c:(.text+0x1a4c): relocation truncated to fit: R_AARCH64_CALL26 against undefined symbol `__compiletime_assert_175' Mark all of the cmpxchg() style functions as __always_inline to ensure that the compiler can see the result. Signed-off-by: Arnd Bergmann --- arch/arm64/include/asm/cmpxchg.h | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) -- 2.20.0 Acked-by: Nick Desaulniers Reported-by: Nathan Chancellor Reviewed-by: Nathan Chancellor Tested-by: Nathan Chancellor Reviewed-by: Andrew Murray Tested-by: Andrew Murray diff --git a/arch/arm64/include/asm/cmpxchg.h b/arch/arm64/include/asm/cmpxchg.h index a1398f2f9994..fd64dc8a235f 100644 --- a/arch/arm64/include/asm/cmpxchg.h +++ b/arch/arm64/include/asm/cmpxchg.h @@ -19,7 +19,7 @@ * acquire+release for the latter. */ #define __XCHG_CASE(w, sfx, name, sz, mb, nop_lse, acq, acq_lse, rel, cl) \ -static inline u##sz __xchg_case_##name##sz(u##sz x, volatile void *ptr) \ +static __always_inline u##sz __xchg_case_##name##sz(u##sz x, volatile void *ptr)\ { \ u##sz ret; \ unsigned long tmp; \ @@ -62,7 +62,7 @@ __XCHG_CASE( , , mb_, 64, dmb ish, nop, , a, l, "memory") #undef __XCHG_CASE #define __XCHG_GEN(sfx) \ -static inline unsigned long __xchg##sfx(unsigned long x, \ +static __always_inline unsigned long __xchg##sfx(unsigned long x, \ volatile void *ptr, \ int size) \ { \ @@ -103,8 +103,9 @@ __XCHG_GEN(_mb) #define arch_xchg_release(...) __xchg_wrapper(_rel, __VA_ARGS__) #define arch_xchg(...) __xchg_wrapper( _mb, __VA_ARGS__) -#define __CMPXCHG_CASE(name, sz) \ -static inline u##sz __cmpxchg_case_##name##sz(volatile void *ptr, \ +#define __CMPXCHG_CASE(name, sz) \ +static __always_inline u##sz \ +__cmpxchg_case_##name##sz(volatile void *ptr, \ u##sz old, \ u##sz new) \ { \ @@ -148,7 +149,7 @@ __CMPXCHG_DBL(_mb) #undef __CMPXCHG_DBL #define __CMPXCHG_GEN(sfx) \ -static inline unsigned long __cmpxchg##sfx(volatile void *ptr, \ +static __always_inline unsigned long __cmpxchg##sfx(volatile void *ptr, \ unsigned long old, \ unsigned long new, \ int size) \ @@ -230,7 +231,7 @@ __CMPXCHG_GEN(_mb) }) #define __CMPWAIT_CASE(w, sfx, sz) \ -static inline void __cmpwait_case_##sz(volatile void *ptr, \ +static __always_inline void __cmpwait_case_##sz(volatile void *ptr, \ unsigned long val) \ { \ unsigned long tmp; \ @@ -255,7 +256,7 @@ __CMPWAIT_CASE( , , 64); #undef __CMPWAIT_CASE #define __CMPWAIT_GEN(sfx) \ -static inline void __cmpwait##sfx(volatile void *ptr, \ +static __always_inline void __cmpwait##sfx(volatile void *ptr, \ unsigned long val, \ int size) \ { \