Thread (4 messages) flat view 4 messages, 4 authors, 2021-08-18

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

From: Christophe Leroy <hidden>
Date: 2021-08-04 05:35:47


Le 04/08/2021 à 03:37, Jordan Niethe a écrit :
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:

LD      .tmp_vmlinux.kallsyms1
powerpc64-linux-ld: arch/powerpc/mm/pgtable.o: in function `.__ptep_set_access_flags':
pgtable.c:(.text+0x17c): undefined reference to `.radix__ptep_set_access_flags'

This is due to radix_enabled() not being inlined. See extract from building with -Winline:

In file included from arch/powerpc/include/asm/lppaca.h:46,
                  from arch/powerpc/include/asm/paca.h:17,
                  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:78,
                  from include/linux/spinlock.h:51,
                  from include/linux/mmzone.h:8,
                  from include/linux/gfp.h:6,
                  from arch/powerpc/mm/pgtable.c:21:
arch/powerpc/include/asm/book3s/64/pgtable.h: In function '__ptep_set_access_flags':
arch/powerpc/include/asm/mmu.h:327:20: error: inlining failed in call to 'radix_enabled': call is unlikely and code size would grow [-Werror=inline]

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.
Thanks for looking at that. I also got a few notifications of that problem by kernel test robot but 
I didn't look at it yet.

https://lkml.org/lkml/2021/7/31/257
https://lkml.org/lkml/2021/7/25/271
quoted hunk ↗ jump to hunk
Link: https://bugzilla.kernel.org/show_bug.cgi?id=213803
Reported-by: Erhard F. <redacted>
Suggested-by: Michael Ellerman <mpe@ellerman.id.au>
Signed-off-by: Jordan Niethe <redacted>
---
  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);
  }
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help