From patchwork Tue Apr 12 18:22:51 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alex Williamson X-Patchwork-Id: 701581 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter1.kernel.org (8.14.4/8.14.3) with ESMTP id p3CIN3kr024825 for ; Tue, 12 Apr 2011 18:23:03 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757477Ab1DLSXA (ORCPT ); Tue, 12 Apr 2011 14:23:00 -0400 Received: from mx1.redhat.com ([209.132.183.28]:13030 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756155Ab1DLSW7 (ORCPT ); Tue, 12 Apr 2011 14:22:59 -0400 Received: from int-mx12.intmail.prod.int.phx2.redhat.com (int-mx12.intmail.prod.int.phx2.redhat.com [10.5.11.25]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id p3CIMqLg011261 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Tue, 12 Apr 2011 14:22:53 -0400 Received: from [10.3.113.29] (ovpn-113-29.phx2.redhat.com [10.3.113.29]) by int-mx12.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id p3CIMqkl015250; Tue, 12 Apr 2011 14:22:52 -0400 Subject: Re: Biweekly KVM Test report, kernel 7a7ada1b... qemu df85c051... From: Alex Williamson To: Avi Kivity , Jan Kiszka Cc: "Ren, Yongjie" , "kvm@vger.kernel.org" In-Reply-To: <4DA4072B.4060409@redhat.com> References: <4DA4072B.4060409@redhat.com> Date: Tue, 12 Apr 2011 12:22:51 -0600 Message-ID: <1302632571.3589.115.camel@x201> Mime-Version: 1.0 X-Scanned-By: MIMEDefang 2.68 on 10.5.11.25 Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.6 (demeter1.kernel.org [140.211.167.41]); Tue, 12 Apr 2011 18:23:03 +0000 (UTC) On Tue, 2011-04-12 at 11:02 +0300, Avi Kivity wrote: > On 04/12/2011 10:48 AM, Ren, Yongjie wrote: > > Hi All, > > This is KVM test result against kvm.git 7a7ada1bfb958d2ad722d0df9299f1b0136ec1d4 based on kernel 2.6.39-rc2+, and qemu-kvm.git df85c051d780bca0ee2462cfeb8ef6d9552a19b0. > > > > We found 1 bug about "NIC cannot work when it had been used before ". > > The VT-d bug 730441 (qemu bugzilla) concerning "nomsi NIC" is fixed. > > > > New issue: > > 1.[VT-d] NIC cannot work when it had been used before > > https://bugs.launchpad.net/qemu/+bug/754591 > > > > += Alex. > This is caused by the patch below. When we do a reset via PCI sysfs, the device state is saved and restored around the reset. When the state is restored, the saved state is invalidated. Now when we go to free the device, we call the "I know what I'm doing" __pci_reset_function(), which doesn't save/restore state, then try to do a restore, but there's nothing saved, so the device only has reset values... oops. Jan, do you actually have a test case where you can see a difference restoring the original saved state? I'm tempted to suggest we just revert this patch. Otherwise it seems like we an interface to extract and reload the original saved state for the device. Thanks, Alex commit ed78661f2614d3c9f69c23e280db3bafdabdf5bb Author: Jan Kiszka Date: Tue Nov 16 22:30:05 2010 +0100 KVM: Save/restore state of assigned PCI device The guest may change states that pci_reset_function does not touch. So we better save/restore the assigned device across guest usage. Acked-by: Alex Williamson Acked-by: Michael S. Tsirkin Signed-off-by: Jan Kiszka Signed-off-by: Marcelo Tosatti --- To unsubscribe from this list: send the line "unsubscribe kvm" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/virt/kvm/assigned-dev.c b/virt/kvm/assigned-dev.c index 7623408..d389207 100644 --- a/virt/kvm/assigned-dev.c +++ b/virt/kvm/assigned-dev.c @@ -197,7 +197,8 @@ static void kvm_free_assigned_device(struct kvm *kvm, { kvm_free_assigned_irq(kvm, assigned_dev); - pci_reset_function(assigned_dev->dev); + __pci_reset_function(assigned_dev->dev); + pci_restore_state(assigned_dev->dev); pci_release_regions(assigned_dev->dev); pci_disable_device(assigned_dev->dev); @@ -514,6 +515,7 @@ static int kvm_vm_ioctl_assign_device(struct kvm *kvm, } pci_reset_function(dev); + pci_save_state(dev); match->assigned_dev_id = assigned_dev->assigned_dev_id; match->host_segnr = assigned_dev->segnr; @@ -544,6 +546,7 @@ out: mutex_unlock(&kvm->lock); return r; out_list_del: + pci_restore_state(dev); list_del(&match->list); pci_release_regions(dev); out_disable: