lkml.org 
[lkml]   [2018]   [Nov]   [19]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH v2] vfio/pci: Parallelize device open and release
On Fri, 16 Nov 2018 09:18:41 -0700
Alex Williamson <alex.williamson@redhat.com> 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@canonical.com>
> Tested-by: Christian Ehrhardt <christian.ehrhardt@canonical.com>
> Reviewed-by: Eric Auger <eric.auger@redhat.com>
> Signed-off-by: Alex Williamson <alex.williamson@redhat.com>
> ---
>
> 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@redhat.com>

\
 
 \ /
  Last update: 2018-11-19 11:03    [W:0.041 / U:8.972 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site