From mboxrd@z Thu Jan 1 00:00:00 1970 From: Cornelia Huck Subject: Re: [PATCH v2] vfio/pci: Parallelize device open and release Date: Mon, 19 Nov 2018 11:02:48 +0100 Message-ID: <20181119110248.68214069.cohuck@redhat.com> References: <154238501981.17682.10484940408205923021.stgit@gimli.home> Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Cc: kvm@vger.kernel.org, linux-kernel@vger.kernel.org, christian.ehrhardt@canonical.com, eric.auger@redhat.com To: Alex Williamson Return-path: In-Reply-To: <154238501981.17682.10484940408205923021.stgit@gimli.home> Sender: linux-kernel-owner@vger.kernel.org List-Id: kvm.vger.kernel.org On Fri, 16 Nov 2018 09:18:41 -0700 Alex Williamson 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 > Tested-by: Christian Ehrhardt > Reviewed-by: Eric Auger > Signed-off-by: Alex Williamson > --- > > 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