From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757451AbaHEJ1u (ORCPT ); Tue, 5 Aug 2014 05:27:50 -0400 Received: from smtp.citrix.com ([66.165.176.89]:21692 "EHLO SMTP.CITRIX.COM" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753635AbaHEJ1s (ORCPT ); Tue, 5 Aug 2014 05:27:48 -0400 X-IronPort-AV: E=Sophos;i="5.01,804,1400025600"; d="scan'208";a="158810297" Message-ID: <53E0A391.8090208@citrix.com> Date: Tue, 5 Aug 2014 10:27:45 +0100 From: David Vrabel User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Icedove/24.5.0 MIME-Version: 1.0 To: Konrad Rzeszutek Wilk , David Vrabel CC: , , , , Subject: Re: [Xen-devel] [PATCH v5 2/6] xen/pciback: Don't deadlock when unbinding. References: <1405354736-7358-1-git-send-email-konrad.wilk@oracle.com> <1405354736-7358-3-git-send-email-konrad.wilk@oracle.com> <53D64AF3.4080202@citrix.com> <20140804184247.GA9009@laptop.dumpdata.com> In-Reply-To: <20140804184247.GA9009@laptop.dumpdata.com> Content-Type: text/plain; charset="ISO-8859-1" Content-Transfer-Encoding: 7bit X-DLP: MIA1 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 04/08/14 19:42, Konrad Rzeszutek Wilk wrote: > On Mon, Jul 28, 2014 at 02:06:59PM +0100, David Vrabel wrote: >> On 14/07/14 17:18, Konrad Rzeszutek Wilk wrote: >>> As commit 0a9fd0152929db372ff61b0d6c280fdd34ae8bdb >>> 'xen/pciback: Document the entry points for 'pcistub_put_pci_dev'' >>> explained there are four entry points in this function. >>> Two of them are when the user fiddles in the SysFS to >>> unbind a device which might be in use by a guest or not. >>> >>> Both 'unbind' states will cause a deadlock as the the PCI lock has >>> already been taken, which then pci_device_reset tries to take. >>> >>> We can simplify this by requiring that all callers of >>> pcistub_put_pci_dev MUST hold the device lock. And then >>> we can just call the lockless version of pci_device_reset. >>> >>> To make it even simpler we will modify xen_pcibk_release_pci_dev >>> to quality whether it should take a lock or not - as it ends >>> up calling xen_pcibk_release_pci_dev and needs to hold the lock. >>> >>> CC: stable@vger.kernel.org >> >> This deadlock is for a rather specific and uncommon use case (manually >> unbinding a PCI while it is passed-through). Is this critical enough to >> warrant a stable backport? > > We seem to trip over it frequently when rebooting a server. > > That is the VF's end up being unbinded while the guests > are being shutdown. And depending on the timing we end up in a deadlock. Ok. I'll add the stable tag. David