[Qemu-devel] [PATCH] vhost-vsock: report QMP event when set running

N. B. posted 1 patch 4 years, 8 months ago
Test asan passed
Test docker-mingw@fedora passed
Test FreeBSD passed
Test docker-clang@ubuntu passed
Test checkpatch passed
Test s390x passed
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/qemu tags/patchew/HK2PR04MB38595779EA521C94675599F981DC0@HK2PR04MB3859.apcprd04.prod.outlook.com
Maintainers: "Marc-André Lureau" <marcandre.lureau@redhat.com>, Eric Blake <eblake@redhat.com>, Paolo Bonzini <pbonzini@redhat.com>, "Michael S. Tsirkin" <mst@redhat.com>, Markus Armbruster <armbru@redhat.com>
There is a newer version of this series
hw/virtio/vhost-vsock.c |  3 +++
qapi/char.json          | 22 ++++++++++++++++++++++
2 files changed, 25 insertions(+)
[Qemu-devel] [PATCH] vhost-vsock: report QMP event when set running
Posted by N. B. 4 years, 8 months ago
From: Ning Bo <n.b@live.com>

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

Signed-off-by: Ning Bo <ning.bo9@zte.com.cn>
---
 hw/virtio/vhost-vsock.c |  3 +++
 qapi/char.json          | 22 ++++++++++++++++++++++
 2 files changed, 25 insertions(+)

diff --git a/hw/virtio/vhost-vsock.c b/hw/virtio/vhost-vsock.c
index 0371493..a5920fd 100644
--- a/hw/virtio/vhost-vsock.c
+++ b/hw/virtio/vhost-vsock.c
@@ -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;
 }
 
diff --git a/qapi/char.json b/qapi/char.json
index a6e81ac..0958dd1 100644
--- a/qapi/char.json
+++ b/qapi/char.json
@@ -570,3 +570,25 @@
 { 'event': 'VSERPORT_CHANGE',
   'data': { 'id': 'str',
             'open': 'bool' } }
+
+##
+# @VSOCK_RUNNING:
+#
+# Emitted when the guest be set running.
+#
+# @cid: guest context ID
+#
+# @running: true if the vsock be set running
+#
+# Since: v4.1.0
+#
+# Example:
+#
+# <- { "event": "VSOCK_RUNNING",
+#      "data": { "cid": "123456", "running": true },
+#      "timestamp": { "seconds": 1401385907, "microseconds": 422329 } }
+#
+##
+{ 'event': 'VSOCK_RUNNING',
+  'data': { 'cid': 'uint64',
+            'running': 'bool' } }
-- 
2.9.5


Re: [Qemu-devel] [PATCH] vhost-vsock: report QMP event when set running
Posted by Michael S. Tsirkin 4 years, 8 months ago
On Tue, Jul 30, 2019 at 12:24:27PM +0000, N. B. wrote:
> From: Ning Bo <n.b@live.com>
> 
> Report vsock running event so that the upper application can
> control boot sequence.
> see https://github.com/kata-containers/runtime/pull/1918
> 
> Signed-off-by: Ning Bo <ning.bo9@zte.com.cn>

Cc Stefan.

Stefan, are you willing to maintain virtio/vhost-vsock in qemu, too?

If yes let's add an entry to MAINTAINERS, ok?

> ---
>  hw/virtio/vhost-vsock.c |  3 +++
>  qapi/char.json          | 22 ++++++++++++++++++++++
>  2 files changed, 25 insertions(+)
> 
> diff --git a/hw/virtio/vhost-vsock.c b/hw/virtio/vhost-vsock.c
> index 0371493..a5920fd 100644
> --- a/hw/virtio/vhost-vsock.c
> +++ b/hw/virtio/vhost-vsock.c
> @@ -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;
>  }
>  
> diff --git a/qapi/char.json b/qapi/char.json
> index a6e81ac..0958dd1 100644
> --- a/qapi/char.json
> +++ b/qapi/char.json
> @@ -570,3 +570,25 @@
>  { 'event': 'VSERPORT_CHANGE',
>    'data': { 'id': 'str',
>              'open': 'bool' } }
> +
> +##
> +# @VSOCK_RUNNING:
> +#
> +# Emitted when the guest be set running.
> +#
> +# @cid: guest context ID
> +#
> +# @running: true if the vsock be set running
> +#
> +# Since: v4.1.0
> +#
> +# Example:
> +#
> +# <- { "event": "VSOCK_RUNNING",
> +#      "data": { "cid": "123456", "running": true },
> +#      "timestamp": { "seconds": 1401385907, "microseconds": 422329 } }
> +#
> +##
> +{ 'event': 'VSOCK_RUNNING',
> +  'data': { 'cid': 'uint64',
> +            'running': 'bool' } }
> -- 
> 2.9.5

Re: [Qemu-devel] [PATCH] vhost-vsock: report QMP event when set running
Posted by Stefan Hajnoczi 4 years, 7 months ago
On Tue, Jul 30, 2019 at 04:29:35PM -0400, Michael S. Tsirkin wrote:
> On Tue, Jul 30, 2019 at 12:24:27PM +0000, N. B. wrote:
> > From: Ning Bo <n.b@live.com>
> > 
> > Report vsock running event so that the upper application can
> > control boot sequence.
> > see https://github.com/kata-containers/runtime/pull/1918
> > 
> > Signed-off-by: Ning Bo <ning.bo9@zte.com.cn>
> 
> Cc Stefan.
> 
> Stefan, are you willing to maintain virtio/vhost-vsock in qemu, too?
> 
> If yes let's add an entry to MAINTAINERS, ok?

Yes, I'll send a patch.

Stefan
Re: [Qemu-devel] [PATCH] vhost-vsock: report QMP event when set running
Posted by Eric Blake 4 years, 8 months ago
On 7/30/19 7:24 AM, N. B. wrote:
> From: Ning Bo <n.b@live.com>
> 
> Report vsock running event so that the upper application can
> control boot sequence.
> see https://github.com/kata-containers/runtime/pull/1918
> 
> Signed-off-by: Ning Bo <ning.bo9@zte.com.cn>

Your From: and S-o-b: differ from one another, which can make crawling
through git history in search of contributor statistics a bit harder.
Can you fix your git settings to use the same address in both places,
and/or contribute a patch to .mailmap to consolidate your contributions
under a single preferred address?

> ---
>  hw/virtio/vhost-vsock.c |  3 +++
>  qapi/char.json          | 22 ++++++++++++++++++++++
>  2 files changed, 25 insertions(+)
> 

> +++ b/qapi/char.json
> @@ -570,3 +570,25 @@
>  { 'event': 'VSERPORT_CHANGE',
>    'data': { 'id': 'str',
>              'open': 'bool' } }
> +
> +##
> +# @VSOCK_RUNNING:
> +#
> +# Emitted when the guest be set running.

s/be set running/changes the vsock status/

> +#
> +# @cid: guest context ID
> +#
> +# @running: true if the vsock be set running

s/be set/is/

> +#
> +# Since: v4.1.0

Not our typical spelling, and as a new feature it is too late for 4.1.
This should read:

# Since: 4.2

-- 
Eric Blake, Principal Software Engineer
Red Hat, Inc.           +1-919-301-3226
Virtualization:  qemu.org | libvirt.org