* [dpdk-dev] [PATCH] net/virtio: fix qemu exit on device stop/start
@ 2016-09-02 14:39 Kyle Larose
0 siblings, 0 replies; only message in thread
From: Kyle Larose @ 2016-09-02 14:39 UTC (permalink / raw)
To: huawei.xie, yuanhan.liu; +Cc: dev, Kyle Larose
Starting with DPDK 16.04, performing a start, then stop followed by a
start on a virtio NIC sending traffic can cause qemu to exit.
Qemu exits with a message like:
2016-09-01T15:45:32.119059Z qemu-kvm: Guest moved used index from 5
to 1
This appears to occur because virtio_dev_start will always reinitialize
the virtio queues if virtio_dev_stop has been called. Prior to the
patch that introduced the regression, virtio_dev_stop did not mark the
device as stopped, so start would not actually reinitialize the queues.
This fix reintroduces that behaviour by tracking whether or not the
queues require initialization separately from whether or not the device
has been stopped. It does this by introducing an "opened" flag to the
device.
A simple test with testpmd can reproduce the problem.
1. Set up two virtio ports, ideally connecting two devices which can
ping one-another.
2. Start pinging between the devices
3. Start testpmd in interactive mode on the two virtio ports
e.g. testpmd -w 0000:00:05.0 -w 0000:00:06.0 -- -i
4. Run the following commands a few times:
start
stop
port stop 0
port stop 1
port start 0
port start 1
start
5. Qemu should exit with a "Guest moved ..." message.
After applying this patch, I can no longer reproduce this problem.
The ping resumes every time I start the ports back up.
Test environment:
- CPU: Intel(R) Xeon(R) CPU E5-2650 v2 @ 2.60GHz
- Host OS: CentOS Linux release 7.1.1503 (Core)
- Guest OS: CentOS Linux release 7.2.1511 (Core)
- Qemu-kvm version: 1.5.3-86.el7_1.6
Fixes: 9a0615af7746 ("virtio: fix restart")
Signed-off-by: Kyle Larose <klarose@sandvine.com>
---
drivers/net/virtio/virtio_ethdev.c | 10 ++++++++--
drivers/net/virtio/virtio_pci.h | 1 +
2 files changed, 9 insertions(+), 2 deletions(-)
diff --git a/drivers/net/virtio/virtio_ethdev.c b/drivers/net/virtio/virtio_ethdev.c
index 07d6449..da796cb 100644
--- a/drivers/net/virtio/virtio_ethdev.c
+++ b/drivers/net/virtio/virtio_ethdev.c
@@ -558,6 +558,9 @@ virtio_dev_close(struct rte_eth_dev *dev)
vtpci_reset(hw);
virtio_dev_free_mbufs(dev);
virtio_free_queues(dev);
+
+ hw->opened = 0;
+
}
static void
@@ -1393,9 +1396,10 @@ virtio_dev_start(struct rte_eth_dev *dev)
virtio_dev_link_update(dev, 0);
/* On restart after stop do not touch queues */
- if (hw->started)
+ if (hw->opened) {
+ hw->started = 1;
return 0;
-
+ }
/* Do final configuration before rx/tx engine starts */
virtio_dev_rxtx_start(dev);
vtpci_reinit_complete(hw);
@@ -1431,6 +1435,8 @@ virtio_dev_start(struct rte_eth_dev *dev)
VIRTQUEUE_DUMP(txvq->vq);
}
+ hw->opened = 1;
+
return 0;
}
diff --git a/drivers/net/virtio/virtio_pci.h b/drivers/net/virtio/virtio_pci.h
index dd7693f..52911af 100644
--- a/drivers/net/virtio/virtio_pci.h
+++ b/drivers/net/virtio/virtio_pci.h
@@ -252,6 +252,7 @@ struct virtio_hw {
uint8_t vlan_strip;
uint8_t use_msix;
uint8_t started;
+ uint8_t opened;
uint8_t modern;
uint8_t mac_addr[ETHER_ADDR_LEN];
uint32_t notify_off_multiplier;
--
1.8.3.1
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2016-09-02 14:39 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-09-02 14:39 [dpdk-dev] [PATCH] net/virtio: fix qemu exit on device stop/start Kyle Larose
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).