From patchwork Sun Oct 6 17:21:03 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 175286 Delivered-To: patch@linaro.org Received: by 2002:a92:7e96:0:0:0:0:0 with SMTP id q22csp3291892ill; Sun, 6 Oct 2019 10:23:17 -0700 (PDT) X-Google-Smtp-Source: APXvYqwwS25aMjIJ4B6yaZXnwYPXhlB7nhfSNTWD9dmrdy/leN8xrooQUJOXkosUEDoynlsY2ydR X-Received: by 2002:a50:f09d:: with SMTP id v29mr25063855edl.4.1570382597795; Sun, 06 Oct 2019 10:23:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1570382597; cv=none; d=google.com; s=arc-20160816; b=gE0aaehZuOrlD/tojZ+/7l1dI9qPedqgBY6Ztm4l+flNntt+df8emuhMO27lWHeKyS Q+Rdxs+CR5lptt9c4hs6xVnNZDjXUvWt6msgII2/Eng6X7sBhMT8rQvLx767zoipmdp4 cJP7RsXQCvnLvezPEIepn5ZEdKcxlz/OwncgQvsXGo6T2ZLiicn+rnPCPdApWyxR5WpC MLQ7CnN5FDNI/j07d55QJTSgzItWRzBhrf7x4pB9Sb1y/5NTFaWODv2gt21ML8zsLIuy 8UtdqTYtReHSWLGtwaOH3VW1vzc9b9ozLVXWFRtp8B22shBFcZlI9aZQSbStkdjWfL3c cdxQ== 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 :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=nu6WUCNHoxvwUe4wk3IhUh6y+aEXlY1t3n05O8Yub9U=; b=J82pd0hvb/7zhOFFqSSim8QpoFklV7uxcvKRUEhQWygvOGWjnbnuQn0/pmrEYZU0a9 RhfWvsnk2d8vIQeJFLiW9FGb45VeMbIirkSeSdotlh59jtNngHlakIubhmibag20cmY4 QQ+8RF9P5fFtcdk8q/Lla6sZr4D2CzdngZa/Wjf3mvGxhbKmCae9JZFABpuLLIOeMqHV weXr1S9JXKifCz/bh3UaDHkRjyeBwO5j6eNq3XfK4IdjHqYIKBUIrg//cmDH/nhgjsdz Ftc2hHqAVgHb6FkZzM4jLtHxP9dlI64DY4mPM7tOZ2ZZXOpu83ATkQlZxKJC9ac72UxV r87w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=IGb6MiD8; 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 s4si5646138eju.265.2019.10.06.10.23.17; Sun, 06 Oct 2019 10:23:17 -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=@kernel.org header.s=default header.b=IGb6MiD8; 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 S1727136AbfJFRXP (ORCPT + 27 others); Sun, 6 Oct 2019 13:23:15 -0400 Received: from mail.kernel.org ([198.145.29.99]:47608 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726714AbfJFRXN (ORCPT ); Sun, 6 Oct 2019 13:23:13 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 2D42D2077B; Sun, 6 Oct 2019 17:23:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1570382592; bh=9SHFMyTZ1b8A1lNB7zidcHr+FW0PPNHHLbMg322wdgI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=IGb6MiD8MjdvBjAReTTNHr/AN/JLAH9lD4ONuuhYJ/Xe3ziHYNA0wTE47a/idEYgP uaC2bWtMDTtIFRZtVGCT8xZAKV9gLJQbPY9naeCxgMVvD/UgpTFv2seEbnnDf1PN1E hyCkjXQBKTtNtTJSJ7p3/5vrhdx+DdO1IfdFGSec= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Nick Desaulniers , Nathan Chancellor , Andrew Murray , Arnd Bergmann , Will Deacon , Sasha Levin Subject: [PATCH 4.9 16/47] arm64: fix unreachable code issue with cmpxchg Date: Sun, 6 Oct 2019 19:21:03 +0200 Message-Id: <20191006172017.742579866@linuxfoundation.org> X-Mailer: git-send-email 2.23.0 In-Reply-To: <20191006172016.873463083@linuxfoundation.org> References: <20191006172016.873463083@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Arnd Bergmann [ 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 Reported-by: Nathan Chancellor Link: https://github.com/ClangBuiltLinux/linux/issues/648 Reviewed-by: Nathan Chancellor Tested-by: Nathan Chancellor Reviewed-by: Andrew Murray Tested-by: Andrew Murray Signed-off-by: Arnd Bergmann Signed-off-by: Will Deacon Signed-off-by: Sasha Levin --- arch/arm64/include/asm/cmpxchg.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) -- 2.20.1 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) \ { \