[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <00df3a24ff594c409eb2ab92d20733f5@huawei.com>
Date: Fri, 24 Nov 2023 08:51:09 +0000
From: Shameerali Kolothum Thodi <shameerali.kolothum.thodi@...wei.com>
To: Brett Creeley <brett.creeley@....com>,
"jgg@...pe.ca" <jgg@...pe.ca>,
"yishaih@...dia.com" <yishaih@...dia.com>,
liulongfang <liulongfang@...wei.com>,
"kevin.tian@...el.com" <kevin.tian@...el.com>,
"alex.williamson@...hat.com" <alex.williamson@...hat.com>,
"kvm@...r.kernel.org" <kvm@...r.kernel.org>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
CC: "shannon.nelson@....com" <shannon.nelson@....com>
Subject: RE: [PATCH vfio 2/2] hisi_acc_vfio_pci: Destroy the
[state|reset]_mutex on release
> -----Original Message-----
> From: Brett Creeley [mailto:brett.creeley@....com]
> Sent: 22 November 2023 19:37
> To: jgg@...pe.ca; yishaih@...dia.com; liulongfang
> <liulongfang@...wei.com>; Shameerali Kolothum Thodi
> <shameerali.kolothum.thodi@...wei.com>; kevin.tian@...el.com;
> alex.williamson@...hat.com; kvm@...r.kernel.org;
> linux-kernel@...r.kernel.org
> Cc: shannon.nelson@....com; brett.creeley@....com
> Subject: [PATCH vfio 2/2] hisi_acc_vfio_pci: Destroy the [state|reset]_mutex
> on release
>
> The [state|reset]_mutex are initialized in vfio init, but
> never destroyed. This isn't required as mutex_destroy()
> doesn't do anything unless lock debugging is enabled.
> However, for completeness, fix it by implementing a
> driver specific release function.
>
> No fixes tag is added as it doesn't seem worthwhile
> for such a trivial and debug only change.
>
> Signed-off-by: Brett Creeley <brett.creeley@....com>
Reviewed-by: Shameer Kolothum <shameerali.kolothum.thodi@...wei.com>
Thanks.
> ---
> drivers/vfio/pci/hisilicon/hisi_acc_vfio_pci.c | 12 +++++++++++-
> 1 file changed, 11 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/vfio/pci/hisilicon/hisi_acc_vfio_pci.c
> b/drivers/vfio/pci/hisilicon/hisi_acc_vfio_pci.c
> index 2c049b8de4b4..dc1e376e1b8a 100644
> --- a/drivers/vfio/pci/hisilicon/hisi_acc_vfio_pci.c
> +++ b/drivers/vfio/pci/hisilicon/hisi_acc_vfio_pci.c
> @@ -1358,10 +1358,20 @@ static int
> hisi_acc_vfio_pci_migrn_init_dev(struct vfio_device *core_vdev)
> return vfio_pci_core_init_dev(core_vdev);
> }
>
> +static void hisi_acc_vfio_pci_migrn_release_dev(struct vfio_device
> *core_vdev)
> +{
> + struct hisi_acc_vf_core_device *hisi_acc_vdev =
> container_of(core_vdev,
> + struct hisi_acc_vf_core_device, core_device.vdev);
> +
> + mutex_destroy(&hisi_acc_vdev->reset_mutex);
> + mutex_destroy(&hisi_acc_vdev->state_mutex);
> + vfio_pci_core_release_dev(core_vdev);
> +}
> +
> static const struct vfio_device_ops hisi_acc_vfio_pci_migrn_ops = {
> .name = "hisi-acc-vfio-pci-migration",
> .init = hisi_acc_vfio_pci_migrn_init_dev,
> - .release = vfio_pci_core_release_dev,
> + .release = hisi_acc_vfio_pci_migrn_release_dev,
> .open_device = hisi_acc_vfio_pci_open_device,
> .close_device = hisi_acc_vfio_pci_close_device,
> .ioctl = hisi_acc_vfio_pci_ioctl,
> --
> 2.17.1
Powered by blists - more mailing lists