qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH v4 3/3] vhost-user: Fix the virtio features negotiation flaw


From: Hyman Huang
Subject: Re: [PATCH v4 3/3] vhost-user: Fix the virtio features negotiation flaw
Date: Wed, 14 Dec 2022 16:23:50 +0800
User-agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101 Thunderbird/102.5.1

Thanks xiangdong for the testing and reporting, indeed, vhost-user negotiaion features saving only apply on dpdk interface, vhost-net and vdpa interface can be ingored. I'll apply it next version.

Yong

在 2022/12/14 16:15, Liuxiangdong 写道:
QEMU will coredump when vm starts.

Using command line:

./build/qemu-system-x86_64 \
     -nodefaults \
     -m 4G \
     -machine pc-i440fx-4.1 \
     -accel kvm \
     -cpu host \
     -smp 4 \
     -device qemu-xhci -device usb-kbd -device usb-tablet \
     -drive if=none,id=linux,file=test.img,format=raw \
     -device virtio-blk-pci,drive=linux,disable-legacy=on \
     -vnc :0 \
     -d all \
     -D %dlog \
     -netdev tap,id=hostnet0,ifname=tap0,vhost=on,script=no,downscript=no \
     -device virtio-net-pci,netdev=hostnet0,id=net0,mac=52:54:00:6b:0d:a1 \
     -device cirrus-vga \
     -msg timestamp=on


And then:
qemu-system-x86_64: ../hw/net/vhost_net.c:149: vhost_net_save_acked_features: Assertion `nc->info->type == NET_CLIENT_DRIVER_VHOST_USER' failed.
Aborted (core dumped)

Because it may be a tap or vdpa besides vhost user when function "get_vhost_net(nc->peer)" returns ture.





From: liuxiangdong <liuxiangdong5@huawei.com>
Date: Mon, 5 Dec 2022 07:11:28 +0800
Subject: [PATCH] vhost_net: keep acked_feature only for
  NET_CLIENT_DRIVER_VHOST_USER

Keep acked_features in NetVhostUserState up-to-date by function vhost_net_save_acked_features in function virtio_net_set_features. But nc->peer->info->type maybe NET_CLIENT_DRIVER_TAP or
NET_CLIENT_DRIVER_VHOST_VDPA besides NET_CLIENT_DRIVER_VHOST_USER.

Don't keep acked_features in other type now except NET_CLIENT_DRIVER_VHOST_USER

Fix:  vhost-user: Fix the virtio features negotiation flaw

Signed-off-by: liuxiangdong <liuxiangdong5@huawei.com>
---
  hw/net/vhost_net.c | 5 +++--
  1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/hw/net/vhost_net.c b/hw/net/vhost_net.c
index a98575ffbc..bea053a742 100644
--- a/hw/net/vhost_net.c
+++ b/hw/net/vhost_net.c
@@ -143,8 +143,9 @@ uint64_t vhost_net_get_acked_features(VHostNetState *net)

  void vhost_net_save_acked_features(NetClientState *nc)
  {
-    assert(nc->info->type == NET_CLIENT_DRIVER_VHOST_USER);
-    vhost_user_save_acked_features(nc);
+    if (nc->info->type == NET_CLIENT_DRIVER_VHOST_USER) {
+        vhost_user_save_acked_features(nc);
+    }
  }

  static int vhost_net_get_fd(NetClientState *backend)

--
Best regard

Hyman Huang(黄勇)



reply via email to

[Prev in Thread] Current Thread [Next in Thread]