Thread (77 messages) 77 messages, 5 authors, 2025-06-26

RE: [PATCH v6 06/25] iommufd/access: Allow access->ops to be NULL for internal use

From: "Tian, Kevin" <kevin.tian@intel.com>
Date: 2025-06-25 03:38:24
Also in: linux-doc, linux-iommu, linux-kselftest, linux-patches, linux-tegra, lkml

From: Nicolin Chen <redacted>
Sent: Saturday, June 14, 2025 3:15 PM

+int iommufd_access_notify_unmap(struct io_pagetable *iopt, unsigned long
iova,
+				unsigned long length)
 {
 	struct iommufd_ioas *ioas =
 		container_of(iopt, struct iommufd_ioas, iopt);
 	struct iommufd_access *access;
 	unsigned long index;
+	int ret = 0;

 	xa_lock(&ioas->iopt.access_list);
 	xa_for_each(&ioas->iopt.access_list, index, access) {
+		if (!access->ops || !access->ops->unmap) {
+			ret = -EBUSY;
+			goto unlock;
+		}
then accesses before this one have been notified to unpin the area
while accesses afterwards are left unnotified.

in the end the unmap fails but with some side-effect incurred.

I'm not sure whether this intermediate state may lead to any undesired
effect later. Just raise it in case you or Jason already thought about it.

 			/* Something is not responding to unmap requests.
*/
 			tries++;
-			if (WARN_ON(tries > 100))
-				return -EDEADLOCK;
+			if (WARN_ON(tries > 100)) {
+				rc = -EDEADLOCK;
+				goto out_unmapped;
+			}
this looks an unrelated fix?
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help