public inbox for kvm@vger.kernel.org
 help / color / mirror / Atom feed
From: Alex Williamson <alex.williamson@redhat.com>
To: Avi Kivity <avi@redhat.com>, Jan Kiszka <jan.kiszka@siemens.com>
Cc: "Ren, Yongjie" <yongjie.ren@intel.com>,
	"kvm@vger.kernel.org" <kvm@vger.kernel.org>
Subject: Re: Biweekly KVM Test report, kernel 7a7ada1b... qemu df85c051...
Date: Tue, 12 Apr 2011 12:22:51 -0600	[thread overview]
Message-ID: <1302632571.3589.115.camel@x201> (raw)
In-Reply-To: <4DA4072B.4060409@redhat.com>

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 <jan.kiszka@siemens.com>
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 <alex.williamson@redhat.com>
    Acked-by: Michael S. Tsirkin <mst@redhat.com>
    Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
    Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>

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:



  reply	other threads:[~2011-04-12 18:22 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-04-12  7:48 Biweekly KVM Test report, kernel 7a7ada1b... qemu df85c051 Ren, Yongjie
2011-04-12  8:02 ` Avi Kivity
2011-04-12 18:22   ` Alex Williamson [this message]
2011-04-12 21:02     ` Jan Kiszka
2011-04-12 21:20       ` Alex Williamson
2011-04-12 22:35         ` Jan Kiszka

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1302632571.3589.115.camel@x201 \
    --to=alex.williamson@redhat.com \
    --cc=avi@redhat.com \
    --cc=jan.kiszka@siemens.com \
    --cc=kvm@vger.kernel.org \
    --cc=yongjie.ren@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox