All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Wuzongyong (Euler Dept)" <cordius.wu@huawei.com>
To: "qemu-devel@nongnu.org" <qemu-devel@nongnu.org>
Cc: Alex Williamson <alex.williamson@redhat.com>,
	"libvir-list@redhat.com" <libvir-list@redhat.com>,
	"Chenhaiwu (Euler)" <chenhaiwu1@huawei.com>,
	"Wanzongshun (Vincent)" <wanzongshun@huawei.com>
Subject: [Qemu-devel] The results of lspci are inconsistent between vfio reset pci devices and reset devices by sysfs interafce
Date: Tue, 9 Oct 2018 12:11:29 +0000	[thread overview]
Message-ID: <9BD73EA91F8E404F851CF3F519B14AA80180A4A5@DGGEMI521-MBX.china.huawei.com> (raw)

Hi,

I start a virtual machine with commandline:
    /usr/libexec/qemu-kvm --enable-kvm -smp 8 -m 8192 -device vfio-pci,host=0000:81:00.0

Then I pause the qemu process before executing the main_loop function by gdb.
At this moment, lspci shows the regions are disabled like below:
    81:00.0 3D controller: NVIDIA Corporation GP100GL [Tesla P100 PCIe 16GB] (rev a1)
        Subsystem: NVIDIA Corporation Device 118f
        Physical Slot: 0-6
        Control: I/O- Mem- BusMaster- SpecCycle- MemWINV- VGASnoop- ParErr- Stepping- SERR- FastB2B- DisINTx+
        Status: Cap+ 66MHz- UDF- FastB2B- ParErr- DEVSEL=fast >TAbort- <TAbort- <MAbort- >SERR- <PERR- INTx-
        Interrupt: pin A routed to IRQ 35
        NUMA node: 1
        Region 0: Memory at c8000000 (32-bit, non-prefetchable) [disabled] [size=16M]
        Region 1: Memory at 27800000000 (64-bit, prefetchable) [disabled] [size=16G]
        Region 3: Memory at 27c00000000 (64-bit, prefetchable) [disabled] [size=32M]

But after the command:
echo 1 > /sys/bus/pci/devices/0000:81:00.0/reset
lspci shows the regions are *not* disabled:
    81:00.0 3D controller: NVIDIA Corporation GP100GL [Tesla P100 PCIe 16GB] (rev a1)
        Subsystem: Huawei Technologies Co., Ltd. Device 2061
        Physical Slot: 0-6
        Control: I/O+ Mem+ BusMaster+ SpecCycle- MemWINV- VGASnoop- ParErr+ Stepping- SERR+ FastB2B- DisINTx-
        Status: Cap+ 66MHz- UDF- FastB2B- ParErr- DEVSEL=fast >TAbort- <TAbort- <MAbort- >SERR- <PERR- INTx-
        Latency: 0, Cache Line Size: 32 bytes
        Interrupt: pin A routed to IRQ 7
        NUMA node: 1
        Region 0: Memory at c8000000 (32-bit, non-prefetchable) [size=16M]
        Region 1: Memory at 27800000000 (64-bit, prefetchable) [size=16G]
        Region 3: Memory at 27c00000000 (64-bit, prefetchable) [size=32M]

AFAIK, qemu performs vfio_pci_reset like the below callstack:
    Qemu:
        vfio_pci_reset
            ioctl(vdev->vbasedev.fd, VFIO_DEVICE_RESET)
Kernel:
    vfio_pci_ioctl
        pci_try_reset_function
            __pci_reset_function_locked
                    pci_parent_bus_reset
                        pci_reset_bridge_secondary_bus

and write 1 to the reset interface of sysfs go through the path:
Kernel:
    reset_store
        pci_reset_function
            __pci_reset_function_locked
                    pci_parent_bus_reset
                        pci_reset_bridge_secondary_bus

So seem that these two methods are same actually, I am confused why the results are inconsistent.

Thanks,
Zongyong Wu

             reply	other threads:[~2018-10-09 12:11 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-10-09 12:11 Wuzongyong (Euler Dept) [this message]
2018-10-09 15:08 ` [Qemu-devel] The results of lspci are inconsistent between vfio reset pci devices and reset devices by sysfs interafce Alex Williamson
2018-10-10  1:26   ` Wuzongyong (Euler Dept)
2018-10-10  1:47   ` Wuzongyong (Euler Dept)
2018-10-10  3:18     ` 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=9BD73EA91F8E404F851CF3F519B14AA80180A4A5@DGGEMI521-MBX.china.huawei.com \
    --to=cordius.wu@huawei.com \
    --cc=alex.williamson@redhat.com \
    --cc=chenhaiwu1@huawei.com \
    --cc=libvir-list@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=wanzongshun@huawei.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.