[v2] examples/vhost: workaround qemu abort
Checks
Commit Message
Current qemu vhost net ring start has a dependency on feature bit
VHOST_USER_F_PROTOCOL_FEATURES. If vhost device start without it, stop
action will be skipped. Consequently, same ioevent fd will be added
twice after reloading driver and then cause qemu abort. However, ring
should be initialized in an enabled state when this feature bit not
negotiated. Work around qemu issue by enabling this feature bit in vhost
user backend.
Signed-off-by: Marvin Liu <yong.liu@intel.com>
Comments
On Wed, Jul 25, 2018 at 05:56:54PM +0800, Marvin Liu wrote:
> Current qemu vhost net ring start has a dependency on feature bit
> VHOST_USER_F_PROTOCOL_FEATURES. If vhost device start without it, stop
> action will be skipped. Consequently, same ioevent fd will be added
> twice after reloading driver and then cause qemu abort. However, ring
> should be initialized in an enabled state when this feature bit not
> negotiated. Work around qemu issue by enabling this feature bit in vhost
> user backend.
>
> Signed-off-by: Marvin Liu <yong.liu@intel.com>
>
> diff --git a/examples/vhost/main.c b/examples/vhost/main.c
> index 2175c1186..4b87331fc 100644
> --- a/examples/vhost/main.c
> +++ b/examples/vhost/main.c
> @@ -1519,8 +1519,12 @@ main(int argc, char *argv[])
> "vhost driver register failure.\n");
> }
>
> - if (builtin_net_driver)
> + if (builtin_net_driver) {
> rte_vhost_driver_set_features(file, VIRTIO_NET_FEATURES);
> + /* Workaround for qemu vhost net device startup */
> + rte_vhost_driver_set_features(file,
> + 1ULL << VHOST_USER_F_PROTOCOL_FEATURES);
rte_vhost_driver_set_features() will overwrite the
existing value. You need to OR VIRTIO_NET_FEATURES
and (1ULL << VHOST_USER_F_PROTOCOL_FEATURES).
> + }
>
> if (mergeable == 0) {
> rte_vhost_driver_disable_features(file,
> --
> 2.17.0
>
> -----Original Message-----
> From: Bie, Tiwei
> Sent: Wednesday, July 25, 2018 10:19 AM
> To: Liu, Yong <yong.liu@intel.com>
> Cc: dev@dpdk.org
> Subject: Re: [PATCH v2] examples/vhost: workaround qemu abort
>
> On Wed, Jul 25, 2018 at 05:56:54PM +0800, Marvin Liu wrote:
> > Current qemu vhost net ring start has a dependency on feature bit
> > VHOST_USER_F_PROTOCOL_FEATURES. If vhost device start without it, stop
> > action will be skipped. Consequently, same ioevent fd will be added
> > twice after reloading driver and then cause qemu abort. However, ring
> > should be initialized in an enabled state when this feature bit not
> > negotiated. Work around qemu issue by enabling this feature bit in vhost
> > user backend.
> >
> > Signed-off-by: Marvin Liu <yong.liu@intel.com>
> >
> > diff --git a/examples/vhost/main.c b/examples/vhost/main.c
> > index 2175c1186..4b87331fc 100644
> > --- a/examples/vhost/main.c
> > +++ b/examples/vhost/main.c
> > @@ -1519,8 +1519,12 @@ main(int argc, char *argv[])
> > "vhost driver register failure.\n");
> > }
> >
> > - if (builtin_net_driver)
> > + if (builtin_net_driver) {
> > rte_vhost_driver_set_features(file, VIRTIO_NET_FEATURES);
> > + /* Workaround for qemu vhost net device startup */
> > + rte_vhost_driver_set_features(file,
> > + 1ULL << VHOST_USER_F_PROTOCOL_FEATURES);
>
> rte_vhost_driver_set_features() will overwrite the
> existing value. You need to OR VIRTIO_NET_FEATURES
> and (1ULL << VHOST_USER_F_PROTOCOL_FEATURES).
>
>
Tiwei,
Thanks for point out the error, I have sent v3 for correcting this.
Regards,
Marvin
>
> > + }
> >
> > if (mergeable == 0) {
> > rte_vhost_driver_disable_features(file,
> > --
> > 2.17.0
> >
@@ -1519,8 +1519,12 @@ main(int argc, char *argv[])
"vhost driver register failure.\n");
}
- if (builtin_net_driver)
+ if (builtin_net_driver) {
rte_vhost_driver_set_features(file, VIRTIO_NET_FEATURES);
+ /* Workaround for qemu vhost net device startup */
+ rte_vhost_driver_set_features(file,
+ 1ULL << VHOST_USER_F_PROTOCOL_FEATURES);
+ }
if (mergeable == 0) {
rte_vhost_driver_disable_features(file,