From: Samarth Narang <samarth.colleges@gmail.com>
To: Jason Gunthorpe <jgg@nvidia.com>, Kevin Tian <kevin.tian@intel.com>
Cc: Joerg Roedel <joro@8bytes.org>, Will Deacon <will@kernel.org>,
Robin Murphy <robin.murphy@arm.com>,
Andrea Parri <parri.andrea@gmail.com>,
Shuah Khan <shuah@kernel.org>,
iommu@lists.linux.dev, linux-arm-kernel@lists.infradead.org,
linux-kselftest@vger.kernel.org, linux-kernel@vger.kernel.org,
Samarth Narang <samarth.colleges@gmail.com>
Subject: [PATCH 0/2] iommu: Propagate iova_bitmap_set() errors through read_and_clear_dirty
Date: Thu, 22 Oct 2026 06:10:13 -0700 [thread overview]
Message-ID: <20261022131015.3281745-1-samarth.colleges@gmail.com> (raw)
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
reply other threads:[~2026-10-22 13:12 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=20261022131015.3281745-1-samarth.colleges@gmail.com \
--to=samarth.colleges@gmail.com \
--cc=iommu@lists.linux.dev \
--cc=jgg@nvidia.com \
--cc=joro@8bytes.org \
--cc=kevin.tian@intel.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-kselftest@vger.kernel.org \
--cc=parri.andrea@gmail.com \
--cc=robin.murphy@arm.com \
--cc=shuah@kernel.org \
--cc=will@kernel.org \
/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®