public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Sasha Levin <sashal@kernel.org>
To: linux-kernel@vger.kernel.org, stable@vger.kernel.org
Cc: Arnd Bergmann <arnd@arndb.de>,
	Nick Desaulniers <ndesaulniers@google.com>,
	Nathan Chancellor <natechancellor@gmail.com>,
	Andrew Murray <andrew.murray@arm.com>,
	Will Deacon <will@kernel.org>, Sasha Levin <sashal@kernel.org>,
	clang-built-linux@googlegroups.com
Subject: [PATCH AUTOSEL 4.9 17/19] arm64: fix unreachable code issue with cmpxchg
Date: Tue, 24 Sep 2019 12:51:28 -0400	[thread overview]
Message-ID: <20190924165130.28625-17-sashal@kernel.org> (raw)
In-Reply-To: <20190924165130.28625-1-sashal@kernel.org>

From: Arnd Bergmann <arnd@arndb.de>

[ Upstream commit 920fdab7b3ce98c14c840261e364f490f3679a62 ]

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.

Acked-by: Nick Desaulniers <ndesaulniers@google.com>
Reported-by: Nathan Chancellor <natechancellor@gmail.com>
Link: https://github.com/ClangBuiltLinux/linux/issues/648
Reviewed-by: Nathan Chancellor <natechancellor@gmail.com>
Tested-by: Nathan Chancellor <natechancellor@gmail.com>
Reviewed-by: Andrew Murray <andrew.murray@arm.com>
Tested-by: Andrew Murray <andrew.murray@arm.com>
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Will Deacon <will@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 arch/arm64/include/asm/cmpxchg.h | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/arch/arm64/include/asm/cmpxchg.h b/arch/arm64/include/asm/cmpxchg.h
index 0f2e1ab5e1666..9b2e2e2e728ae 100644
--- a/arch/arm64/include/asm/cmpxchg.h
+++ b/arch/arm64/include/asm/cmpxchg.h
@@ -73,7 +73,7 @@ __XCHG_CASE( ,  ,  mb_8, 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)			\
 {									\
@@ -115,7 +115,7 @@ __XCHG_GEN(_mb)
 #define xchg(...)		__xchg_wrapper( _mb, __VA_ARGS__)
 
 #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)			\
@@ -248,7 +248,7 @@ __CMPWAIT_CASE( ,  , 8);
 #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)				\
 {									\
-- 
2.20.1


  parent reply	other threads:[~2019-09-24 16:53 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-09-24 16:51 [PATCH AUTOSEL 4.9 01/19] drm/bridge: tc358767: Increase AUX transfer length limit Sasha Levin
2019-09-24 16:51 ` [PATCH AUTOSEL 4.9 02/19] video: ssd1307fb: Start page range at page_offset Sasha Levin
2019-09-24 16:51 ` [PATCH AUTOSEL 4.9 03/19] drm/radeon: Fix EEH during kexec Sasha Levin
2019-09-24 16:51 ` [PATCH AUTOSEL 4.9 04/19] gpu: drm: radeon: Fix a possible null-pointer dereference in radeon_connector_set_property() Sasha Levin
2019-09-24 16:51 ` [PATCH AUTOSEL 4.9 05/19] ipmi_si: Only schedule continuously in the thread in maintenance mode Sasha Levin
2019-09-24 16:51 ` [PATCH AUTOSEL 4.9 06/19] clk: qoriq: Fix -Wunused-const-variable Sasha Levin
2019-09-24 16:51 ` [PATCH AUTOSEL 4.9 07/19] drm/amd/powerplay/smu7: enforce minimal VBITimeout (v2) Sasha Levin
2019-09-24 16:51 ` [PATCH AUTOSEL 4.9 08/19] clk: sirf: Don't reference clk_init_data after registration Sasha Levin
2019-09-24 16:51 ` [PATCH AUTOSEL 4.9 09/19] powerpc/rtas: use device model APIs and serialization during LPM Sasha Levin
2019-09-24 16:51 ` [PATCH AUTOSEL 4.9 10/19] powerpc/futex: Fix warning: 'oldval' may be used uninitialized in this function Sasha Levin
2019-09-24 16:51 ` [PATCH AUTOSEL 4.9 11/19] powerpc/pseries/mobility: use cond_resched when updating device tree Sasha Levin
2019-09-24 16:51 ` [PATCH AUTOSEL 4.9 12/19] pinctrl: tegra: Fix write barrier placement in pmx_writel Sasha Levin
2019-09-24 16:51 ` [PATCH AUTOSEL 4.9 13/19] vfio_pci: Restore original state on release Sasha Levin
2019-09-24 16:51 ` [PATCH AUTOSEL 4.9 14/19] drm/amdgpu/si: fix ASIC tests Sasha Levin
2019-09-24 16:51 ` [PATCH AUTOSEL 4.9 15/19] powerpc/64s/exception: machine check use correct cfar for late handler Sasha Levin
2019-09-24 16:51 ` [PATCH AUTOSEL 4.9 16/19] powerpc/pseries: correctly track irq state in default idle Sasha Levin
2019-09-24 16:51 ` Sasha Levin [this message]
2019-09-24 16:51 ` [PATCH AUTOSEL 4.9 18/19] clk: at91: select parent if main oscillator or bypass is enabled Sasha Levin
2019-09-24 16:51 ` [PATCH AUTOSEL 4.9 19/19] scsi: core: Reduce memory required for SCSI logging Sasha Levin

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190924165130.28625-17-sashal@kernel.org \
    --to=sashal@kernel.org \
    --cc=andrew.murray@arm.com \
    --cc=arnd@arndb.de \
    --cc=clang-built-linux@googlegroups.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=natechancellor@gmail.com \
    --cc=ndesaulniers@google.com \
    --cc=stable@vger.kernel.org \
    --cc=will@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox