examples/vhost: fix qemu abort
Checks
Commit Message
When start vhost sample with builtin-net-driver argument, vhost feature
bit will be zero. If VHOST_USER_F_PROTOCOL_FEATURES is not set, vhost
net start will be failed in qemu. This occasion will cause device stop
action was skipped. Consequently, same ioevent fd will be added second
time after reload driver and then cause qemu abort. Add feature bit
which has been supported by vhost library can fix this error.
Fixes: ca059fa5 ("examples/vhost: demonstrate the new generic APIs")
Signed-off-by: Marvin Liu <yong.liu@intel.com>
Comments
On Tue, Jul 24, 2018 at 11:16:49PM +0800, Marvin Liu wrote:
> When start vhost sample with builtin-net-driver argument, vhost feature
> bit will be zero. If VHOST_USER_F_PROTOCOL_FEATURES is not set, vhost
> net start will be failed in qemu. This occasion will cause device stop
> action was skipped. Consequently, same ioevent fd will be added second
> time after reload driver and then cause qemu abort. Add feature bit
> which has been supported by vhost library can fix this error.
>
> Fixes: ca059fa5 ("examples/vhost: demonstrate the new generic APIs")
It's a bug in QEMU, this is a workaround in DPDK.
So there is no need to fix any commit in DPDK.
>
> Signed-off-by: Marvin Liu <yong.liu@intel.com>
>
> diff --git a/examples/vhost/main.c b/examples/vhost/main.c
> index 2175c1186..44aec2f47 100644
> --- a/examples/vhost/main.c
> +++ b/examples/vhost/main.c
> @@ -1520,7 +1520,8 @@ main(int argc, char *argv[])
> }
>
> if (builtin_net_driver)
> - rte_vhost_driver_set_features(file, VIRTIO_NET_FEATURES);
There is no need to remove VIRTIO_NET_FEATURES
although it's defined to 0 (as it's helpful for
users to understand this example).
> + rte_vhost_driver_set_features(file,
> + 1ULL << VHOST_USER_F_PROTOCOL_FEATURES);
It's better to add some comments that this is
a workaround and why this workaround is needed.
>
> if (mergeable == 0) {
> rte_vhost_driver_disable_features(file,
> --
> 2.17.0
>
@@ -1520,7 +1520,8 @@ main(int argc, char *argv[])
}
if (builtin_net_driver)
- rte_vhost_driver_set_features(file, VIRTIO_NET_FEATURES);
+ rte_vhost_driver_set_features(file,
+ 1ULL << VHOST_USER_F_PROTOCOL_FEATURES);
if (mergeable == 0) {
rte_vhost_driver_disable_features(file,