[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <DS0PR11MB75299599F5DCFA79D894536AC3DB9@DS0PR11MB7529.namprd11.prod.outlook.com>
Date: Tue, 7 Feb 2023 08:54:33 +0000
From: "Liu, Yi L" <yi.l.liu@...el.com>
To: "Tian, Kevin" <kevin.tian@...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 11/14] vfio: Make vfio_device_open() exclusive between
group path and device cdev path
> From: Tian, Kevin <kevin.tian@...el.com>
> Sent: Tuesday, February 7, 2023 2:25 PM
>
> > From: Liu, Yi L <yi.l.liu@...el.com>
> > Sent: Monday, February 6, 2023 5:05 PM
> >
> > struct vfio_device_file *
> > -vfio_allocate_device_file(struct vfio_device *device)
> > +vfio_allocate_device_file(struct vfio_device *device, bool
> is_cdev_device)
> > {
> > struct vfio_device_file *df;
> >
> > @@ -407,6 +407,7 @@ vfio_allocate_device_file(struct vfio_device
> *device)
> > return ERR_PTR(-ENOMEM);
> >
> > df->device = device;
> > + df->is_cdev_device = is_cdev_device;
>
> You missed Alex's comment that the one caller can open code the
> assignment instead of introducing an unmemorable Boolean arg here.
Oh, yes. will open code to set it in cdev path.
> >
> > + /*
> > + * Device cdev path cannot support multiple device open since
> > + * it doesn't have a secure way for it. So a second device
> > + * open attempt should be failed if the caller is from a cdev
> > + * path or the device has already been opened by a cdev path.
> > + */
> > + if (device->open_count != 0 &&
> > + (df->is_cdev_device || device->single_open))
> > + return -EINVAL;
> > +
>
> If we are gonna handle the exclusive open via dma ownership, then
> here we don't need a new single_open flag inside vfio_device since
> only one interface (cdev or group) could be used to open this device.
>
> Just preventing multi-open in cdev is sufficient here.
I see. Per below discussion, just need to make group path always
use vfio_group pointer as DMA marker.
https://lore.kernel.org/kvm/BN9PR11MB5276FA68E8CAD6394A8887848CDB9@BN9PR11MB5276.namprd11.prod.outlook.com/
Regards,
Yi Liu
Powered by blists - more mailing lists