qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Alex Williamson <alex.williamson@redhat.com>
To: Chen Fan <chen.fan.fnst@cn.fujitsu.com>
Cc: marcel@redhat.com, izumi.taku@jp.fujitsu.com, qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [RFC v2 6/8] vfio_pci: fix a wrong check in vfio_pci_reset
Date: Wed, 04 Feb 2015 06:53:12 -0700	[thread overview]
Message-ID: <1423057992.22865.460.camel@redhat.com> (raw)
In-Reply-To: <54D1EC5F.2020200@cn.fujitsu.com>

On Wed, 2015-02-04 at 17:54 +0800, Chen Fan wrote:
> On 02/03/2015 04:16 AM, Alex Williamson wrote:
> > On Wed, 2015-01-28 at 16:37 +0800, Chen Fan wrote:
> >> when vfio device support FLR, then when device reset,
> >> we call VFIO_DEVICE_RESET ioctl to reset the device first,
> >> at kernel side, we also can see the order of reset:
> >> 3330         rc = pcie_flr(dev, probe);
> >> 3331         if (rc != -ENOTTY)
> >> 3332                 goto done;
> >> 3333
> >> 3334         rc = pci_af_flr(dev, probe);
> >> 3335         if (rc != -ENOTTY)
> >> 3336                 goto done;
> >> 3337
> >> 3338         rc = pci_pm_reset(dev, probe);
> >> 3339         if (rc != -ENOTTY)
> >> 3340                 goto done;
> >>
> >> so when vfio has FLR, reset it directly.
> >>
> >> Signed-off-by: Chen Fan <chen.fan.fnst@cn.fujitsu.com>
> >> ---
> >>   hw/vfio/pci.c | 2 +-
> >>   1 file changed, 1 insertion(+), 1 deletion(-)
> >>
> >> diff --git a/hw/vfio/pci.c b/hw/vfio/pci.c
> >> index 8c81bb3..54eb6b4 100644
> >> --- a/hw/vfio/pci.c
> >> +++ b/hw/vfio/pci.c
> >> @@ -3455,7 +3455,7 @@ static void vfio_pci_reset(DeviceState *dev)
> >>       vfio_pci_pre_reset(vdev);
> >>   
> >>       if (vdev->vbasedev.reset_works &&
> >> -        (vdev->has_flr || !vdev->has_pm_reset) &&
> >> +        vdev->has_flr &&
> >>           !ioctl(vdev->vbasedev.fd, VFIO_DEVICE_RESET)) {
> >>           trace_vfio_pci_reset_flr(vdev->vbasedev.name);
> >>           goto post_reset;
> > Does this actually fix anything?  QEMU shouldn't rely on a specific
> > behavior of the kernel.  This test is de-prioritizing a PM reset because
> > they're often non-effective.  If the device supports FLR, the second
> > part of the OR is unreached, so what's the point of this change?
> For this change, when I tested the code on my own machine.
> I found the vfio device has neither flr nor pm reset (e.g. NoSoftRst+).
> this also trigger ioctl VFIO_DEVICE_RESET, is it right?

Yes, that means that the device has a device specific reset or that it's
a singleton device on the bus and we can use the simpler path of
VFIO_DEVICE_RESET.  Thanks,

Alex

  reply	other threads:[~2015-02-04 13:53 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-01-28  8:37 [Qemu-devel] [RFC v2 0/8] pass aer error to guest for vfio device Chen Fan
2015-01-28  8:37 ` [Qemu-devel] [RFC v2 1/8] pcie_aer: fix typos in pcie_aer_inject_error comment Chen Fan
2015-01-28  8:37 ` [Qemu-devel] [RFC v2 2/8] vfio-pci: add aer capability support Chen Fan
2015-02-02 20:15   ` Alex Williamson
2015-02-06  7:03     ` Chen Fan
2015-02-06 13:43       ` Alex Williamson
2015-01-28  8:37 ` [Qemu-devel] [RFC v2 3/8] pcie_aer: expose pcie_aer_msg() interface Chen Fan
2015-01-28  8:37 ` [Qemu-devel] [RFC v2 4/8] vfio-pci: pass the aer error to guest Chen Fan
2015-02-02 20:16   ` Alex Williamson
2015-02-06  7:06     ` Chen Fan
2015-01-28  8:37 ` [Qemu-devel] [RFC v2 5/8] pcie_aer: fix a trivial typo in PCIEAERMsg comments Chen Fan
2015-01-28  8:37 ` [Qemu-devel] [RFC v2 6/8] vfio_pci: fix a wrong check in vfio_pci_reset Chen Fan
2015-02-02 20:16   ` Alex Williamson
2015-02-04  9:54     ` Chen Fan
2015-02-04 13:53       ` Alex Williamson [this message]
2015-01-28  8:37 ` [Qemu-devel] [RFC v2 7/8] vfio_pci: change vfio device features bit macro to enum definition Chen Fan
2015-02-02 20:15   ` Alex Williamson
2015-01-28  8:37 ` [Qemu-devel] [RFC v2 8/8] vfio-pci: add VFIO_FEATURE_ENABLE_AER_CAP feature Chen Fan
2015-02-02 20:16   ` Alex Williamson

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=1423057992.22865.460.camel@redhat.com \
    --to=alex.williamson@redhat.com \
    --cc=chen.fan.fnst@cn.fujitsu.com \
    --cc=izumi.taku@jp.fujitsu.com \
    --cc=marcel@redhat.com \
    --cc=qemu-devel@nongnu.org \
    /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;
as well as URLs for NNTP newsgroup(s).