Re: [PATCH v2] vfio/pci: Parallelize device open and release

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri, 16 Nov 2018 09:18:41 -0700
Alex Williamson <alex.williamson@xxxxxxxxxx> wrote:

> In commit 61d792562b53 ("vfio-pci: Use mutex around open, release, and
> remove") a mutex was added to freeze the refcnt for a device so that
> we can handle errors and perform bus resets on final close.  However,
> bus resets can be rather slow and a global mutex here is undesirable.
> Evaluating the potential locking granularity, a per-device mutex
> provides the best resolution but with multiple devices on a bus all
> released concurrently, they'll race to acquire each other's mutex,
> likely resulting in no reset at all if we use trylock.  We therefore
> lock at the granularity of the bus/slot reset as we're only attempting
> a single reset for this group of devices anyway.  This allows much
> greater scaling as we're bounded in the number of devices protected by
> a single reflck object.
> 
> Reported-by: Christian Ehrhardt <christian.ehrhardt@xxxxxxxxxxxxx>
> Tested-by: Christian Ehrhardt <christian.ehrhardt@xxxxxxxxxxxxx>
> Reviewed-by: Eric Auger <eric.auger@xxxxxxxxxx>
> Signed-off-by: Alex Williamson <alex.williamson@xxxxxxxxxx>
> ---
> 
> v2:
>  - Rolled in PTR_ERR_OR_ZERO suggestion from kbuild bot
>  - Updated commit log and comments per Eric's feedback
> 
>  drivers/vfio/pci/vfio_pci.c         |  160 ++++++++++++++++++++++++++++++-----
>  drivers/vfio/pci/vfio_pci_private.h |    6 +
>  2 files changed, 142 insertions(+), 24 deletions(-)

Reviewed-by: Cornelia Huck <cohuck@xxxxxxxxxx>



[Index of Archives]     [KVM ARM]     [KVM ia64]     [KVM ppc]     [Virtualization Tools]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Questions]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux