Message ID | 20230203215027.151988-3-mjrosato@linux.ibm.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | vfio: fix deadlock between group lock and kvm lock | expand |
> From: Matthew Rosato <mjrosato@linux.ibm.com> > Sent: Saturday, February 4, 2023 5:50 AM > > Nothing uses this value during vfio_device_open anymore so it's safe > to remove it. > > Signed-off-by: Matthew Rosato <mjrosato@linux.ibm.com> > --- > drivers/vfio/group.c | 2 +- > drivers/vfio/vfio.h | 3 +-- > drivers/vfio/vfio_main.c | 7 +++---- > 3 files changed, 5 insertions(+), 7 deletions(-) Reviewed-by: Yi Liu <yi.l.liu@intel.com> Regards, Yi Liu > diff --git a/drivers/vfio/group.c b/drivers/vfio/group.c > index 98621ac082f0..0e9036e2b9c4 100644 > --- a/drivers/vfio/group.c > +++ b/drivers/vfio/group.c > @@ -187,7 +187,7 @@ static int vfio_device_group_open(struct vfio_device > *device) > if (device->open_count == 0) > vfio_device_group_get_kvm_safe(device); > > - ret = vfio_device_open(device, device->group->iommufd, device- > >kvm); > + ret = vfio_device_open(device, device->group->iommufd); > > if (device->open_count == 0) > vfio_device_put_kvm(device); > diff --git a/drivers/vfio/vfio.h b/drivers/vfio/vfio.h > index 24d6cd285945..4f39ab549a80 100644 > --- a/drivers/vfio/vfio.h > +++ b/drivers/vfio/vfio.h > @@ -18,8 +18,7 @@ struct vfio_container; > > void vfio_device_put_registration(struct vfio_device *device); > bool vfio_device_try_get_registration(struct vfio_device *device); > -int vfio_device_open(struct vfio_device *device, > - struct iommufd_ctx *iommufd, struct kvm *kvm); > +int vfio_device_open(struct vfio_device *device, struct iommufd_ctx > *iommufd); > void vfio_device_close(struct vfio_device *device, > struct iommufd_ctx *iommufd); > > diff --git a/drivers/vfio/vfio_main.c b/drivers/vfio/vfio_main.c > index 28c47cd6a6b5..3a597e799918 100644 > --- a/drivers/vfio/vfio_main.c > +++ b/drivers/vfio/vfio_main.c > @@ -397,7 +397,7 @@ static bool vfio_assert_device_open(struct > vfio_device *device) > } > > static int vfio_device_first_open(struct vfio_device *device, > - struct iommufd_ctx *iommufd, struct kvm > *kvm) > + struct iommufd_ctx *iommufd) > { > int ret; > > @@ -444,8 +444,7 @@ static void vfio_device_last_close(struct vfio_device > *device, > module_put(device->dev->driver->owner); > } > > -int vfio_device_open(struct vfio_device *device, > - struct iommufd_ctx *iommufd, struct kvm *kvm) > +int vfio_device_open(struct vfio_device *device, struct iommufd_ctx > *iommufd) > { > int ret = 0; > > @@ -453,7 +452,7 @@ int vfio_device_open(struct vfio_device *device, > > device->open_count++; > if (device->open_count == 1) { > - ret = vfio_device_first_open(device, iommufd, kvm); > + ret = vfio_device_first_open(device, iommufd); > if (ret) > device->open_count--; > } > -- > 2.39.1
> From: Matthew Rosato <mjrosato@linux.ibm.com> > Sent: Saturday, February 4, 2023 5:50 AM > > Nothing uses this value during vfio_device_open anymore so it's safe > to remove it. > > Signed-off-by: Matthew Rosato <mjrosato@linux.ibm.com> Reviewed-by: Kevin Tian <kevin.tian@intel.com>
Tested-by: Tony Krowiak <akrowiak@linux.ibm.com> On 2/3/23 4:50 PM, Matthew Rosato wrote: > Nothing uses this value during vfio_device_open anymore so it's safe > to remove it. > > Signed-off-by: Matthew Rosato <mjrosato@linux.ibm.com> > --- > drivers/vfio/group.c | 2 +- > drivers/vfio/vfio.h | 3 +-- > drivers/vfio/vfio_main.c | 7 +++---- > 3 files changed, 5 insertions(+), 7 deletions(-) > > diff --git a/drivers/vfio/group.c b/drivers/vfio/group.c > index 98621ac082f0..0e9036e2b9c4 100644 > --- a/drivers/vfio/group.c > +++ b/drivers/vfio/group.c > @@ -187,7 +187,7 @@ static int vfio_device_group_open(struct vfio_device *device) > if (device->open_count == 0) > vfio_device_group_get_kvm_safe(device); > > - ret = vfio_device_open(device, device->group->iommufd, device->kvm); > + ret = vfio_device_open(device, device->group->iommufd); > > if (device->open_count == 0) > vfio_device_put_kvm(device); > diff --git a/drivers/vfio/vfio.h b/drivers/vfio/vfio.h > index 24d6cd285945..4f39ab549a80 100644 > --- a/drivers/vfio/vfio.h > +++ b/drivers/vfio/vfio.h > @@ -18,8 +18,7 @@ struct vfio_container; > > void vfio_device_put_registration(struct vfio_device *device); > bool vfio_device_try_get_registration(struct vfio_device *device); > -int vfio_device_open(struct vfio_device *device, > - struct iommufd_ctx *iommufd, struct kvm *kvm); > +int vfio_device_open(struct vfio_device *device, struct iommufd_ctx *iommufd); > void vfio_device_close(struct vfio_device *device, > struct iommufd_ctx *iommufd); > > diff --git a/drivers/vfio/vfio_main.c b/drivers/vfio/vfio_main.c > index 28c47cd6a6b5..3a597e799918 100644 > --- a/drivers/vfio/vfio_main.c > +++ b/drivers/vfio/vfio_main.c > @@ -397,7 +397,7 @@ static bool vfio_assert_device_open(struct vfio_device *device) > } > > static int vfio_device_first_open(struct vfio_device *device, > - struct iommufd_ctx *iommufd, struct kvm *kvm) > + struct iommufd_ctx *iommufd) > { > int ret; > > @@ -444,8 +444,7 @@ static void vfio_device_last_close(struct vfio_device *device, > module_put(device->dev->driver->owner); > } > > -int vfio_device_open(struct vfio_device *device, > - struct iommufd_ctx *iommufd, struct kvm *kvm) > +int vfio_device_open(struct vfio_device *device, struct iommufd_ctx *iommufd) > { > int ret = 0; > > @@ -453,7 +452,7 @@ int vfio_device_open(struct vfio_device *device, > > device->open_count++; > if (device->open_count == 1) { > - ret = vfio_device_first_open(device, iommufd, kvm); > + ret = vfio_device_first_open(device, iommufd); > if (ret) > device->open_count--; > }
diff --git a/drivers/vfio/group.c b/drivers/vfio/group.c index 98621ac082f0..0e9036e2b9c4 100644 --- a/drivers/vfio/group.c +++ b/drivers/vfio/group.c @@ -187,7 +187,7 @@ static int vfio_device_group_open(struct vfio_device *device) if (device->open_count == 0) vfio_device_group_get_kvm_safe(device); - ret = vfio_device_open(device, device->group->iommufd, device->kvm); + ret = vfio_device_open(device, device->group->iommufd); if (device->open_count == 0) vfio_device_put_kvm(device); diff --git a/drivers/vfio/vfio.h b/drivers/vfio/vfio.h index 24d6cd285945..4f39ab549a80 100644 --- a/drivers/vfio/vfio.h +++ b/drivers/vfio/vfio.h @@ -18,8 +18,7 @@ struct vfio_container; void vfio_device_put_registration(struct vfio_device *device); bool vfio_device_try_get_registration(struct vfio_device *device); -int vfio_device_open(struct vfio_device *device, - struct iommufd_ctx *iommufd, struct kvm *kvm); +int vfio_device_open(struct vfio_device *device, struct iommufd_ctx *iommufd); void vfio_device_close(struct vfio_device *device, struct iommufd_ctx *iommufd); diff --git a/drivers/vfio/vfio_main.c b/drivers/vfio/vfio_main.c index 28c47cd6a6b5..3a597e799918 100644 --- a/drivers/vfio/vfio_main.c +++ b/drivers/vfio/vfio_main.c @@ -397,7 +397,7 @@ static bool vfio_assert_device_open(struct vfio_device *device) } static int vfio_device_first_open(struct vfio_device *device, - struct iommufd_ctx *iommufd, struct kvm *kvm) + struct iommufd_ctx *iommufd) { int ret; @@ -444,8 +444,7 @@ static void vfio_device_last_close(struct vfio_device *device, module_put(device->dev->driver->owner); } -int vfio_device_open(struct vfio_device *device, - struct iommufd_ctx *iommufd, struct kvm *kvm) +int vfio_device_open(struct vfio_device *device, struct iommufd_ctx *iommufd) { int ret = 0; @@ -453,7 +452,7 @@ int vfio_device_open(struct vfio_device *device, device->open_count++; if (device->open_count == 1) { - ret = vfio_device_first_open(device, iommufd, kvm); + ret = vfio_device_first_open(device, iommufd); if (ret) device->open_count--; }
Nothing uses this value during vfio_device_open anymore so it's safe to remove it. Signed-off-by: Matthew Rosato <mjrosato@linux.ibm.com> --- drivers/vfio/group.c | 2 +- drivers/vfio/vfio.h | 3 +-- drivers/vfio/vfio_main.c | 7 +++---- 3 files changed, 5 insertions(+), 7 deletions(-)