diff mbox

[2/2] mm: fix undefined reference to `.kernel_map_pages' on PPC builds

Message ID 20150120140200.aa7ba0eb28d95e456972e178@freescale.com (mailing list archive)
State Rejected, archived
Headers show

Commit Message

Kim Phillips Jan. 20, 2015, 8:02 p.m. UTC
It's possible to configure DEBUG_PAGEALLOC without PAGE_POISONING on
ppc.  Fix building the generic kernel_map_pages() implementation in
this case:

  LD      init/built-in.o
mm/built-in.o: In function `free_pages_prepare':
mm/page_alloc.c:770: undefined reference to `.kernel_map_pages'
mm/built-in.o: In function `prep_new_page':
mm/page_alloc.c:933: undefined reference to `.kernel_map_pages'
mm/built-in.o: In function `map_pages':
mm/compaction.c:61: undefined reference to `.kernel_map_pages'
make: *** [vmlinux] Error 1

Signed-off-by: Kim Phillips <kim.phillips@freescale.com>
---
 mm/Makefile | 1 +
 1 file changed, 1 insertion(+)

Comments

Josh Triplett Jan. 20, 2015, 11:01 p.m. UTC | #1
On Tue, Jan 20, 2015 at 02:02:00PM -0600, Kim Phillips wrote:
> It's possible to configure DEBUG_PAGEALLOC without PAGE_POISONING on
> ppc.  Fix building the generic kernel_map_pages() implementation in
> this case:
> 
>   LD      init/built-in.o
> mm/built-in.o: In function `free_pages_prepare':
> mm/page_alloc.c:770: undefined reference to `.kernel_map_pages'
> mm/built-in.o: In function `prep_new_page':
> mm/page_alloc.c:933: undefined reference to `.kernel_map_pages'
> mm/built-in.o: In function `map_pages':
> mm/compaction.c:61: undefined reference to `.kernel_map_pages'
> make: *** [vmlinux] Error 1
> 
> Signed-off-by: Kim Phillips <kim.phillips@freescale.com>
> ---
>  mm/Makefile | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/mm/Makefile b/mm/Makefile
> index 4bf586e..2956467 100644
> --- a/mm/Makefile
> +++ b/mm/Makefile
> @@ -46,6 +46,7 @@ obj-$(CONFIG_SLOB) += slob.o
>  obj-$(CONFIG_MMU_NOTIFIER) += mmu_notifier.o
>  obj-$(CONFIG_KSM) += ksm.o
>  obj-$(CONFIG_PAGE_POISONING) += debug-pagealloc.o
> +obj-$(CONFIG_DEBUG_PAGEALLOC) += debug-pagealloc.o

Does it work correctly to list the same object file twice?  Doesn't seem
like it would.  Shouldn't this do something like the following instead:

ifneq ($(CONFIG_DEBUG_PAGEALLOC)$(CONFIG_PAGE_POISONING),)
obj-y += debug-pagealloc.o
endif

?

>  obj-$(CONFIG_SLAB) += slab.o
>  obj-$(CONFIG_SLUB) += slub.o
>  obj-$(CONFIG_KMEMCHECK) += kmemcheck.o
> -- 
> 2.2.2
>
Andrew Morton Jan. 21, 2015, 12:07 a.m. UTC | #2
On Tue, 20 Jan 2015 15:01:50 -0800 josh@joshtriplett.org wrote:

> On Tue, Jan 20, 2015 at 02:02:00PM -0600, Kim Phillips wrote:
> > It's possible to configure DEBUG_PAGEALLOC without PAGE_POISONING on
> > ppc.  Fix building the generic kernel_map_pages() implementation in
> > this case:
> > 
> >   LD      init/built-in.o
> > mm/built-in.o: In function `free_pages_prepare':
> > mm/page_alloc.c:770: undefined reference to `.kernel_map_pages'
> > mm/built-in.o: In function `prep_new_page':
> > mm/page_alloc.c:933: undefined reference to `.kernel_map_pages'
> > mm/built-in.o: In function `map_pages':
> > mm/compaction.c:61: undefined reference to `.kernel_map_pages'
> > make: *** [vmlinux] Error 1
> > 
> > Signed-off-by: Kim Phillips <kim.phillips@freescale.com>
> > ---
> >  mm/Makefile | 1 +
> >  1 file changed, 1 insertion(+)
> > 
> > diff --git a/mm/Makefile b/mm/Makefile
> > index 4bf586e..2956467 100644
> > --- a/mm/Makefile
> > +++ b/mm/Makefile
> > @@ -46,6 +46,7 @@ obj-$(CONFIG_SLOB) += slob.o
> >  obj-$(CONFIG_MMU_NOTIFIER) += mmu_notifier.o
> >  obj-$(CONFIG_KSM) += ksm.o
> >  obj-$(CONFIG_PAGE_POISONING) += debug-pagealloc.o
> > +obj-$(CONFIG_DEBUG_PAGEALLOC) += debug-pagealloc.o
> 
> Does it work correctly to list the same object file twice?  Doesn't seem
> like it would.  Shouldn't this do something like the following instead:
> 
> ifneq ($(CONFIG_DEBUG_PAGEALLOC)$(CONFIG_PAGE_POISONING),)
> obj-y += debug-pagealloc.o
> endif
> 

I expect it's a Kconfig problem.  DEBUG_PAGEALLOC should be selecting
PAGE_POISONING.

config DEBUG_PAGEALLOC
	bool "Debug page memory allocations"
	depends on DEBUG_KERNEL
	depends on !HIBERNATION || ARCH_SUPPORTS_DEBUG_PAGEALLOC && !PPC && !SPARC
	depends on !KMEMCHECK
	select PAGE_EXTENSION
	select PAGE_POISONING if !ARCH_SUPPORTS_DEBUG_PAGEALLOC

Culprits cc'ed!
Akinobu Mita Jan. 21, 2015, 12:57 p.m. UTC | #3
2015-01-21 9:07 GMT+09:00 Andrew Morton <akpm@linux-foundation.org>:
> On Tue, 20 Jan 2015 15:01:50 -0800 josh@joshtriplett.org wrote:
>
>> On Tue, Jan 20, 2015 at 02:02:00PM -0600, Kim Phillips wrote:
>> > It's possible to configure DEBUG_PAGEALLOC without PAGE_POISONING on
>> > ppc.  Fix building the generic kernel_map_pages() implementation in
>> > this case:
>> >
>> >   LD      init/built-in.o
>> > mm/built-in.o: In function `free_pages_prepare':
>> > mm/page_alloc.c:770: undefined reference to `.kernel_map_pages'
>> > mm/built-in.o: In function `prep_new_page':
>> > mm/page_alloc.c:933: undefined reference to `.kernel_map_pages'
>> > mm/built-in.o: In function `map_pages':
>> > mm/compaction.c:61: undefined reference to `.kernel_map_pages'
>> > make: *** [vmlinux] Error 1

kernel_map_pages() is static inline function since commit 031bc5743f15
("mm/debug-pagealloc: make debug-pagealloc boottime configurable").

But there is old declaration in 'arch/powerpc/include/asm/cacheflush.h'.
Removing it or changing s/kernel_map_pages/__kernel_map_pages/ in this
header file or something can fix this problem?

The architecture which has ARCH_SUPPORTS_DEBUG_PAGEALLOC
including PPC should not build mm/debug-pagealloc.o
diff mbox

Patch

diff --git a/mm/Makefile b/mm/Makefile
index 4bf586e..2956467 100644
--- a/mm/Makefile
+++ b/mm/Makefile
@@ -46,6 +46,7 @@  obj-$(CONFIG_SLOB) += slob.o
 obj-$(CONFIG_MMU_NOTIFIER) += mmu_notifier.o
 obj-$(CONFIG_KSM) += ksm.o
 obj-$(CONFIG_PAGE_POISONING) += debug-pagealloc.o
+obj-$(CONFIG_DEBUG_PAGEALLOC) += debug-pagealloc.o
 obj-$(CONFIG_SLAB) += slab.o
 obj-$(CONFIG_SLUB) += slub.o
 obj-$(CONFIG_KMEMCHECK) += kmemcheck.o