mbox series

[v2,vfio,0/3] pds/vfio: Fixes for locking bugs

Message ID 20231011230115.35719-1-brett.creeley@amd.com (mailing list archive)
Headers show
Series pds/vfio: Fixes for locking bugs | expand

Message

Brett Creeley Oct. 11, 2023, 11:01 p.m. UTC
This series contains fixes for locking bugs in the recently introduced
pds-vfio-pci driver. There was an initial bug reported by Dan Carpenter
at:

https://lore.kernel.org/kvm/1f9bc27b-3de9-4891-9687-ba2820c1b390@moroto.mountain/

However, more locking bugs were found when looking into the previously
mentioned issue. So, all fixes are included in this series.

v2:
https://lore.kernel.org/kvm/20230914191540.54946-1-brett.creeley@amd.com/
- Trim the OOPs in the patch commit messages
- Rework patch 3/3 to only unlock the spinlock once
- Destroy the state_mutex in the driver specific vfio_device_ops.release
  callback

Brett Creeley (3):
  pds/vfio: Fix spinlock bad magic BUG
  pds/vfio: Fix mutex lock->magic != lock warning
  pds/vfio: Fix possible sleep while in atomic context

 drivers/vfio/pci/pds/vfio_dev.c | 27 ++++++++++++++++++++-------
 1 file changed, 20 insertions(+), 7 deletions(-)

Comments

Alex Williamson Oct. 13, 2023, 9:09 p.m. UTC | #1
On Wed, 11 Oct 2023 16:01:12 -0700
Brett Creeley <brett.creeley@amd.com> wrote:

> This series contains fixes for locking bugs in the recently introduced
> pds-vfio-pci driver. There was an initial bug reported by Dan Carpenter
> at:
> 
> https://lore.kernel.org/kvm/1f9bc27b-3de9-4891-9687-ba2820c1b390@moroto.mountain/
> 
> However, more locking bugs were found when looking into the previously
> mentioned issue. So, all fixes are included in this series.
> 
> v2:
> https://lore.kernel.org/kvm/20230914191540.54946-1-brett.creeley@amd.com/
> - Trim the OOPs in the patch commit messages
> - Rework patch 3/3 to only unlock the spinlock once

I thought we determined the spinlock, and thus the atomic context, was
an arbitrary choice.  I would have figured we simply convert it to a
mutex.  Why didn't we take that route?  Thanks,

Alex

> - Destroy the state_mutex in the driver specific vfio_device_ops.release
>   callback
> 
> Brett Creeley (3):
>   pds/vfio: Fix spinlock bad magic BUG
>   pds/vfio: Fix mutex lock->magic != lock warning
>   pds/vfio: Fix possible sleep while in atomic context
> 
>  drivers/vfio/pci/pds/vfio_dev.c | 27 ++++++++++++++++++++-------
>  1 file changed, 20 insertions(+), 7 deletions(-)
>
Brett Creeley Oct. 16, 2023, 2:49 p.m. UTC | #2
On 10/13/2023 2:09 PM, Alex Williamson wrote:
> Caution: This message originated from an External Source. Use proper caution when opening attachments, clicking links, or responding.
> 
> 
> On Wed, 11 Oct 2023 16:01:12 -0700
> Brett Creeley <brett.creeley@amd.com> wrote:
> 
>> This series contains fixes for locking bugs in the recently introduced
>> pds-vfio-pci driver. There was an initial bug reported by Dan Carpenter
>> at:
>>
>> https://lore.kernel.org/kvm/1f9bc27b-3de9-4891-9687-ba2820c1b390@moroto.mountain/
>>
>> However, more locking bugs were found when looking into the previously
>> mentioned issue. So, all fixes are included in this series.
>>
>> v2:
>> https://lore.kernel.org/kvm/20230914191540.54946-1-brett.creeley@amd.com/
>> - Trim the OOPs in the patch commit messages
>> - Rework patch 3/3 to only unlock the spinlock once
> 
> I thought we determined the spinlock, and thus the atomic context, was
> an arbitrary choice.  I would have figured we simply convert it to a
> mutex.  Why didn't we take that route?  Thanks,
> 
> Alex

Hmm. I guess it wasn't completely clear that was the expected solution 
even after Jason's response. However, I can resubmit a v3 with that change.

Thanks,

Brett
> 
>> - Destroy the state_mutex in the driver specific vfio_device_ops.release
>>    callback
>>
>> Brett Creeley (3):
>>    pds/vfio: Fix spinlock bad magic BUG
>>    pds/vfio: Fix mutex lock->magic != lock warning
>>    pds/vfio: Fix possible sleep while in atomic context
>>
>>   drivers/vfio/pci/pds/vfio_dev.c | 27 ++++++++++++++++++++-------
>>   1 file changed, 20 insertions(+), 7 deletions(-)
>>
>