From: Jason Gunthorpe <jgg@nvidia.com>
To: "Tian, Kevin" <kevin.tian@intel.com>
Cc: "iommu@lists.linux.dev" <iommu@lists.linux.dev>,
Joerg Roedel <joro@8bytes.org>,
"linux-kselftest@vger.kernel.org"
<linux-kselftest@vger.kernel.org>,
Robin Murphy <robin.murphy@arm.com>,
Shuah Khan <shuah@kernel.org>, Will Deacon <will@kernel.org>,
Alex Mastro <amastro@fb.com>, Eric Auger <eric.auger@redhat.com>,
Lixiao Yang <lixiao.yang@intel.com>,
Matthew Rosato <mjrosato@linux.ibm.com>,
Nicolin Chen <nicolinc@nvidia.com>,
"patches@lists.linux.dev" <patches@lists.linux.dev>,
"Liu, Yi L" <yi.l.liu@intel.com>
Subject: Re: [PATCH iommufd] iommufd: Make vfio_compat's unmap succeed if the range is already empty
Date: Mon, 17 Nov 2025 11:34:18 -0400 [thread overview]
Message-ID: <20251117153418.GE10864@nvidia.com> (raw)
In-Reply-To: <BN9PR11MB5276EE15198CEECC799B3B568CC9A@BN9PR11MB5276.namprd11.prod.outlook.com>
On Mon, Nov 17, 2025 at 06:56:56AM +0000, Tian, Kevin wrote:
> > From: Jason Gunthorpe <jgg@nvidia.com>
> > Sent: Wednesday, November 5, 2025 2:12 AM
> >
>
> sorry coming to this late, but why do we leave inconsistent behavior
> between unmapping all vs. unmapping a range:
>
> > int iopt_unmap_all(struct io_pagetable *iopt, unsigned long *unmapped)
> > {
> > - int rc;
> > -
> > - rc = iopt_unmap_iova_range(iopt, 0, ULONG_MAX, unmapped);
> > /* If the IOVAs are empty then unmap all succeeds */
> > - if (rc == -ENOENT)
> > - return 0;
> > - return rc;
> > + return iopt_unmap_iova_range(iopt, 0, ULONG_MAX, unmapped);
> > }
>
> here empty IOVAs succeeds, while...
>
> > @@ -367,6 +367,10 @@ int iommufd_ioas_unmap(struct iommufd_ucmd
> > *ucmd)
> > &unmapped);
> > if (rc)
> > goto out_put;
> > + if (!unmapped) {
> > + rc = -ENOENT;
> > + goto out_put;
> > + }
> > }
>
> ...here it's a failure.
>
> from uAPI p.o.v. better the two scenarios are consistent?
Maybe, but this has been like this from the start, so I don't think we
should change it..
This patch was about aligning the type 1 emulation, not changing the
existing iommufd uapi.
Jason
prev parent reply other threads:[~2025-11-17 15:34 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-11-04 18:11 [PATCH iommufd] iommufd: Make vfio_compat's unmap succeed if the range is already empty Jason Gunthorpe
2025-11-04 18:56 ` Alex Mastro
2025-11-05 4:47 ` Nicolin Chen
2025-11-10 11:22 ` Yi Liu
2025-11-17 6:56 ` Tian, Kevin
2025-11-17 15:34 ` Jason Gunthorpe [this message]
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=20251117153418.GE10864@nvidia.com \
--to=jgg@nvidia.com \
--cc=amastro@fb.com \
--cc=eric.auger@redhat.com \
--cc=iommu@lists.linux.dev \
--cc=joro@8bytes.org \
--cc=kevin.tian@intel.com \
--cc=linux-kselftest@vger.kernel.org \
--cc=lixiao.yang@intel.com \
--cc=mjrosato@linux.ibm.com \
--cc=nicolinc@nvidia.com \
--cc=patches@lists.linux.dev \
--cc=robin.murphy@arm.com \
--cc=shuah@kernel.org \
--cc=will@kernel.org \
--cc=yi.l.liu@intel.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;
as well as URLs for NNTP newsgroup(s).