From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-15.3 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,NICE_REPLY_A,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED, USER_AGENT_SANE_1 autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 8BA67C433DB for ; Mon, 4 Jan 2021 11:35:29 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 51D5F20770 for ; Mon, 4 Jan 2021 11:35:29 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726328AbhADLfM (ORCPT ); Mon, 4 Jan 2021 06:35:12 -0500 Received: from mx2.suse.de ([195.135.220.15]:36340 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726129AbhADLfL (ORCPT ); Mon, 4 Jan 2021 06:35:11 -0500 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.221.27]) by mx2.suse.de (Postfix) with ESMTP id 9BDC8ACAF; Mon, 4 Jan 2021 11:34:30 +0000 (UTC) To: Arnd Bergmann , Andrew Morton , Nathan Chancellor , Nick Desaulniers , "Kirill A. Shutemov" , Wei Yang Cc: Arnd Bergmann , Dmitry Safonov <0x7f454c46@gmail.com>, Brian Geffon , linux-mm@kvack.org, linux-kernel@vger.kernel.org, clang-built-linux@googlegroups.com References: <20201230154104.522605-1-arnd@kernel.org> From: Vlastimil Babka Subject: Re: [PATCH] mm/mremap: fix BUILD_BUG_ON() error in get_extent Message-ID: Date: Mon, 4 Jan 2021 12:34:29 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.5.1 MIME-Version: 1.0 In-Reply-To: <20201230154104.522605-1-arnd@kernel.org> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The subject should say BUILD_BUG() On 12/30/20 4:40 PM, Arnd Bergmann wrote: > From: Arnd Bergmann > > clang cannt evaluate this function argument at compile time > when the function is not inlined, which leads to a link > time failure: > > ld.lld: error: undefined symbol: __compiletime_assert_414 >>>> referenced by mremap.c >>>> mremap.o:(get_extent) in archive mm/built-in.a > > Mark the function as __always_inline to avoid it. Not sure if it's the ideal fix, maybe just convert it to BUG() instead? Functions shouldn't really have BUILD_BUG depending on parameters and rely on inlining to make it work... > Fixes: 9ad9718bfa41 ("mm/mremap: calculate extent in one place") I think it's rather this one that introduces the BUILD_BUG() ? c49dd3401802 ("mm: speedup mremap on 1GB or larger regions") > Signed-off-by: Arnd Bergmann > --- > mm/mremap.c | 5 +++-- > 1 file changed, 3 insertions(+), 2 deletions(-) > > diff --git a/mm/mremap.c b/mm/mremap.c > index c5590afe7165..1cb464a07184 100644 > --- a/mm/mremap.c > +++ b/mm/mremap.c > @@ -336,8 +336,9 @@ enum pgt_entry { > * valid. Else returns a smaller extent bounded by the end of the source and > * destination pgt_entry. > */ > -static unsigned long get_extent(enum pgt_entry entry, unsigned long old_addr, > - unsigned long old_end, unsigned long new_addr) > +static __always_inline unsigned long get_extent(enum pgt_entry entry, > + unsigned long old_addr, unsigned long old_end, > + unsigned long new_addr) > { > unsigned long next, extent, mask, size; > >