From: Mike Rapoport <rppt@kernel.org>
To: Jackie Liu <liu.yun@linux.dev>
Cc: akpm@linux-foundation.org, linux-mm@kvack.org
Subject: Re: [PATCH] memblock: fix memblock_phys_alloc() section mismatch error
Date: Thu, 16 Dec 2021 11:00:23 +0200 [thread overview]
Message-ID: <YbsAJ5mDxz2H5aZ6@kernel.org> (raw)
In-Reply-To: <20211216011748.1079724-1-liu.yun@linux.dev>
On Thu, Dec 16, 2021 at 09:17:48AM +0800, Jackie Liu wrote:
> From: Jackie Liu <liuyun01@kylinos.cn>
>
> Fix modpost Section mismatch error in memblock_phys_alloc()
>
> [...]
> WARNING: modpost: vmlinux.o(.text.unlikely+0x1dcc): 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.
>
> ERROR: modpost: Section mismatches detected.
> Set CONFIG_SECTION_MISMATCH_WARN_ONLY=y to allow them.
> [...]
>
> I have checked that the memblock_phys_alloc used in the source tree is all in
> the __init section, we should also let him save it in this section.
I don't know why compiler decided against inlining memblock_phys_alloc(),
so better solution here would be to use __always_inline IMO.
> Reported-by: k2ci <kernel-bot@kylinos.cn>
> Signed-off-by: Jackie Liu <liuyun01@kylinos.cn>
> ---
> include/linux/memblock.h | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/include/linux/memblock.h b/include/linux/memblock.h
> index 8adcf1fa8096..8959d43bc76b 100644
> --- a/include/linux/memblock.h
> +++ b/include/linux/memblock.h
> @@ -405,7 +405,7 @@ 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,
> +static inline phys_addr_t __init memblock_phys_alloc(phys_addr_t size,
> phys_addr_t align)
> {
> return memblock_phys_alloc_range(size, align, 0,
> --
> 2.25.1
>
--
Sincerely yours,
Mike.
prev parent reply other threads:[~2021-12-16 9:01 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-12-16 1:17 [PATCH] memblock: fix memblock_phys_alloc() section mismatch error Jackie Liu
2021-12-16 9:00 ` Mike Rapoport [this message]
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=YbsAJ5mDxz2H5aZ6@kernel.org \
--to=rppt@kernel.org \
--cc=akpm@linux-foundation.org \
--cc=linux-mm@kvack.org \
--cc=liu.yun@linux.dev \
/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;
as well as URLs for NNTP newsgroup(s).