* [Qemu-devel] [PATCH] vhost-user: Send VHOST_RESET_OWNER on vhost stop
@ 2015-04-26 13:00 Luke Gorrie
2015-04-26 13:00 ` Luke Gorrie
0 siblings, 1 reply; 2+ messages in thread
From: Luke Gorrie @ 2015-04-26 13:00 UTC (permalink / raw)
To: qemu-devel; +Cc: Luke Gorrie, n.nikolaev, mst
Hilarity can ensue if vhost is left enabled while a guest reboots.
Luke Gorrie (1):
vhost-user: Send VHOST_RESET_OWNER on vhost stop
hw/net/vhost_net.c | 7 +++++++
1 file changed, 7 insertions(+)
--
2.1.4
^ permalink raw reply [flat|nested] 2+ messages in thread
* [Qemu-devel] [PATCH] vhost-user: Send VHOST_RESET_OWNER on vhost stop
2015-04-26 13:00 [Qemu-devel] [PATCH] vhost-user: Send VHOST_RESET_OWNER on vhost stop Luke Gorrie
@ 2015-04-26 13:00 ` Luke Gorrie
0 siblings, 0 replies; 2+ messages in thread
From: Luke Gorrie @ 2015-04-26 13:00 UTC (permalink / raw)
To: qemu-devel; +Cc: Luke Gorrie, n.nikolaev, mst
Ensure that the vhost-user slave knows when the vrings are valid and
when they are invalid, for example during a guest reboot.
The vhost-user protocol says this of VHOST_RESET_OWNER:
Issued when a new connection is about to be closed. The Master
will no longer own this connection (and will usually close it).
Send this message to tell the vhost-user slave that the vhost session
has ended and that session state (e.g. vrings) is no longer valid.
Signed-off-by: Luke Gorrie <luke@snabb.co>
---
hw/net/vhost_net.c | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/hw/net/vhost_net.c b/hw/net/vhost_net.c
index cf23335..47f8b89 100644
--- a/hw/net/vhost_net.c
+++ b/hw/net/vhost_net.c
@@ -263,6 +263,13 @@ 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);
--
2.1.4
^ permalink raw reply related [flat|nested] 2+ messages in thread
end of thread, other threads:[~2015-04-26 13:01 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-04-26 13:00 [Qemu-devel] [PATCH] vhost-user: Send VHOST_RESET_OWNER on vhost stop Luke Gorrie
2015-04-26 13:00 ` Luke Gorrie
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).