[RFC 08/12] powerpc/pseries: Annotate the DTL debugfs read lock context

From: Ritesh Harjani (IBM)

Date: Sun Sep 27 2026 - 10:37:18 EST


Clang's context analysis reports:
dtl.c: error: rw_semaphore 'dtl_access_lock' is still held at the end of function [-Werror,-Wthread-safety-analysis]
dtl.c: error: releasing rw_semaphore 'dtl_access_lock' that was not held [-Werror,-Wthread-safety-analysis]

Add the necessary annotations to phy_attest_sequence_{begin|end}(),
to fix these errors for enabling Clang context analysis.

Signed-off-by: Ritesh Harjani (IBM) <ritesh.list@xxxxxxxxx>
---
arch/powerpc/platforms/pseries/dtl.c | 8 ++++++++
1 file changed, 8 insertions(+)

diff --git a/arch/powerpc/platforms/pseries/dtl.c b/arch/powerpc/platforms/pseries/dtl.c
index f293588b8c7b..18c597210103 100644
--- a/arch/powerpc/platforms/pseries/dtl.c
+++ b/arch/powerpc/platforms/pseries/dtl.c
@@ -177,7 +177,12 @@ static u64 dtl_current_index(struct dtl *dtl)
}
#endif /* CONFIG_VIRT_CPU_ACCOUNTING_NATIVE */

+/*
+ * On success the read lock stays held until dtl_disable(). That covers
+ * the whole time the debugfs file is open.
+ */
static int dtl_enable(struct dtl *dtl)
+ __cond_acquires_shared(0, &dtl_access_lock)
{
long int n_entries;
long int rc;
@@ -225,6 +230,7 @@ static int dtl_enable(struct dtl *dtl)
}

static void dtl_disable(struct dtl *dtl)
+ __releases_shared(&dtl_access_lock)
{
spin_lock(&dtl->lock);
dtl_stop(dtl);
@@ -238,6 +244,7 @@ static void dtl_disable(struct dtl *dtl)
/* file interface */

static int dtl_file_open(struct inode *inode, struct file *filp)
+ __cond_acquires_shared(0, &dtl_access_lock)
{
struct dtl *dtl = inode->i_private;
int rc;
@@ -251,6 +258,7 @@ static int dtl_file_open(struct inode *inode, struct file *filp)
}

static int dtl_file_release(struct inode *inode, struct file *filp)
+ __releases_shared(&dtl_access_lock)
{
struct dtl *dtl = inode->i_private;
dtl_disable(dtl);
--
2.39.5