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 1/6] powerpc/mm/book3s64: unlock RCU before returning from mm_iommu_is_devmem()
Date: Mon, 28 Sep 2026 16:14:31 +0530 [thread overview]
Message-ID: <04e4dafde56fe4b055fbd763dc0e119862073c6d.1790590014.git.ritesh.list@gmail.com> (raw)
In-Reply-To: <cover.1790590014.git.ritesh.list@gmail.com>
Clang's context analysis reports:
iommu_api.c:380:1: error: __ctx_lock_RCU 'RCU' is not held on every path through here [-Werror,-Wthread-safety-analysis]
mm_iommu_is_devmem() takes the RCU read lock to walk the preregistered
device-memory list. On a match it returned true from inside the loop and
skipped rcu_read_unlock(). Hence fix it.
Fixes: b5952f8125ae ("powerpc/mm/book3s64/iommu: fix some RCU-list locks")
Signed-off-by: Ritesh Harjani (IBM) <ritesh.list@gmail.com>
---
arch/powerpc/mm/book3s64/iommu_api.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/arch/powerpc/mm/book3s64/iommu_api.c b/arch/powerpc/mm/book3s64/iommu_api.c
index 60d00c9e7f19..56d9aa6cc8e2 100644
--- a/arch/powerpc/mm/book3s64/iommu_api.c
+++ b/arch/powerpc/mm/book3s64/iommu_api.c
@@ -356,6 +356,7 @@ bool mm_iommu_is_devmem(struct mm_struct *mm, unsigned long hpa,
{
struct mm_iommu_table_group_mem_t *mem;
unsigned long end;
+ bool ret = false;
rcu_read_lock();
list_for_each_entry_rcu(mem, &mm->context.iommu_group_mem_list, next) {
@@ -371,12 +372,13 @@ bool mm_iommu_is_devmem(struct mm_struct *mm, unsigned long hpa,
* and the caller needs to distinguish this situation.
*/
*size = min(1UL << pageshift, end - hpa);
- return true;
+ ret = true;
+ break;
}
}
rcu_read_unlock();
- return false;
+ return ret;
}
EXPORT_SYMBOL_GPL(mm_iommu_is_devmem);
--
2.39.5
next prev parent reply other threads:[~2026-09-28 10:44 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-28 10:44 [RFC 0/6] powerpc/mm: Enable clang context analysis Ritesh Harjani (IBM)
2026-09-28 10:44 ` Ritesh Harjani (IBM) [this message]
2026-09-28 10:44 ` [RFC 2/6] powerpc/mm/book3s64: Rework tlbie() to remove conditional locking Ritesh Harjani (IBM)
2026-09-28 10:44 ` [RFC 3/6] powerpc/mm/book3s64: Rework native_flush_hash_range() " Ritesh Harjani (IBM)
2026-09-28 10:44 ` [RFC 4/6] powerpc/mm/book3s64: Annotate the subpage-protection PTE lock Ritesh Harjani (IBM)
2026-09-28 10:44 ` [RFC 5/6] powerpc/mm: Rework nohash TLB broadcast locking Ritesh Harjani (IBM)
2026-09-28 10:44 ` [RFC 6/6] powerpc/mm: 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=04e4dafde56fe4b055fbd763dc0e119862073c6d.1790590014.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®