[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <BN9PR11MB5276E166F8BB56049A5CFEC48CDB9@BN9PR11MB5276.namprd11.prod.outlook.com>
Date: Tue, 7 Feb 2023 06:06:55 +0000
From: "Tian, Kevin" <kevin.tian@...el.com>
To: "Liu, Yi L" <yi.l.liu@...el.com>,
"alex.williamson@...hat.com" <alex.williamson@...hat.com>,
"jgg@...dia.com" <jgg@...dia.com>
CC: "cohuck@...hat.com" <cohuck@...hat.com>,
"eric.auger@...hat.com" <eric.auger@...hat.com>,
"nicolinc@...dia.com" <nicolinc@...dia.com>,
"kvm@...r.kernel.org" <kvm@...r.kernel.org>,
"mjrosato@...ux.ibm.com" <mjrosato@...ux.ibm.com>,
"chao.p.peng@...ux.intel.com" <chao.p.peng@...ux.intel.com>,
"yi.y.sun@...ux.intel.com" <yi.y.sun@...ux.intel.com>,
"peterx@...hat.com" <peterx@...hat.com>,
"jasowang@...hat.com" <jasowang@...hat.com>,
"shameerali.kolothum.thodi@...wei.com"
<shameerali.kolothum.thodi@...wei.com>,
"lulu@...hat.com" <lulu@...hat.com>,
"suravee.suthikulpanit@....com" <suravee.suthikulpanit@....com>,
"intel-gvt-dev@...ts.freedesktop.org"
<intel-gvt-dev@...ts.freedesktop.org>,
"intel-gfx@...ts.freedesktop.org" <intel-gfx@...ts.freedesktop.org>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
"linux-s390@...r.kernel.org" <linux-s390@...r.kernel.org>
Subject: RE: [PATCH v2 09/14] vfio-iommufd: Add detach_ioas support for
physical VFIO devices
> From: Liu, Yi L <yi.l.liu@...el.com>
> Sent: Monday, February 6, 2023 5:05 PM
>
> +static void __vfio_iommufd_detach(struct vfio_device *vdev)
> +{
> + iommufd_device_detach(vdev->iommufd_device);
> + vdev->iommufd_attached = false;
> +}
> +
> void vfio_iommufd_physical_unbind(struct vfio_device *vdev)
> {
> lockdep_assert_held(&vdev->dev_set->lock);
>
> - if (vdev->iommufd_attached) {
> - iommufd_device_detach(vdev->iommufd_device);
> - vdev->iommufd_attached = false;
> - }
> + if (vdev->iommufd_attached)
> + __vfio_iommufd_detach(vdev);
I'm not sure whether this abstraction really improves things.
Just two callers. and the old code reads clearer to me which
checks a flag, does something and then clear the flag.
> @@ -74,6 +74,7 @@ struct vfio_device {
> * @unbind_iommufd: Opposite of bind_iommufd
> * @attach_ioas: Called when attaching device to an IOAS/HWPT managed
> by the
> * bound iommufd. Undo in unbind_iommufd.
"Undo in unbind_iommufd if @detach_ioas is not called".
> + * @detach_ioas: Opposite of attach_ioas, this is for runtime undo.
remove "this is for runtime undo" which is confusing.
Powered by blists - more mailing lists