Skip to contentSkip to conversation

net: 'Remove vhostforce option in addition to vhost param'

RFC In review Pankaj Gupta 3 participants 7 messages Feb 12, 2015 – Feb 19, 2015 Networking

lore
Share & tools
lore
#0 lore raw

RFC 1/1 net: 'Remove vhostforce option in addition to vhost param'

vhostforce was added to enable use of vhost when guest don't have MSI-X support.
Now, we have scenarios which dont use interrupts like DPDK 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.

---
 net/tap.c        |  4 +---
 net/vhost-user.c | 16 ++--------------
 2 files changed, 3 insertions(+), 17 deletions(-)
net/tap.c +1 -3
index 1fe0edf..bd2efa9 100644
@@ -634,13 +634,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_handle_fd_param(cur_mon, vhostfdname);
net/vhost-user.c +2 -14
index 24e050c..d2d7bf2 100644
@@ -18,7 +18,6 @@
 typedef struct VhostUserState {
     NetClientState nc;
     CharDriverState *chr;
-    bool vhostforce;
     VHostNetState *vhost_net;
 } VhostUserState;
 
@@ -51,7 +50,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);
 
@@ -133,8 +131,7 @@ static void net_vhost_user_event(void *opaque, int event)
 }
 
 static int net_vhost_user_init(NetClientState *peer, const char *device,
-                               const char *name, CharDriverState *chr,
-                               bool vhostforce)
+                               const char *name, CharDriverState *chr)
 {
     NetClientState *nc;
     VhostUserState *s;
@@ -149,7 +146,6 @@ static int net_vhost_user_init(NetClientState *peer, const char *device,
     /* We don't provide a receive callback */
     s->nc.receive_disabled = 1;
     s->chr = chr;
-    s->vhostforce = vhostforce;
 
     qemu_chr_add_handlers(s->chr, NULL, NULL, net_vhost_user_event, s);
 
@@ -230,7 +226,6 @@ int net_init_vhost_user(const NetClientOptions *opts, const char *name,
 {
     const NetdevVhostUserOptions *vhost_user_opts;
     CharDriverState *chr;
-    bool vhostforce;
 
     assert(opts->kind == NET_CLIENT_OPTIONS_KIND_VHOST_USER);
     vhost_user_opts = opts->vhost_user;
@@ -247,12 +242,5 @@ int net_init_vhost_user(const NetClientOptions *opts, const char *name,
         return -1;
     }
 
-    /* vhostforce for non-MSIX */
-    if (vhost_user_opts->has_vhostforce) {
-        vhostforce = vhost_user_opts->vhostforce;
-    } else {
-        vhostforce = false;
-    }
-
-    return net_vhost_user_init(peer, "vhost_user", name, chr, vhostforce);
+    return net_vhost_user_init(peer, "vhost_user", name, chr);
 }
Signature · 1 line
1.8.3.1
#1 lore raw
Quoted 10 lines · Pankaj Gupta

vhostforce was added to enable use of vhost when guest don't have MSI-X support.
Now, we have scenarios which dont use interrupts like DPDK 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.

The patch doesn't seem to do what it says.
Did you try with a non MSIX guest and vhost=on, to check that it actually runs vhost and not userspace virtio?

Quoted 86 lines
---
 net/tap.c        |  4 +---
 net/vhost-user.c | 16 ++--------------
 2 files changed, 3 insertions(+), 17 deletions(-)
net/tap.c +1 -3
index 1fe0edf..bd2efa9 100644
@@ -634,13 +634,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_handle_fd_param(cur_mon, vhostfdname);
net/vhost-user.c +2 -14
index 24e050c..d2d7bf2 100644
@@ -18,7 +18,6 @@
 typedef struct VhostUserState {
     NetClientState nc;
     CharDriverState *chr;
-    bool vhostforce;
     VHostNetState *vhost_net;
 } VhostUserState;
 
@@ -51,7 +50,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);
 
@@ -133,8 +131,7 @@ static void net_vhost_user_event(void *opaque, int event)
 }
 
 static int net_vhost_user_init(NetClientState *peer, const char *device,
-                               const char *name, CharDriverState *chr,
-                               bool vhostforce)
+                               const char *name, CharDriverState *chr)
 {
     NetClientState *nc;
     VhostUserState *s;
@@ -149,7 +146,6 @@ static int net_vhost_user_init(NetClientState *peer, const char *device,
     /* We don't provide a receive callback */
     s->nc.receive_disabled = 1;
     s->chr = chr;
-    s->vhostforce = vhostforce;
 
     qemu_chr_add_handlers(s->chr, NULL, NULL, net_vhost_user_event, s);
 
@@ -230,7 +226,6 @@ int net_init_vhost_user(const NetClientOptions *opts, const char *name,
 {
     const NetdevVhostUserOptions *vhost_user_opts;
     CharDriverState *chr;
-    bool vhostforce;
 
     assert(opts->kind == NET_CLIENT_OPTIONS_KIND_VHOST_USER);
     vhost_user_opts = opts->vhost_user;
@@ -247,12 +242,5 @@ int net_init_vhost_user(const NetClientOptions *opts, const char *name,
         return -1;
     }
 
-    /* vhostforce for non-MSIX */
-    if (vhost_user_opts->has_vhostforce) {
-        vhostforce = vhost_user_opts->vhostforce;
-    } else {
-        vhostforce = false;
-    }
-
-    return net_vhost_user_init(peer, "vhost_user", name, chr, vhostforce);
+    return net_vhost_user_init(peer, "vhost_user", name, chr);
 }
Signature · 1 line
1.8.3.1
#2 lore raw
Quoted 8 lines · Pankaj Gupta
Quoted 6 lines

vhostforce was added to enable use of vhost when guest don't have MSI-X support.
Now, we have scenarios which dont use interrupts like DPDK and still use vhost. Also, performance of guests without MSI-X support is getting less popular.

Quoted 8 lines
Quoted 4 lines

Its ok to remove this extra option and enable vhost on the basis of vhost=ON/OFF.

The patch doesn't seem to do what it says.
Did you try with a non MSIX guest and vhost=on, to check that it actually runs vhost and not userspace virtio?

No, I have not. I just did basic tested a new guest without vhostforce. I will test non-MSIX guest and share the result.

Quoted 94 lines
Quoted 92 lines
---
 net/tap.c        |  4 +---
 net/vhost-user.c | 16 ++--------------
 2 files changed, 3 insertions(+), 17 deletions(-)
net/tap.c +1 -3
index 1fe0edf..bd2efa9 100644
@@ -634,13 +634,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_handle_fd_param(cur_mon, vhostfdname);
net/vhost-user.c +1 -4
index 24e050c..d2d7bf2 100644
@@ -18,7 +18,6 @@
 typedef struct VhostUserState {
     NetClientState nc;
     CharDriverState *chr;
-    bool vhostforce;
     VHostNetState *vhost_net;
 } VhostUserState;
 
@@ -51,7 +50,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);
 
@@ -133,8 +131,7 @@ static void net_vhost_user_event(void *opaque, int
 event)
 }
 
 static int net_vhost_user_init(NetClientState *peer, const char *device,
-                               const char *name, CharDriverState *chr,
-                               bool vhostforce)
+                               const char *name, CharDriverState *chr)
 {
     NetClientState *nc;
     VhostUserState *s;
net/vhost-user.c +0 -2
@@ -149,7 +146,6 @@ static int net_vhost_user_init(NetClientState *peer,
 const char *device,
     /* We don't provide a receive callback */
     s->nc.receive_disabled = 1;
     s->chr = chr;
-    s->vhostforce = vhostforce;
 
     qemu_chr_add_handlers(s->chr, NULL, NULL, net_vhost_user_event, s);
@@ -230,7 +226,6 @@ int net_init_vhost_user(const NetClientOptions *opts,
 const char *name,
 {
     const NetdevVhostUserOptions *vhost_user_opts;
     CharDriverState *chr;
-    bool vhostforce;
 
     assert(opts->kind == NET_CLIENT_OPTIONS_KIND_VHOST_USER);
     vhost_user_opts = opts->vhost_user;
net/vhost-user.c +1 -8
@@ -247,12 +242,5 @@ int net_init_vhost_user(const NetClientOptions *opts,
 const char *name,
         return -1;
     }
 
-    /* vhostforce for non-MSIX */
-    if (vhost_user_opts->has_vhostforce) {
-        vhostforce = vhost_user_opts->vhostforce;
-    } else {
-        vhostforce = false;
-    }
-
-    return net_vhost_user_init(peer, "vhost_user", name, chr, vhostforce);
+    return net_vhost_user_init(peer, "vhost_user", name, chr);

}
--
1.8.3.1

#3 lore raw
Quoted 12 lines
Quoted 12 lines · Pankaj Gupta
Quoted 9 lines

vhostforce was added to enable use of vhost when guest don't have MSI-X support.
Now, we have scenarios which dont use interrupts like DPDK 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.

Quoted 8 lines
Quoted 5 lines
Quoted 1 line

The patch doesn't seem to do what it says.
Did you try with a non MSIX guest and vhost=on, to check that it actually runs vhost and not userspace virtio?

No, I have not. I just did basic tested a new guest without vhostforce. I will test non-MSIX guest and share the result.

I tested this with RHEL 4 guest which don't have MSI-X. Though vhost gets created but still userspace virtio-net code executes.

So, vhostforce was added to disable vhost for non-MSI guest? I took the idea from KVM/Networking todo list.

Do we have some other dependency before we want to remove vhostforce?

Quoted 98 lines
Quoted 97 lines
Quoted 95 lines

---
 net/tap.c        |  4 +---
 net/vhost-user.c | 16 ++--------------
 2 files changed, 3 insertions(+), 17 deletions(-)
net/tap.c +1 -3
index 1fe0edf..bd2efa9 100644
@@ -634,13 +634,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_handle_fd_param(cur_mon, vhostfdname);
net/vhost-user.c +1 -4
index 24e050c..d2d7bf2 100644
@@ -18,7 +18,6 @@
 typedef struct VhostUserState {
     NetClientState nc;
     CharDriverState *chr;
-    bool vhostforce;
     VHostNetState *vhost_net;
 } VhostUserState;
 
@@ -51,7 +50,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);
 
@@ -133,8 +131,7 @@ static void net_vhost_user_event(void *opaque, int
 event)
 }
 
 static int net_vhost_user_init(NetClientState *peer, const char *device,
-                               const char *name, CharDriverState *chr,
-                               bool vhostforce)
+                               const char *name, CharDriverState *chr)
 {
     NetClientState *nc;
     VhostUserState *s;
net/vhost-user.c +0 -2
@@ -149,7 +146,6 @@ static int net_vhost_user_init(NetClientState *peer,
 const char *device,
     /* We don't provide a receive callback */
     s->nc.receive_disabled = 1;
     s->chr = chr;
-    s->vhostforce = vhostforce;
 
     qemu_chr_add_handlers(s->chr, NULL, NULL, net_vhost_user_event, s);
@@ -230,7 +226,6 @@ int net_init_vhost_user(const NetClientOptions *opts,
 const char *name,
 {
     const NetdevVhostUserOptions *vhost_user_opts;
     CharDriverState *chr;
-    bool vhostforce;
 
     assert(opts->kind == NET_CLIENT_OPTIONS_KIND_VHOST_USER);
     vhost_user_opts = opts->vhost_user;
net/vhost-user.c +0 -8
@@ -247,12 +242,5 @@ int net_init_vhost_user(const NetClientOptions
 *opts,
 const char *name,
         return -1;
     }
 
-    /* vhostforce for non-MSIX */
-    if (vhost_user_opts->has_vhostforce) {
-        vhostforce = vhost_user_opts->vhostforce;
-    } else {
-        vhostforce = false;
-    }
-
-    return net_vhost_user_init(peer, "vhost_user", name, chr,

vhostforce);
+ return net_vhost_user_init(peer, "vhost_user", name, chr);
}
--
1.8.3.1

#4 lore raw
Quoted 18 lines · Pankaj Gupta
Quoted 18 lines
Quoted 17 lines · Pankaj Gupta
Quoted 10 lines

vhostforce was added to enable use of vhost when guest don't have MSI-X support.
Now, we have scenarios which dont use interrupts like DPDK 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.

The patch doesn't seem to do what it says.
Did you try with a non MSIX guest and vhost=on, to check that it actually runs vhost and not userspace virtio?

Quoted 8 lines
Quoted 3 lines

No, I have not. I just did basic tested a new guest without
vhostforce.
I will test non-MSIX guest and share the result.

I tested this with RHEL 4 guest which don't have MSI-X. Though vhost gets created but still userspace virtio-net code executes.

So, vhostforce was added to disable vhost for non-MSI guest?

In fact to enable vhost.

Quoted 5 lines

I took the idea from KVM/Networking todo list.

Do we have some other dependency before we want to remove vhostforce?

You may want to take a look at the vhost_dev->force and vhost_dev_query().

Quoted 111 lines
Quoted 110 lines
Quoted 8 lines
Quoted 8 lines
 

---
 net/tap.c        |  4 +---
 net/vhost-user.c | 16 ++--------------
 2 files changed, 3 insertions(+), 17 deletions(-)
Quoted 5 lines

net/tap.c static int net_init_tap_one(const

Quoted 5 lines
net/tap.c +0 -0
index 1fe0edf..bd2efa9 100644
@@ -634,13 +634,11 @@ static int net_init_tap_one(const 

NetdevTapOptions

Quoted 6 lines

net/tap.c static int net_init_tap_one(const NetdevTapOptions *tap, NetClientState *peer,

Quoted 6 lines
net/tap.c +0 -2
 *tap, NetClientState *peer,
         }
     }
 
-    if (tap->has_vhost ? tap->vhost :
-        vhostfdname || (tap->has_vhostforce && 

tap->vhostforce)) {

Quoted 9 lines
Quoted 9 lines
net/tap.c +1 -1
+    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_handle_fd_param(cur_mon,

vhostfdname);

Quoted 18 lines
Quoted 18 lines
net/vhost-user.c +0 -2
index 24e050c..d2d7bf2 100644
@@ -18,7 +18,6 @@
 typedef struct VhostUserState {
     NetClientState nc;
     CharDriverState *chr;
-    bool vhostforce;
     VHostNetState *vhost_net;
 } VhostUserState;
 
@@ -51,7 +50,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;
 
Quoted 3 lines

net/vhost-user.c static void net_vhost_user_event(void

Quoted 3 lines
net/vhost-user.c +0 -0
     s->vhost_net = vhost_net_init(&options);
 
@@ -133,8 +131,7 @@ static void net_vhost_user_event(void 

*opaque, int

Quoted 4 lines

net/vhost-user.c static void net_vhost_user_event(void · line 134

Quoted 4 lines
net/vhost-user.c +0 -0
 event)
 }
 
 static int net_vhost_user_init(NetClientState *peer, const 

char *device,

Quoted 1 line

net/vhost-user.c static void net_vhost_user_event(void · line 137

Quoted 1 line
net/vhost-user.c +0 -1
-                               const char *name, 

CharDriverState *chr,

Quoted 2 lines

net/vhost-user.c static void net_vhost_user_event(void · line 135

Quoted 2 lines
net/vhost-user.c +1 -1
-                               bool vhostforce)
+                               const char *name, 

CharDriverState *chr)

Quoted 4 lines

net/vhost-user.c static int

Quoted 4 lines
net/vhost-user.c +0 -0
 {
     NetClientState *nc;
     VhostUserState *s;
net/vhost-user.c +0 -0
@@ -149,7 +146,6 @@ static int 

net_vhost_user_init(NetClientState *peer,

Quoted 7 lines

net/vhost-user.c static int net_vhost_user_init(NetClientState *peer, const char *device,

Quoted 7 lines
net/vhost-user.c +0 -1
 const char *device,
     /* We don't provide a receive callback */
     s->nc.receive_disabled = 1;
     s->chr = chr;
-    s->vhostforce = vhostforce;
 
     qemu_chr_add_handlers(s->chr, NULL, NULL, 

net_vhost_user_event, s);

Quoted 2 lines

net/vhost-user.c int net_init_vhost_user(const

Quoted 2 lines
net/vhost-user.c +0 -0
@@ -230,7 +226,6 @@ int net_init_vhost_user(const 

NetClientOptions *opts,

Quoted 9 lines

net/vhost-user.c int net_init_vhost_user(const

Quoted 9 lines
net/vhost-user.c +0 -1
 const char *name,
 {
     const NetdevVhostUserOptions *vhost_user_opts;
     CharDriverState *chr;
-    bool vhostforce;
 
     assert(opts->kind == NET_CLIENT_OPTIONS_KIND_VHOST_USER);
     vhost_user_opts = opts->vhost_user;
net/vhost-user.c +0 -0
@@ -247,12 +242,5 @@ int net_init_vhost_user(const 

NetClientOptions

Quoted 20 lines
Quoted 18 lines
net/vhost-user.c +0 -8
 *opts,
 const char *name,
         return -1;
     }
 
-    /* vhostforce for non-MSIX */
-    if (vhost_user_opts->has_vhostforce) {
-        vhostforce = vhost_user_opts->vhostforce;
-    } else {
-        vhostforce = false;
-    }
-
-    return net_vhost_user_init(peer, "vhost_user", name, chr,

vhostforce);
+ return net_vhost_user_init(peer, "vhost_user", name, chr);
}
--
1.8.3.1

#5 lore raw

Hi,

Could you please help/guide me here. As suggested by Jason I did other changes also. But when I did testing still virtio-net.c functions like 'receive()' gets called when vhost is 'ON'.

I want to know is there anything I am missing here or is this expected behaviour?

I was also searching for "kvm eventfd support for injecting level-triggered interrupts", For non-MSIX guests, can we remove vhost-force unless we have this feature?

Best regards,
Pankaj

----- Original Message -----

Quoted 160 lines

From: "Jason Wang" <[email protected]>
To: "Pankaj Gupta" <[email protected]>
Cc: "Michael S. Tsirkin" <[email protected]>, [email protected], [email protected], [email protected]
Sent: Sunday, February 15, 2015 8:11:29 AM
Subject: Re: [Qemu-devel] [RFC] net: 'Remove vhostforce option in addition to vhost param'

Quoted 22 lines · Pankaj Gupta
Quoted 14 lines
Quoted 14 lines · Pankaj Gupta
Quoted 10 lines

vhostforce was added to enable use of vhost when guest don't have MSI-X support.
Now, we have scenarios which dont use interrupts like DPDK 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.

Quoted 7 lines
Quoted 3 lines

The patch doesn't seem to do what it says.
Did you try with a non MSIX guest and vhost=on, to check that it actually runs vhost and not userspace virtio?

No, I have not. I just did basic tested a new guest without
vhostforce.
I will test non-MSIX guest and share the result.

Quoted 5 lines

I tested this with RHEL 4 guest which don't have MSI-X. Though vhost gets
created but still userspace virtio-net code executes.

So, vhostforce was added to disable vhost for non-MSI guest?

In fact to enable vhost.

Quoted 5 lines

I took the idea from KVM/Networking todo list.

Do we have some other dependency before we want to remove vhostforce?

You may want to take a look at the vhost_dev->force and vhost_dev_query().

Quoted 111 lines
Quoted 110 lines
Quoted 8 lines
Quoted 8 lines
 

---
 net/tap.c        |  4 +---
 net/vhost-user.c | 16 ++--------------
 2 files changed, 3 insertions(+), 17 deletions(-)
Quoted 5 lines

net/tap.c static int net_init_tap_one(const

Quoted 5 lines
net/tap.c +0 -0
index 1fe0edf..bd2efa9 100644
@@ -634,13 +634,11 @@ static int net_init_tap_one(const

NetdevTapOptions

Quoted 6 lines

net/tap.c static int net_init_tap_one(const NetdevTapOptions *tap, NetClientState *peer,

Quoted 6 lines
net/tap.c +0 -2
 *tap, NetClientState *peer,
         }
     }
 
-    if (tap->has_vhost ? tap->vhost :
-        vhostfdname || (tap->has_vhostforce &&

tap->vhostforce)) {

Quoted 9 lines
Quoted 9 lines
net/tap.c +1 -1
+    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_handle_fd_param(cur_mon,

vhostfdname);

Quoted 18 lines
Quoted 18 lines
net/vhost-user.c +0 -2
index 24e050c..d2d7bf2 100644
@@ -18,7 +18,6 @@
 typedef struct VhostUserState {
     NetClientState nc;
     CharDriverState *chr;
-    bool vhostforce;
     VHostNetState *vhost_net;
 } VhostUserState;
 
@@ -51,7 +50,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;
 
Quoted 3 lines

net/vhost-user.c static void net_vhost_user_event(void

Quoted 3 lines
net/vhost-user.c +0 -0
     s->vhost_net = vhost_net_init(&options);
 
@@ -133,8 +131,7 @@ static void net_vhost_user_event(void

*opaque, int

Quoted 4 lines

net/vhost-user.c static void net_vhost_user_event(void · line 134

Quoted 4 lines
net/vhost-user.c +0 -0
 event)
 }
 
 static int net_vhost_user_init(NetClientState *peer, const

char *device,

Quoted 1 line

net/vhost-user.c static void net_vhost_user_event(void · line 137

Quoted 1 line
net/vhost-user.c +0 -1
-                               const char *name,

CharDriverState *chr,

Quoted 2 lines

net/vhost-user.c static void net_vhost_user_event(void · line 135

Quoted 2 lines
net/vhost-user.c +1 -1
-                               bool vhostforce)
+                               const char *name,

CharDriverState *chr)

Quoted 4 lines

net/vhost-user.c static int

Quoted 4 lines
net/vhost-user.c +0 -0
 {
     NetClientState *nc;
     VhostUserState *s;
net/vhost-user.c +0 -0
@@ -149,7 +146,6 @@ static int

net_vhost_user_init(NetClientState *peer,

Quoted 7 lines

net/vhost-user.c static int net_vhost_user_init(NetClientState *peer, const char *device,

Quoted 7 lines
net/vhost-user.c +0 -1
 const char *device,
     /* We don't provide a receive callback */
     s->nc.receive_disabled = 1;
     s->chr = chr;
-    s->vhostforce = vhostforce;
 
     qemu_chr_add_handlers(s->chr, NULL, NULL,

net_vhost_user_event, s);

Quoted 2 lines

net/vhost-user.c int net_init_vhost_user(const

Quoted 2 lines
net/vhost-user.c +0 -0
@@ -230,7 +226,6 @@ int net_init_vhost_user(const

NetClientOptions *opts,

Quoted 9 lines

net/vhost-user.c int net_init_vhost_user(const

Quoted 9 lines
net/vhost-user.c +0 -1
 const char *name,
 {
     const NetdevVhostUserOptions *vhost_user_opts;
     CharDriverState *chr;
-    bool vhostforce;
 
     assert(opts->kind == NET_CLIENT_OPTIONS_KIND_VHOST_USER);
     vhost_user_opts = opts->vhost_user;
net/vhost-user.c +0 -0
@@ -247,12 +242,5 @@ int net_init_vhost_user(const

NetClientOptions

Quoted 20 lines
Quoted 18 lines
net/vhost-user.c +0 -8
 *opts,
 const char *name,
         return -1;
     }
 
-    /* vhostforce for non-MSIX */
-    if (vhost_user_opts->has_vhostforce) {
-        vhostforce = vhost_user_opts->vhostforce;
-    } else {
-        vhostforce = false;
-    }
-
-    return net_vhost_user_init(peer, "vhost_user", name, chr,

vhostforce);
+ return net_vhost_user_init(peer, "vhost_user", name, chr);
}
--
1.8.3.1

#6 lore raw
Quoted 6 lines · Pankaj Gupta

Hi,

Could you please help/guide me here. As suggested by Jason I did other changes also. But when I did testing still virtio-net.c functions like 'receive()' gets called when vhost is 'ON'.

I want to know is there anything I am missing here or is this expected behaviour?

It's a known bug.

Quoted 5 lines

I was also searching for "kvm eventfd support for injecting level-triggered interrupts", For non-MSIX guests, can we remove vhost-force unless we have this feature?

Best regards,
Pankaj

This feature is unused by vhost ATM.

Quoted 160 lines
Quoted 160 lines

From: "Jason Wang" <[email protected]>
To: "Pankaj Gupta" <[email protected]>
Cc: "Michael S. Tsirkin" <[email protected]>, [email protected], [email protected], [email protected]
Sent: Sunday, February 15, 2015 8:11:29 AM
Subject: Re: [Qemu-devel] [RFC] net: 'Remove vhostforce option in addition to vhost param'

Quoted 22 lines · Pankaj Gupta
Quoted 14 lines
Quoted 14 lines · Pankaj Gupta
Quoted 10 lines

vhostforce was added to enable use of vhost when guest don't have MSI-X support.
Now, we have scenarios which dont use interrupts like DPDK 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.

Quoted 7 lines
Quoted 3 lines

The patch doesn't seem to do what it says.
Did you try with a non MSIX guest and vhost=on, to check that it actually runs vhost and not userspace virtio?

No, I have not. I just did basic tested a new guest without
vhostforce.
I will test non-MSIX guest and share the result.

Quoted 5 lines

I tested this with RHEL 4 guest which don't have MSI-X. Though vhost gets
created but still userspace virtio-net code executes.

So, vhostforce was added to disable vhost for non-MSI guest?

In fact to enable vhost.

Quoted 5 lines

I took the idea from KVM/Networking todo list.

Do we have some other dependency before we want to remove vhostforce?

You may want to take a look at the vhost_dev->force and vhost_dev_query().

Quoted 111 lines
Quoted 110 lines
Quoted 8 lines
Quoted 8 lines
 

---
 net/tap.c        |  4 +---
 net/vhost-user.c | 16 ++--------------
 2 files changed, 3 insertions(+), 17 deletions(-)
Quoted 5 lines

net/tap.c static int net_init_tap_one(const

Quoted 5 lines
net/tap.c +0 -0
index 1fe0edf..bd2efa9 100644
@@ -634,13 +634,11 @@ static int net_init_tap_one(const

NetdevTapOptions

Quoted 6 lines

net/tap.c static int net_init_tap_one(const NetdevTapOptions *tap, NetClientState *peer,

Quoted 6 lines
net/tap.c +0 -2
 *tap, NetClientState *peer,
         }
     }
 
-    if (tap->has_vhost ? tap->vhost :
-        vhostfdname || (tap->has_vhostforce &&

tap->vhostforce)) {

Quoted 9 lines
Quoted 9 lines
net/tap.c +1 -1
+    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_handle_fd_param(cur_mon,

vhostfdname);

Quoted 18 lines
Quoted 18 lines
net/vhost-user.c +0 -2
index 24e050c..d2d7bf2 100644
@@ -18,7 +18,6 @@
 typedef struct VhostUserState {
     NetClientState nc;
     CharDriverState *chr;
-    bool vhostforce;
     VHostNetState *vhost_net;
 } VhostUserState;
 
@@ -51,7 +50,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;
 
Quoted 3 lines

net/vhost-user.c static void net_vhost_user_event(void

Quoted 3 lines
net/vhost-user.c +0 -0
     s->vhost_net = vhost_net_init(&options);
 
@@ -133,8 +131,7 @@ static void net_vhost_user_event(void

*opaque, int

Quoted 4 lines

net/vhost-user.c static void net_vhost_user_event(void · line 134

Quoted 4 lines
net/vhost-user.c +0 -0
 event)
 }
 
 static int net_vhost_user_init(NetClientState *peer, const

char *device,

Quoted 1 line

net/vhost-user.c static void net_vhost_user_event(void · line 137

Quoted 1 line
net/vhost-user.c +0 -1
-                               const char *name,

CharDriverState *chr,

Quoted 2 lines

net/vhost-user.c static void net_vhost_user_event(void · line 135

Quoted 2 lines
net/vhost-user.c +1 -1
-                               bool vhostforce)
+                               const char *name,

CharDriverState *chr)

Quoted 4 lines

net/vhost-user.c static int

Quoted 4 lines
net/vhost-user.c +0 -0
 {
     NetClientState *nc;
     VhostUserState *s;
net/vhost-user.c +0 -0
@@ -149,7 +146,6 @@ static int

net_vhost_user_init(NetClientState *peer,

Quoted 7 lines

net/vhost-user.c static int net_vhost_user_init(NetClientState *peer, const char *device,

Quoted 7 lines
net/vhost-user.c +0 -1
 const char *device,
     /* We don't provide a receive callback */
     s->nc.receive_disabled = 1;
     s->chr = chr;
-    s->vhostforce = vhostforce;
 
     qemu_chr_add_handlers(s->chr, NULL, NULL,

net_vhost_user_event, s);

Quoted 2 lines

net/vhost-user.c int net_init_vhost_user(const

Quoted 2 lines
net/vhost-user.c +0 -0
@@ -230,7 +226,6 @@ int net_init_vhost_user(const

NetClientOptions *opts,

Quoted 9 lines

net/vhost-user.c int net_init_vhost_user(const

Quoted 9 lines
net/vhost-user.c +0 -1
 const char *name,
 {
     const NetdevVhostUserOptions *vhost_user_opts;
     CharDriverState *chr;
-    bool vhostforce;
 
     assert(opts->kind == NET_CLIENT_OPTIONS_KIND_VHOST_USER);
     vhost_user_opts = opts->vhost_user;
net/vhost-user.c +0 -0
@@ -247,12 +242,5 @@ int net_init_vhost_user(const

NetClientOptions

Quoted 20 lines
Quoted 18 lines
net/vhost-user.c +0 -8
 *opts,
 const char *name,
         return -1;
     }
 
-    /* vhostforce for non-MSIX */
-    if (vhost_user_opts->has_vhostforce) {
-        vhostforce = vhost_user_opts->vhostforce;
-    } else {
-        vhostforce = false;
-    }
-
-    return net_vhost_user_init(peer, "vhost_user", name, chr,

vhostforce);
+ return net_vhost_user_init(peer, "vhost_user", name, chr);
}
--
1.8.3.1