net: Remove vhostforce option in addition to vhost parameter
PATCH 1/1 net: Remove vhostforce option in addition to vhost parameter
vhostforce was added to enable vhost when
guest don't have MSI-X support.
Now, we have scenarios like DPDK in Guest which dont use interrupts and still use vhost. Also, performance of guests without MSI-X support is getting less popular.
Its OK to remove this extra option and enable vhost on the basis of vhost=ON/OFF.
Done basic testing with vhost on/off for latest guests and old guests(non-msix).
--- hw/net/vhost_net.c | 2 +- hw/scsi/vhost-scsi.c | 2 +- hw/virtio/vhost.c | 6 ++---- include/hw/virtio/vhost.h | 3 +-- include/net/vhost_net.h | 1 - net/tap.c | 4 +--- net/vhost-user.c | 1 - 7 files changed, 6 insertions(+), 13 deletions(-)
hw/net/vhost_net.c +1 -1
@@ -159,7 +159,7 @@ struct vhost_net *vhost_net_init(VhostNetOptions *options) net->dev.vqs = net->vqs; r =vhost_dev_init (&net->dev, options->opaque, - options->backend_type, options->force); + options->backend_type);if (r <0 ) { goto fail; }
hw/scsi/vhost-scsi.c +1 -1
@@ -246,7 +246,7 @@ static void vhost_scsi_realize(DeviceState *dev, Error **errp) s->dev.backend_features =0 ; ret =vhost_dev_init (&s->dev, (void *)(uintptr_t )vhostfd, -VHOST_BACKEND_TYPE_KERNEL , true); +VHOST_BACKEND_TYPE_KERNEL );if (ret <0 ) {error_setg (errp,"vhost-scsi: vhost initialization failed: %s" ,strerror (-ret));
hw/virtio/vhost.c +2 -4
@@ -811,7 +811,7 @@ static void vhost_virtqueue_cleanup(struct vhost_virtqueue *vq) }int vhost_dev_init (struct vhost_dev *hdev,void *opaque, -VhostBackendType backend_type,bool force) +VhostBackendType backend_type) {uint64_t features;int i, r;
@@ -874,7 +874,6 @@ int vhost_dev_init(struct vhost_dev *hdev, void *opaque, hdev->started = false; hdev->memory_changed = false;memory_listener_register (&hdev->memory_listener, &address_space_memory); - hdev->force = force;return 0 ; fail_vq:while (--i >=0 ) {
@@ -909,8 +908,7 @@ bool vhost_dev_query(struct vhost_dev *hdev, VirtIODevice *vdev)VirtioBusClass *k =VIRTIO_BUS_GET_CLASS (vbus);return !k->query_guest_notifiers || - k->query_guest_notifiers (qbus->parent) || - hdev->force; + k->query_guest_notifiers (qbus->parent); }/* Stop processing guest IO notifications in qemu.
include/hw/virtio/vhost.h +1 -2
@@ -46,7 +46,6 @@ struct vhost_dev {vhost_log_chunk_t *log;unsigned long long log_size;Error *migration_blocker; -bool force;bool memory_changed;hwaddr mem_changed_start_addr;hwaddr mem_changed_end_addr;
@@ -55,7 +54,7 @@ struct vhost_dev { };int vhost_dev_init (struct vhost_dev *hdev,void *opaque, -VhostBackendType backend_type,bool force); +VhostBackendType backend_type);void vhost_dev_cleanup (struct vhost_dev *hdev);bool vhost_dev_query (struct vhost_dev *hdev,VirtIODevice *vdev);int vhost_dev_start (struct vhost_dev *hdev,VirtIODevice *vdev);
include/net/vhost_net.h +0 -1
@@ -11,7 +11,6 @@ typedef struct VhostNetOptions {VhostBackendType backend_type;NetClientState *net_backend;void *opaque; -bool force; } VhostNetOptions;struct vhost_net *vhost_net_init (VhostNetOptions *options);
net/tap.c +1 -3
@@ -635,13 +635,11 @@ static int net_init_tap_one(const NetdevTapOptions *tap, NetClientState *peer, } } -if (tap->has_vhost ? tap->vhost : - vhostfdname || (tap->has_vhostforce && tap->vhostforce)) { +if (tap->has_vhost ? tap->vhost : vhostfdname) {VhostNetOptions options; options.backend_type =VHOST_BACKEND_TYPE_KERNEL ; options.net_backend = &s->nc; - options.force = tap->has_vhostforce && tap->vhostforce;if (tap->has_vhostfd || tap->has_vhostfds) { vhostfd =monitor_fd_param (cur_mon, vhostfdname, &err);
net/vhost-user.c +0 -1
@@ -51,7 +51,6 @@ static int vhost_user_start(VhostUserState *s) options.backend_type =VHOST_BACKEND_TYPE_USER ; options.net_backend = &s->nc; options.opaque = s->chr; - options.force = s->vhostforce; s->vhost_net =vhost_net_init (&options);
Signature · 1 line
1.8.3.1
Ping.
Can I get any suggestions on this patch.
Best regards,
Pankaj
Quoted 154 lines
vhostforce was added to enable vhost when
guest don't have MSI-X support.
Now, we have scenarios like DPDK in Guest which dont use interrupts and still use vhost. Also, performance of guests without MSI-X support is getting less popular.Its OK to remove this extra option and enable vhost on the basis of vhost=ON/OFF.
Done basic testing with vhost on/off for latest guests and old guests(non-msix).Signed-off-by Pankaj Gupta <[email protected]>--- hw/net/vhost_net.c | 2 +- hw/scsi/vhost-scsi.c | 2 +- hw/virtio/vhost.c | 6 ++---- include/hw/virtio/vhost.h | 3 +-- include/net/vhost_net.h | 1 - net/tap.c | 4 +--- net/vhost-user.c | 1 - 7 files changed, 6 insertions(+), 13 deletions(-)hw/net/vhost_net.c +1
-1@@ -159,7 +159,7 @@ struct vhost_net *vhost_net_init(VhostNetOptions *options) net->dev.vqs = net->vqs; r =vhost_dev_init (&net->dev, options->opaque, - options->backend_type, options->force); + options->backend_type);if (r <0 ) { goto fail;}hw/scsi/vhost-scsi.c +1
-1@@ -246,7 +246,7 @@ static void vhost_scsi_realize(DeviceState *dev, Error **errp) s->dev.backend_features =0 ; ret =vhost_dev_init (&s->dev, (void *)(uintptr_t )vhostfd, -VHOST_BACKEND_TYPE_KERNEL , true); +VHOST_BACKEND_TYPE_KERNEL );if (ret <0 ) { error_setg(errp, "vhost-scsi: vhost initialization failed: %s",strerror(-ret));hw/virtio/vhost.c +1
-1@@ -811,7 +811,7 @@ static void vhost_virtqueue_cleanup(struct vhost_virtqueue *vq) }int vhost_dev_init (struct vhost_dev *hdev,void *opaque, -VhostBackendType backend_type,bool force) +VhostBackendType backend_type) {uint64_t features;int i, r;hw/virtio/vhost.c +1
-3@@ -874,7 +874,6 @@ int vhost_dev_init(struct vhost_dev *hdev, void *opaque, hdev->started = false; hdev->memory_changed = false;memory_listener_register (&hdev->memory_listener, &address_space_memory); - hdev->force = force;return 0 ; fail_vq:while (--i >=0 ) {@@ -909,8 +908,7 @@ bool vhost_dev_query(struct vhost_dev *hdev, VirtIODevice *vdev)VirtioBusClass *k =VIRTIO_BUS_GET_CLASS (vbus);return !k->query_guest_notifiers || - k->query_guest_notifiers (qbus->parent) || - hdev->force; + k->query_guest_notifiers (qbus->parent); }/* Stop processing guest IO notifications in qemu.
include/hw/virtio/vhost.h +1
-2@@ -46,7 +46,6 @@ struct vhost_dev {vhost_log_chunk_t *log;unsigned long long log_size;Error *migration_blocker; -bool force;bool memory_changed;hwaddr mem_changed_start_addr;hwaddr mem_changed_end_addr;@@ -55,7 +54,7 @@ struct vhost_dev { };int vhost_dev_init (struct vhost_dev *hdev,void *opaque, -VhostBackendType backend_type,bool force); +VhostBackendType backend_type);void vhost_dev_cleanup (struct vhost_dev *hdev);bool vhost_dev_query (struct vhost_dev *hdev,VirtIODevice *vdev);int vhost_dev_start (struct vhost_dev *hdev,VirtIODevice *vdev);include/net/vhost_net.h +0
-1@@ -11,7 +11,6 @@ typedef struct VhostNetOptions {VhostBackendType backend_type;NetClientState *net_backend;void *opaque; -bool force; } VhostNetOptions;struct vhost_net *vhost_net_init (VhostNetOptions *options);net/tap.c +1
-3@@ -635,13 +635,11 @@ static int net_init_tap_one(const NetdevTapOptions *tap, NetClientState *peer, } } -if (tap->has_vhost ? tap->vhost : - vhostfdname || (tap->has_vhostforce && tap->vhostforce)) { +if (tap->has_vhost ? tap->vhost : vhostfdname) {VhostNetOptions options; options.backend_type =VHOST_BACKEND_TYPE_KERNEL ; options.net_backend = &s->nc; - options.force = tap->has_vhostforce && tap->vhostforce;if (tap->has_vhostfd || tap->has_vhostfds) {vhostfd = monitor_fd_param(cur_mon, vhostfdname, &err);net/vhost-user.c +0
-2@@ -51,7 +51,6 @@ static int vhost_user_start(VhostUserState *s) options.backend_type =VHOST_BACKEND_TYPE_USER ; options.net_backend = &s->nc; options.opaque = s->chr; - options.force = s->vhostforce; s->vhost_net =vhost_net_init (&options); --1.8.3.1
Quoted 19 lines · Pankaj Gupta
Ping.
Can I get any suggestions on this patch.
Best regards,
PankajQuoted 12 lines
vhostforce was added to enable vhost when
guest don't have MSI-X support.
Now, we have scenarios like DPDK in Guest which dont use interrupts and still use vhost. Also, performance of guests without MSI-X support is getting less popular.Its OK to remove this extra option and enable vhost on the basis of vhost=ON/OFF.
Done basic testing with vhost on/off for latest guests and old guests(non-msix).Signed-off-by Pankaj Gupta <[email protected]>
Looks good. Two questions:
- Did libvirt use this? if not, we may want to drop vhostfore option completely.
- If vhostforce=off still attractable (I guess not)? If yes, we may want to simply make vhostforce default to true?
Thanks
Quoted 141 lines
Quoted 141 lines
--- hw/net/vhost_net.c | 2 +- hw/scsi/vhost-scsi.c | 2 +- hw/virtio/vhost.c | 6 ++---- include/hw/virtio/vhost.h | 3 +-- include/net/vhost_net.h | 1 - net/tap.c | 4 +--- net/vhost-user.c | 1 - 7 files changed, 6 insertions(+), 13 deletions(-)hw/net/vhost_net.c +1
-1@@ -159,7 +159,7 @@ struct vhost_net *vhost_net_init(VhostNetOptions *options) net->dev.vqs = net->vqs; r =vhost_dev_init (&net->dev, options->opaque, - options->backend_type, options->force); + options->backend_type);if (r <0 ) { goto fail;}hw/scsi/vhost-scsi.c +1
-1@@ -246,7 +246,7 @@ static void vhost_scsi_realize(DeviceState *dev, Error **errp) s->dev.backend_features =0 ; ret =vhost_dev_init (&s->dev, (void *)(uintptr_t )vhostfd, -VHOST_BACKEND_TYPE_KERNEL , true); +VHOST_BACKEND_TYPE_KERNEL );if (ret <0 ) { error_setg(errp, "vhost-scsi: vhost initialization failed: %s",strerror(-ret));hw/virtio/vhost.c +1
-1@@ -811,7 +811,7 @@ static void vhost_virtqueue_cleanup(struct vhost_virtqueue *vq) }int vhost_dev_init (struct vhost_dev *hdev,void *opaque, -VhostBackendType backend_type,bool force) +VhostBackendType backend_type) {uint64_t features;int i, r;hw/virtio/vhost.c +1
-3@@ -874,7 +874,6 @@ int vhost_dev_init(struct vhost_dev *hdev, void *opaque, hdev->started = false; hdev->memory_changed = false;memory_listener_register (&hdev->memory_listener, &address_space_memory); - hdev->force = force;return 0 ; fail_vq:while (--i >=0 ) {@@ -909,8 +908,7 @@ bool vhost_dev_query(struct vhost_dev *hdev, VirtIODevice *vdev)VirtioBusClass *k =VIRTIO_BUS_GET_CLASS (vbus);return !k->query_guest_notifiers || - k->query_guest_notifiers (qbus->parent) || - hdev->force; + k->query_guest_notifiers (qbus->parent); }/* Stop processing guest IO notifications in qemu.
include/hw/virtio/vhost.h +1
-2@@ -46,7 +46,6 @@ struct vhost_dev {vhost_log_chunk_t *log;unsigned long long log_size;Error *migration_blocker; -bool force;bool memory_changed;hwaddr mem_changed_start_addr;hwaddr mem_changed_end_addr;@@ -55,7 +54,7 @@ struct vhost_dev { };int vhost_dev_init (struct vhost_dev *hdev,void *opaque, -VhostBackendType backend_type,bool force); +VhostBackendType backend_type);void vhost_dev_cleanup (struct vhost_dev *hdev);bool vhost_dev_query (struct vhost_dev *hdev,VirtIODevice *vdev);int vhost_dev_start (struct vhost_dev *hdev,VirtIODevice *vdev);include/net/vhost_net.h +0
-1@@ -11,7 +11,6 @@ typedef struct VhostNetOptions {VhostBackendType backend_type;NetClientState *net_backend;void *opaque; -bool force; } VhostNetOptions;struct vhost_net *vhost_net_init (VhostNetOptions *options);net/tap.c +1
-3@@ -635,13 +635,11 @@ static int net_init_tap_one(const NetdevTapOptions *tap, NetClientState *peer, } } -if (tap->has_vhost ? tap->vhost : - vhostfdname || (tap->has_vhostforce && tap->vhostforce)) { +if (tap->has_vhost ? tap->vhost : vhostfdname) {VhostNetOptions options; options.backend_type =VHOST_BACKEND_TYPE_KERNEL ; options.net_backend = &s->nc; - options.force = tap->has_vhostforce && tap->vhostforce;if (tap->has_vhostfd || tap->has_vhostfds) {vhostfd = monitor_fd_param(cur_mon, vhostfdname, &err);net/vhost-user.c +0
-2@@ -51,7 +51,6 @@ static int vhost_user_start(VhostUserState *s) options.backend_type =VHOST_BACKEND_TYPE_USER ; options.net_backend = &s->nc; options.opaque = s->chr; - options.force = s->vhostforce; s->vhost_net =vhost_net_init (&options); --1.8.3.1
Quoted 21 lines · Jason Wang
Quoted 18 lines · Pankaj Gupta
Ping.
Can I get any suggestions on this patch.
Best regards,
PankajQuoted 11 lines
vhostforce was added to enable vhost when
guest don't have MSI-X support.
Now, we have scenarios like DPDK in Guest which dont use interrupts and still use vhost. Also, performance of guests without MSI-X support is getting less popular.Its OK to remove this extra option and enable vhost on the basis of vhost=ON/OFF.
Done basic testing with vhost on/off for latest guests and old guests(non-msix).
Quoted 6 lines
Quoted 1 line
Quoted 1 line
Signed-off-by Pankaj Gupta <[email protected]>Looks good. Two questions:
- Did libvirt use this? if not, we may want to drop vhostfore option completely.
Yes, it did.
Quoted 145 lines
- If vhostforce=off still attractable (I guess not)? If yes, we may want to simply make vhostforce default to true?
Thanks
Quoted 141 lines
Quoted 141 lines
--- hw/net/vhost_net.c | 2 +- hw/scsi/vhost-scsi.c | 2 +- hw/virtio/vhost.c | 6 ++---- include/hw/virtio/vhost.h | 3 +-- include/net/vhost_net.h | 1 - net/tap.c | 4 +--- net/vhost-user.c | 1 - 7 files changed, 6 insertions(+), 13 deletions(-)hw/net/vhost_net.c +1
-1@@ -159,7 +159,7 @@ struct vhost_net *vhost_net_init(VhostNetOptions *options) net->dev.vqs = net->vqs; r =vhost_dev_init (&net->dev, options->opaque, - options->backend_type, options->force); + options->backend_type);if (r <0 ) { goto fail;}hw/scsi/vhost-scsi.c +1
-1@@ -246,7 +246,7 @@ static void vhost_scsi_realize(DeviceState *dev, Error **errp) s->dev.backend_features =0 ; ret =vhost_dev_init (&s->dev, (void *)(uintptr_t )vhostfd, -VHOST_BACKEND_TYPE_KERNEL , true); +VHOST_BACKEND_TYPE_KERNEL );if (ret <0 ) { error_setg(errp, "vhost-scsi: vhost initialization failed: %s",strerror(-ret));hw/virtio/vhost.c +1
-1@@ -811,7 +811,7 @@ static void vhost_virtqueue_cleanup(struct vhost_virtqueue *vq) }int vhost_dev_init (struct vhost_dev *hdev,void *opaque, -VhostBackendType backend_type,bool force) +VhostBackendType backend_type) {uint64_t features;int i, r;hw/virtio/vhost.c +1
-3@@ -874,7 +874,6 @@ int vhost_dev_init(struct vhost_dev *hdev, void *opaque, hdev->started = false; hdev->memory_changed = false;memory_listener_register (&hdev->memory_listener, &address_space_memory); - hdev->force = force;return 0 ; fail_vq:while (--i >=0 ) {@@ -909,8 +908,7 @@ bool vhost_dev_query(struct vhost_dev *hdev, VirtIODevice *vdev)VirtioBusClass *k =VIRTIO_BUS_GET_CLASS (vbus);return !k->query_guest_notifiers || - k->query_guest_notifiers (qbus->parent) || - hdev->force; + k->query_guest_notifiers (qbus->parent); }/* Stop processing guest IO notifications in qemu.
include/hw/virtio/vhost.h +1
-2@@ -46,7 +46,6 @@ struct vhost_dev {vhost_log_chunk_t *log;unsigned long long log_size;Error *migration_blocker; -bool force;bool memory_changed;hwaddr mem_changed_start_addr;hwaddr mem_changed_end_addr;@@ -55,7 +54,7 @@ struct vhost_dev { };int vhost_dev_init (struct vhost_dev *hdev,void *opaque, -VhostBackendType backend_type,bool force); +VhostBackendType backend_type);void vhost_dev_cleanup (struct vhost_dev *hdev);bool vhost_dev_query (struct vhost_dev *hdev,VirtIODevice *vdev);int vhost_dev_start (struct vhost_dev *hdev,VirtIODevice *vdev);include/net/vhost_net.h +0
-1@@ -11,7 +11,6 @@ typedef struct VhostNetOptions {VhostBackendType backend_type;NetClientState *net_backend;void *opaque; -bool force; } VhostNetOptions;struct vhost_net *vhost_net_init (VhostNetOptions *options);net/tap.c +1
-3@@ -635,13 +635,11 @@ static int net_init_tap_one(const NetdevTapOptions *tap, NetClientState *peer, } } -if (tap->has_vhost ? tap->vhost : - vhostfdname || (tap->has_vhostforce && tap->vhostforce)) { +if (tap->has_vhost ? tap->vhost : vhostfdname) {VhostNetOptions options; options.backend_type =VHOST_BACKEND_TYPE_KERNEL ; options.net_backend = &s->nc; - options.force = tap->has_vhostforce && tap->vhostforce;if (tap->has_vhostfd || tap->has_vhostfds) {vhostfd = monitor_fd_param(cur_mon, vhostfdname, &err);net/vhost-user.c +0
-2@@ -51,7 +51,6 @@ static int vhost_user_start(VhostUserState *s) options.backend_type =VHOST_BACKEND_TYPE_USER ; options.net_backend = &s->nc; options.opaque = s->chr; - options.force = s->vhostforce; s->vhost_net =vhost_net_init (&options); --1.8.3.1
Quoted 22 lines · Michael S. Tsirkin
Quoted 21 lines · Jason Wang
Quoted 21 lines · Pankaj Gupta
Quoted 18 lines
Quoted 18 lines
Ping.
Can I get any suggestions on this patch.
Best regards,
PankajQuoted 11 lines
Quoted 11 lines
vhostforce was added to enable vhost when
guest don't have MSI-X support.
Now, we have scenarios like DPDK in Guest which dont use interrupts and still use vhost. Also, performance of guests without MSI-X support is getting less popular.Its OK to remove this extra option and enable vhost on the basis of vhost=ON/OFF.
Done basic testing with vhost on/off for latest guests and old guests(non-msix).
Quoted 8 lines
Quoted 6 lines
Quoted 6 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Signed-off-by Pankaj Gupta <[email protected]>Looks good. Two questions:
- Did libvirt use this? if not, we may want to drop vhostfore option completely.
Yes, it did.
For vhost-user, vhostforce is mandatory. But how about tap? Looks like it was not used, and I could not even find any option in
http://libvirt.org/formatdomain.html.
Quoted 26 lines · Jason Wang
Quoted 24 lines · Michael S. Tsirkin
Quoted 23 lines · Jason Wang
Quoted 23 lines · Pankaj Gupta
Quoted 13 lines
Quoted 13 lines
Ping.
Can I get any suggestions on this patch.
Best regards,
PankajQuoted 6 lines
Quoted 6 lines
vhostforce was added to enable vhost when
guest don't have MSI-X support.
Now, we have scenarios like DPDK in Guest which dont use interrupts and still use vhost. Also, performance of guests without MSI-X support is getting less popular.Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Its OK to remove this extra option and enable vhost on the basis of vhost=ON/OFF.
Done basic testing with vhost on/off for latest guests and old guests(non-msix).Signed-off-by Pankaj Gupta <[email protected]>Looks good. Two questions:
Quoted 8 lines
Quoted 4 lines
Quoted 2 lines
Quoted 2 lines
- Did libvirt use this? if not, we may want to drop vhostfore option completely.
Yes, it did.
For vhost-user, vhostforce is mandatory. But how about tap? Looks like it was not used, and I could not even find any option in
http://libvirt.org/formatdomain.html.
CC Michal for the answer.
Quoted 31 lines · Jason Wang
Quoted 28 lines · Jason Wang
Quoted 26 lines · Michael S. Tsirkin
Quoted 25 lines · Jason Wang
Quoted 25 lines · Pankaj Gupta
Quoted 13 lines
Quoted 13 lines
Ping.
Can I get any suggestions on this patch.
Best regards,
PankajQuoted 6 lines
Quoted 6 lines
vhostforce was added to enable vhost when
guest don't have MSI-X support.
Now, we have scenarios like DPDK in Guest which dont use interrupts and still use vhost. Also, performance of guests without MSI-X support is getting less popular.Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Its OK to remove this extra option and enable vhost on the basis of vhost=ON/OFF.
Done basic testing with vhost on/off for latest guests and old guests(non-msix).Signed-off-by Pankaj Gupta <[email protected]>Looks good. Two questions:
- Did libvirt use this? if not, we may want to drop vhostfore option completely.
Quoted 9 lines
Quoted 6 lines
Quoted 2 lines
Yes, it did.
For vhost-user, vhostforce is mandatory. But how about tap? Looks like it was not used, and I could not even find any option in
http://libvirt.org/formatdomain.html.CC Michal for the answer.
No, vhostforce is not used by libvirt at all. Which brings up interesting question: for vhost-user libvirt constructs merely the follwing cmd line:
-chardev socket,id=charnet0,path=/tmp/vhost0.sock,server \
-netdev type=vhost-user,id=hostnet0,chardev=charnet0 \
How does vhostforce fit in? I suppose the cmd line is working even without libvirt passing vhostforce. Should it do so?
Michal
Quoted 44 lines · Michal Privoznik
Quoted 28 lines · Jason Wang
Quoted 26 lines · Jason Wang
Quoted 25 lines · Michael S. Tsirkin
Quoted 24 lines · Jason Wang
Quoted 24 lines · Pankaj Gupta
Quoted 13 lines
Quoted 13 lines
Ping.
Can I get any suggestions on this patch.
Best regards,
PankajQuoted 6 lines
Quoted 6 lines
vhostforce was added to enable vhost when
guest don't have MSI-X support.
Now, we have scenarios like DPDK in Guest which dont use interrupts and still use vhost. Also, performance of guests without MSI-X support is getting less popular.Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Its OK to remove this extra option and enable vhost on the basis of vhost=ON/OFF.
Done basic testing with vhost on/off for latest guests and old guests(non-msix).Signed-off-by Pankaj Gupta <[email protected]>Looks good. Two questions:
- Did libvirt use this? if not, we may want to drop vhostfore option completely.
Quoted 8 lines
Quoted 6 lines
Quoted 2 lines
Yes, it did.
For vhost-user, vhostforce is mandatory. But how about tap? Looks like it was not used, and I could not even find any option in
http://libvirt.org/formatdomain.html.CC Michal for the answer.
No, vhostforce is not used by libvirt at all. Which brings up interesting question: for vhost-user libvirt constructs merely the follwing cmd line:
(quoted diff) +0
-2-chardev socket,id=charnet0,path=/tmp/vhost0.sock,server \ -netdev type=vhost-user,id=hostnet0,chardev=charnet0 \
Quoted 2 lines
How does vhostforce fit in? I suppose the cmd line is working even without libvirt passing vhostforce. Should it do so?
Without this patch, it works with normal virtio-net drivers but may not work for guest pmd. Since pmd does not use MSI-X interrupts, so qemu won't start vhost_net. So libvirt needs vhostforce for vhost-user.
With this patch, libvirt does not need to care about this.
Quoted 3 lines
Michal
Quoted 23 lines · Pankaj Gupta
Ping.
Can I get any suggestions on this patch.
Best regards,
PankajQuoted 13 lines
vhostforce was added to enable vhost when
guest don't have MSI-X support.
Now, we have scenarios like DPDK in Guest which dont use interrupts and still use vhost. Also, performance of guests without MSI-X support is getting less popular.Its OK to remove this extra option and enable vhost on the basis of vhost=ON/OFF.
Done basic testing with vhost on/off for latest guests and old guests(non-msix).Signed-off-by Pankaj Gupta <[email protected]>
I think this silently changes the command line semantics:
previously vhostforce=on implies vhost=on, with this patch it does not.
Quoted 141 lines
Quoted 141 lines
--- hw/net/vhost_net.c | 2 +- hw/scsi/vhost-scsi.c | 2 +- hw/virtio/vhost.c | 6 ++---- include/hw/virtio/vhost.h | 3 +-- include/net/vhost_net.h | 1 - net/tap.c | 4 +--- net/vhost-user.c | 1 - 7 files changed, 6 insertions(+), 13 deletions(-)hw/net/vhost_net.c +1
-1@@ -159,7 +159,7 @@ struct vhost_net *vhost_net_init(VhostNetOptions *options) net->dev.vqs = net->vqs; r =vhost_dev_init (&net->dev, options->opaque, - options->backend_type, options->force); + options->backend_type);if (r <0 ) { goto fail;}hw/scsi/vhost-scsi.c +1
-1@@ -246,7 +246,7 @@ static void vhost_scsi_realize(DeviceState *dev, Error **errp) s->dev.backend_features =0 ; ret =vhost_dev_init (&s->dev, (void *)(uintptr_t )vhostfd, -VHOST_BACKEND_TYPE_KERNEL , true); +VHOST_BACKEND_TYPE_KERNEL );if (ret <0 ) { error_setg(errp, "vhost-scsi: vhost initialization failed: %s",strerror(-ret));hw/virtio/vhost.c +1
-1@@ -811,7 +811,7 @@ static void vhost_virtqueue_cleanup(struct vhost_virtqueue *vq) }int vhost_dev_init (struct vhost_dev *hdev,void *opaque, -VhostBackendType backend_type,bool force) +VhostBackendType backend_type) {uint64_t features;int i, r;hw/virtio/vhost.c +1
-3@@ -874,7 +874,6 @@ int vhost_dev_init(struct vhost_dev *hdev, void *opaque, hdev->started = false; hdev->memory_changed = false;memory_listener_register (&hdev->memory_listener, &address_space_memory); - hdev->force = force;return 0 ; fail_vq:while (--i >=0 ) {@@ -909,8 +908,7 @@ bool vhost_dev_query(struct vhost_dev *hdev, VirtIODevice *vdev)VirtioBusClass *k =VIRTIO_BUS_GET_CLASS (vbus);return !k->query_guest_notifiers || - k->query_guest_notifiers (qbus->parent) || - hdev->force; + k->query_guest_notifiers (qbus->parent); }/* Stop processing guest IO notifications in qemu.
include/hw/virtio/vhost.h +1
-2@@ -46,7 +46,6 @@ struct vhost_dev {vhost_log_chunk_t *log;unsigned long long log_size;Error *migration_blocker; -bool force;bool memory_changed;hwaddr mem_changed_start_addr;hwaddr mem_changed_end_addr;@@ -55,7 +54,7 @@ struct vhost_dev { };int vhost_dev_init (struct vhost_dev *hdev,void *opaque, -VhostBackendType backend_type,bool force); +VhostBackendType backend_type);void vhost_dev_cleanup (struct vhost_dev *hdev);bool vhost_dev_query (struct vhost_dev *hdev,VirtIODevice *vdev);int vhost_dev_start (struct vhost_dev *hdev,VirtIODevice *vdev);include/net/vhost_net.h +0
-1@@ -11,7 +11,6 @@ typedef struct VhostNetOptions {VhostBackendType backend_type;NetClientState *net_backend;void *opaque; -bool force; } VhostNetOptions;struct vhost_net *vhost_net_init (VhostNetOptions *options);net/tap.c +1
-3@@ -635,13 +635,11 @@ static int net_init_tap_one(const NetdevTapOptions *tap, NetClientState *peer, } } -if (tap->has_vhost ? tap->vhost : - vhostfdname || (tap->has_vhostforce && tap->vhostforce)) { +if (tap->has_vhost ? tap->vhost : vhostfdname) {VhostNetOptions options; options.backend_type =VHOST_BACKEND_TYPE_KERNEL ; options.net_backend = &s->nc; - options.force = tap->has_vhostforce && tap->vhostforce;if (tap->has_vhostfd || tap->has_vhostfds) {vhostfd = monitor_fd_param(cur_mon, vhostfdname, &err);net/vhost-user.c +0
-2@@ -51,7 +51,6 @@ static int vhost_user_start(VhostUserState *s) options.backend_type =VHOST_BACKEND_TYPE_USER ; options.net_backend = &s->nc; options.opaque = s->chr; - options.force = s->vhostforce; s->vhost_net =vhost_net_init (&options); --1.8.3.1
Quoted 23 lines
Quoted 23 lines
Ping.
Can I get any suggestions on this patch.
Best regards,
PankajQuoted 12 lines
vhostforce was added to enable vhost when
guest don't have MSI-X support.
Now, we have scenarios like DPDK in Guest which dont use interrupts and still use vhost. Also, performance of guests without MSI-X support is getting less popular.Its OK to remove this extra option and enable vhost on the basis of vhost=ON/OFF.
Done basic testing with vhost on/off for latest guests and old guests(non-msix).
Quoted 5 lines
Quoted 1 line
Quoted 1 line
Signed-off-by Pankaj Gupta <[email protected]>I think this silently changes the command line semantics:
previously vhostforce=on implies vhost=on, with this patch it does not.
Yes, we are trying to eliminate 'vhostforce'. As we already have vhost='ON/OFF'.
In case of 'virtio-net', with vhost= 'ON', without guest support of MSI-X we will fall back to QEMU. If we use vhostforce='ON', we will use 'vhost' even it has to follow a long path again via QEMU->vhost. also we don't have support of KVM level triggered irqfd.
In case 'vhost-user' is used, we are hard-coding 'vhostforce' to 'true' because we want vhost(vhost-user) to run. We are also removing this as it alos checks 'vhost_dev_query'.
Any use-case where we want to forcefully use vhost even we are falling back to userspace Virtio-net?
One use-case I can think for 'vhost-user' without MSI-X support e.g iPXE boot. Here we want to use vhost-user for every/any condition, because we don't have any alternative.
Any suggestions?
Quoted 148 lines
Quoted 146 lines
Quoted 146 lines
--- hw/net/vhost_net.c | 2 +- hw/scsi/vhost-scsi.c | 2 +- hw/virtio/vhost.c | 6 ++---- include/hw/virtio/vhost.h | 3 +-- include/net/vhost_net.h | 1 - net/tap.c | 4 +--- net/vhost-user.c | 1 - 7 files changed, 6 insertions(+), 13 deletions(-)hw/net/vhost_net.c +1
-1@@ -159,7 +159,7 @@ struct vhost_net *vhost_net_init(VhostNetOptions *options) net->dev.vqs = net->vqs; r =vhost_dev_init (&net->dev, options->opaque, - options->backend_type, options->force); + options->backend_type);if (r <0 ) { goto fail;}hw/scsi/vhost-scsi.c +0
-0@@ -246,7 +246,7 @@ static void vhost_scsi_realize(DeviceState *dev,Error
**errp)s->dev.backend_features = 0; ret = vhost_dev_init(&s->dev, (void *)(uintptr_t)vhostfd,hw/scsi/vhost-scsi.c +1
-1- VHOST_BACKEND_TYPE_KERNEL, true); + VHOST_BACKEND_TYPE_KERNEL);if (ret <0 ) {error_setg (errp,"vhost-scsi: vhost initialization failed: %s" ,strerror (-ret));hw/virtio/vhost.c +1
-1@@ -811,7 +811,7 @@ static void vhost_virtqueue_cleanup(struct vhost_virtqueue *vq) }int vhost_dev_init (struct vhost_dev *hdev,void *opaque, -VhostBackendType backend_type,bool force) +VhostBackendType backend_type) {uint64_t features;int i, r;hw/virtio/vhost.c +0
-1@@ -874,7 +874,6 @@ int vhost_dev_init(struct vhost_dev *hdev, void *opaque, hdev->started = false; hdev->memory_changed = false;memory_listener_register (&hdev->memory_listener, &address_space_memory); - hdev->force = force;return 0 ;
fail_vq:while (--i >= 0) {hw/virtio/vhost.c +0
-0@@ -909,8 +908,7 @@ bool vhost_dev_query(struct vhost_dev *hdev,VirtIODevice
*vdev)VirtioBusClass *k = VIRTIO_BUS_GET_CLASS(vbus); return !k->query_guest_notifiers ||hw/virtio/vhost.c +1
-2- k->query_guest_notifiers (qbus->parent) || - hdev->force; + k->query_guest_notifiers (qbus->parent); }/* Stop processing guest IO notifications in qemu. include/hw/virtio/vhost.h +1
-2@@ -46,7 +46,6 @@ struct vhost_dev {vhost_log_chunk_t *log;unsigned long long log_size;Error *migration_blocker; -bool force;bool memory_changed;hwaddr mem_changed_start_addr;hwaddr mem_changed_end_addr;@@ -55,7 +54,7 @@ struct vhost_dev { };int vhost_dev_init (struct vhost_dev *hdev,void *opaque, -VhostBackendType backend_type,bool force); +VhostBackendType backend_type);void vhost_dev_cleanup (struct vhost_dev *hdev);bool vhost_dev_query (struct vhost_dev *hdev,VirtIODevice *vdev);int vhost_dev_start (struct vhost_dev *hdev,VirtIODevice *vdev);include/net/vhost_net.h +0
-1@@ -11,7 +11,6 @@ typedef struct VhostNetOptions {VhostBackendType backend_type;NetClientState *net_backend;void *opaque; -bool force; } VhostNetOptions;struct vhost_net *vhost_net_init (VhostNetOptions *options);net/tap.c +1
-3@@ -635,13 +635,11 @@ static int net_init_tap_one(const NetdevTapOptions *tap, NetClientState *peer, } } -if (tap->has_vhost ? tap->vhost : - vhostfdname || (tap->has_vhostforce && tap->vhostforce)) { +if (tap->has_vhost ? tap->vhost : vhostfdname) {VhostNetOptions options; options.backend_type =VHOST_BACKEND_TYPE_KERNEL ; options.net_backend = &s->nc; - options.force = tap->has_vhostforce && tap->vhostforce;if (tap->has_vhostfd || tap->has_vhostfds) {vhostfd = monitor_fd_param(cur_mon, vhostfdname, &err);net/vhost-user.c +0
-2@@ -51,7 +51,6 @@ static int vhost_user_start(VhostUserState *s) options.backend_type =VHOST_BACKEND_TYPE_USER ; options.net_backend = &s->nc; options.opaque = s->chr; - options.force = s->vhostforce; s->vhost_net =vhost_net_init (&options); --1.8.3.1