From patchwork Wed Jun 14 22:33:59 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Prasad Sodagudi X-Patchwork-Id: 9787599 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id E272F602D9 for ; Wed, 14 Jun 2017 22:34:29 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D583028505 for ; Wed, 14 Jun 2017 22:34:29 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id C9CCF28517; Wed, 14 Jun 2017 22:34:29 +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=-1.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID autolearn=unavailable version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [65.50.211.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 5FF8C28505 for ; Wed, 14 Jun 2017 22:34:28 +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-Type: Content-Transfer-Encoding:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:Message-ID:References:In-Reply-To:Subject:To:From: Date:MIME-Version:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=VGdvrfdECOOvfS/8fFCtKU56ALx7CJ5vdRVlJOvT0R4=; b=QUmtSyMH6IqbKb4pYhZlcai7c suuurXaCcb9997Xuj1dFeIW29bnngdlsBWs87D8GZBAHuEH1y0xq7jziA9vaH0aOoyjZw8dkP0dXu n0deQttMlfskxYiLaEwS++oVsb8cNunYP87Lh4UEEZU/lIIKR5/AqYLkafB/d2/RAM+/TNguBzxe9 9c9tc7zlfXTGZmeLXSYiaQfdephvsmwIMXP/R4cfe4s0QfyIOtDiRh6DOfV1f8G4oM2LfDpzlUYdS uFJo4jdAoWjx6/7lmadkXnXOQ4eTDtIQLbFwxy9YHsAD1BHXnWntxDxh6OWV61YbqPzrUG1uAOPMt ceqEDqY4w==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.87 #1 (Red Hat Linux)) id 1dLGrp-0000t7-J9; Wed, 14 Jun 2017 22:34:25 +0000 Received: from smtp.codeaurora.org ([198.145.29.96]) by bombadil.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1dLGrm-0000qn-Ia for linux-arm-kernel@lists.infradead.org; Wed, 14 Jun 2017 22:34:24 +0000 Received: by smtp.codeaurora.org (Postfix, from userid 1000) id A562F60863; Wed, 14 Jun 2017 22:34:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1497479640; bh=cg+OjbN3PQsa5HPYniE1/FhKbvS9vl0hFCOJ2k5eM8M=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=Q0O8lCf7UhDD0jIFs/kUSTMeRk3D8I+9RtPL7NyIVeLFWCK36Upk33ZKYxwdtAlf1 Im+fGEbeyFUO5UBNGj6h2j71ZP43u85JX6g/fTscSqJ0jBEkAggkcx84Dam9WUhqw3 MnK4Ickq+CZZSVnwJH97+WXF0N76rL9s2IEVI4s8= Received: from mail.codeaurora.org (localhost.localdomain [127.0.0.1]) by smtp.codeaurora.org (Postfix) with ESMTP id E599560863; Wed, 14 Jun 2017 22:33:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1497479640; bh=cg+OjbN3PQsa5HPYniE1/FhKbvS9vl0hFCOJ2k5eM8M=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=Q0O8lCf7UhDD0jIFs/kUSTMeRk3D8I+9RtPL7NyIVeLFWCK36Upk33ZKYxwdtAlf1 Im+fGEbeyFUO5UBNGj6h2j71ZP43u85JX6g/fTscSqJ0jBEkAggkcx84Dam9WUhqw3 MnK4Ickq+CZZSVnwJH97+WXF0N76rL9s2IEVI4s8= MIME-Version: 1.0 Date: Wed, 14 Jun 2017 15:33:59 -0700 From: Sodagudi Prasad To: Will Deacon Subject: Re: Using __always_inline attribute In-Reply-To: <20170614100641.GB16190@arm.com> References: <2a762f1f3b355e71c5bca6a6e00bffe0@codeaurora.org> <20170614100641.GB16190@arm.com> Message-ID: <9198053a46999b0b46dcab992527d0d7@codeaurora.org> X-Sender: psodagud@codeaurora.org User-Agent: Roundcube Webmail/1.2.5 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20170614_153422_656068_D26253B7 X-CRM114-Status: GOOD ( 19.36 ) 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, peterz@infradead.org, catalin.marinas@arm.com, linux-kernel@vger.kernel.org, mingo@kernel.org, linux-arm-kernel@lists.infradead.org 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 On 2017-06-14 03:06, Will Deacon wrote: > Hi Prasad, > > On Tue, Jun 13, 2017 at 03:39:37PM -0700, Sodagudi Prasad wrote: >> With a variant of a CLANG(based on 4.0) following errors observed on >> Linux >> 4.12-rc5 tag. > > How are you building the kernel with clang, btw? I'd be keen to try the > same > thing, but I thought the LLVMLinux project was largely dead at his > point. Do > you still need build system patches, or is this now integrated with > Kbuild? Hi Will, Trying clang patches from below tree - https://android.googlesource.com/kernel/common/+/experimental/android-4.4-llvm > >> net/built-in.o: In function `__xchg_mb': >> arch/arm64/include/asm/cmpxchg.h:99: \ >> undefined reference to `__compiletime_assert_99' >> arch/arm64/include/asm/cmpxchg.h:99: \ >> undefined reference to `__compiletime_assert_99 >> >> Clang does not seems to be marking this macro as inline and causing >> above >> compilation issue due to BUILD_BUG(). > > The only BUILD_BUG I see around here is if the size parameter (which is > calculated using sizeof) is not known to be 1,2,4 or 8 at compile time. > It > would be interesting to know which call site is confusing clang in this > way > and what code is actually being emitted here. > > If it's just that __xchg_mb isn't being inlined into the __xchg_wrapper > macro, then your patch should be ok, but I'd like to be sure it's not > something else. I'm also surprised you haven't see this crop up in > other > places. After digging further, we observed that inline definition was changed recently and causing this issue. Here is missing part of inline macro definition __attribute__((unused)). Commit abb2ea7dfd82 ("compiler, clang: suppress warning for unused static inline functions") have redefined the inline macro as below #define inline inline __attribute__((unused)) But actual definition of inline macro defined compiler-gcc.h file as shown below. #define inline inline __attribute__((always_inline)) notrace As always_inline attribute is missing in inline definition, compile may not inline macros __xchg_mb in arch/arm64/include/asm/cmpxchg.h file and leading to error. Some compilers may not honor inline as inline if always_inline attribute is removed because of -inline-threshold compiler options. Here is the change to fix this issue- notrace -Thanks, Prasad > > Will diff --git a/include/linux/compiler-clang.h b/include/linux/compiler-clang.h index d614c5e..a0e6433 100644 --- a/include/linux/compiler-clang.h +++ b/include/linux/compiler-clang.h @@ -22,4 +22,4 @@ * directives. Suppress the warning in clang as well. */ #undef inline -#define inline inline __attribute__((unused)) notrace +#define inline __attribute__((always_inline)) __attribute__((unused))