Re: [PATCH v2 vfio 2/3] pds/vfio: Fix mutex lock->magic != lock warning

From: Jason Gunthorpe
Date: Thu Oct 12 2023 - 09:50:24 EST


On Thu, Oct 12, 2023 at 09:00:09AM +0000, Shameerali Kolothum Thodi wrote:

> > Also, don't destroy the mutex on close because the device may
> > be re-opened, which would cause mutex to be uninitialized. Fix this by
> > implementing a driver specific vfio_device_ops.release callback that
> > destroys the mutex before calling vfio_pci_core_release_dev().
> >
> > Signed-off-by: Brett Creeley <brett.creeley@xxxxxxx>
> > Reviewed-by: Shannon Nelson <shannon.nelson@xxxxxxx>
>
> Reviewed-by: Shameer Kolothum <shameerali.kolothum.thodi@xxxxxxxxxx>
>
> Looks like mutex destruction logic needs to be added to HiSilicon driver as well.
> From a quick look mlx5 also doesn't destroy the state_mutex.

FWIW, mutex_destroy is a debugging feature, it is nice if you can do it, but
not a bug if it is missing..

Jason