mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Ritesh Harjani (IBM)" <ritesh.list@gmail.com>
To: linuxppc-dev@lists.ozlabs.org
Cc: Madhavan Srinivasan <maddy@linux.ibm.com>,
	Michael Ellerman <mpe@ellerman.id.au>,
	Christophe Leroy <chleroy@kernel.org>,
	Venkat Rao Bagalkote <venkat88@linux.ibm.com>,
	Shrikanth Hegde <sshegde@linux.ibm.com>,
	Marco Elver <elver@google.com>,
	linux-kernel@vger.kernel.org,
	"Ritesh Harjani (IBM)" <ritesh.list@gmail.com>
Subject: [RFC 02/12] powerpc/pseries: Rework hugepage invalidate to remove conditional locking
Date: Sun, 27 Sep 2026 20:03:43 +0530	[thread overview]
Message-ID: <89d8ff14a479760d1a37cae9f7667a07feaad0a2.1790517984.git.ritesh.list@gmail.com> (raw)
In-Reply-To: <cover.1790517984.git.ritesh.list@gmail.com>

Clang's compiler based static context analysis does not work with locks
that are conditionally taken like in __pSeries_lpar_hugepage_invalidate().

lpar.c:1240:6: error: spinlock 'pSeries_lpar_tlbie_lock' is not held on every path through here [-Werror,-Wthread-safety-analysis]

But this also simplifies the function definition in my opinion - so this
is also a win.

No functional change intended.

Signed-off-by: Ritesh Harjani (IBM) <ritesh.list@gmail.com>
---
 arch/powerpc/platforms/pseries/lpar.c | 25 ++++++++++++++++---------
 1 file changed, 16 insertions(+), 9 deletions(-)

diff --git a/arch/powerpc/platforms/pseries/lpar.c b/arch/powerpc/platforms/pseries/lpar.c
index 94cd30e9f6e1..abd77c45cbf4 100644
--- a/arch/powerpc/platforms/pseries/lpar.c
+++ b/arch/powerpc/platforms/pseries/lpar.c
@@ -1224,26 +1224,33 @@ static void hugepage_bulk_invalidate(unsigned long *slot, unsigned long *vpn,
 		BUG_ON(rc != H_SUCCESS);
 	}
 }
-
-static void __pSeries_lpar_hugepage_invalidate(unsigned long *slot,
+static void __pSeries_lpar_hugepage_invalidate_unlocked(unsigned long *slot,
 						      unsigned long *vpn,
 						      int count, int psize,
 						      int ssize)
 {
-	unsigned long flags = 0;
-	int lock_tlbie = !mmu_has_feature(MMU_FTR_LOCKLESS_TLBIE);
-
-	if (lock_tlbie)
-		spin_lock_irqsave(&pSeries_lpar_tlbie_lock, flags);
-
 	/* Assuming THP size is 16M */
 	if (is_supported_hlbkrm(psize, MMU_PAGE_16M))
 		hugepage_block_invalidate(slot, vpn, count, psize, ssize);
 	else
 		hugepage_bulk_invalidate(slot, vpn, count, psize, ssize);
+}
 
-	if (lock_tlbie)
+static void __pSeries_lpar_hugepage_invalidate(unsigned long *slot,
+						      unsigned long *vpn,
+						      int count, int psize,
+						      int ssize)
+{
+	unsigned long flags = 0;
+
+	if (!mmu_has_feature(MMU_FTR_LOCKLESS_TLBIE)) {
+		spin_lock_irqsave(&pSeries_lpar_tlbie_lock, flags);
+		__pSeries_lpar_hugepage_invalidate_unlocked(slot, vpn, count, psize, ssize);
 		spin_unlock_irqrestore(&pSeries_lpar_tlbie_lock, flags);
+		return;
+	}
+
+	__pSeries_lpar_hugepage_invalidate_unlocked(slot, vpn, count, psize, ssize);
 }
 
 static void pSeries_lpar_hugepage_invalidate(unsigned long vsid,
-- 
2.39.5


  parent reply	other threads:[~2026-09-27 14:34 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-27 14:33 [RFC 00/12] powerpc/pseries,powernv: Enable clang context analysis Ritesh Harjani (IBM)
2026-09-27 14:33 ` [RFC 01/12] powerpc/pseries: Drop inline from hugepage invalidate Ritesh Harjani (IBM)
2026-09-27 14:33 ` Ritesh Harjani (IBM) [this message]
2026-09-27 14:33 ` [RFC 03/12] powerpc/pseries: Rework hash flush to remove conditional locking Ritesh Harjani (IBM)
2026-09-27 14:33 ` [RFC 04/12] powerpc/pseries: Add context annotations for the DTL worker lock Ritesh Harjani (IBM)
2026-09-27 14:33 ` [RFC 05/12] powerpc/pseries: Annotate the VPD sequence lock context Ritesh Harjani (IBM)
2026-09-27 14:33 ` [RFC 06/12] powerpc/pseries: Annotate the RTAS indices " Ritesh Harjani (IBM)
2026-09-27 14:33 ` [RFC 07/12] powerpc/pseries: Annotate the RTAS physical-attestation " Ritesh Harjani (IBM)
2026-09-27 14:33 ` [RFC 08/12] powerpc/pseries: Annotate the DTL debugfs read " Ritesh Harjani (IBM)
2026-09-29  2:04   ` Ritesh Harjani
2026-09-27 14:33 ` [RFC 09/12] powerpc/pseries: Disable context analysis for the CMM hotplug notifier Ritesh Harjani (IBM)
2026-09-27 14:33 ` [RFC 10/12] powerpc/pseries: Enable context analysis Ritesh Harjani (IBM)
2026-09-27 14:33 ` [RFC 11/12] powerpc/powernv: Rework OPAL console write to remove conditional locking Ritesh Harjani (IBM)
2026-09-27 14:33 ` [RFC 12/12] 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=89d8ff14a479760d1a37cae9f7667a07feaad0a2.1790517984.git.ritesh.list@gmail.com \
    --to=ritesh.list@gmail.com \
    --cc=chleroy@kernel.org \
    --cc=elver@google.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linuxppc-dev@lists.ozlabs.org \
    --cc=maddy@linux.ibm.com \
    --cc=mpe@ellerman.id.au \
    --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®