linux-next: build warning after merge of the akpm-current tree
Subsystems (3)
Hi all,
After merging the akpm-current tree, today's linux-next build (x86_64 allnoconfig) produced this warning:
mm/sparse.c:311:12: warning: 'fill_subsection_map' defined but not used [-Wunused-function]
311 | static int fill_subsection_map(unsigned long pfn, unsigned long nr_pages)
| ^~~~~~~~~~~~~~~~~~~
mm/sparse.c:306:13: warning: 'is_subsection_map_empty' defined but not used [-Wunused-function]
306 | static bool is_subsection_map_empty(struct mem_section *ms)
| ^~~~~~~~~~~~~~~~~~~~~~~
mm/sparse.c:301:12: warning: 'clear_subsection_map' defined but not used [-Wunused-function]
301 | static int clear_subsection_map(unsigned long pfn, unsigned long nr_pages)
| ^~~~~~~~~~~~~~~~~~~~Introduced by commits
38eb09ac7c29 ("mm/sparse.c: introduce new function fill_subsection_map()") 334411156ba6 ("mm/sparse.c: introduce a new function clear_subsection_map()")
Or maybe laster patches.
Signature · 2 lines
Cheers, Stephen Rothwell
Quoted 4 lines · Stephen Rothwell
Hi all,
After merging the akpm-current tree, today's linux-next build (
x86_64allnoconfig) produced this warning:
I tried with allnoconfig on x86_64, make doesn't trigger below warnings.
Hi Andrew,
Should we fix this kind of warning? If have to, I'll try to make several macro functions like subsection_map_init does for !CONFIG_SPARSEMEM.
Quoted 21 lines
mm/sparse.c:311:12: warning: 'fill_subsection_map' defined but not used [-Wunused-function]
311 | static intfill_subsection_map(unsigned long pfn, unsigned long nr_pages)| ^~~~~~~~~~~~~~~~~~~ mm/sparse.c:306:13: warning: 'is_subsection_map_empty' defined but not used [-Wunused-function] 306 | static bool is_subsection_map_empty(struct mem_section *ms) | ^~~~~~~~~~~~~~~~~~~~~~~ mm/sparse.c:301:12: warning: 'clear_subsection_map' defined but not used [-Wunused-function] 301 | static int clear_subsection_map(unsigned long pfn, unsigned long nr_pages) | ^~~~~~~~~~~~~~~~~~~~Introduced by commits
38eb09ac7c29("mm/sparse.c: introduce new functionfill_subsection_map()")334411156ba6("mm/sparse.c: introduce a new functionclear_subsection_map()")Or maybe laster patches.
Signature · 2 lines
Cheers, Stephen Rothwell
Quoted 15 lines · Stephen Rothwell
Hi all,
After merging the akpm-current tree, today's linux-next build (
x86_64allnoconfig) produced this warning:
mm/sparse.c:311:12: warning: 'fill_subsection_map' defined but not used [-Wunused-function]
311 | static intfill_subsection_map(unsigned long pfn, unsigned long nr_pages)| ^~~~~~~~~~~~~~~~~~~ mm/sparse.c:306:13: warning: 'is_subsection_map_empty' defined but not used [-Wunused-function] 306 | static bool is_subsection_map_empty(struct mem_section *ms) | ^~~~~~~~~~~~~~~~~~~~~~~ mm/sparse.c:301:12: warning: 'clear_subsection_map' defined but not used [-Wunused-function] 301 | static int clear_subsection_map(unsigned long pfn, unsigned long nr_pages) | ^~~~~~~~~~~~~~~~~~~~
Quoted 4 lines
Introduced by commits
38eb09ac7c29("mm/sparse.c: introduce new functionfill_subsection_map()")334411156ba6("mm/sparse.c: introduce a new functionclear_subsection_map()")
Hi Stephen,
I made below change, but I can't triger these warnings. Could you try below patch, see if it's works?
From 9be668f1e30b6bb4ed5f4a07e7d3bb76d3f58f35 Mon Sep 17 00:00:00 2001
From: Baoquan He <[email protected]>
Date: Fri, 13 Mar 2020 20:25:54 +0800
Subject: [PATCH] mm/sparse.c: fix the building warning with !SPARSEMEM
Stephen reported below warnings are seen with allnoconfig on x86_64. Fix it by making those dummy functions sub-section map handling visible with CONFIG_SPARSEMEM enabled.
mm/sparse.c:311:12: warning: 'fill_subsection_map' defined but not used [-Wunused-function]
311 | static int fill_subsection_map(unsigned long pfn, unsigned long nr_pages)
| ^~~~~~~~~~~~~~~~~~~
mm/sparse.c:306:13: warning: 'is_subsection_map_empty' defined but not used [-Wunused-function]
306 | static bool is_subsection_map_empty(struct mem_section *ms)
| ^~~~~~~~~~~~~~~~~~~~~~~
mm/sparse.c:301:12: warning: 'clear_subsection_map' defined but not used [-Wunused-function]
301 | static int clear_subsection_map(unsigned long pfn, unsigned long nr_pages)
| ^~~~~~~~~~~~~~~~~~~~--- mm/sparse.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
mm/sparse.c +1 -1
@@ -293,7 +293,7 @@ static int fill_subsection_map(unsigned long pfn, unsigned long nr_pages) return rc; } -#else +#elif defined(CONFIG_SPARSEMEM)void __init subsection_map_init (unsigned long pfn,unsigned long nr_pages) { }
Signature · 1 line
2.17.2
Hi Baoquan,
Quoted 3 lines · On Fri, 13 Mar 2020 20:56:27 +0800 Baoquan He <[email protected]> wrote:
I made below change, but I can't triger these warnings. Could you try below patch, see if it's works?
I needed to add "ARCH=x86_64" to the "make allnoconfig" command line (and the subsequent "make") otherwise I get a 32 bit build.
Quoted 29 lines
From
9be668f1e30b6bb4ed5f4a07e7d3bb76d3f58f35Mon Sep 17 00:00:00 2001
From: Baoquan He <[email protected]>
Date: Fri, 13 Mar 2020 20:25:54 +0800
Subject: [PATCH]mm/sparse.c: fix the building warning with !SPARSEMEMStephen reported below warnings are seen with allnoconfig on
x86_64. Fix it by making those dummy functions sub-section map handling visible withCONFIG_SPARSEMEMenabled.
mm/sparse.c:311:12: warning: 'fill_subsection_map' defined but not used [-Wunused-function]
311 | static intfill_subsection_map(unsigned long pfn, unsigned long nr_pages)| ^~~~~~~~~~~~~~~~~~~ mm/sparse.c:306:13: warning: 'is_subsection_map_empty' defined but not used [-Wunused-function] 306 | static bool is_subsection_map_empty(struct mem_section *ms) | ^~~~~~~~~~~~~~~~~~~~~~~ mm/sparse.c:301:12: warning: 'clear_subsection_map' defined but not used [-Wunused-function] 301 | static int clear_subsection_map(unsigned long pfn, unsigned long nr_pages) | ^~~~~~~~~~~~~~~~~~~~Signed-off-by Baoquan He <[email protected]>--- mm/sparse.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)mm/sparse.c +0
-0
mm/sparse.c static int fill_subsection_map(unsigned long pfn, unsigned long nr_pages) · line 299
Quoted 8 lines
mm/sparse.c +1
-1@@ -293,7 +293,7 @@ static int fill_subsection_map(unsigned long pfn, unsigned long nr_pages) return rc; } -#else +#elif defined(CONFIG_SPARSEMEM)void __init subsection_map_init (unsigned long pfn,unsigned long nr_pages) { }
This didn't make any difference as CONFIG_SPARSEMEM is set for the x86_64 allnoconfig build.
Signature · 2 lines
Cheers, Stephen Rothwell
Quoted 9 lines · Stephen Rothwell
Hi Baoquan,
Quoted 3 lines · On Fri, 13 Mar 2020 20:56:27 +0800 Baoquan He <[email protected]> wrote:
I made below change, but I can't triger these warnings. Could you try below patch, see if it's works?
I needed to add "ARCH=x86_64" to the "make allnoconfig" command line (and the subsequent "make") otherwise I get a 32 bit build.
Ok, I now see the warnings with 'allnoconfig ARCH=x86_64', thanks.
Quoted 31 lines
Quoted 31 lines
From
9be668f1e30b6bb4ed5f4a07e7d3bb76d3f58f35Mon Sep 17 00:00:00 2001
From: Baoquan He <[email protected]>
Date: Fri, 13 Mar 2020 20:25:54 +0800
Subject: [PATCH]mm/sparse.c: fix the building warning with !SPARSEMEMStephen reported below warnings are seen with allnoconfig on
x86_64. Fix it by making those dummy functions sub-section map handling visible withCONFIG_SPARSEMEMenabled.
mm/sparse.c:311:12: warning: 'fill_subsection_map' defined but not used [-Wunused-function]
311 | static intfill_subsection_map(unsigned long pfn, unsigned long nr_pages)| ^~~~~~~~~~~~~~~~~~~ mm/sparse.c:306:13: warning: 'is_subsection_map_empty' defined but not used [-Wunused-function] 306 | static bool is_subsection_map_empty(struct mem_section *ms) | ^~~~~~~~~~~~~~~~~~~~~~~ mm/sparse.c:301:12: warning: 'clear_subsection_map' defined but not used [-Wunused-function] 301 | static int clear_subsection_map(unsigned long pfn, unsigned long nr_pages) | ^~~~~~~~~~~~~~~~~~~~Signed-off-by Baoquan He <[email protected]>--- mm/sparse.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)mm/sparse.c +0
-0@@ -293,7 +293,7 @@ static int fill_subsection_map(unsigned long pfn, unsigned long nr_pages)
Quoted 10 lines
mm/sparse.c static int fill_subsection_map(unsigned long pfn, unsigned long nr_pages) · line 299
Quoted 7 lines
mm/sparse.c +1
-1return rc; } -#else +#elif defined(CONFIG_SPARSEMEM)void __init subsection_map_init (unsigned long pfn,unsigned long nr_pages) { }This didn't make any difference as
CONFIG_SPARSEMEMis set for thex86_64allnoconfig build.
You are right, CONFIG_SPARSEMEM is set for x86_64. I will work out a patch after testing. Thanks for these details.
Quoted 5 lines · Stephen Rothwell
After merging the akpm-current tree, today's linux-next build (
x86_64allnoconfig) produced this warning:
mm/sparse.c:311:12: warning: 'fill_subsection_map' defined but not used [-Wunused-function]
311 | static intfill_subsection_map(unsigned long pfn, unsigned long nr_pages)
Quoted 7 lines
| ^~~~~~~~~~~~~~~~~~~
mm/sparse.c:306:13: warning: 'is_subsection_map_empty' defined but not used [-Wunused-function]
306 | static bool is_subsection_map_empty(struct mem_section *ms)
| ^~~~~~~~~~~~~~~~~~~~~~~
mm/sparse.c:301:12: warning: 'clear_subsection_map' defined but not used [-Wunused-function]
301 | static int clear_subsection_map(unsigned long pfn, unsigned long nr_pages)
| ^~~~~~~~~~~~~~~~~~~~Hi Stephen, Andrew,
I made a patch to fix these warnings, the reason has been told in the log. Or just drop below patch. Both is fine to me.
mm-sparsec-move-subsection_map-related-functions-together.patch
From 273196eeb7bbc4af93bef18f594af91541e3ce8a Mon Sep 17 00:00:00 2001
From: Baoquan He <[email protected]>
Date: Sat, 14 Mar 2020 17:01:01 +0800
Subject: [PATCH] mm/sparse.c: move functions into CONFIG_MEMORY_HOTPLUG
ifdeffery scope
Stephen reported warnings are seen with allnoconfig on x86_64:
mm/sparse.c:311:12: warning: 'fill_subsection_map' defined but not used [-Wunused-function]
311 | static int fill_subsection_map(unsigned long pfn, unsigned long nr_pages)
| ^~~~~~~~~~~~~~~~~~~
mm/sparse.c:306:13: warning: 'is_subsection_map_empty' defined but not used [-Wunused-function]
306 | static bool is_subsection_map_empty(struct mem_section *ms)
| ^~~~~~~~~~~~~~~~~~~~~~~
mm/sparse.c:301:12: warning: 'clear_subsection_map' defined but not used [-Wunused-function]
301 | static int clear_subsection_map(unsigned long pfn, unsigned long nr_pages)
| ^~~~~~~~~~~~~~~~~~~~This is because allnoconfig on x86_64 sets CONFIG_SPARSEMEM=y and CONFIG_MEMORY_HOTPLUG=n. Functions clear_subsection_map(), is_subsection_map_empty() and fill_subsection_map() are all defined outside CONFIG_MEMORY_HOTPLUG ifdeffery scope. However, their callers, section_activate() and section_deactivate() are inside CONFIG_MEMORY_HOTPLUG ifdeffery scope.
So let's move them into the CONFIG_MEMORY_HOTPLUG iddeffery scope which includes their callers.
--- mm/sparse.c | 128 ++++++++++++++++++++++++++-------------------------- 1 file changed, 64 insertions(+), 64 deletions(-)
mm/sparse.c +64 -64
@@ -244,74 +244,10 @@ void __init subsection_map_init(unsigned long pfn, unsigned long nr_pages) nr_pages -= pfns; } } - -static int clear_subsection_map (unsigned long pfn,unsigned long nr_pages) -{ - DECLARE_BITMAP(map, SUBSECTIONS_PER_SECTION) = { 0 }; - DECLARE_BITMAP(tmp, SUBSECTIONS_PER_SECTION) = { 0 }; -struct mem_section *ms =__pfn_to_section (pfn); -unsigned long *subsection_map = ms->usage - ? &ms->usage->subsection_map[0 ] :NULL ; - -subsection_mask_set (map, pfn, nr_pages); -if (subsection_map) -bitmap_and (tmp, map, subsection_map,SUBSECTIONS_PER_SECTION ); - -if (WARN (!subsection_map || !bitmap_equal (tmp, map,SUBSECTIONS_PER_SECTION ), -"section already deactivated (%#lx + %ld)\n" , - pfn, nr_pages)) -return -EINVAL ; - -bitmap_xor (subsection_map, map, subsection_map,SUBSECTIONS_PER_SECTION ); -return 0 ; -} - -static bool is_subsection_map_empty (struct mem_section *ms) -{ -return bitmap_empty (&ms->usage->subsection_map[0 ], -SUBSECTIONS_PER_SECTION ); -} - -static int fill_subsection_map (unsigned long pfn,unsigned long nr_pages) -{ -struct mem_section *ms =__pfn_to_section (pfn); - DECLARE_BITMAP(map, SUBSECTIONS_PER_SECTION) = { 0 }; -unsigned long *subsection_map; -int rc =0 ; - -subsection_mask_set (map, pfn, nr_pages); - - subsection_map = &ms->usage->subsection_map[0 ]; - -if (bitmap_empty (map,SUBSECTIONS_PER_SECTION )) - rc = -EINVAL ; -else if (bitmap_intersects (map, subsection_map,SUBSECTIONS_PER_SECTION )) - rc = -EEXIST ; -else -bitmap_or (subsection_map, map, subsection_map, -SUBSECTIONS_PER_SECTION ); - -return rc; -}#else void __init subsection_map_init (unsigned long pfn,unsigned long nr_pages) { } - -static int clear_subsection_map (unsigned long pfn,unsigned long nr_pages) -{ -return 0 ; -} - -static bool is_subsection_map_empty (struct mem_section *ms) -{ -return true; -} - -static int fill_subsection_map (unsigned long pfn,unsigned long nr_pages) -{ -return 0 ; -}#endif /* Record a memory area against a node. */
@@ -730,6 +666,55 @@ static void free_map_bootmem(struct page *memmap)vmemmap_free (start, end,NULL ); } + +static int clear_subsection_map (unsigned long pfn,unsigned long nr_pages) +{ + DECLARE_BITMAP(map, SUBSECTIONS_PER_SECTION) = { 0 }; + DECLARE_BITMAP(tmp, SUBSECTIONS_PER_SECTION) = { 0 }; +struct mem_section *ms =__pfn_to_section (pfn); +unsigned long *subsection_map = ms->usage + ? &ms->usage->subsection_map[0 ] :NULL ; + +subsection_mask_set (map, pfn, nr_pages); +if (subsection_map) +bitmap_and (tmp, map, subsection_map,SUBSECTIONS_PER_SECTION ); + +if (WARN (!subsection_map || !bitmap_equal (tmp, map,SUBSECTIONS_PER_SECTION ), +"section already deactivated (%#lx + %ld)\n" , + pfn, nr_pages)) +return -EINVAL ; + +bitmap_xor (subsection_map, map, subsection_map,SUBSECTIONS_PER_SECTION ); +return 0 ; +} + +static bool is_subsection_map_empty (struct mem_section *ms) +{ +return bitmap_empty (&ms->usage->subsection_map[0 ], +SUBSECTIONS_PER_SECTION ); +} + +static int fill_subsection_map (unsigned long pfn,unsigned long nr_pages) +{ +struct mem_section *ms =__pfn_to_section (pfn); + DECLARE_BITMAP(map, SUBSECTIONS_PER_SECTION) = { 0 }; +unsigned long *subsection_map; +int rc =0 ; + +subsection_mask_set (map, pfn, nr_pages); + + subsection_map = &ms->usage->subsection_map[0 ]; + +if (bitmap_empty (map,SUBSECTIONS_PER_SECTION )) + rc = -EINVAL ; +else if (bitmap_intersects (map, subsection_map,SUBSECTIONS_PER_SECTION )) + rc = -EEXIST ; +else +bitmap_or (subsection_map, map, subsection_map, +SUBSECTIONS_PER_SECTION ); + +return rc; +}#else struct page *__meminit populate_section_memmap (unsigned long pfn,unsigned long nr_pages,int nid,struct vmem_altmap *altmap)
@@ -773,6 +758,21 @@ static void free_map_bootmem(struct page *memmap) put_page_bootmem(page); } } + +static int clear_subsection_map (unsigned long pfn,unsigned long nr_pages) +{ +return 0 ; +} + +static bool is_subsection_map_empty (struct mem_section *ms) +{ +return true; +} + +static int fill_subsection_map (unsigned long pfn,unsigned long nr_pages) +{ +return 0 ; +}#endif /* CONFIG_SPARSEMEM_VMEMMAP */ /*
Signature · 1 line
2.17.2
Stephen Rothwell
AppliedHi Baoquan,
Quoted 11 lines · On Mon, 16 Mar 2020 12:58:04 +0800 Baoquan He <[email protected]> wrote:
I made a patch to fix these warnings, the reason has been told in the log. Or just drop below patch. Both is fine to me.
mm-sparsec-move-subsection_map-related-functions-together.patch
From
273196eeb7bbc4af93bef18f594af91541e3ce8aMon Sep 17 00:00:00 2001
From: Baoquan He <[email protected]>
Date: Sat, 14 Mar 2020 17:01:01 +0800
Subject: [PATCH]mm/sparse.c: move functions intoCONFIG_MEMORY_HOTPLUG
ifdeffery scope
I have applied this to linux-next today to see how it goes.
Signature · 2 lines
Cheers, Stephen Rothwell
Quoted 9 lines · Stephen Rothwell
Hi Baoquan,
Quoted 6 lines · On Mon, 16 Mar 2020 12:58:04 +0800 Baoquan He <[email protected]> wrote:
I made a patch to fix these warnings, the reason has been told in the log. Or just drop below patch. Both is fine to me.
mm-sparsec-move-subsection_map-related-functions-together.patch
Quoted 7 lines
Quoted 5 lines
From
273196eeb7bbc4af93bef18f594af91541e3ce8aMon Sep 17 00:00:00 2001
From: Baoquan He <[email protected]>
Date: Sat, 14 Mar 2020 17:01:01 +0800
Subject: [PATCH]mm/sparse.c: move functions intoCONFIG_MEMORY_HOTPLUG
ifdeffery scopeI have applied this to linux-next today to see how it goes.
Thanks.
Stephen Rothwell
Tested-byHi all,
Quoted 10 lines · On Mon, 16 Mar 2020 17:13:26 +1100 Stephen Rothwell <[email protected]>…
Hi Baoquan,
Quoted 6 lines · On Mon, 16 Mar 2020 12:58:04 +0800 Baoquan He <[email protected]> wrote:
I made a patch to fix these warnings, the reason has been told in the log. Or just drop below patch. Both is fine to me.
mm-sparsec-move-subsection_map-related-functions-together.patch
Quoted 7 lines
Quoted 5 lines
From
273196eeb7bbc4af93bef18f594af91541e3ce8aMon Sep 17 00:00:00 2001
From: Baoquan He <[email protected]>
Date: Sat, 14 Mar 2020 17:01:01 +0800
Subject: [PATCH]mm/sparse.c: move functions intoCONFIG_MEMORY_HOTPLUG
ifdeffery scopeI have applied this to linux-next today to see how it goes.
Signature · 2 lines
Cheers, Stephen Rothwell