Subject: Re: linux-next: build failure after merge of the mm tree

From: "Aneesh Kumar K.V" <[email-masked]>
Date: Wed, 26 Jul 2023 10:52:33 +0530

Hi Stephen,

Stephen Rothwell <[email-masked]> writes:

> Hi all,
>
> After merging the mm tree, today's linux-next build (powerpc64
> allnoconfig) failed like this:
>
> In file included from arch/powerpc/include/asm/book3s/64/pgtable.h:285,
>                  from arch/powerpc/include/asm/book3s/64/mmu-hash.h:20,
>                  from arch/powerpc/include/asm/book3s/64/mmu.h:32,
>                  from arch/powerpc/include/asm/mmu.h:396,
>                  from arch/powerpc/include/asm/lppaca.h:46,
>                  from arch/powerpc/include/asm/paca.h:18,
>                  from arch/powerpc/include/asm/current.h:13,
>                  from include/linux/thread_info.h:23,
>                  from include/asm-generic/preempt.h:5,
>                  from ./arch/powerpc/include/generated/asm/preempt.h:1,
>                  from include/linux/preempt.h:79,
>                  from include/linux/spinlock.h:56,
>                  from include/linux/ipc.h:5,
>                  from include/uapi/linux/sem.h:5,
>                  from include/linux/sem.h:5,
>                  from include/linux/compat.h:14,
>                  from arch/powerpc/kernel/asm-offsets.c:12:
> arch/powerpc/include/asm/book3s/64/radix.h:367:30: error: static declaration of 'vmemmap_can_optimize' follows non-static declaration
>   367 | #define vmemmap_can_optimize vmemmap_can_optimize
>       |                              ^~~~~~~~~~~~~~~~~~~~
> include/linux/mm.h:3695:20: note: in expansion of macro 'vmemmap_can_optimize'
>  3695 | static inline bool vmemmap_can_optimize(struct vmem_altmap *altmap,
>       |                    ^~~~~~~~~~~~~~~~~~~~
> arch/powerpc/include/asm/book3s/64/radix.h:367:30: note: previous declaration of 'vmemmap_can_optimize' with type 'bool(struct vmem_altmap *, struct dev_pagemap *)' {aka '_Bool(struct vmem_altmap *, struct dev_pagemap *)'}
>   367 | #define vmemmap_can_optimize vmemmap_can_optimize
>       |                              ^~~~~~~~~~~~~~~~~~~~
> arch/powerpc/include/asm/book3s/64/radix.h:368:6: note: in expansion of macro 'vmemmap_can_optimize'
>   368 | bool vmemmap_can_optimize(struct vmem_altmap *altmap, struct dev_pagemap *pgmap);
>       |      ^~~~~~~~~~~~~~~~~~~~
>
> Presumably caused by commit
>
>   f684ffc3ac9f ("powerpc/book3s64/radix: add support for vmemmap optimization for radix")
>
> I have reverted that commit (and the following 2) for today.

Thanks for the report. Can you add the below diff. We should look at
ppc64 not including radix headers if CONFIG_PPC_RADIX_MMU is disabled.
But for now we can keep the below diff?

diff --git a/arch/powerpc/include/asm/book3s/64/radix.h b/arch/powerpc/include/asm/book3s/64/radix.h
index 3195f268ed7f..357e23a403d3 100644
--- a/arch/powerpc/include/asm/book3s/64/radix.h
+++ b/arch/powerpc/include/asm/book3s/64/radix.h
@@ -364,8 +364,10 @@ int radix__remove_section_mapping(unsigned long start, unsigned long end);
 
 void radix__kernel_map_pages(struct page *page, int numpages, int enable);
 
+#ifdef CONFIG_ARCH_WANT_OPTIMIZE_DAX_VMEMMAP
 #define vmemmap_can_optimize vmemmap_can_optimize
 bool vmemmap_can_optimize(struct vmem_altmap *altmap, struct dev_pagemap *pgmap);
+#endif
 
 #define vmemmap_populate_compound_pages vmemmap_populate_compound_pages
 int __meminit vmemmap_populate_compound_pages(unsigned long start_pfn,