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

From: Michael Ellerman <[email-masked]>
Date: Mon, 11 Nov 2019 21:24:31 +1100

Hi Mike,

Mike Kravetz <[email-masked]> writes:
> On 11/5/19 2:19 AM, Stephen Rothwell wrote:
>> Hi all,
>> 
>> After merging the akpm-current tree, today's linux-next build (powerpc64
>> allnoconfig) failed like this:
>> 
>> In file included from arch/powerpc/mm/mem.c:30:
>> include/linux/hugetlb.h:233:19: error: redefinition of 'pmd_huge'
>>   233 | static inline int pmd_huge(pmd_t pmd)
>>       |                   ^~~~~~~~
>> In file included from arch/powerpc/include/asm/book3s/64/pgtable.h:301,
>>                  from arch/powerpc/include/asm/book3s/64/mmu-hash.h:20,
>>                  from arch/powerpc/include/asm/book3s/64/mmu.h:46,
>>                  from arch/powerpc/include/asm/mmu.h:356,
>>                  from arch/powerpc/include/asm/lppaca.h:47,
>>                  from arch/powerpc/include/asm/paca.h:17,
>>                  from arch/powerpc/include/asm/current.h:13,
>>                  from include/linux/sched.h:12,
>>                  from arch/powerpc/mm/mem.c:16:
>> arch/powerpc/include/asm/book3s/64/pgtable-4k.h:74:19: note: previous definition of 'pmd_huge' was here
>>    74 | static inline int pmd_huge(pmd_t pmd) { return 0; }
>>       |                   ^~~~~~~~
...
>
> Hello Michael,
>
> When I started to look into this I noticed that you added commit aad71e3928be
> ("powerpc/mm: Fix build break with RADIX=y & HUGETLBFS=n") some time back.
> It appears that all other architectures get the definition of pmd_huge and
> pud_huge from <linux/hugetlb.h> in the !CONFIG_HUGETLB_PAGE case.  Previously,
> this was not an issue as the #define pmd_huge/pud_huge did not conflict with
> the static inline in the powerpc header files.  The conflicts above happened
> when I converted the macros to also be static inlines.  Could you live with
> a patch like the following to remove the stubs from powerpc header files and
> fix your original build break by including  <linux/hugetlb.h>?  After the
> below patch is applied, the above commit will not cause the build errors seen
> in linux-next.

As long as the end result is the same, ie. we get an empty definition
that always returns false then yeah that's fine by me.

> From 4b3ab017e639e4e583fff801e6d8e6727b7877e8 Mon Sep 17 00:00:00 2001
> From: Mike Kravetz <[email-masked]>
> Date: Tue, 5 Nov 2019 15:12:15 -0800
> Subject: [PATCH] powerpc/mm: remove pmd_huge/pud_huge stubs and include
>  hugetlb.h
>
> This removes the power specific stubs created by commit aad71e3928be
> ("powerpc/mm: Fix build break with RADIX=y & HUGETLBFS=n") used when
> !CONFIG_HUGETLB_PAGE.  Instead, it addresses the build break by
> getting the definitions from <linux/hugetlb.h>.
>
> Signed-off-by: Mike Kravetz <[email-masked]>
> ---
>  arch/powerpc/include/asm/book3s/64/pgtable-4k.h  | 3 ---
>  arch/powerpc/include/asm/book3s/64/pgtable-64k.h | 3 ---
>  arch/powerpc/mm/book3s64/radix_pgtable.c         | 1 +
>  3 files changed, 1 insertion(+), 6 deletions(-)

The two pgtable headers are included eventually by our top-level
pgtable.h, and that is included by over 100 files. So I worry this is
going to break the build somewhere in some obscure configuration.

I'll push it through some test builds and see what happens.

cheers