Subject: Re: [PATCH] powerpc: Always inline radix_enabled() to fix build failure

From: "Erhard F." <[email-masked]>
Date: Wed, 4 Aug 2021 18:03:03 +0200

On Wed,  4 Aug 2021 11:37:24 +1000
Jordan Niethe <[email-masked]> wrote:

> This is the same as commit acdad8fb4a15 ("powerpc: Force inlining of
> mmu_has_feature to fix build failure") but for radix_enabled().  The
> config in the linked bugzilla causes the following build failure:
> [...]
> The code relies on constant folding of MMU_FTRS_POSSIBLE at buildtime
> and elimination of non possible parts of code at compile time. For this
> to work radix_enabled() must be inlined so make it __always_inline.
> 
> Link: https://bugzilla.kernel.org/show_bug.cgi?id=213803
> Reported-by: Erhard F. <[email-masked]>
> Suggested-by: Michael Ellerman <[email-masked]>
> Signed-off-by: Jordan Niethe <[email-masked]>
> ---
>  arch/powerpc/include/asm/mmu.h | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/arch/powerpc/include/asm/mmu.h b/arch/powerpc/include/asm/mmu.h
> index 27016b98ecb2..8abe8e42e045 100644
> --- a/arch/powerpc/include/asm/mmu.h
> +++ b/arch/powerpc/include/asm/mmu.h
> @@ -324,7 +324,7 @@ static inline void assert_pte_locked(struct mm_struct *mm, unsigned long addr)
>  }
>  #endif /* !CONFIG_DEBUG_VM */
>  
> -static inline bool radix_enabled(void)
> +static __always_inline bool radix_enabled(void)
>  {
>  	return mmu_has_feature(MMU_FTR_TYPE_RADIX);
>  }
> -- 
> 2.25.1

Thanks Jordan!

Your patch works well and my kernel build completes. Tested on v5.14-rc4. Only getting some warnings now:

[...]
  CHK     include/generated/autoksyms.h
  GEN     .version
  CHK     include/generated/compile.h
  LD      vmlinux.o
  MODPOST vmlinux.symvers
  MODINFO modules.builtin.modinfo
  GEN     modules.builtin
  LD      .tmp_vmlinux.kallsyms1
ld: warning: creating DT_TEXTREL in a PIE
  KSYMS   .tmp_vmlinux.kallsyms1.S
  AS      .tmp_vmlinux.kallsyms1.S
  LD      .tmp_vmlinux.kallsyms2
ld: warning: creating DT_TEXTREL in a PIE
  KSYMS   .tmp_vmlinux.kallsyms2.S
  AS      .tmp_vmlinux.kallsyms2.S
  LD      vmlinux
ld: warning: creating DT_TEXTREL in a PIE
  SORTTAB vmlinux
  SYSMAP  System.map
  CHKHEAD vmlinux
  CHKREL  vmlinux
  GEN     .version
  CHK     include/generated/compile.h
  UPD     include/generated/compile.h
  CC      init/version.o
  AR      init/built-in.a
  LD      vmlinux.o
  MODPOST vmlinux.symvers
  MODINFO modules.builtin.modinfo
  GEN     modules.builtin
  LD      .tmp_vmlinux.kallsyms1
ld: warning: creating DT_TEXTREL in a PIE
  KSYMS   .tmp_vmlinux.kallsyms1.S
  AS      .tmp_vmlinux.kallsyms1.S
  LD      .tmp_vmlinux.kallsyms2
ld: warning: creating DT_TEXTREL in a PIE
  KSYMS   .tmp_vmlinux.kallsyms2.S
  AS      .tmp_vmlinux.kallsyms2.S
  LD      vmlinux
ld: warning: creating DT_TEXTREL in a PIE
  SORTTAB vmlinux
  SYSMAP  System.map
  CHKHEAD vmlinux
  CHKREL  vmlinux
  MODPOST modules-only.symvers
[...]