From: "Ritesh Harjani (IBM)" <ritesh.list@gmail.com>
To: linuxppc-dev@lists.ozlabs.org
Cc: Madhavan Srinivasan <maddy@linux.ibm.com>,
Venkat Rao Bagalkote <venkat88@linux.ibm.com>,
linux-kernel@vger.kernel.org, chleroy@kernel.org,
Michael Ellerman <mpe@ellerman.id.au>,
Nicholas Piggin <npiggin@gmail.com>,
Shrikanth Hegde <sshegde@linux.ibm.com>,
"Ritesh Harjani (IBM)" <ritesh.list@gmail.com>
Subject: [PATCHv3 02/19] powerpc/mm/book3s64: Rework tlbie() to remove conditional locking
Date: Fri, 20 Nov 2026 09:33:01 +0530 [thread overview]
Message-ID: <f6de49ee75ad37cceb9b67bc1d79ea64fee19258.1795147055.git.ritesh.list@gmail.com> (raw)
In-Reply-To: <cover.1795147055.git.ritesh.list@gmail.com>
Clang's context analysis reports:
hash_native.c:235:2: error: raw_spinlock 'native_tlbie_lock' is not held on every path through here [-Werror,-Wthread-safety-analysis]
hash_native.c:245:3: error: releasing raw_spinlock 'native_tlbie_lock' that was not held [-Werror,-Wthread-safety-analysis]
This patch reworks the tlbie() function to remove the conditional
locking. It fixes the clang context analysis reported errors. However,
this also simplifies the code around tlbie[l] - which is also a win.
No functional change intended.
Signed-off-by: Ritesh Harjani (IBM) <ritesh.list@gmail.com>
---
arch/powerpc/mm/book3s64/hash_native.c | 34 ++++++++++++++++++--------
1 file changed, 24 insertions(+), 10 deletions(-)
diff --git a/arch/powerpc/mm/book3s64/hash_native.c b/arch/powerpc/mm/book3s64/hash_native.c
index ab2a80e59011..6bad0545b57a 100644
--- a/arch/powerpc/mm/book3s64/hash_native.c
+++ b/arch/powerpc/mm/book3s64/hash_native.c
@@ -222,6 +222,23 @@ static inline void __tlbiel(unsigned long vpn, int psize, int apsize, int ssize)
}
+static inline void __tlbie_sequence(unsigned long vpn, int psize, int apsize,
+ int ssize)
+{
+ asm volatile("ptesync": : :"memory");
+ __tlbie(vpn, psize, apsize, ssize);
+ fixup_tlbie_vpn(vpn, psize, apsize, ssize);
+ asm volatile("eieio; tlbsync; ptesync": : :"memory");
+}
+
+static inline void __tlbiel_sequence(unsigned long vpn, int psize, int apsize,
+ int ssize)
+{
+ asm volatile("ptesync": : :"memory");
+ __tlbiel(vpn, psize, apsize, ssize);
+ ppc_after_tlbiel_barrier();
+}
+
static inline void tlbie(unsigned long vpn, int psize, int apsize,
int ssize, int local)
{
@@ -230,19 +247,16 @@ static inline void tlbie(unsigned long vpn, int psize, int apsize,
if (use_local)
use_local = mmu_psize_defs[psize].tlbiel;
- if (lock_tlbie && !use_local)
- raw_spin_lock(&native_tlbie_lock);
- asm volatile("ptesync": : :"memory");
+
if (use_local) {
- __tlbiel(vpn, psize, apsize, ssize);
- ppc_after_tlbiel_barrier();
+ __tlbiel_sequence(vpn, psize, apsize, ssize);
+ } else if (lock_tlbie) {
+ raw_spin_lock(&native_tlbie_lock);
+ __tlbie_sequence(vpn, psize, apsize, ssize);
+ raw_spin_unlock(&native_tlbie_lock);
} else {
- __tlbie(vpn, psize, apsize, ssize);
- fixup_tlbie_vpn(vpn, psize, apsize, ssize);
- asm volatile("eieio; tlbsync; ptesync": : :"memory");
+ __tlbie_sequence(vpn, psize, apsize, ssize);
}
- if (lock_tlbie && !use_local)
- raw_spin_unlock(&native_tlbie_lock);
}
static inline void native_lock_hpte(struct hash_pte *hptep)
--
2.39.5
next prev parent reply other threads:[~2026-11-20 4:03 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-20 4:02 [PATCHv3 00/19] powerpc/mm, pseries, powernv: Enable clang context analysis Ritesh Harjani (IBM)
2026-11-20 4:03 ` [PATCHv3 01/19] powerpc/mm/book3s64: unlock RCU before returning from mm_iommu_is_devmem() Ritesh Harjani (IBM)
2026-11-20 4:03 ` Ritesh Harjani (IBM) [this message]
2026-11-20 4:03 ` [PATCHv3 03/19] powerpc/64s/hash: Reference all arguments in the 4K pte_iterate_hashed_subpages() Ritesh Harjani (IBM)
2026-11-20 4:03 ` [PATCHv3 04/19] powerpc/mm/book3s64: Rework native_flush_hash_range() to remove conditional locking Ritesh Harjani (IBM)
2026-11-20 4:03 ` [PATCHv3 05/19] powerpc/mm/book3s64: Annotate the subpage-protection PTE lock Ritesh Harjani (IBM)
2026-11-20 4:03 ` [PATCHv3 06/19] powerpc/mm: Rework nohash TLB broadcast locking Ritesh Harjani (IBM)
2026-11-20 4:03 ` [PATCHv3 07/19] powerpc/mm: Enable context analysis Ritesh Harjani (IBM)
2026-11-20 4:03 ` [PATCHv3 08/19] powerpc/pseries: Drop inline from hugepage invalidate Ritesh Harjani (IBM)
2026-11-20 4:03 ` [PATCHv3 09/19] powerpc/pseries: Rework hugepage invalidate to remove conditional locking Ritesh Harjani (IBM)
2026-11-20 4:03 ` [PATCHv3 10/19] powerpc/pseries: Rework hash flush " Ritesh Harjani (IBM)
2026-11-20 4:03 ` [PATCHv3 11/19] powerpc/pseries: Add context annotations for the DTL worker lock Ritesh Harjani (IBM)
2026-11-20 4:03 ` [PATCHv3 12/19] powerpc/pseries: Annotate the VPD sequence lock context Ritesh Harjani (IBM)
2026-11-20 4:03 ` [PATCHv3 13/19] powerpc/pseries: Annotate the RTAS indices " Ritesh Harjani (IBM)
2026-11-20 4:03 ` [PATCHv3 14/19] powerpc/pseries: Annotate the RTAS physical-attestation " Ritesh Harjani (IBM)
2026-11-20 4:03 ` [PATCHv3 15/19] powerpc/pseries: Annotate the DTL debugfs read " Ritesh Harjani (IBM)
2026-11-20 4:03 ` [PATCHv3 16/19] powerpc/pseries: Disable context analysis for the CMM hotplug notifier Ritesh Harjani (IBM)
2026-11-20 4:03 ` [PATCHv3 17/19] powerpc/pseries: Enable context analysis Ritesh Harjani (IBM)
2026-11-20 4:03 ` [PATCHv3 18/19] powerpc/powernv: Rework OPAL console write to remove conditional locking Ritesh Harjani (IBM)
2026-11-20 4:03 ` [PATCHv3 19/19] powerpc/powernv: Enable context analysis Ritesh Harjani (IBM)
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=f6de49ee75ad37cceb9b67bc1d79ea64fee19258.1795147055.git.ritesh.list@gmail.com \
--to=ritesh.list@gmail.com \
--cc=chleroy@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linuxppc-dev@lists.ozlabs.org \
--cc=maddy@linux.ibm.com \
--cc=mpe@ellerman.id.au \
--cc=npiggin@gmail.com \
--cc=sshegde@linux.ibm.com \
--cc=venkat88@linux.ibm.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
all inboxes | Powered by JetHome®