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=-16.4 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED 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 0D725C433FE for ; Mon, 13 Sep 2021 06:40:06 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 8A1B061004 for ; Mon, 13 Sep 2021 06:40:05 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 8A1B061004 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=kvack.org Received: by kanga.kvack.org (Postfix) id B4C996B0071; Mon, 13 Sep 2021 02:40:04 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id AFCB06B0072; Mon, 13 Sep 2021 02:40:04 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 9EC20900002; Mon, 13 Sep 2021 02:40:04 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0187.hostedemail.com [216.40.44.187]) by kanga.kvack.org (Postfix) with ESMTP id 8D5E56B0071 for ; Mon, 13 Sep 2021 02:40:04 -0400 (EDT) Received: from smtpin37.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay02.hostedemail.com (Postfix) with ESMTP id 31918267D9 for ; Mon, 13 Sep 2021 06:40:04 +0000 (UTC) X-FDA: 78581600328.37.799D944 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by imf13.hostedemail.com (Postfix) with ESMTP id D95B3102C9E7 for ; Mon, 13 Sep 2021 06:40:03 +0000 (UTC) Received: by mail.kernel.org (Postfix) with ESMTPSA id E8E7860F92; Mon, 13 Sep 2021 06:40:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1631515202; bh=xSHJWXfszpsEa3y+UEM2rqndlX2dbUCNterc5ZybSZ4=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=jeQpPIWBNyQts5s+yt1r8um3vBmGd/Wlvac7Q5I8jCbZ4hHdU6uZDoNJVE9nzAhne 4hPIJmOVa0WMHkxVFti4NiAbSXGkvgV//KvG70GoSodjqKbGDfiRBxWbr3Lm/jEOQi yjAtIUJUep7094Ut1F2r/A+IyafmOUw7hL9C+5gp6AQAQJ46wywyVZ+d7Vpxa+oK2M GPBZ++Mc7hZ1jELk+DKf4cMKsIyz+D1eO70WGMNHuJjuHS6w/4ouRV/n8Z7GJHWddP a8GgouJMS+4S+88ECA2x3gdlydK72XZ/BQ4FzDRCqM1zjN3YaO+cNEdMiRQzo9qQyT puMVXZntsJW6A== Date: Mon, 13 Sep 2021 09:39:56 +0300 From: Mike Rapoport To: Adam Borowski Cc: linux-mm@kvack.org Subject: Re: [PATCH] memblock: fix a section mismatch when a function doesn't get inlined Message-ID: References: <20210912204111.10314-1-kilobyte@angband.pl> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210912204111.10314-1-kilobyte@angband.pl> X-Rspamd-Server: rspam01 X-Rspamd-Queue-Id: D95B3102C9E7 Authentication-Results: imf13.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=jeQpPIWB; dmarc=pass (policy=none) header.from=kernel.org; spf=pass (imf13.hostedemail.com: domain of rppt@kernel.org designates 198.145.29.99 as permitted sender) smtp.mailfrom=rppt@kernel.org X-Stat-Signature: aiuojwyzpoiemkxtjuofjpqenpeawkpe X-HE-Tag: 1631515203-611154 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: Hi Adam, On Sun, Sep 12, 2021 at 10:41:11PM +0200, Adam Borowski wrote: > WARNING: modpost: vmlinux.o(.text.unlikely+0xab6): Section mismatch in > reference from the function memblock_phys_alloc() to the function > .init.text:memblock_phys_alloc_range() > The function memblock_phys_alloc() references > the function __init memblock_phys_alloc_range(). > This is often because memblock_phys_alloc lacks a __init > annotation or the annotation of memblock_phys_alloc_range is wrong. There is a bunch of other wrappers in include/linux/memblock.h that most probably would cause the same warning. Can add the patch below and build the kernel with the config that prevents inlining of memblock_phys_alloc to see what the compiler thinks about other wrappers? I believe they all would produce the same warning. diff --git a/mm/memblock.c b/mm/memblock.c index 28a813d9e955..6351c5754bb0 100644 --- a/mm/memblock.c +++ b/mm/memblock.c @@ -2089,6 +2089,32 @@ void __init memblock_free_all(void) totalram_pages_add(pages); } +void __init memblock_test_inlining(void) +{ + void *addr; + + addr = memblock_alloc_raw(PAGE_SIZE, PAGE_SIZE); + if (!addr) + return; + memblock_free(__pa(addr), PAGE_SIZE); + + addr = memblock_alloc_from(PAGE_SIZE, PAGE_SIZE, + MEMBLOCK_ALLOC_ACCESSIBLE); + if (!addr) + return; + memblock_free(__pa(addr), PAGE_SIZE); + + addr = memblock_alloc_low(PAGE_SIZE, PAGE_SIZE); + if (!addr) + return; + memblock_free(__pa(addr), PAGE_SIZE); + + addr = memblock_alloc_node(PAGE_SIZE, PAGE_SIZE, NUMA_NO_NODE); + if (!addr) + return; + memblock_free(__pa(addr), PAGE_SIZE); +} + #if defined(CONFIG_DEBUG_FS) && defined(CONFIG_ARCH_KEEP_MEMBLOCK) static int memblock_debug_show(struct seq_file *m, void *private) > Simplest way is to just ensure it is inlined. > > Signed-off-by: Adam Borowski > --- > Found when running riscv64 randconfigs, but doesn't appear to be arch > specific. > > include/linux/memblock.h | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) > > diff --git a/include/linux/memblock.h b/include/linux/memblock.h > index b066024c62e3..dfdd7c50c27d 100644 > --- a/include/linux/memblock.h > +++ b/include/linux/memblock.h > @@ -387,8 +387,8 @@ phys_addr_t memblock_alloc_range_nid(phys_addr_t size, > phys_addr_t end, int nid, bool exact_nid); > phys_addr_t memblock_phys_alloc_try_nid(phys_addr_t size, phys_addr_t align, int nid); > > -static inline phys_addr_t memblock_phys_alloc(phys_addr_t size, > - phys_addr_t align) > +static __always_inline phys_addr_t memblock_phys_alloc(phys_addr_t size, > + phys_addr_t align) > { > return memblock_phys_alloc_range(size, align, 0, > MEMBLOCK_ALLOC_ACCESSIBLE); > -- > 2.33.0 > -- Sincerely yours, Mike.