qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH 0/4] virtiofsd: implement vhost-user.rst "Backend program conventions"
@ 2019-08-27  9:54 Stefan Hajnoczi
  2019-08-27  9:54 ` [Qemu-devel] [PATCH 1/4] virtiofsd: make -f (foreground) the default Stefan Hajnoczi
                   ` (4 more replies)
  0 siblings, 5 replies; 13+ messages in thread
From: Stefan Hajnoczi @ 2019-08-27  9:54 UTC (permalink / raw)
  To: virtio-fs, qemu-devel
  Cc: Marc-André Lureau, Dr. David Alan Gilbert, Stefan Hajnoczi,
	Michael S. Tsirkin

This series implements the conventions for vhost-user backend programs
described in vhost-user.rst:
1. Run in the foreground by default.
2. Show vhost-user.json capabilities when --print-capabilities is given.
3. Ship a vhost-user.json file so the program can be discovered.

No command-line options or VHostUserBackendCapabilities are defined for the
'fs' backend type yet.  Let's until it becomes clear what should be standard
for all 'fs' backends and what is specific to virtiofsd.

Stefan Hajnoczi (4):
  virtiofsd: make -f (foreground) the default
  virtiofsd: add --print-capabilities option
  virtiofsd: install virtiofsd in libexec
  virtiofsd: add vhost-user.json file

 docs/interop/vhost-user.json                |  4 +++-
 Makefile                                    |  3 +++
 contrib/virtiofsd/fuse_lowlevel.h           |  1 +
 contrib/virtiofsd/helper.c                  |  5 +++++
 contrib/virtiofsd/passthrough_ll.c          | 12 ++++++++++++
 .gitignore                                  |  1 +
 contrib/virtiofsd/50-qemu-virtiofsd.json.in |  5 +++++
 7 files changed, 30 insertions(+), 1 deletion(-)
 create mode 100644 contrib/virtiofsd/50-qemu-virtiofsd.json.in

-- 
2.21.0



^ permalink raw reply	[flat|nested] 13+ messages in thread

* [Qemu-devel] [PATCH 1/4] virtiofsd: make -f (foreground) the default
  2019-08-27  9:54 [Qemu-devel] [PATCH 0/4] virtiofsd: implement vhost-user.rst "Backend program conventions" Stefan Hajnoczi
@ 2019-08-27  9:54 ` Stefan Hajnoczi
  2019-09-03 17:17   ` Dr. David Alan Gilbert
  2019-08-27  9:54 ` [Qemu-devel] [PATCH 2/4] virtiofsd: add --print-capabilities option Stefan Hajnoczi
                   ` (3 subsequent siblings)
  4 siblings, 1 reply; 13+ messages in thread
From: Stefan Hajnoczi @ 2019-08-27  9:54 UTC (permalink / raw)
  To: virtio-fs, qemu-devel
  Cc: Marc-André Lureau, Dr. David Alan Gilbert, Stefan Hajnoczi,
	Michael S. Tsirkin

According to vhost-user.rst "Backend program conventions", backend
programs should run in the foregound by default.  Follow the
conventions so libvirt and other management tools can control virtiofsd
in a standard way.

Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
---
 contrib/virtiofsd/helper.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/contrib/virtiofsd/helper.c b/contrib/virtiofsd/helper.c
index 4c71452080..8d8bca889b 100644
--- a/contrib/virtiofsd/helper.c
+++ b/contrib/virtiofsd/helper.c
@@ -42,6 +42,7 @@ static const struct fuse_opt fuse_helper_opts[] = {
 	FUSE_OPT_KEY("-d",		FUSE_OPT_KEY_KEEP),
 	FUSE_OPT_KEY("debug",		FUSE_OPT_KEY_KEEP),
 	FUSE_HELPER_OPT("-f",		foreground),
+	FUSE_HELPER_OPT_VALUE("--daemonize", foreground, 0),
 	FUSE_HELPER_OPT("-s",		singlethread),
 	FUSE_HELPER_OPT("fsname=",	nodefault_subtype),
 	FUSE_OPT_KEY("fsname=",		FUSE_OPT_KEY_KEEP),
@@ -139,6 +140,7 @@ void fuse_cmdline_help(void)
 	       "    -d   -o debug              enable debug output (implies -f)\n"
 	       "    --syslog                   log to syslog (default stderr)\n"
 	       "    -f                         foreground operation\n"
+	       "    --daemonize                run in background\n"
 	       "    -s                         disable multi-threaded operation\n"
 	       "    -o clone_fd                use separate fuse device fd for each thread\n"
 	       "                               (may improve performance)\n"
@@ -171,6 +173,7 @@ int fuse_parse_cmdline(struct fuse_args *args,
 	memset(opts, 0, sizeof(struct fuse_cmdline_opts));
 
 	opts->max_idle_threads = 10;
+	opts->foreground = 1;
 
 	if (fuse_opt_parse(args, opts, fuse_helper_opts,
 			   fuse_helper_opt_proc) == -1)
-- 
2.21.0



^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [Qemu-devel] [PATCH 2/4] virtiofsd: add --print-capabilities option
  2019-08-27  9:54 [Qemu-devel] [PATCH 0/4] virtiofsd: implement vhost-user.rst "Backend program conventions" Stefan Hajnoczi
  2019-08-27  9:54 ` [Qemu-devel] [PATCH 1/4] virtiofsd: make -f (foreground) the default Stefan Hajnoczi
@ 2019-08-27  9:54 ` Stefan Hajnoczi
  2019-09-03 17:26   ` Dr. David Alan Gilbert
  2019-09-12 12:40   ` Marc-André Lureau
  2019-08-27  9:54 ` [Qemu-devel] [PATCH 3/4] virtiofsd: install virtiofsd in libexec Stefan Hajnoczi
                   ` (2 subsequent siblings)
  4 siblings, 2 replies; 13+ messages in thread
From: Stefan Hajnoczi @ 2019-08-27  9:54 UTC (permalink / raw)
  To: virtio-fs, qemu-devel
  Cc: Marc-André Lureau, Dr. David Alan Gilbert, Stefan Hajnoczi,
	Michael S. Tsirkin

Add the --print-capabilities option as per vhost-user.rst "Backend
programs conventions".  Currently there are no advertised features.

Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
---
 docs/interop/vhost-user.json       |  4 +++-
 contrib/virtiofsd/fuse_lowlevel.h  |  1 +
 contrib/virtiofsd/helper.c         |  2 ++
 contrib/virtiofsd/passthrough_ll.c | 12 ++++++++++++
 4 files changed, 18 insertions(+), 1 deletion(-)

diff --git a/docs/interop/vhost-user.json b/docs/interop/vhost-user.json
index da6aaf51c8..d4ea1f7ac5 100644
--- a/docs/interop/vhost-user.json
+++ b/docs/interop/vhost-user.json
@@ -31,6 +31,7 @@
 # @rproc-serial: virtio remoteproc serial link
 # @scsi: virtio scsi
 # @vsock: virtio vsock transport
+# @fs: virtio fs (since 4.2)
 #
 # Since: 4.0
 ##
@@ -50,7 +51,8 @@
       'rpmsg',
       'rproc-serial',
       'scsi',
-      'vsock'
+      'vsock',
+      'fs'
   ]
 }
 
diff --git a/contrib/virtiofsd/fuse_lowlevel.h b/contrib/virtiofsd/fuse_lowlevel.h
index b441d3dfed..e3d8747571 100644
--- a/contrib/virtiofsd/fuse_lowlevel.h
+++ b/contrib/virtiofsd/fuse_lowlevel.h
@@ -1796,6 +1796,7 @@ struct fuse_cmdline_opts {
 	int nodefault_subtype;
 	int show_version;
 	int show_help;
+	int print_capabilities;
 	int clone_fd;
 	int syslog;
 	int log_level;
diff --git a/contrib/virtiofsd/helper.c b/contrib/virtiofsd/helper.c
index 8d8bca889b..84bf1c834d 100644
--- a/contrib/virtiofsd/helper.c
+++ b/contrib/virtiofsd/helper.c
@@ -35,6 +35,7 @@ static const struct fuse_opt fuse_helper_opts[] = {
 	FUSE_HELPER_OPT("--help",	show_help),
 	FUSE_HELPER_OPT("-V",		show_version),
 	FUSE_HELPER_OPT("--version",	show_version),
+	FUSE_HELPER_OPT("--print-capabilities", print_capabilities),
 	FUSE_HELPER_OPT("-d",		debug),
 	FUSE_HELPER_OPT("debug",	debug),
 	FUSE_HELPER_OPT("-d",		foreground),
@@ -137,6 +138,7 @@ void fuse_cmdline_help(void)
 {
 	printf("    -h   --help                print help\n"
 	       "    -V   --version             print version\n"
+	       "    --print-capabilities       print vhost-user.json\n"
 	       "    -d   -o debug              enable debug output (implies -f)\n"
 	       "    --syslog                   log to syslog (default stderr)\n"
 	       "    -f                         foreground operation\n"
diff --git a/contrib/virtiofsd/passthrough_ll.c b/contrib/virtiofsd/passthrough_ll.c
index 0ef01b7e3f..e2e20f22cd 100644
--- a/contrib/virtiofsd/passthrough_ll.c
+++ b/contrib/virtiofsd/passthrough_ll.c
@@ -2879,6 +2879,14 @@ static void fuse_lo_data_cleanup(struct lo_data *lo)
         free((char *)lo->source);
 }
 
+/* Print vhost-user.json backend program capabilities */
+static void print_capabilities(void)
+{
+	printf("{\n");
+	printf("  \"type\": \"fs\"\n");
+	printf("}\n");
+}
+
 int main(int argc, char *argv[])
 {
 	struct fuse_args args = FUSE_ARGS_INIT(argc, argv);
@@ -2931,6 +2939,10 @@ int main(int argc, char *argv[])
 		fuse_lowlevel_version();
 		ret = 0;
 		goto err_out1;
+	} else if (opts.print_capabilities) {
+		print_capabilities();
+		ret = 0;
+		goto err_out1;
 	}
 
 	if (fuse_opt_parse(&args, &lo, lo_opts, NULL)== -1)
-- 
2.21.0



^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [Qemu-devel] [PATCH 3/4] virtiofsd: install virtiofsd in libexec
  2019-08-27  9:54 [Qemu-devel] [PATCH 0/4] virtiofsd: implement vhost-user.rst "Backend program conventions" Stefan Hajnoczi
  2019-08-27  9:54 ` [Qemu-devel] [PATCH 1/4] virtiofsd: make -f (foreground) the default Stefan Hajnoczi
  2019-08-27  9:54 ` [Qemu-devel] [PATCH 2/4] virtiofsd: add --print-capabilities option Stefan Hajnoczi
@ 2019-08-27  9:54 ` Stefan Hajnoczi
  2019-09-03 17:29   ` Dr. David Alan Gilbert
  2019-08-27  9:54 ` [Qemu-devel] [PATCH 4/4] virtiofsd: add vhost-user.json file Stefan Hajnoczi
  2019-09-03 17:32 ` [Qemu-devel] [PATCH 0/4] virtiofsd: implement vhost-user.rst "Backend program conventions" Dr. David Alan Gilbert
  4 siblings, 1 reply; 13+ messages in thread
From: Stefan Hajnoczi @ 2019-08-27  9:54 UTC (permalink / raw)
  To: virtio-fs, qemu-devel
  Cc: Marc-André Lureau, Dr. David Alan Gilbert, Stefan Hajnoczi,
	Michael S. Tsirkin

Build and install virtiofsd on Linux hosts.  This is also how
vhost-user-gpu is handled.

Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
---
 Makefile | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/Makefile b/Makefile
index a3dfdd6fa8..ef6eca07cc 100644
--- a/Makefile
+++ b/Makefile
@@ -317,6 +317,8 @@ HELPERS-y =
 HELPERS-$(call land,$(CONFIG_SOFTMMU),$(CONFIG_LINUX)) = qemu-bridge-helper$(EXESUF)
 
 ifdef CONFIG_LINUX
+HELPERS-y += virtiofsd$(EXESUF)
+
 ifdef CONFIG_VIRGL
 ifdef CONFIG_GBM
 HELPERS-y += vhost-user-gpu$(EXESUF)
-- 
2.21.0



^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [Qemu-devel] [PATCH 4/4] virtiofsd: add vhost-user.json file
  2019-08-27  9:54 [Qemu-devel] [PATCH 0/4] virtiofsd: implement vhost-user.rst "Backend program conventions" Stefan Hajnoczi
                   ` (2 preceding siblings ...)
  2019-08-27  9:54 ` [Qemu-devel] [PATCH 3/4] virtiofsd: install virtiofsd in libexec Stefan Hajnoczi
@ 2019-08-27  9:54 ` Stefan Hajnoczi
  2019-09-03 17:31   ` Dr. David Alan Gilbert
  2019-09-03 17:32 ` [Qemu-devel] [PATCH 0/4] virtiofsd: implement vhost-user.rst "Backend program conventions" Dr. David Alan Gilbert
  4 siblings, 1 reply; 13+ messages in thread
From: Stefan Hajnoczi @ 2019-08-27  9:54 UTC (permalink / raw)
  To: virtio-fs, qemu-devel
  Cc: Marc-André Lureau, Dr. David Alan Gilbert, Stefan Hajnoczi,
	Michael S. Tsirkin

Install a vhost-user.json file describing virtiofsd.  This allows
libvirt and other management tools to enumerate vhost-user backend
programs.

Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
---
 Makefile                                    | 1 +
 .gitignore                                  | 1 +
 contrib/virtiofsd/50-qemu-virtiofsd.json.in | 5 +++++
 3 files changed, 7 insertions(+)
 create mode 100644 contrib/virtiofsd/50-qemu-virtiofsd.json.in

diff --git a/Makefile b/Makefile
index ef6eca07cc..c6e2f4e7a0 100644
--- a/Makefile
+++ b/Makefile
@@ -318,6 +318,7 @@ HELPERS-$(call land,$(CONFIG_SOFTMMU),$(CONFIG_LINUX)) = qemu-bridge-helper$(EXE
 
 ifdef CONFIG_LINUX
 HELPERS-y += virtiofsd$(EXESUF)
+vhost-user-json-y += contrib/virtiofsd/50-qemu-virtiofsd.json
 
 ifdef CONFIG_VIRGL
 ifdef CONFIG_GBM
diff --git a/.gitignore b/.gitignore
index fd6e6c38c7..554c7abe81 100644
--- a/.gitignore
+++ b/.gitignore
@@ -6,6 +6,7 @@
 /config-target.*
 /config.status
 /config-temp
+/contrib/virtiofsd/50-qemu-virtiofsd.json
 /elf2dmp
 /trace-events-all
 /trace/generated-events.h
diff --git a/contrib/virtiofsd/50-qemu-virtiofsd.json.in b/contrib/virtiofsd/50-qemu-virtiofsd.json.in
new file mode 100644
index 0000000000..9bcd86f8dc
--- /dev/null
+++ b/contrib/virtiofsd/50-qemu-virtiofsd.json.in
@@ -0,0 +1,5 @@
+{
+  "description": "QEMU virtiofsd vhost-user-fs",
+  "type": "fs",
+  "binary": "@libexecdir@/virtiofsd"
+}
-- 
2.21.0



^ permalink raw reply related	[flat|nested] 13+ messages in thread

* Re: [Qemu-devel] [PATCH 1/4] virtiofsd: make -f (foreground) the default
  2019-08-27  9:54 ` [Qemu-devel] [PATCH 1/4] virtiofsd: make -f (foreground) the default Stefan Hajnoczi
@ 2019-09-03 17:17   ` Dr. David Alan Gilbert
  0 siblings, 0 replies; 13+ messages in thread
From: Dr. David Alan Gilbert @ 2019-09-03 17:17 UTC (permalink / raw)
  To: Stefan Hajnoczi
  Cc: virtio-fs, Marc-André Lureau, qemu-devel, Michael S. Tsirkin

* Stefan Hajnoczi (stefanha@redhat.com) wrote:
> According to vhost-user.rst "Backend program conventions", backend
> programs should run in the foregound by default.  Follow the
> conventions so libvirt and other management tools can control virtiofsd
> in a standard way.
> 
> Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>

Reviewed-by: Dr. David Alan Gilbert <dgilbert@redhat.com>

> ---
>  contrib/virtiofsd/helper.c | 3 +++
>  1 file changed, 3 insertions(+)
> 
> diff --git a/contrib/virtiofsd/helper.c b/contrib/virtiofsd/helper.c
> index 4c71452080..8d8bca889b 100644
> --- a/contrib/virtiofsd/helper.c
> +++ b/contrib/virtiofsd/helper.c
> @@ -42,6 +42,7 @@ static const struct fuse_opt fuse_helper_opts[] = {
>  	FUSE_OPT_KEY("-d",		FUSE_OPT_KEY_KEEP),
>  	FUSE_OPT_KEY("debug",		FUSE_OPT_KEY_KEEP),
>  	FUSE_HELPER_OPT("-f",		foreground),
> +	FUSE_HELPER_OPT_VALUE("--daemonize", foreground, 0),
>  	FUSE_HELPER_OPT("-s",		singlethread),
>  	FUSE_HELPER_OPT("fsname=",	nodefault_subtype),
>  	FUSE_OPT_KEY("fsname=",		FUSE_OPT_KEY_KEEP),
> @@ -139,6 +140,7 @@ void fuse_cmdline_help(void)
>  	       "    -d   -o debug              enable debug output (implies -f)\n"
>  	       "    --syslog                   log to syslog (default stderr)\n"
>  	       "    -f                         foreground operation\n"
> +	       "    --daemonize                run in background\n"
>  	       "    -s                         disable multi-threaded operation\n"
>  	       "    -o clone_fd                use separate fuse device fd for each thread\n"
>  	       "                               (may improve performance)\n"
> @@ -171,6 +173,7 @@ int fuse_parse_cmdline(struct fuse_args *args,
>  	memset(opts, 0, sizeof(struct fuse_cmdline_opts));
>  
>  	opts->max_idle_threads = 10;
> +	opts->foreground = 1;
>  
>  	if (fuse_opt_parse(args, opts, fuse_helper_opts,
>  			   fuse_helper_opt_proc) == -1)
> -- 
> 2.21.0
> 
--
Dr. David Alan Gilbert / dgilbert@redhat.com / Manchester, UK


^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [Qemu-devel] [PATCH 2/4] virtiofsd: add --print-capabilities option
  2019-08-27  9:54 ` [Qemu-devel] [PATCH 2/4] virtiofsd: add --print-capabilities option Stefan Hajnoczi
@ 2019-09-03 17:26   ` Dr. David Alan Gilbert
  2019-09-04 15:51     ` Stefan Hajnoczi
  2019-09-12 12:40   ` Marc-André Lureau
  1 sibling, 1 reply; 13+ messages in thread
From: Dr. David Alan Gilbert @ 2019-09-03 17:26 UTC (permalink / raw)
  To: Stefan Hajnoczi
  Cc: virtio-fs, Marc-André Lureau, qemu-devel, Michael S. Tsirkin

* Stefan Hajnoczi (stefanha@redhat.com) wrote:
> Add the --print-capabilities option as per vhost-user.rst "Backend
> programs conventions".  Currently there are no advertised features.
> 
> Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>

That looks OK to me, but can someone who understands the json
requirement explain what says whether a 'features' entry is optional?

Dave

> ---
>  docs/interop/vhost-user.json       |  4 +++-
>  contrib/virtiofsd/fuse_lowlevel.h  |  1 +
>  contrib/virtiofsd/helper.c         |  2 ++
>  contrib/virtiofsd/passthrough_ll.c | 12 ++++++++++++
>  4 files changed, 18 insertions(+), 1 deletion(-)
> 
> diff --git a/docs/interop/vhost-user.json b/docs/interop/vhost-user.json
> index da6aaf51c8..d4ea1f7ac5 100644
> --- a/docs/interop/vhost-user.json
> +++ b/docs/interop/vhost-user.json
> @@ -31,6 +31,7 @@
>  # @rproc-serial: virtio remoteproc serial link
>  # @scsi: virtio scsi
>  # @vsock: virtio vsock transport
> +# @fs: virtio fs (since 4.2)
>  #
>  # Since: 4.0
>  ##
> @@ -50,7 +51,8 @@
>        'rpmsg',
>        'rproc-serial',
>        'scsi',
> -      'vsock'
> +      'vsock',
> +      'fs'
>    ]
>  }
>  
> diff --git a/contrib/virtiofsd/fuse_lowlevel.h b/contrib/virtiofsd/fuse_lowlevel.h
> index b441d3dfed..e3d8747571 100644
> --- a/contrib/virtiofsd/fuse_lowlevel.h
> +++ b/contrib/virtiofsd/fuse_lowlevel.h
> @@ -1796,6 +1796,7 @@ struct fuse_cmdline_opts {
>  	int nodefault_subtype;
>  	int show_version;
>  	int show_help;
> +	int print_capabilities;
>  	int clone_fd;
>  	int syslog;
>  	int log_level;
> diff --git a/contrib/virtiofsd/helper.c b/contrib/virtiofsd/helper.c
> index 8d8bca889b..84bf1c834d 100644
> --- a/contrib/virtiofsd/helper.c
> +++ b/contrib/virtiofsd/helper.c
> @@ -35,6 +35,7 @@ static const struct fuse_opt fuse_helper_opts[] = {
>  	FUSE_HELPER_OPT("--help",	show_help),
>  	FUSE_HELPER_OPT("-V",		show_version),
>  	FUSE_HELPER_OPT("--version",	show_version),
> +	FUSE_HELPER_OPT("--print-capabilities", print_capabilities),
>  	FUSE_HELPER_OPT("-d",		debug),
>  	FUSE_HELPER_OPT("debug",	debug),
>  	FUSE_HELPER_OPT("-d",		foreground),
> @@ -137,6 +138,7 @@ void fuse_cmdline_help(void)
>  {
>  	printf("    -h   --help                print help\n"
>  	       "    -V   --version             print version\n"
> +	       "    --print-capabilities       print vhost-user.json\n"
>  	       "    -d   -o debug              enable debug output (implies -f)\n"
>  	       "    --syslog                   log to syslog (default stderr)\n"
>  	       "    -f                         foreground operation\n"
> diff --git a/contrib/virtiofsd/passthrough_ll.c b/contrib/virtiofsd/passthrough_ll.c
> index 0ef01b7e3f..e2e20f22cd 100644
> --- a/contrib/virtiofsd/passthrough_ll.c
> +++ b/contrib/virtiofsd/passthrough_ll.c
> @@ -2879,6 +2879,14 @@ static void fuse_lo_data_cleanup(struct lo_data *lo)
>          free((char *)lo->source);
>  }
>  
> +/* Print vhost-user.json backend program capabilities */
> +static void print_capabilities(void)
> +{
> +	printf("{\n");
> +	printf("  \"type\": \"fs\"\n");
> +	printf("}\n");
> +}
> +
>  int main(int argc, char *argv[])
>  {
>  	struct fuse_args args = FUSE_ARGS_INIT(argc, argv);
> @@ -2931,6 +2939,10 @@ int main(int argc, char *argv[])
>  		fuse_lowlevel_version();
>  		ret = 0;
>  		goto err_out1;
> +	} else if (opts.print_capabilities) {
> +		print_capabilities();
> +		ret = 0;
> +		goto err_out1;
>  	}
>  
>  	if (fuse_opt_parse(&args, &lo, lo_opts, NULL)== -1)
> -- 
> 2.21.0
> 
--
Dr. David Alan Gilbert / dgilbert@redhat.com / Manchester, UK


^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [Qemu-devel] [PATCH 3/4] virtiofsd: install virtiofsd in libexec
  2019-08-27  9:54 ` [Qemu-devel] [PATCH 3/4] virtiofsd: install virtiofsd in libexec Stefan Hajnoczi
@ 2019-09-03 17:29   ` Dr. David Alan Gilbert
  0 siblings, 0 replies; 13+ messages in thread
From: Dr. David Alan Gilbert @ 2019-09-03 17:29 UTC (permalink / raw)
  To: Stefan Hajnoczi
  Cc: virtio-fs, Marc-André Lureau, qemu-devel, Michael S. Tsirkin

* Stefan Hajnoczi (stefanha@redhat.com) wrote:
> Build and install virtiofsd on Linux hosts.  This is also how
> vhost-user-gpu is handled.
> 
> Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>

Reviewed-by: Dr. David Alan Gilbert <dgilbert@redhat.com>

> ---
>  Makefile | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/Makefile b/Makefile
> index a3dfdd6fa8..ef6eca07cc 100644
> --- a/Makefile
> +++ b/Makefile
> @@ -317,6 +317,8 @@ HELPERS-y =
>  HELPERS-$(call land,$(CONFIG_SOFTMMU),$(CONFIG_LINUX)) = qemu-bridge-helper$(EXESUF)
>  
>  ifdef CONFIG_LINUX
> +HELPERS-y += virtiofsd$(EXESUF)
> +
>  ifdef CONFIG_VIRGL
>  ifdef CONFIG_GBM
>  HELPERS-y += vhost-user-gpu$(EXESUF)
> -- 
> 2.21.0
> 
--
Dr. David Alan Gilbert / dgilbert@redhat.com / Manchester, UK


^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [Qemu-devel] [PATCH 4/4] virtiofsd: add vhost-user.json file
  2019-08-27  9:54 ` [Qemu-devel] [PATCH 4/4] virtiofsd: add vhost-user.json file Stefan Hajnoczi
@ 2019-09-03 17:31   ` Dr. David Alan Gilbert
  0 siblings, 0 replies; 13+ messages in thread
From: Dr. David Alan Gilbert @ 2019-09-03 17:31 UTC (permalink / raw)
  To: Stefan Hajnoczi
  Cc: virtio-fs, Marc-André Lureau, qemu-devel, Michael S. Tsirkin

* Stefan Hajnoczi (stefanha@redhat.com) wrote:
> Install a vhost-user.json file describing virtiofsd.  This allows
> libvirt and other management tools to enumerate vhost-user backend
> programs.
> 
> Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>

Reviewed-by: Dr. David Alan Gilbert <dgilbert@redhat.com>

> ---
>  Makefile                                    | 1 +
>  .gitignore                                  | 1 +
>  contrib/virtiofsd/50-qemu-virtiofsd.json.in | 5 +++++
>  3 files changed, 7 insertions(+)
>  create mode 100644 contrib/virtiofsd/50-qemu-virtiofsd.json.in
> 
> diff --git a/Makefile b/Makefile
> index ef6eca07cc..c6e2f4e7a0 100644
> --- a/Makefile
> +++ b/Makefile
> @@ -318,6 +318,7 @@ HELPERS-$(call land,$(CONFIG_SOFTMMU),$(CONFIG_LINUX)) = qemu-bridge-helper$(EXE
>  
>  ifdef CONFIG_LINUX
>  HELPERS-y += virtiofsd$(EXESUF)
> +vhost-user-json-y += contrib/virtiofsd/50-qemu-virtiofsd.json
>  
>  ifdef CONFIG_VIRGL
>  ifdef CONFIG_GBM
> diff --git a/.gitignore b/.gitignore
> index fd6e6c38c7..554c7abe81 100644
> --- a/.gitignore
> +++ b/.gitignore
> @@ -6,6 +6,7 @@
>  /config-target.*
>  /config.status
>  /config-temp
> +/contrib/virtiofsd/50-qemu-virtiofsd.json
>  /elf2dmp
>  /trace-events-all
>  /trace/generated-events.h
> diff --git a/contrib/virtiofsd/50-qemu-virtiofsd.json.in b/contrib/virtiofsd/50-qemu-virtiofsd.json.in
> new file mode 100644
> index 0000000000..9bcd86f8dc
> --- /dev/null
> +++ b/contrib/virtiofsd/50-qemu-virtiofsd.json.in
> @@ -0,0 +1,5 @@
> +{
> +  "description": "QEMU virtiofsd vhost-user-fs",
> +  "type": "fs",
> +  "binary": "@libexecdir@/virtiofsd"
> +}
> -- 
> 2.21.0
> 
--
Dr. David Alan Gilbert / dgilbert@redhat.com / Manchester, UK


^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [Qemu-devel] [PATCH 0/4] virtiofsd: implement vhost-user.rst "Backend program conventions"
  2019-08-27  9:54 [Qemu-devel] [PATCH 0/4] virtiofsd: implement vhost-user.rst "Backend program conventions" Stefan Hajnoczi
                   ` (3 preceding siblings ...)
  2019-08-27  9:54 ` [Qemu-devel] [PATCH 4/4] virtiofsd: add vhost-user.json file Stefan Hajnoczi
@ 2019-09-03 17:32 ` Dr. David Alan Gilbert
  4 siblings, 0 replies; 13+ messages in thread
From: Dr. David Alan Gilbert @ 2019-09-03 17:32 UTC (permalink / raw)
  To: Stefan Hajnoczi
  Cc: virtio-fs, Marc-André Lureau, qemu-devel, Michael S. Tsirkin

* Stefan Hajnoczi (stefanha@redhat.com) wrote:
> This series implements the conventions for vhost-user backend programs
> described in vhost-user.rst:
> 1. Run in the foreground by default.
> 2. Show vhost-user.json capabilities when --print-capabilities is given.
> 3. Ship a vhost-user.json file so the program can be discovered.
> 
> No command-line options or VHostUserBackendCapabilities are defined for the
> 'fs' backend type yet.  Let's until it becomes clear what should be standard
> for all 'fs' backends and what is specific to virtiofsd.

1,3,4 merged; 2 waiting on reivew from someone who understands the json
requirement.

> 
> Stefan Hajnoczi (4):
>   virtiofsd: make -f (foreground) the default
>   virtiofsd: add --print-capabilities option
>   virtiofsd: install virtiofsd in libexec
>   virtiofsd: add vhost-user.json file
> 
>  docs/interop/vhost-user.json                |  4 +++-
>  Makefile                                    |  3 +++
>  contrib/virtiofsd/fuse_lowlevel.h           |  1 +
>  contrib/virtiofsd/helper.c                  |  5 +++++
>  contrib/virtiofsd/passthrough_ll.c          | 12 ++++++++++++
>  .gitignore                                  |  1 +
>  contrib/virtiofsd/50-qemu-virtiofsd.json.in |  5 +++++
>  7 files changed, 30 insertions(+), 1 deletion(-)
>  create mode 100644 contrib/virtiofsd/50-qemu-virtiofsd.json.in
> 
> -- 
> 2.21.0
> 
--
Dr. David Alan Gilbert / dgilbert@redhat.com / Manchester, UK


^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [Qemu-devel] [PATCH 2/4] virtiofsd: add --print-capabilities option
  2019-09-03 17:26   ` Dr. David Alan Gilbert
@ 2019-09-04 15:51     ` Stefan Hajnoczi
  2019-09-12 11:12       ` Stefan Hajnoczi
  0 siblings, 1 reply; 13+ messages in thread
From: Stefan Hajnoczi @ 2019-09-04 15:51 UTC (permalink / raw)
  To: Dr. David Alan Gilbert
  Cc: virtio-fs, Marc-André Lureau, qemu-devel, Michael S. Tsirkin

[-- Attachment #1: Type: text/plain, Size: 751 bytes --]

On Tue, Sep 03, 2019 at 06:26:44PM +0100, Dr. David Alan Gilbert wrote:
> * Stefan Hajnoczi (stefanha@redhat.com) wrote:
> > Add the --print-capabilities option as per vhost-user.rst "Backend
> > programs conventions".  Currently there are no advertised features.
> > 
> > Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
> 
> That looks OK to me, but can someone who understands the json
> requirement explain what says whether a 'features' entry is optional?

I have defined a VHostUserBackendType ('fs') but no
VHostUserBackendCapabilities union field.

I guess this is allowed since many other VIRTIO device types are also
defined without a VHostUserBackendCapabilities union field (only 'gpu'
and 'input' have one).

Stefan

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [Qemu-devel] [PATCH 2/4] virtiofsd: add --print-capabilities option
  2019-09-04 15:51     ` Stefan Hajnoczi
@ 2019-09-12 11:12       ` Stefan Hajnoczi
  0 siblings, 0 replies; 13+ messages in thread
From: Stefan Hajnoczi @ 2019-09-12 11:12 UTC (permalink / raw)
  To: Marc-André Lureau
  Cc: virtio-fs, Michael S. Tsirkin, Dr. David Alan Gilbert, qemu-devel

[-- Attachment #1: Type: text/plain, Size: 943 bytes --]

On Wed, Sep 04, 2019 at 04:51:21PM +0100, Stefan Hajnoczi wrote:
> On Tue, Sep 03, 2019 at 06:26:44PM +0100, Dr. David Alan Gilbert wrote:
> > * Stefan Hajnoczi (stefanha@redhat.com) wrote:
> > > Add the --print-capabilities option as per vhost-user.rst "Backend
> > > programs conventions".  Currently there are no advertised features.
> > > 
> > > Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
> > 
> > That looks OK to me, but can someone who understands the json
> > requirement explain what says whether a 'features' entry is optional?
> 
> I have defined a VHostUserBackendType ('fs') but no
> VHostUserBackendCapabilities union field.
> 
> I guess this is allowed since many other VIRTIO device types are also
> defined without a VHostUserBackendCapabilities union field (only 'gpu'
> and 'input' have one).

Hi Marc-André,
Please review when you have time.  You are the vhost-user.json expert
:).

Stefan

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [Qemu-devel] [PATCH 2/4] virtiofsd: add --print-capabilities option
  2019-08-27  9:54 ` [Qemu-devel] [PATCH 2/4] virtiofsd: add --print-capabilities option Stefan Hajnoczi
  2019-09-03 17:26   ` Dr. David Alan Gilbert
@ 2019-09-12 12:40   ` Marc-André Lureau
  1 sibling, 0 replies; 13+ messages in thread
From: Marc-André Lureau @ 2019-09-12 12:40 UTC (permalink / raw)
  To: Stefan Hajnoczi
  Cc: virtio-fs, qemu-devel, Dr. David Alan Gilbert, Michael S. Tsirkin

Hi

On Tue, Aug 27, 2019 at 1:55 PM Stefan Hajnoczi <stefanha@redhat.com> wrote:
>
> Add the --print-capabilities option as per vhost-user.rst "Backend
> programs conventions".  Currently there are no advertised features.
>
> Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>

Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>

> ---
>  docs/interop/vhost-user.json       |  4 +++-
>  contrib/virtiofsd/fuse_lowlevel.h  |  1 +
>  contrib/virtiofsd/helper.c         |  2 ++
>  contrib/virtiofsd/passthrough_ll.c | 12 ++++++++++++
>  4 files changed, 18 insertions(+), 1 deletion(-)
>
> diff --git a/docs/interop/vhost-user.json b/docs/interop/vhost-user.json
> index da6aaf51c8..d4ea1f7ac5 100644
> --- a/docs/interop/vhost-user.json
> +++ b/docs/interop/vhost-user.json
> @@ -31,6 +31,7 @@
>  # @rproc-serial: virtio remoteproc serial link
>  # @scsi: virtio scsi
>  # @vsock: virtio vsock transport
> +# @fs: virtio fs (since 4.2)
>  #
>  # Since: 4.0
>  ##
> @@ -50,7 +51,8 @@
>        'rpmsg',
>        'rproc-serial',
>        'scsi',
> -      'vsock'
> +      'vsock',
> +      'fs'
>    ]
>  }
>
> diff --git a/contrib/virtiofsd/fuse_lowlevel.h b/contrib/virtiofsd/fuse_lowlevel.h
> index b441d3dfed..e3d8747571 100644
> --- a/contrib/virtiofsd/fuse_lowlevel.h
> +++ b/contrib/virtiofsd/fuse_lowlevel.h
> @@ -1796,6 +1796,7 @@ struct fuse_cmdline_opts {
>         int nodefault_subtype;
>         int show_version;
>         int show_help;
> +       int print_capabilities;
>         int clone_fd;
>         int syslog;
>         int log_level;
> diff --git a/contrib/virtiofsd/helper.c b/contrib/virtiofsd/helper.c
> index 8d8bca889b..84bf1c834d 100644
> --- a/contrib/virtiofsd/helper.c
> +++ b/contrib/virtiofsd/helper.c
> @@ -35,6 +35,7 @@ static const struct fuse_opt fuse_helper_opts[] = {
>         FUSE_HELPER_OPT("--help",       show_help),
>         FUSE_HELPER_OPT("-V",           show_version),
>         FUSE_HELPER_OPT("--version",    show_version),
> +       FUSE_HELPER_OPT("--print-capabilities", print_capabilities),
>         FUSE_HELPER_OPT("-d",           debug),
>         FUSE_HELPER_OPT("debug",        debug),
>         FUSE_HELPER_OPT("-d",           foreground),
> @@ -137,6 +138,7 @@ void fuse_cmdline_help(void)
>  {
>         printf("    -h   --help                print help\n"
>                "    -V   --version             print version\n"
> +              "    --print-capabilities       print vhost-user.json\n"
>                "    -d   -o debug              enable debug output (implies -f)\n"
>                "    --syslog                   log to syslog (default stderr)\n"
>                "    -f                         foreground operation\n"
> diff --git a/contrib/virtiofsd/passthrough_ll.c b/contrib/virtiofsd/passthrough_ll.c
> index 0ef01b7e3f..e2e20f22cd 100644
> --- a/contrib/virtiofsd/passthrough_ll.c
> +++ b/contrib/virtiofsd/passthrough_ll.c
> @@ -2879,6 +2879,14 @@ static void fuse_lo_data_cleanup(struct lo_data *lo)
>          free((char *)lo->source);
>  }
>
> +/* Print vhost-user.json backend program capabilities */
> +static void print_capabilities(void)
> +{
> +       printf("{\n");
> +       printf("  \"type\": \"fs\"\n");
> +       printf("}\n");
> +}
> +
>  int main(int argc, char *argv[])
>  {
>         struct fuse_args args = FUSE_ARGS_INIT(argc, argv);
> @@ -2931,6 +2939,10 @@ int main(int argc, char *argv[])
>                 fuse_lowlevel_version();
>                 ret = 0;
>                 goto err_out1;
> +       } else if (opts.print_capabilities) {
> +               print_capabilities();
> +               ret = 0;
> +               goto err_out1;
>         }
>
>         if (fuse_opt_parse(&args, &lo, lo_opts, NULL)== -1)
> --
> 2.21.0
>


^ permalink raw reply	[flat|nested] 13+ messages in thread

end of thread, other threads:[~2019-09-12 12:42 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-08-27  9:54 [Qemu-devel] [PATCH 0/4] virtiofsd: implement vhost-user.rst "Backend program conventions" Stefan Hajnoczi
2019-08-27  9:54 ` [Qemu-devel] [PATCH 1/4] virtiofsd: make -f (foreground) the default Stefan Hajnoczi
2019-09-03 17:17   ` Dr. David Alan Gilbert
2019-08-27  9:54 ` [Qemu-devel] [PATCH 2/4] virtiofsd: add --print-capabilities option Stefan Hajnoczi
2019-09-03 17:26   ` Dr. David Alan Gilbert
2019-09-04 15:51     ` Stefan Hajnoczi
2019-09-12 11:12       ` Stefan Hajnoczi
2019-09-12 12:40   ` Marc-André Lureau
2019-08-27  9:54 ` [Qemu-devel] [PATCH 3/4] virtiofsd: install virtiofsd in libexec Stefan Hajnoczi
2019-09-03 17:29   ` Dr. David Alan Gilbert
2019-08-27  9:54 ` [Qemu-devel] [PATCH 4/4] virtiofsd: add vhost-user.json file Stefan Hajnoczi
2019-09-03 17:31   ` Dr. David Alan Gilbert
2019-09-03 17:32 ` [Qemu-devel] [PATCH 0/4] virtiofsd: implement vhost-user.rst "Backend program conventions" Dr. David Alan Gilbert

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).