[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <ZMK7xNR+PaBek+Ou@Asurada-Nvidia>
Date: Thu, 27 Jul 2023 11:47:32 -0700
From: Nicolin Chen <nicolinc@...dia.com>
To: Jason Gunthorpe <jgg@...dia.com>
CC: <kevin.tian@...el.com>, <yi.l.liu@...el.com>, <joro@...tes.org>,
<will@...nel.org>, <robin.murphy@....com>,
<alex.williamson@...hat.com>, <shuah@...nel.org>,
<linux-kernel@...r.kernel.org>, <iommu@...ts.linux.dev>,
<kvm@...r.kernel.org>, <linux-kselftest@...r.kernel.org>,
<mjrosato@...ux.ibm.com>, <farman@...ux.ibm.com>
Subject: Re: [PATCH v9 3/6] iommufd: Add iommufd_access_change_ioas helper
On Thu, Jul 27, 2023 at 11:40:17AM -0300, Jason Gunthorpe wrote:
> On Thu, Jul 27, 2023 at 12:23:08AM -0700, Nicolin Chen wrote:
> > + if (new_ioas) {
> > + rc = iopt_add_access(&new_ioas->iopt, access);
> > + if (rc) {
> > + iommufd_put_object(&new_ioas->obj);
> > + access->ioas = cur_ioas;
> > + return rc;
> > + }
> > + iommufd_ref_to_users(&new_ioas->obj);
>
> Kevin's suggestion to just open code the refcount_inc here
Will replace this iommufd_ref_to_users with a refcount_inc in v10.
> And have a wrapper func that does:
>
> iommufd_access_change_ioas_id(struct iommufd_access *access, u32 id)
> {
> struct iommufd_ioas *ioas = iommufd_get_ioas(ictx, ioas_id);
> int rc;
>
> if (IS_ERR(ioas))
> return PTR_ERR(ioas);
> rc = iommufd_access_change_ioas(access, ioas);
> iommufd_put_object(&ioas->obj);
> return rc;
> }
>
> Does looks cleaner
I see. So we can drop iommufd_put_object(&new_ioas->obj) in
iommufd_access_change_ioas().
> Then we delete iommufd_ref_to_users() as there are no users (once all
> the branches are merged).
Ack.
Nicolin
Powered by blists - more mailing lists