* [PATCH 0/2] iommu: Propagate iova_bitmap_set() errors through read_and_clear_dirty
@ 2026-10-22 13:10 Samarth Narang
0 siblings, 0 replies; only message in thread
From: Samarth Narang @ 2026-10-22 13:10 UTC (permalink / raw)
To: Jason Gunthorpe, Kevin Tian
Cc: Joerg Roedel, Will Deacon, Robin Murphy, Andrea Parri,
Shuah Khan, iommu, linux-arm-kernel, linux-kselftest,
linux-kernel, Samarth Narang
This is a follow-up series on a6ec38d74c08 ("iommufd/iova_bitmap: Fail
GET_DIRTY_BITMAP when a bitmap page cannot be pinned"), which keeps the
first iova_bitmap_set() error in the iova_bitmap so the ioctl fails. As
Jason suggested, this series propagates the error up the call chain
instead.
Patch 1 makes iova_bitmap_set() and iommu_dirty_bitmap_record() return
an error, and makes the iommupt and io-pgtable-arm dirty walkers stop on
it before clearing the IOPTE. We only clear the dirty bit after it has
been recorded in the user bitmap, which prevents a failed
GET_DIRTY_BITMAP from losing the dirty state of the IOPTEs. This should
also address the case Andrea raised for the -EPROTO path: with this
series, an entry that did not fit stays dirty for the retry.
Patch 2 adds a corresponding selftest. It fails on the current for-next
and passes with patch 1.
Tested on x86_64 in a 2 vCPU QEMU/KVM guest with the iommufd selftest
(mock iommupt domain, CONFIG_DEBUG_GENERIC_PT=y): the new test is the
only change in outcome, with no WARN in dmesg.
Samarth Narang (2):
iommu: Return iova_bitmap_set() errors from read_and_clear_dirty
iommufd/selftest: Test GET_DIRTY_BITMAP with an unpinnable bitmap page
drivers/iommu/generic_pt/iommu_pt.h | 29 +++++++++-----
drivers/iommu/io-pgtable-arm.c | 5 ++-
drivers/iommu/iommufd/iova_bitmap.c | 18 ++++++---
include/linux/iommu.h | 27 ++++++++-----
include/linux/iova_bitmap.h | 9 +++--
tools/testing/selftests/iommu/iommufd.c | 50 +++++++++++++++++++++++++
6 files changed, 110 insertions(+), 28 deletions(-)
base-commit: 04bcf84613346b973a8cc0c59238b6b5bc902688
--
2.53.0
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2026-10-22 13:12 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-10-22 13:10 [PATCH 0/2] iommu: Propagate iova_bitmap_set() errors through read_and_clear_dirty Samarth Narang
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®