* [PATCH] mm/sparse.c: mark populate_section_memmap as __meminit @ 2019-10-28 16:55 Ilya Leoshkevich 2019-10-29 11:09 ` David Hildenbrand ` (2 more replies) 0 siblings, 3 replies; 7+ messages in thread From: Ilya Leoshkevich @ 2019-10-28 16:55 UTC (permalink / raw) To: Andrew Morton Cc: linux-mm, linux-kernel, linux-s390, Heiko Carstens, Vasily Gorbik, Ilya Leoshkevich Building the kernel on s390 with -Og produces the following warning: WARNING: vmlinux.o(.text+0x28dabe): Section mismatch in reference from the function populate_section_memmap() to the function .meminit.text:__populate_section_memmap() The function populate_section_memmap() references the function __meminit __populate_section_memmap(). This is often because populate_section_memmap lacks a __meminit annotation or the annotation of __populate_section_memmap is wrong. While -Og is not supported, in theory this might still happen with another compiler or on another architecture. So fix this by using the correct section annotations. Signed-off-by: Ilya Leoshkevich <iii@linux.ibm.com> --- mm/sparse.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/mm/sparse.c b/mm/sparse.c index f6891c1992b1..0f1f36443a96 100644 --- a/mm/sparse.c +++ b/mm/sparse.c @@ -448,7 +448,7 @@ static unsigned long __init section_map_size(void) return PAGE_ALIGN(sizeof(struct page) * PAGES_PER_SECTION); } -struct page __init *__populate_section_memmap(unsigned long pfn, +struct page __meminit *__populate_section_memmap(unsigned long pfn, unsigned long nr_pages, int nid, struct vmem_altmap *altmap) { unsigned long size = section_map_size(); @@ -647,7 +647,7 @@ void offline_mem_sections(unsigned long start_pfn, unsigned long end_pfn) #endif #ifdef CONFIG_SPARSEMEM_VMEMMAP -static struct page *populate_section_memmap(unsigned long pfn, +static struct page * __meminit populate_section_memmap(unsigned long pfn, unsigned long nr_pages, int nid, struct vmem_altmap *altmap) { return __populate_section_memmap(pfn, nr_pages, nid, altmap); @@ -669,7 +669,7 @@ static void free_map_bootmem(struct page *memmap) vmemmap_free(start, end, NULL); } #else -struct page *populate_section_memmap(unsigned long pfn, +struct page * __meminit populate_section_memmap(unsigned long pfn, unsigned long nr_pages, int nid, struct vmem_altmap *altmap) { struct page *page, *ret; -- 2.23.0 ^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [PATCH] mm/sparse.c: mark populate_section_memmap as __meminit 2019-10-28 16:55 [PATCH] mm/sparse.c: mark populate_section_memmap as __meminit Ilya Leoshkevich @ 2019-10-29 11:09 ` David Hildenbrand 2019-10-30 6:42 ` kbuild test robot 2019-10-30 8:14 ` Oscar Salvador 2 siblings, 0 replies; 7+ messages in thread From: David Hildenbrand @ 2019-10-29 11:09 UTC (permalink / raw) To: Ilya Leoshkevich, Andrew Morton Cc: linux-mm, linux-kernel, linux-s390, Heiko Carstens, Vasily Gorbik On 28.10.19 17:55, Ilya Leoshkevich wrote: > Building the kernel on s390 with -Og produces the following warning: > > WARNING: vmlinux.o(.text+0x28dabe): Section mismatch in reference from the function populate_section_memmap() to the function .meminit.text:__populate_section_memmap() > The function populate_section_memmap() references > the function __meminit __populate_section_memmap(). > This is often because populate_section_memmap lacks a __meminit > annotation or the annotation of __populate_section_memmap is wrong. > > While -Og is not supported, in theory this might still happen with > another compiler or on another architecture. So fix this by using the > correct section annotations. > > Signed-off-by: Ilya Leoshkevich <iii@linux.ibm.com> > --- > mm/sparse.c | 6 +++--- > 1 file changed, 3 insertions(+), 3 deletions(-) > > diff --git a/mm/sparse.c b/mm/sparse.c > index f6891c1992b1..0f1f36443a96 100644 > --- a/mm/sparse.c > +++ b/mm/sparse.c > @@ -448,7 +448,7 @@ static unsigned long __init section_map_size(void) > return PAGE_ALIGN(sizeof(struct page) * PAGES_PER_SECTION); > } > > -struct page __init *__populate_section_memmap(unsigned long pfn, > +struct page __meminit *__populate_section_memmap(unsigned long pfn, > unsigned long nr_pages, int nid, struct vmem_altmap *altmap) > { > unsigned long size = section_map_size(); > @@ -647,7 +647,7 @@ void offline_mem_sections(unsigned long start_pfn, unsigned long end_pfn) > #endif > > #ifdef CONFIG_SPARSEMEM_VMEMMAP > -static struct page *populate_section_memmap(unsigned long pfn, > +static struct page * __meminit populate_section_memmap(unsigned long pfn, > unsigned long nr_pages, int nid, struct vmem_altmap *altmap) > { > return __populate_section_memmap(pfn, nr_pages, nid, altmap); > @@ -669,7 +669,7 @@ static void free_map_bootmem(struct page *memmap) > vmemmap_free(start, end, NULL); > } > #else > -struct page *populate_section_memmap(unsigned long pfn, > +struct page * __meminit populate_section_memmap(unsigned long pfn, > unsigned long nr_pages, int nid, struct vmem_altmap *altmap) > { > struct page *page, *ret; > So mm/sparse-vmemmap.c:__populate_section_memmap() already has this annotation. I guess it's the right thing to do as populate_section_memmap() is called from static struct page * __meminit section_activate() Acked-by: David Hildenbrand <david@redhat.com> -- Thanks, David / dhildenb ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] mm/sparse.c: mark populate_section_memmap as __meminit 2019-10-28 16:55 [PATCH] mm/sparse.c: mark populate_section_memmap as __meminit Ilya Leoshkevich 2019-10-29 11:09 ` David Hildenbrand @ 2019-10-30 6:42 ` kbuild test robot 2019-10-30 8:14 ` Oscar Salvador 2 siblings, 0 replies; 7+ messages in thread From: kbuild test robot @ 2019-10-30 6:42 UTC (permalink / raw) To: Ilya Leoshkevich Cc: kbuild-all, Andrew Morton, linux-mm, linux-kernel, linux-s390, Heiko Carstens, Vasily Gorbik, Ilya Leoshkevich [-- Attachment #1: Type: text/plain, Size: 1348 bytes --] Hi Ilya, I love your patch! Perhaps something to improve: [auto build test WARNING on mmotm/master] url: https://github.com/0day-ci/linux/commits/Ilya-Leoshkevich/mm-sparse-c-mark-populate_section_memmap-as-__meminit/20191030-113800 base: git://git.cmpxchg.org/linux-mmotm.git master config: sh-allnoconfig (attached as .config) compiler: sh4-linux-gcc (GCC) 7.4.0 reproduce: wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross chmod +x ~/bin/make.cross # save the attached .config to linux build tree GCC_VERSION=7.4.0 make.cross ARCH=sh If you fix the issue, kindly add following tag Reported-by: kbuild test robot <lkp@intel.com> All warnings (new ones prefixed by >>): >> WARNING: vmlinux.o(.meminit.text+0x153c): Section mismatch in reference from the function __populate_section_memmap() to the function .init.text:memblock_alloc_try_nid() The function __meminit __populate_section_memmap() references a function __init memblock_alloc_try_nid(). If memblock_alloc_try_nid is only used by __populate_section_memmap then annotate memblock_alloc_try_nid with a matching annotation. --- 0-DAY kernel test infrastructure Open Source Technology Center https://lists.01.org/pipermail/kbuild-all Intel Corporation [-- Attachment #2: .config.gz --] [-- Type: application/gzip, Size: 5841 bytes --] ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] mm/sparse.c: mark populate_section_memmap as __meminit @ 2019-10-30 6:42 ` kbuild test robot 0 siblings, 0 replies; 7+ messages in thread From: kbuild test robot @ 2019-10-30 6:42 UTC (permalink / raw) To: kbuild-all [-- Attachment #1: Type: text/plain, Size: 1378 bytes --] Hi Ilya, I love your patch! Perhaps something to improve: [auto build test WARNING on mmotm/master] url: https://github.com/0day-ci/linux/commits/Ilya-Leoshkevich/mm-sparse-c-mark-populate_section_memmap-as-__meminit/20191030-113800 base: git://git.cmpxchg.org/linux-mmotm.git master config: sh-allnoconfig (attached as .config) compiler: sh4-linux-gcc (GCC) 7.4.0 reproduce: wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross chmod +x ~/bin/make.cross # save the attached .config to linux build tree GCC_VERSION=7.4.0 make.cross ARCH=sh If you fix the issue, kindly add following tag Reported-by: kbuild test robot <lkp@intel.com> All warnings (new ones prefixed by >>): >> WARNING: vmlinux.o(.meminit.text+0x153c): Section mismatch in reference from the function __populate_section_memmap() to the function .init.text:memblock_alloc_try_nid() The function __meminit __populate_section_memmap() references a function __init memblock_alloc_try_nid(). If memblock_alloc_try_nid is only used by __populate_section_memmap then annotate memblock_alloc_try_nid with a matching annotation. --- 0-DAY kernel test infrastructure Open Source Technology Center https://lists.01.org/pipermail/kbuild-all Intel Corporation [-- Attachment #2: config.gz --] [-- Type: application/gzip, Size: 5841 bytes --] ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] mm/sparse.c: mark populate_section_memmap as __meminit @ 2019-10-30 6:42 ` kbuild test robot 0 siblings, 0 replies; 7+ messages in thread From: kbuild test robot @ 2019-10-30 6:42 UTC (permalink / raw) To: Ilya Leoshkevich Cc: kbuild-all, Andrew Morton, linux-mm, linux-kernel, linux-s390, Heiko Carstens, Vasily Gorbik [-- Attachment #1: Type: text/plain, Size: 1348 bytes --] Hi Ilya, I love your patch! Perhaps something to improve: [auto build test WARNING on mmotm/master] url: https://github.com/0day-ci/linux/commits/Ilya-Leoshkevich/mm-sparse-c-mark-populate_section_memmap-as-__meminit/20191030-113800 base: git://git.cmpxchg.org/linux-mmotm.git master config: sh-allnoconfig (attached as .config) compiler: sh4-linux-gcc (GCC) 7.4.0 reproduce: wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross chmod +x ~/bin/make.cross # save the attached .config to linux build tree GCC_VERSION=7.4.0 make.cross ARCH=sh If you fix the issue, kindly add following tag Reported-by: kbuild test robot <lkp@intel.com> All warnings (new ones prefixed by >>): >> WARNING: vmlinux.o(.meminit.text+0x153c): Section mismatch in reference from the function __populate_section_memmap() to the function .init.text:memblock_alloc_try_nid() The function __meminit __populate_section_memmap() references a function __init memblock_alloc_try_nid(). If memblock_alloc_try_nid is only used by __populate_section_memmap then annotate memblock_alloc_try_nid with a matching annotation. --- 0-DAY kernel test infrastructure Open Source Technology Center https://lists.01.org/pipermail/kbuild-all Intel Corporation [-- Attachment #2: .config.gz --] [-- Type: application/gzip, Size: 5841 bytes --] ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] mm/sparse.c: mark populate_section_memmap as __meminit 2019-10-28 16:55 [PATCH] mm/sparse.c: mark populate_section_memmap as __meminit Ilya Leoshkevich 2019-10-29 11:09 ` David Hildenbrand 2019-10-30 6:42 ` kbuild test robot @ 2019-10-30 8:14 ` Oscar Salvador 2019-10-30 15:07 ` Ilya Leoshkevich 2 siblings, 1 reply; 7+ messages in thread From: Oscar Salvador @ 2019-10-30 8:14 UTC (permalink / raw) To: Ilya Leoshkevich Cc: Andrew Morton, linux-mm, linux-kernel, linux-s390, Heiko Carstens, Vasily Gorbik On Mon, Oct 28, 2019 at 05:55:49PM +0100, Ilya Leoshkevich wrote: > Building the kernel on s390 with -Og produces the following warning: > > WARNING: vmlinux.o(.text+0x28dabe): Section mismatch in reference from the function populate_section_memmap() to the function .meminit.text:__populate_section_memmap() > The function populate_section_memmap() references > the function __meminit __populate_section_memmap(). > This is often because populate_section_memmap lacks a __meminit > annotation or the annotation of __populate_section_memmap is wrong. > > While -Og is not supported, in theory this might still happen with > another compiler or on another architecture. So fix this by using the > correct section annotations. > > Signed-off-by: Ilya Leoshkevich <iii@linux.ibm.com> > --- > mm/sparse.c | 6 +++--- > 1 file changed, 3 insertions(+), 3 deletions(-) > > diff --git a/mm/sparse.c b/mm/sparse.c > index f6891c1992b1..0f1f36443a96 100644 > --- a/mm/sparse.c > +++ b/mm/sparse.c > @@ -448,7 +448,7 @@ static unsigned long __init section_map_size(void) > return PAGE_ALIGN(sizeof(struct page) * PAGES_PER_SECTION); > } > > -struct page __init *__populate_section_memmap(unsigned long pfn, > +struct page __meminit *__populate_section_memmap(unsigned long pfn, > unsigned long nr_pages, int nid, struct vmem_altmap *altmap) > { > unsigned long size = section_map_size(); > @@ -647,7 +647,7 @@ void offline_mem_sections(unsigned long start_pfn, unsigned long end_pfn) > #endif > > #ifdef CONFIG_SPARSEMEM_VMEMMAP > -static struct page *populate_section_memmap(unsigned long pfn, > +static struct page * __meminit populate_section_memmap(unsigned long pfn, > unsigned long nr_pages, int nid, struct vmem_altmap *altmap) > { > return __populate_section_memmap(pfn, nr_pages, nid, altmap); > @@ -669,7 +669,7 @@ static void free_map_bootmem(struct page *memmap) > vmemmap_free(start, end, NULL); > } > #else > -struct page *populate_section_memmap(unsigned long pfn, > +struct page * __meminit populate_section_memmap(unsigned long pfn, > unsigned long nr_pages, int nid, struct vmem_altmap *altmap) > { > struct page *page, *ret; I did not really check deep, but I __think__ you only need to add __meminit in populate_section_memmap functions. __populate_section_memmap for SPARSE case is only used at init phase. -- Oscar Salvador SUSE L3 ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] mm/sparse.c: mark populate_section_memmap as __meminit 2019-10-30 8:14 ` Oscar Salvador @ 2019-10-30 15:07 ` Ilya Leoshkevich 0 siblings, 0 replies; 7+ messages in thread From: Ilya Leoshkevich @ 2019-10-30 15:07 UTC (permalink / raw) To: Oscar Salvador Cc: Andrew Morton, linux-mm, linux-kernel, linux-s390, Heiko Carstens, Vasily Gorbik > Am 30.10.2019 um 09:14 schrieb Oscar Salvador <osalvador@suse.de>: > > On Mon, Oct 28, 2019 at 05:55:49PM +0100, Ilya Leoshkevich wrote: >> Building the kernel on s390 with -Og produces the following warning: >> >> WARNING: vmlinux.o(.text+0x28dabe): Section mismatch in reference from the function populate_section_memmap() to the function .meminit.text:__populate_section_memmap() >> The function populate_section_memmap() references >> the function __meminit __populate_section_memmap(). >> This is often because populate_section_memmap lacks a __meminit >> annotation or the annotation of __populate_section_memmap is wrong. >> >> While -Og is not supported, in theory this might still happen with >> another compiler or on another architecture. So fix this by using the >> correct section annotations. >> >> Signed-off-by: Ilya Leoshkevich <iii@linux.ibm.com> >> --- >> mm/sparse.c | 6 +++--- >> 1 file changed, 3 insertions(+), 3 deletions(-) >> >> diff --git a/mm/sparse.c b/mm/sparse.c >> index f6891c1992b1..0f1f36443a96 100644 >> --- a/mm/sparse.c >> +++ b/mm/sparse.c >> @@ -448,7 +448,7 @@ static unsigned long __init section_map_size(void) >> return PAGE_ALIGN(sizeof(struct page) * PAGES_PER_SECTION); >> } >> >> -struct page __init *__populate_section_memmap(unsigned long pfn, >> +struct page __meminit *__populate_section_memmap(unsigned long pfn, >> unsigned long nr_pages, int nid, struct vmem_altmap *altmap) >> { >> unsigned long size = section_map_size(); >> @@ -647,7 +647,7 @@ void offline_mem_sections(unsigned long start_pfn, unsigned long end_pfn) >> #endif >> >> #ifdef CONFIG_SPARSEMEM_VMEMMAP >> -static struct page *populate_section_memmap(unsigned long pfn, >> +static struct page * __meminit populate_section_memmap(unsigned long pfn, >> unsigned long nr_pages, int nid, struct vmem_altmap *altmap) >> { >> return __populate_section_memmap(pfn, nr_pages, nid, altmap); >> @@ -669,7 +669,7 @@ static void free_map_bootmem(struct page *memmap) >> vmemmap_free(start, end, NULL); >> } >> #else >> -struct page *populate_section_memmap(unsigned long pfn, >> +struct page * __meminit populate_section_memmap(unsigned long pfn, >> unsigned long nr_pages, int nid, struct vmem_altmap *altmap) >> { >> struct page *page, *ret; > > I did not really check deep, but I __think__ you only need to add __meminit in > populate_section_memmap functions. > > __populate_section_memmap for SPARSE case is only used at init phase. You are absolutely right, and this is what must be causing the problem on sh4. With CONFIG_SPARSEMEM_VMEMMAP, populate_section_memmap calls __populate_section_memmap version from mm/sparse-vmemmap.c, which is already marked as __meminit. Without CONFIG_SPARSEMEM_VMEMMAP, populate_section_memmap does not call __populate_section_memmap (which is then defined in mm/sparse.c). Like you said, in this case the latter is called only during the init phase (by sparse_init_nid), so it should keep the __init annotation. I think it still makes sense to mark the !CONFIG_SPARSEMEM_VMEMMAP version of populate_section_memmap as __meminit, since it's only called from __meminit section_activate. I will send a v2. ^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2019-10-30 15:07 UTC | newest] Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2019-10-28 16:55 [PATCH] mm/sparse.c: mark populate_section_memmap as __meminit Ilya Leoshkevich 2019-10-29 11:09 ` David Hildenbrand 2019-10-30 6:42 ` kbuild test robot 2019-10-30 6:42 ` kbuild test robot 2019-10-30 6:42 ` kbuild test robot 2019-10-30 8:14 ` Oscar Salvador 2019-10-30 15:07 ` Ilya Leoshkevich
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.