[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH 20/79] hw/virtio: fix vhost user fails to startup wh
From: |
Michael Roth |
Subject: |
[Qemu-devel] [PATCH 20/79] hw/virtio: fix vhost user fails to startup when MQ |
Date: |
Mon, 28 Aug 2017 19:13:55 -0500 |
From: Zhiyong Yang <address@hidden>
Qemu2.7~2.9 and vhost user for dpdk 17.02 release work together
to cause failures of new connection when negotiating to set MQ.
(one queue pair works well).
Because there exist some bugs in qemu code when introducing
VHOST_USER_PROTOCOL_F_REPLY_ACK to qemu. When vhost_user_set_mem_table
is invoked to deal with the vhost message VHOST_USER_SET_MEM_TABLE
for the second time, qemu indeed doesn't send the messge (The message
needs to be sent only once)but still will be waiting for dpdk's reply
ack, then, qemu is always freezing, while DPDK is always waiting for
next vhost message from qemu.
The patch aims to fix the bug, MQ can work well.
The same bug is found in function vhost_user_net_set_mtu, it is fixed
at the same time.
DPDK related patch is as following:
http://www.dpdk.org/dev/patchwork/patch/23955/
Signed-off-by: Zhiyong Yang <address@hidden>
Cc: address@hidden
Fixes: ca525ce5618b ("vhost-user: Introduce a new protocol feature REPLY_ACK.")
Reviewed-by: Maxime Coquelin <address@hidden>
Reviewed-by: Michael S. Tsirkin <address@hidden>
Signed-off-by: Michael S. Tsirkin <address@hidden>
Tested-by: Jens Freimann <address@hidden>
Reviewed-by: Marc-André Lureau <address@hidden>
(cherry picked from commit 60cd11024f41cc73175e651a2dfe09a3cade56bb)
Signed-off-by: Michael Roth <address@hidden>
---
hw/virtio/vhost-user.c | 21 +++++++++++++--------
1 file changed, 13 insertions(+), 8 deletions(-)
diff --git a/hw/virtio/vhost-user.c b/hw/virtio/vhost-user.c
index 9334a8a..32a95a8c 100644
--- a/hw/virtio/vhost-user.c
+++ b/hw/virtio/vhost-user.c
@@ -163,22 +163,26 @@ fail:
}
static int process_message_reply(struct vhost_dev *dev,
- VhostUserRequest request)
+ VhostUserMsg msg)
{
- VhostUserMsg msg;
+ VhostUserMsg msg_reply;
- if (vhost_user_read(dev, &msg) < 0) {
+ if ((msg.flags & VHOST_USER_NEED_REPLY_MASK) == 0) {
+ return 0;
+ }
+
+ if (vhost_user_read(dev, &msg_reply) < 0) {
return -1;
}
- if (msg.request != request) {
+ if (msg_reply.request != msg.request) {
error_report("Received unexpected msg type."
"Expected %d received %d",
- request, msg.request);
+ msg.request, msg_reply.request);
return -1;
}
- return msg.payload.u64 ? -1 : 0;
+ return msg_reply.payload.u64 ? -1 : 0;
}
static bool vhost_user_one_time_request(VhostUserRequest request)
@@ -208,6 +212,7 @@ static int vhost_user_write(struct vhost_dev *dev,
VhostUserMsg *msg,
* request, we just ignore it.
*/
if (vhost_user_one_time_request(msg->request) && dev->vq_index != 0) {
+ msg->flags &= ~VHOST_USER_NEED_REPLY_MASK;
return 0;
}
@@ -320,7 +325,7 @@ static int vhost_user_set_mem_table(struct vhost_dev *dev,
}
if (reply_supported) {
- return process_message_reply(dev, msg.request);
+ return process_message_reply(dev, msg);
}
return 0;
@@ -712,7 +717,7 @@ static int vhost_user_net_set_mtu(struct vhost_dev *dev,
uint16_t mtu)
/* If reply_ack supported, slave has to ack specified MTU is valid */
if (reply_supported) {
- return process_message_reply(dev, msg.request);
+ return process_message_reply(dev, msg);
}
return 0;
--
2.7.4
- [Qemu-devel] [PATCH 09/79] pci: deassert intx when pci device unrealize, (continued)
- [Qemu-devel] [PATCH 09/79] pci: deassert intx when pci device unrealize, Michael Roth, 2017/08/28
- [Qemu-devel] [PATCH 13/79] 9pfs: local: fix unlink of alien files in mapped-file mode, Michael Roth, 2017/08/28
- [Qemu-devel] [PATCH 11/79] ACPI: don't call acpi_pcihp_device_plug_cb on xen, Michael Roth, 2017/08/28
- [Qemu-devel] [PATCH 16/79] qobject: Add helper macros for common scalar insertions, Michael Roth, 2017/08/28
- [Qemu-devel] [PATCH 12/79] replication: Make --disable-replication compile again, Michael Roth, 2017/08/28
- [Qemu-devel] [PATCH 17/79] s390x: Drop useless casts, Michael Roth, 2017/08/28
- [Qemu-devel] [PATCH 21/79] aio: add missing aio_notify() to aio_enable_external(), Michael Roth, 2017/08/28
- [Qemu-devel] [PATCH 15/79] qobject: Drop useless QObject casts, Michael Roth, 2017/08/28
- [Qemu-devel] [PATCH 01/79] qga-win: Enable 'can-offline' field in 'guest-get-vcpus' reply, Michael Roth, 2017/08/28
- [Qemu-devel] [PATCH 19/79] block: Reuse bs as backing hd for drive-backup sync=none, Michael Roth, 2017/08/28
- [Qemu-devel] [PATCH 20/79] hw/virtio: fix vhost user fails to startup when MQ,
Michael Roth <=
- [Qemu-devel] [PATCH 22/79] qemu-img: wait for convert coroutines to complete, Michael Roth, 2017/08/28
- [Qemu-devel] [PATCH 23/79] block/vhdx: Make vhdx_create() always set errp, Michael Roth, 2017/08/28
- [Qemu-devel] [PATCH 27/79] target/xtensa: fix return value of read/write simcalls, Michael Roth, 2017/08/28
- [Qemu-devel] [PATCH 26/79] target/xtensa: fix mapping direction in read/write simcalls, Michael Roth, 2017/08/28
- [Qemu-devel] [PATCH 29/79] curl: never invoke callbacks with s->mutex held, Michael Roth, 2017/08/28
- [Qemu-devel] [PATCH 18/79] qobject: Use simpler QDict/QList scalar insertion macros, Michael Roth, 2017/08/28
- [Qemu-devel] [PATCH 25/79] blockdev: use drained_begin/end for qmp_block_resize, Michael Roth, 2017/08/28
- [Qemu-devel] [PATCH 24/79] block: Add errp to b{lk, drv}_truncate(), Michael Roth, 2017/08/28
- [Qemu-devel] [PATCH 34/79] virtio-scsi: Unset hotplug handler when unrealize, Michael Roth, 2017/08/28
- [Qemu-devel] [PATCH 02/79] dirty-bitmap: Report BlockDirtyInfo.count in bytes, as documented, Michael Roth, 2017/08/28