From: Jason Gunthorpe <jgg@nvidia.com>
To: "Tian, Kevin" <kevin.tian@intel.com>
Cc: "iommu@lists.linux.dev" <iommu@lists.linux.dev>,
"Joerg Roedel (AMD)" <joro@8bytes.org>,
Robin Murphy <robin.murphy@arm.com>,
Will Deacon <will@kernel.org>,
"Aneesh Kumar K.V (Arm)" <aneesh.kumar@kernel.org>,
Nicolin Chen <nicolinc@nvidia.com>,
"patches@lists.linux.dev" <patches@lists.linux.dev>,
Peiyang He <peiyang_he@smail.nju.edu.cn>,
Xu Yilun <yilun.xu@linux.intel.com>
Subject: Re: [PATCH] iommufd/selftest: Simplify iommufd_device_remove_vdev()
Date: Tue, 14 Jul 2026 10:46:43 -0300 [thread overview]
Message-ID: <20260714134643.GA3695849@nvidia.com> (raw)
In-Reply-To: <CO1PR11MB4835796C5B8DD7575E5F80908CF92@CO1PR11MB4835.namprd11.prod.outlook.com>
On Tue, Jul 14, 2026 at 01:11:09AM +0000, Tian, Kevin wrote:
> > From: Jason Gunthorpe <jgg@nvidia.com>
> > Sent: Tuesday, July 14, 2026 1:25 AM
> >
> > Peiyang reports that this function indirectly includes a fault injection
> > point through iommufd_get_object() that was intended to cover the uAPI use
> > of object IDs, not in places like this that cannot fail.
> >
> > On deeper inspection this can be written using a dedicated helper to
> > obtain a users refcount relying entirely on the xa locking instead of
> > going through the whole get/put scheme. The new helper doesn't need the
> > fault injection point.
>
> I thought a plain refcount_inc_not_zero() in iommufd_device_remove_vdev()
> could work too, but having the new helper check xarray is more defensive.
It does seem like that would be safe alone
> > + * the object is installed in the xarray, otherwise things are racing with
> > + * a parallel destruction.
> > + */
> > +int iommufd_inc_users(struct iommufd_ctx *ictx, struct iommufd_object
> > *obj)
>
> iommufd_try_inc_users()?
Sure
Thanks,
Jason
next prev parent reply other threads:[~2026-07-14 13:46 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-13 17:25 [PATCH] iommufd/selftest: Simplify iommufd_device_remove_vdev() Jason Gunthorpe
2026-07-13 19:55 ` Nicolin Chen
2026-07-14 1:11 ` Tian, Kevin
2026-07-14 13:46 ` Jason Gunthorpe [this message]
2026-07-14 1:14 ` Tian, Kevin
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=20260714134643.GA3695849@nvidia.com \
--to=jgg@nvidia.com \
--cc=aneesh.kumar@kernel.org \
--cc=iommu@lists.linux.dev \
--cc=joro@8bytes.org \
--cc=kevin.tian@intel.com \
--cc=nicolinc@nvidia.com \
--cc=patches@lists.linux.dev \
--cc=peiyang_he@smail.nju.edu.cn \
--cc=robin.murphy@arm.com \
--cc=will@kernel.org \
--cc=yilun.xu@linux.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