From mboxrd@z Thu Jan 1 00:00:00 1970 From: Konrad Rzeszutek Wilk Subject: Re: [PATCH for-4.5] reset PCI devices on force removal even when QEMU returns error Date: Fri, 12 Dec 2014 11:50:35 -0500 Message-ID: <20141212165035.GA28592@laptop.dumpdata.com> References: <1999787702.20141212161352@eikelenboom.it> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Content-Disposition: inline In-Reply-To: <1999787702.20141212161352@eikelenboom.it> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: Sander Eikelenboom Cc: "Wei Liu (Intern)" , xen-devel@lists.xensource.com, Ian Jackson , Ian Campbell , Stefano Stabellini List-Id: xen-devel@lists.xenproject.org On Fri, Dec 12, 2014 at 04:13:52PM +0100, Sander Eikelenboom wrote: > Hi Konrad, > > This doesn't seem to be applied yet, nor does it seem to have a release-(N)ACK > from you ? Hm, Stefano: - Is this a regression? - What are the risks of this not going in? I presume that it just means we haven't reset it in sysfs. But the xc_deassign_device operation if not done will not affect the hypervisor - which will move the device to dom0 upon guest teardown. > > -- > Sander > > > > Friday, November 28, 2014, 5:53:09 PM, you wrote: > > > On do_pci_remove when QEMU returns error, we just bail out early without > > resetting the device. On domain shutdown we are racing with QEMU exiting > > and most often QEMU closes the QMP connection before executing the > > requested command. > > > In these cases if force=1, it makes sense to go ahead with rest of the > > PCI device removal, that includes resetting the device and calling > > xc_deassign_device. Otherwise we risk not resetting the device properly > > on domain shutdown. > > > Signed-off-by: Stefano Stabellini > > > diff --git a/tools/libxl/libxl_pci.c b/tools/libxl/libxl_pci.c > > index 316643c..0ac0b93 100644 > > --- a/tools/libxl/libxl_pci.c > > +++ b/tools/libxl/libxl_pci.c > > @@ -1243,7 +1245,7 @@ static int do_pci_remove(libxl__gc *gc, uint32_t domid, > > rc = ERROR_INVAL; > > goto out_fail; > > } > > - if (rc) { > > + if (rc && !force) { > > rc = ERROR_FAIL; > > goto out_fail; > > } > >