From: Benjamin Gray <bgray@linux.ibm.com>
To: Christophe Leroy <christophe.leroy@csgroup.eu>,
"linuxppc-dev@lists.ozlabs.org" <linuxppc-dev@lists.ozlabs.org>
Cc: kernel test robot <lkp@intel.com>
Subject: Re: [PATCH] powerpc/tlb: Remove BUILD_BUG for book3s/32/tlbflush.h local_flush_tlb_page_psize
Date: Fri, 27 Jan 2023 09:30:59 +1100 [thread overview]
Message-ID: <0e47ee626fc06957a51c4535f1cddcf7c57836e3.camel@linux.ibm.com> (raw)
In-Reply-To: <ffcd0097-b366-b98c-9853-1d10d78a5666@csgroup.eu>
On Wed, 2023-01-25 at 09:43 +0000, Christophe Leroy wrote:
> By the way, are you should the problem is really BUILD_BUG() ?
> Looking
> at your patch I would think that the problem is because it is "static
> inline". Have you tried 'static __always_inline' instead ?
I did not try it, so I just did but it doesn't make a difference.
Looking further, the failing config also enabled
CONFIG_JUMP_LABEL_FEATURE_CHECK_DEBUG, which causes the
mmu_has_feature(MMU_FTR_TYPE_RADIX) call of radix_enabled() to be non-
trivial. It must check static_key_initialized, and falls back to
early_mmu_has_feature if it triggers. Clang apparently can't see that
early_mmu_has_feature will also always return false for Radix, so
doesn't see that everything guarded by radix_enabled() is dead code. I
suppose it's complicated by the fact it still has to run
mmu_has_feature for the assertion side effect despite the return value
being knowable at compile time.
So because of this weird interaction, the following should (and does)
also prevent the compilation error by making the radix_enabled() return
value more obvious to the compiler in the case where Radix is not
implemented. (I've put the constant second here so the early usage
assertion still runs).
diff --git a/arch/powerpc/include/asm/mmu.h
b/arch/powerpc/include/asm/mmu.h
index 94b981152667..3592ff9a522b 100644
--- a/arch/powerpc/include/asm/mmu.h
+++ b/arch/powerpc/include/asm/mmu.h
@@ -327,7 +327,7 @@ static inline void assert_pte_locked(struct
mm_struct *mm, unsigned long addr)
static __always_inline bool radix_enabled(void)
{
- return mmu_has_feature(MMU_FTR_TYPE_RADIX);
+ return mmu_has_feature(MMU_FTR_TYPE_RADIX) &&
IS_ENABLED(CONFIG_PPC_RADIX_MMU);
}
static __always_inline bool early_radix_enabled(void)
next prev parent reply other threads:[~2023-01-26 22:32 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-01-24 21:54 [PATCH] powerpc/tlb: Remove BUILD_BUG for book3s/32/tlbflush.h local_flush_tlb_page_psize Benjamin Gray
2023-01-25 9:43 ` Christophe Leroy
2023-01-26 22:30 ` Benjamin Gray [this message]
2023-01-27 6:08 ` Christophe Leroy
2023-01-25 11:35 ` Michael Ellerman
2023-01-26 21:53 ` Benjamin Gray
2023-01-31 3:09 ` Michael Ellerman
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=0e47ee626fc06957a51c4535f1cddcf7c57836e3.camel@linux.ibm.com \
--to=bgray@linux.ibm.com \
--cc=christophe.leroy@csgroup.eu \
--cc=linuxppc-dev@lists.ozlabs.org \
--cc=lkp@intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).