diff mbox

[v2,4/5] Revert "vhost-user: Send VHOST_RESET_OWNER on vhost stop"

Message ID 1445418438-24244-4-git-send-email-yuanhan.liu@linux.intel.com
State New
Headers show

Commit Message

Yuanhan Liu Oct. 21, 2015, 9:07 a.m. UTC
Don't send VHOST_RESET_OWNER, for as Michael stated:

    Because we need to get the state from remote after stop.
    RESET_OWNER discards that, so we can't resume the VM.

This reverts commit 294ce717e0f212ed0763307f3eab72b4a1bdf4d0.

Cc: Luke Gorrie <luke@snabb.co>
Cc: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Yuanhan Liu <yuanhan.liu@linux.intel.com>
---
 hw/net/vhost_net.c | 7 -------
 1 file changed, 7 deletions(-)

Comments

Michael S. Tsirkin Oct. 21, 2015, 10:35 a.m. UTC | #1
On Wed, Oct 21, 2015 at 05:07:17PM +0800, Yuanhan Liu wrote:
> Don't send VHOST_RESET_OWNER, for as Michael stated:
> 
>     Because we need to get the state from remote after stop.
>     RESET_OWNER discards that, so we can't resume the VM.
> 
> This reverts commit 294ce717e0f212ed0763307f3eab72b4a1bdf4d0.
> 
> Cc: Luke Gorrie <luke@snabb.co>
> Cc: Michael S. Tsirkin <mst@redhat.com>
> Signed-off-by: Yuanhan Liu <yuanhan.liu@linux.intel.com>

OK but we still need to call it on device reset.
Otherwise device will corrupt memory.

> ---
>  hw/net/vhost_net.c | 7 -------
>  1 file changed, 7 deletions(-)
> 
> diff --git a/hw/net/vhost_net.c b/hw/net/vhost_net.c
> index 804f5c9..95da5f8 100644
> --- a/hw/net/vhost_net.c
> +++ b/hw/net/vhost_net.c
> @@ -293,13 +293,6 @@ static void vhost_net_stop_one(struct vhost_net *net,
>                                            &file);
>              assert(r >= 0);
>          }
> -    } else if (net->nc->info->type == NET_CLIENT_OPTIONS_KIND_VHOST_USER) {
> -        for (file.index = 0; file.index < net->dev.nvqs; ++file.index) {
> -            const VhostOps *vhost_ops = net->dev.vhost_ops;
> -            int r = vhost_ops->vhost_call(&net->dev, VHOST_RESET_OWNER,
> -                                          NULL);
> -            assert(r >= 0);
> -        }
>      }
>      if (net->nc->info->poll) {
>          net->nc->info->poll(net->nc, true);
> -- 
> 1.9.0
Michael S. Tsirkin Oct. 21, 2015, 10:39 a.m. UTC | #2
On Wed, Oct 21, 2015 at 05:07:17PM +0800, Yuanhan Liu wrote:
> Don't send VHOST_RESET_OWNER, for as Michael stated:
> 
>     Because we need to get the state from remote after stop.
>     RESET_OWNER discards that, so we can't resume the VM.
> 
> This reverts commit 294ce717e0f212ed0763307f3eab72b4a1bdf4d0.
> 
> Cc: Luke Gorrie <luke@snabb.co>
> Cc: Michael S. Tsirkin <mst@redhat.com>
> Signed-off-by: Yuanhan Liu <yuanhan.liu@linux.intel.com>

Yes but poking at guest memory after driver is unloaded
is even worse.

> ---
>  hw/net/vhost_net.c | 7 -------
>  1 file changed, 7 deletions(-)
> 
> diff --git a/hw/net/vhost_net.c b/hw/net/vhost_net.c
> index 804f5c9..95da5f8 100644
> --- a/hw/net/vhost_net.c
> +++ b/hw/net/vhost_net.c
> @@ -293,13 +293,6 @@ static void vhost_net_stop_one(struct vhost_net *net,
>                                            &file);
>              assert(r >= 0);
>          }
> -    } else if (net->nc->info->type == NET_CLIENT_OPTIONS_KIND_VHOST_USER) {
> -        for (file.index = 0; file.index < net->dev.nvqs; ++file.index) {
> -            const VhostOps *vhost_ops = net->dev.vhost_ops;
> -            int r = vhost_ops->vhost_call(&net->dev, VHOST_RESET_OWNER,
> -                                          NULL);
> -            assert(r >= 0);
> -        }
>      }
>      if (net->nc->info->poll) {
>          net->nc->info->poll(net->nc, true);
> -- 
> 1.9.0
>
diff mbox

Patch

diff --git a/hw/net/vhost_net.c b/hw/net/vhost_net.c
index 804f5c9..95da5f8 100644
--- a/hw/net/vhost_net.c
+++ b/hw/net/vhost_net.c
@@ -293,13 +293,6 @@  static void vhost_net_stop_one(struct vhost_net *net,
                                           &file);
             assert(r >= 0);
         }
-    } else if (net->nc->info->type == NET_CLIENT_OPTIONS_KIND_VHOST_USER) {
-        for (file.index = 0; file.index < net->dev.nvqs; ++file.index) {
-            const VhostOps *vhost_ops = net->dev.vhost_ops;
-            int r = vhost_ops->vhost_call(&net->dev, VHOST_RESET_OWNER,
-                                          NULL);
-            assert(r >= 0);
-        }
     }
     if (net->nc->info->poll) {
         net->nc->info->poll(net->nc, true);