Skip to contentSkip to conversation

vhost-vsock: report QMP event when set running

PATCH Superseded Ning Bo 4 participants 4 messages Aug 1, 2019

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore

Ning Bo

author
#0 lore raw

PATCH 1/1 vhost-vsock: report QMP event when set running

Report vsock running event so that the upper application can control boot sequence.
see https://github.com/kata-containers/runtime/pull/1918

---
 hw/virtio/vhost-vsock.c |  3 +++
 qapi/char.json          | 22 ++++++++++++++++++++++
 2 files changed, 25 insertions(+)
hw/virtio/vhost-vsock.c +3 -0
index 0371493..a5920fd 100644
@@ -22,6 +22,7 @@
 #include "qemu/iov.h"
 #include "qemu/module.h"
 #include "monitor/monitor.h"
+#include "qapi/qapi-events-char.h"
 
 enum {
     VHOST_VSOCK_SAVEVM_VERSION = 0,
@@ -68,6 +69,8 @@ static int vhost_vsock_set_running(VHostVSock *vsock, int start)
     if (ret < 0) {
         return -errno;
     }
+    qapi_event_send_vsock_running(vsock->conf.guest_cid, start != 0);
+
     return 0;
 }
 
qapi/char.json +22 -0
index a6e81ac..7b746e3 100644
@@ -570,3 +570,25 @@
 { 'event': 'VSERPORT_CHANGE',
   'data': { 'id': 'str',
             'open': 'bool' } }
+
+##
+# @VSOCK_RUNNING:
+#
+# Emitted when the guest changes the vsock status.
+#
+# @cid: guest context ID
+#
+# @running: true if the vsock is running
+#
+# Since: v4.2
+#
+# Example:
+#
+# <- { "event": "VSOCK_RUNNING",
+#      "data": { "cid": "123456", "running": true },
+#      "timestamp": { "seconds": 1401385907, "microseconds": 422329 } }
+#
+##
+{ 'event': 'VSOCK_RUNNING',
+  'data': { 'cid': 'uint64',
+            'running': 'bool' } }
Signature · 1 line
2.9.5
#1 lore raw
Quoted 6 lines · Ning Bo

Report vsock running event so that the upper application can control boot sequence.
see https://github.com/kata-containers/runtime/pull/1918

---

Since this is an update to an earlier version you posted, it is helpful to include 'v2' in the subject line ('git format-patch -v2' or 'git send-email -v2' can do that on your behalf), as well as to document here after the --- separator how it differs from v1.

More patch submission hints at https://wiki.qemu.org/Contribute/SubmitAPatch

Quoted 6 lines

+++ b/qapi/char.json

qapi/char.json +1 -0
@@ -570,3 +570,25 @@
 { 'event': 'VSERPORT_CHANGE',
   'data': { 'id': 'str',
             'open': 'bool' } }
+

qapi/char.json line 583

Quoted 10 lines
qapi/char.json +10 -0
+##
+# @VSOCK_RUNNING:
+#
+# Emitted when the guest changes the vsock status.
+#
+# @cid: guest context ID
+#
+# @running: true if the vsock is running
+#
+# Since: v4.2

Still not consistent with other uses. s/v4.2/4.2/

Signature · 3 lines
Eric Blake, Principal Software Engineer
Red Hat, Inc.           +1-919-301-3226
Virtualization:  qemu.org | libvirt.org
#2 lore raw
In reply to Ning Bo
Quoted 3 lines · Ning Bo

Report vsock running event so that the upper application can control boot sequence.
see https://github.com/kata-containers/runtime/pull/1918

Please provide a more complete summary of the use case in the commit message. What exactly is the problem? What is the proposed solution, and how does it make use of the new event?

Quoted 47 lines
---
 hw/virtio/vhost-vsock.c |  3 +++
 qapi/char.json          | 22 ++++++++++++++++++++++
 2 files changed, 25 insertions(+)
hw/virtio/vhost-vsock.c +3 -0
index 0371493..a5920fd 100644
@@ -22,6 +22,7 @@
 #include "qemu/iov.h"
 #include "qemu/module.h"
 #include "monitor/monitor.h"
+#include "qapi/qapi-events-char.h"
 
 enum {
     VHOST_VSOCK_SAVEVM_VERSION = 0,
@@ -68,6 +69,8 @@ static int vhost_vsock_set_running(VHostVSock *vsock, int start)
     if (ret < 0) {
         return -errno;
     }
+    qapi_event_send_vsock_running(vsock->conf.guest_cid, start != 0);
+
     return 0;
 }
 
qapi/char.json +12 -0
index a6e81ac..7b746e3 100644
@@ -570,3 +570,25 @@
 { 'event': 'VSERPORT_CHANGE',
   'data': { 'id': 'str',
             'open': 'bool' } }
+
+##
+# @VSOCK_RUNNING:
+#
+# Emitted when the guest changes the vsock status.
+#
+# @cid: guest context ID
+#
+# @running: true if the vsock is running
+#
+# Since: v4.2
+#

qapi/char.json line 594

Quoted 10 lines
qapi/char.json +10 -0
+# Example:
+#
+# <- { "event": "VSOCK_RUNNING",
+#      "data": { "cid": "123456", "running": true },
+#      "timestamp": { "seconds": 1401385907, "microseconds": 422329 } }
+#
+##
+{ 'event': 'VSOCK_RUNNING',
+  'data': { 'cid': 'uint64',
+            'running': 'bool' } }

Can you explain why you put this into char.json?

The event traces successful calls of vhost_vsock_set_running(). I have no idea what vhost_vsock_set_running() does (pardon my ignorance). Can you point me to a specification?

Its @start parameter is int. The event's @running is bool. Zero gets mapped to false, non-zero to true. Are you sure all non-zero values are equivalent, and will remain equivalent?

#3 lore raw
Quoted 11 lines · Markus Armbruster
Quoted 3 lines · Ning Bo

Report vsock running event so that the upper application can control boot sequence.
see https://github.com/kata-containers/runtime/pull/1918

Please provide a more complete summary of the use case in the commit message. What exactly is the problem? What is the proposed solution, and how does it make use of the new event?

Quoted 1 line

Also it would seem that it should be possible to detect port listen state change just by trying to connect to it. Why isn't that an option?

Quoted 59 lines
Quoted 46 lines
---
 hw/virtio/vhost-vsock.c |  3 +++
 qapi/char.json          | 22 ++++++++++++++++++++++
 2 files changed, 25 insertions(+)
hw/virtio/vhost-vsock.c +3 -0
index 0371493..a5920fd 100644
@@ -22,6 +22,7 @@
 #include "qemu/iov.h"
 #include "qemu/module.h"
 #include "monitor/monitor.h"
+#include "qapi/qapi-events-char.h"
 
 enum {
     VHOST_VSOCK_SAVEVM_VERSION = 0,
@@ -68,6 +69,8 @@ static int vhost_vsock_set_running(VHostVSock *vsock, int start)
     if (ret < 0) {
         return -errno;
     }
+    qapi_event_send_vsock_running(vsock->conf.guest_cid, start != 0);
+
     return 0;
 }
 
qapi/char.json +12 -0
index a6e81ac..7b746e3 100644
@@ -570,3 +570,25 @@
 { 'event': 'VSERPORT_CHANGE',
   'data': { 'id': 'str',
             'open': 'bool' } }
+
+##
+# @VSOCK_RUNNING:
+#
+# Emitted when the guest changes the vsock status.
+#
+# @cid: guest context ID
+#
+# @running: true if the vsock is running
+#
+# Since: v4.2
+#

qapi/char.json line 594

Quoted 10 lines
qapi/char.json +10 -0
+# Example:
+#
+# <- { "event": "VSOCK_RUNNING",
+#      "data": { "cid": "123456", "running": true },
+#      "timestamp": { "seconds": 1401385907, "microseconds": 422329 } }
+#
+##
+{ 'event': 'VSOCK_RUNNING',
+  'data': { 'cid': 'uint64',
+            'running': 'bool' } }

Can you explain why you put this into char.json?

Quoted 7 lines

The event traces successful calls of vhost_vsock_set_running(). I have no idea what vhost_vsock_set_running() does (pardon my ignorance). Can you point me to a specification?

Its @start parameter is int. The event's @running is bool. Zero gets mapped to false, non-zero to true. Are you sure all non-zero values are equivalent, and will remain equivalent?

Allowing guest to emit events at a high speed