Dump: add a Filesystem in Userspace and command "fuse-mount"
PATCH 2/2 Dump: add command "fuse-mount"
In reply to Nan LiAdd a "fuse-mount" command to support the Filesystem in Userspace (FUSE). It can mount or unmount the filesystem with both hmp and qmp commands. It calls the API function qemu_fuse_main(int argc, char *argv[]).
--- dump.c | 48 ++++++++++++++++++++++++++++++++++++++++++++++++ hmp-commands.hx | 19 +++++++++++++++++++ hmp.c | 12 ++++++++++++ hmp.h | 1 + qapi-schema.json | 15 +++++++++++++++ qmp-commands.hx | 31 +++++++++++++++++++++++++++++++ 6 files changed, 126 insertions(+)
dump.c +48 -0
@@ -26,6 +26,10 @@#include "qapi/qmp/qerror.h" #include "qmp-commands.h" #include "qapi-event.h" +#ifdef CONFIG_FUSE +#include <sys/mount.h> +#include "fuse-mem.h" +#endif #include <zlib.h> #ifdef CONFIG_LZO
@@ -1846,3 +1850,47 @@ DumpGuestMemoryCapability *qmp_query_dump_guest_memory_capability(Error **errp)return cap; } + +#ifdef CONFIG_FUSE +static void *fuse_process (void *data) +{ +pid_t pid; +int argc =2 ; +char *argv[2 ]; +char programname[] ="fuse-mount-process" ; + argv[0 ] = programname; + argv[1 ] = (char *)data; +int ret; + +if ((pid =fork ()) <0 ) +perror ("fork() is failed" ); +else if (pid ==0 ) { + ret =qemu_fuse_main (argc, argv); +if ( ret !=0 ) +perror ("qemu_fuse_main() is failed" ); +exit (0 ); + } +return NULL ; +} + +void qmp_fuse_mount (bool unmount,const char *mountpoint,Error **errp) +{ +int ret; + +if (unmount) { + ret =umount (mountpoint); +if (ret <0 ) { +error_setg (errp,"umount() is failed" ); + } +return ; + } + +char * prot =g_strdup (mountpoint); +fuse_process ((void *)prot); +} +#else +void qmp_fuse_mount (bool unmount,const char *mountpoint,Error **errp) +{ +abort (); +} +#endif
hmp-commands.hx +19 -0
@@ -1087,6 +1087,25 @@ gdb. Without -z|-l|-s, the dump format is ELF. together with begin. ETEXI +#if defined(CONFIG_FUSE) + { + .name = "fuse-mount", + .args_type = "unmount:-u,mountpoint:s", + .params = "[-u] mountpoint", + .help = "mount(unmount) fuse system on 'mountpoint'.\n\t\t\t" + "-u: unmount.", + .mhandler.cmd = hmp_fuse_mount, + }, + +STEXI +@item fuse-mount [-u] @var{mountpoint} +@findex fuse-mount +Mount(unmount) fuse system to @var{mountpoint}. + -u: unmount. + mountpoint: the mount point (a path) of fuse system. +ETEXI +#endif + #if defined(TARGET_S390X) { .name = "dump-skeys",
hmp.c +12 -0
@@ -1643,6 +1643,18 @@ void hmp_dump_guest_memory(Monitor *mon, const QDict *qdict)g_free (prot); } +#ifdef CONFIG_FUSE +void hmp_fuse_mount (Monitor *mon,const QDict *qdict) +{ +Error *err =NULL ; +bool unmount =qdict_get_try_bool (qdict,"unmount" , false); +const char *mountpoint =qdict_get_str (qdict,"mountpoint" ); + +qmp_fuse_mount (unmount, mountpoint, &err); +hmp_handle_error (mon, &err); +} +#endif +void hmp_netdev_add (Monitor *mon,const QDict *qdict) {Error *err =NULL ;
hmp.h +1 -0
@@ -85,6 +85,7 @@ void hmp_migrate(Monitor *mon, const QDict *qdict);void hmp_device_add (Monitor *mon,const QDict *qdict);void hmp_device_del (Monitor *mon,const QDict *qdict);void hmp_dump_guest_memory (Monitor *mon,const QDict *qdict); +void hmp_fuse_mount (Monitor *mon,const QDict *qdict);void hmp_netdev_add (Monitor *mon,const QDict *qdict);void hmp_netdev_del (Monitor *mon,const QDict *qdict);void hmp_getfd (Monitor *mon,const QDict *qdict);
qapi-schema.json +15 -0
@@ -2283,6 +2283,21 @@ 'returns': 'DumpGuestMemoryCapability' } ## +# @fuse-mount: +# +# mount(unmount) fuse system on 'mountpoint'. +# +# @is_mount: optional if true, umount the fuse system from the mount point +# +# @mountpoint: the mount point (a path) of fuse system +# +# Returns: Nothing on success +# +# Since: 2.6 +## +{ 'command': 'fuse-mount', 'data': {'unmount': 'bool', 'mountpoint': 'str'} } + +## # @dump-skeys # # Dump guest's storage keys
qmp-commands.hx +31 -0
@@ -921,6 +921,37 @@ Example: EQMP +#if defined(CONFIG_FUSE) + { + .name = "fuse-mount", + .args_type = "unmount:b,mountpoint:s", + .params = "[-u] mountpoint", + .help = "mount(unmount) fuse system on 'mountpoint'.\n\t\t\t" + "-u: unmount.", + .mhandler.cmd_new = qmp_marshal_fuse_mount, + }, +SQMP +fuse-mount + +mount(unmount) fuse system on 'mountpoint'. + +Arguments: + +- "unmount": unmount the fuse system (json-bool) +- "mountpoint": the mount point (a path) of fuse system (json-string) + +Example: + +-> { "execute": "fuse-mount", "arguments": { "mountpoint": "/etc/qemu/fuse" } } +<- { "return": {} } + +Notes: + +(1) All boolean arguments default to false + +EQMP +#endif + #if defined TARGET_S390X { .name = "dump-skeys",
Signature · 1 line
1.8.4.5
PATCH 1/2 Dump: introduce a Filesystem in Userspace
In reply to Nan LiWhen running the command "dump-guest-memory", we usually need a large space of storage to save the dumpfile into disk. It costs not only much time to save a file in some of hard disks, but also costs limited storage in host. In order to reduce the saving time and make it convenient for users to dump the guest memory, we introduce a Filesystem in Userspace (FUSE) to save the dump file in RAM. It is selectable in the configure file, adding a compiling of package "fuse-devel". It doesn't change the way of dumping guest memory.
qemu_fuse_main(int argc, char *argv[]) is the API for qemu code to mount this filesystem. And it only supports these operations just for dumping guest memory.
static struct fuse_operations qemu_fuse_oper = {
.getattr = qemu_fuse_getattr,
.fgetattr = qemu_fuse_fgetattr,
.readdir = qemu_fuse_readdir,
.create = qemu_fuse_create,
.open = qemu_fuse_open,
.read = qemu_fuse_read,
.write = qemu_fuse_write,
.unlink = qemu_fuse_unlink,
};
--- Makefile.target | 1 + configure | 34 +++++ fuse-mem.c | 376 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ fuse-mem.h | 2 + 4 files changed, 413 insertions(+) create mode 100644 fuse-mem.c create mode 100644 fuse-mem.h
Makefile.target +1 -0
@@ -138,6 +138,7 @@ obj-$(CONFIG_KVM) += kvm-all.o obj-y += memory.o cputlb.o obj-y += memory_mapping.o obj-y += dump.o +obj-$(CONFIG_FUSE) += fuse-mem.o obj-y += migration/ram.o migration/savevm.o LIBS := $(libs_softmmu) $(LIBS)
configure +34 -0
@@ -275,6 +275,7 @@ trace_backends="log" trace_file="trace" spice="" rbd="" +fuse="yes" smartcard="" libusb="" usb_redir=""
@@ -1023,6 +1024,10 @@ for opt do ;; --enable-rbd) rbd="yes" ;; + --disable-fuse) fuse="no" + ;; + --enable-fuse) fuse="yes" + ;; --disable-xfsctl) xfs="no" ;; --enable-xfsctl) xfs="yes"
@@ -1349,6 +1354,7 @@ disabled with --disable-FEATURE, default is enabled if available: vhost-net vhost-net acceleration support spice spice rbd rados block device (rbd) + fuse the support of dumping guest memory via fuse libiscsi iscsi support libnfs nfs support smartcard smartcard support (libcacard)
@@ -3139,6 +3145,28 @@ EOF fi ########################################## +# fuse probe +min_fuse_version=2.9.3 +if test "$fuse" != "no" ; then + if $pkg_config --atleast-version=$min_fuse_version fuse; then + fuse_cflags=`$pkg_config fuse --cflags` + fuse_libs=`$pkg_config fuse --libs` + QEMU_CFLAGS="$fuse_cflags $QEMU_CFLAGS" + libs_softmmu="$fuse_libs $libs_softmmu" + fuse=yes + else + if $pkg_config fuse; then + if test "$fuse" = "yes" ; then + error_exit "fuse >= $min_fuse_version required for --enable-fuse" + fi + else + feature_not_found "fuse" "Please install fuse devel pkgs: fuse-devel" + fi + fuse=no + fi +fi + +########################################## # libssh2 probe min_libssh2_version=1.2.8 if test "$libssh2" != "no" ; then
@@ -4815,6 +4843,7 @@ else echo "spice support $spice" fi echo "rbd support $rbd" +echo "fuse support $fuse" echo "xfsctl support $xfs" echo "smartcard support $smartcard" echo "libusb $libusb"
@@ -5293,6 +5322,11 @@ if test "$rbd" = "yes" ; then echo "RBD_CFLAGS=$rbd_cflags" >> $config_host_mak echo "RBD_LIBS=$rbd_libs" >> $config_host_mak fi +if test "$fuse" = "yes" ; then + echo "CONFIG_FUSE=y" >> $config_host_mak + echo "FUSE_CFLAGS=$fuse_cflags" >> $config_host_mak + echo "FUSE_LIBS=$fuse_libs" >> $config_host_mak +fi echo "CONFIG_COROUTINE_BACKEND=$coroutine" >> $config_host_mak if test "$coroutine_pool" = "yes" ; then
fuse-mem.c new file +376 -0
376 lines not on this page · raw message
fuse-mem.h new file +2 -0
@@ -0,0 +1,2 @@ +extern int qemu_fuse_main (int argc,char *argv[]); +
Signature · 1 line
1.8.4.5
cover Dump: add a Filesystem in Userspace and command "fuse-mount"
These two patches introduce a Filesystem in Userspace (FUSE) and add a "fuse-mount" command to support this filesystem.
(1)
When running the command "dump-guest-memory", we usually need a large space of storage to save the dumpfile into disk. It costs not only much time to save a file in some of hard disks, but also costs limited storage in host. In order to reduce the saving time and make it convenient for users to dump the guest memory, we introduce a Filesystem in Userspace (FUSE) to save the dump file in RAM. It is selectable in the configure file, adding a compiling of package "fuse-devel". It doesn't change the way of dumping guest memory.
qemu_fuse_main(int argc, char *argv[]) is the API for qemu code to mount this filesystem. And it only supports these operations just for dumping guest memory.
static struct fuse_operations qemu_fuse_oper = {
.getattr = qemu_fuse_getattr,
.fgetattr = qemu_fuse_fgetattr,
.readdir = qemu_fuse_readdir, .create = qemu_fuse_create,
.open = qemu_fuse_open,
.read = qemu_fuse_read,
.write = qemu_fuse_write,
.unlink = qemu_fuse_unlink,
};
(2)
command "fuse-mount"
It can mount or unmount the filesystem with both hmp and qmp commands. It calls the API function qemu_fuse_main(int argc, char *argv[]).
Nan Li (2):
Dump: introduce a Filesystem in Userspace
Dump: add command "fuse-mount"
Makefile.target | 1 + configure | 34 +++++ dump.c | 48 +++++++ fuse-mem.c | 376 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ fuse-mem.h | 2 + hmp-commands.hx | 19 +++ hmp.c | 12 ++ hmp.h | 1 + qapi-schema.json | 15 +++ qmp-commands.hx | 31 +++++ 10 files changed, 539 insertions(+) create mode 100644 fuse-mem.c create mode 100644 fuse-mem.h
Signature · 1 line
1.8.4.5
Re: [Qemu-devel] [PATCH 1/2] Dump: introduce a Filesystem in Userspace
In reply to Nan LiQuoted 7 lines · Nan Li
When running the command "dump-guest-memory", we usually need a large space of storage to save the dumpfile into disk. It costs not only much time to save a file in some of hard disks, but also costs limited storage in host. In order to reduce the saving time and make it convenient for users to dump the guest memory, we introduce a Filesystem in Userspace (FUSE) to save the dump file in RAM. It is selectable in the configure file, adding a compiling of package "fuse-devel". It doesn't change the way of dumping guest memory.
Why introduce FUSE? Can we reuse NBD instead?
Quoted 17 lines
qemu_fuse_main(int argc, char *argv[])is the API for qemu code to mount this filesystem. And it only supports these operations just for dumping guest memory.static struct
fuse_operationsqemu_fuse_oper= {
.getattr =qemu_fuse_getattr,
.fgetattr =qemu_fuse_fgetattr,
.readdir =qemu_fuse_readdir,
.create =qemu_fuse_create,
.open =qemu_fuse_open,
.read =qemu_fuse_read,
.write =qemu_fuse_write,
.unlink =qemu_fuse_unlink,
};Signed-off-by Nan Li <[email protected]>
Quoted 8 lines
--- Makefile.target | 1 + configure | 34 +++++ fuse-mem.c | 376 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ fuse-mem.h | 2 + 4 files changed, 413 insertions(+) create mode 100644 fuse-mem.c create mode 100644 fuse-mem.h
New files should be listed in MAINTAINERS; also, new files usually belong better in an appropriate subdirectory rather than littering the top directory (we're trying to reduce, not increase, the number of top-level files).
I haven't closely reviewed the patch, because I think the meta-questions about the feature in general should be discussed first.
Signature · 2 lines
Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org
Re: [Qemu-devel] [PATCH 1/2] Dump: introduce a Filesystem in Userspace
Quoted 10 lines · Eric Blake
Quoted 7 lines · Nan Li
When running the command "dump-guest-memory", we usually need a large space of storage to save the dumpfile into disk. It costs not only much time to save a file in some of hard disks, but also costs limited storage in host. In order to reduce the saving time and make it convenient for users to dump the guest memory, we introduce a Filesystem in Userspace (FUSE) to save the dump file in RAM. It is selectable in the configure file, adding a compiling of package "fuse-devel". It doesn't change the way of dumping guest memory.
Why introduce FUSE? Can we reuse NBD instead?
The commit message talks of letting QEMU dump to RAM avoiding disk I/O. IOW, it seems like it could just dump to any tmpfs directory.
I'm not really seeing a compelling reason why QEMU needs to mount a fuse filesystem itself - whatever app is using QEMU could handle mounting of fs without QEMU's involvement at all.
Regards,
Daniel
Signature · 4 lines
|: http://berrange.com -o- http://www.flickr.com/photos/dberrange/ :| |: http://libvirt.org -o- http://virt-manager.org :| |: http://autobuild.org -o- http://search.cpan.org/~danberr/ :| |: http://entangle-photo.org -o- http://live.gnome.org/gtk-vnc :|
Re: [Qemu-devel] [PATCH 1/2] Dump: introduce a Filesystem in Userspace
Quoted 10 lines · On Mon, 9 May 2016 17:13:07 +0100 "Daniel P. Berrange" <[email protected]>…
Quoted 9 lines · Eric Blake
Quoted 7 lines · Nan Li
When running the command "dump-guest-memory", we usually need a large space of storage to save the dumpfile into disk. It costs not only much time to save a file in some of hard disks, but also costs limited storage in host. In order to reduce the saving time and make it convenient for users to dump the guest memory, we introduce a Filesystem in Userspace (FUSE) to save the dump file in RAM. It is selectable in the configure file, adding a compiling of package "fuse-devel". It doesn't change the way of dumping guest memory.
Quoted 8 lines
Quoted 1 line
Why introduce FUSE? Can we reuse NBD instead?
The commit message talks of letting QEMU dump to RAM avoiding disk I/O. IOW, it seems like it could just dump to any tmpfs directory.
I'm not really seeing a compelling reason why QEMU needs to mount a fuse filesystem itself - whatever app is using QEMU could handle mounting of fs without QEMU's involvement at all.
The ultimate goal is to export internal QEMU state (memory content, register values) as an ELF file, so you could simply reuse any existing tools that can work with ELF dump files (gdb, crash, makedumpfile, readelf, etc.) instead of re-inventing the wheel for each of those tools.
This cannot be really done from outside of QEMU without too much overhead (how would you access guest memory from outside QEMU?).
And since this information should be available as an ELF file, it cannot be achieved with NBD, because that's a (raw) block device.
Petr T
Re: [Qemu-devel] [PATCH 2/2] Dump: add command "fuse-mount"
In reply to Nan LiQuoted 39 lines · Nan Li
Add a "fuse-mount" command to support the Filesystem in Userspace (FUSE). It can mount or unmount the filesystem with both hmp and qmp commands. It calls the API function
qemu_fuse_main(int argc, char *argv[]).Signed-off-by Nan Li <[email protected]>--- dump.c | 48 ++++++++++++++++++++++++++++++++++++++++++++++++ hmp-commands.hx | 19 +++++++++++++++++++ hmp.c | 12 ++++++++++++ hmp.h | 1 + qapi-schema.json | 15 +++++++++++++++ qmp-commands.hx | 31 +++++++++++++++++++++++++++++++ 6 files changed, 126 insertions(+)dump.c +10
-0@@ -26,6 +26,10 @@#include "qapi/qmp/qerror.h" #include "qmp-commands.h" #include "qapi-event.h" +#ifdef CONFIG_FUSE +#include <sys/mount.h> +#include "fuse-mem.h" +#endif #include <zlib.h> #ifdef CONFIG_LZO @@ -1846,3 +1850,47 @@ DumpGuestMemoryCapability *qmp_query_dump_guest_memory_capability(Error **errp)return cap; } + +#ifdef CONFIG_FUSE +static void *fuse_process (void *data) +{ +pid_t pid; +int argc =2 ;
dump.c DumpGuestMemoryCapability *qmp_query_dump_guest_memory_capability(Error **errp) · line 1868
Quoted 10 lines
dump.c +10
-0+char *argv[2 ]; +char programname[] ="fuse-mount-process" ; + argv[0 ] = programname; + argv[1 ] = (char *)data; +int ret; + +if ((pid =fork ()) <0 ) +perror ("fork() is failed" ); +else if (pid ==0 ) { + ret =qemu_fuse_main (argc, argv);
If you fork() in a multi-threaded program, then you are restricted to only use POSIX APIs declared async signal safe, until such time as you execve(). I've not looked at the code, but I'm not imagining that fuse_main() is going to be safe in this respect.
Regards,
Daniel
Signature · 4 lines
|: http://berrange.com -o- http://www.flickr.com/photos/dberrange/ :| |: http://libvirt.org -o- http://virt-manager.org :| |: http://autobuild.org -o- http://search.cpan.org/~danberr/ :| |: http://entangle-photo.org -o- http://live.gnome.org/gtk-vnc :|
Re: [Qemu-devel] [PATCH 1/2] Dump: introduce a Filesystem in Userspace
In reply to Petr TesarikQuoted 22 lines · Petr Tesarik
Quoted 10 lines · On Mon, 9 May 2016 17:13:07 +0100 "Daniel P. Berrange" <[email protected]>…
Quoted 9 lines · Eric Blake
Quoted 7 lines · Nan Li
When running the command "dump-guest-memory", we usually need a large space of storage to save the dumpfile into disk. It costs not only much time to save a file in some of hard disks, but also costs limited storage in host. In order to reduce the saving time and make it convenient for users to dump the guest memory, we introduce a Filesystem in Userspace (FUSE) to save the dump file in RAM. It is selectable in the configure file, adding a compiling of package "fuse-devel". It doesn't change the way of dumping guest memory.
Quoted 8 lines
Quoted 1 line
Why introduce FUSE? Can we reuse NBD instead?
The commit message talks of letting QEMU dump to RAM avoiding disk I/O. IOW, it seems like it could just dump to any tmpfs directory.
I'm not really seeing a compelling reason why QEMU needs to mount a fuse filesystem itself - whatever app is using QEMU could handle mounting of fs without QEMU's involvement at all.
Quoted 8 lines
The ultimate goal is to export internal QEMU state (memory content, register values) as an ELF file, so you could simply reuse any existing tools that can work with ELF dump files (gdb, crash, makedumpfile, readelf, etc.) instead of re-inventing the wheel for each of those tools.
This cannot be really done from outside of QEMU without too much overhead (how would you access guest memory from outside QEMU?).
Maybe I'm missing something, but IIUC the 'dump-guest-memory' monitor command in QEMU already dumps in ELF format which can be used by standard ELF tools. If you don't want that dump to hit disk, then you could mount a tmpfs and then tell QEMU to write to that.
Regards,
Daniel
Signature · 4 lines
|: http://berrange.com -o- http://www.flickr.com/photos/dberrange/ :| |: http://libvirt.org -o- http://virt-manager.org :| |: http://autobuild.org -o- http://search.cpan.org/~danberr/ :| |: http://entangle-photo.org -o- http://live.gnome.org/gtk-vnc :|
Re: [Qemu-devel] [PATCH 2/2] Dump: add command "fuse-mount"
In reply to Nan LiQuoted 8 lines · Nan Li
Add a "fuse-mount" command to support the Filesystem in Userspace (FUSE). It can mount or unmount the filesystem with both hmp and qmp commands. It calls the API function
qemu_fuse_main(int argc, char *argv[]).Signed-off-by Nan Li <[email protected]>---
+++b/qapi-schema.json
qapi-schema.json line 2290
Quoted 8 lines
qapi-schema.json +5
-0@@ -2283,6 +2283,21 @@ 'returns': 'DumpGuestMemoryCapability' } ## +# @fuse-mount: +# +# mount(unmount) fuse system on 'mountpoint'. +# +# @is_mount: optional if true, umount the fuse system from the mount point
s/umount/unmount/
New QMP commands should favor the use of '-' rather than '_' (as in 'is-mount'). But the name 'is_mount' does not even appear below, so you aren't documenting reality.
qapi-schema.json line 2296
Quoted 6 lines
qapi-schema.json +6
-0+# +# @mountpoint: the mount point (a path) of fuse system +# +# Returns: Nothing on success +# +# Since: 2.6
You've missed 2.6. This has to be 2.7 or later.
Quoted 3 lines
qapi-schema.json +3
-0+## +{ 'command': 'fuse-mount', 'data': {'unmount': 'bool', 'mountpoint': 'str'} } +
Signature · 2 lines
Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org
Re: [Qemu-devel] [PATCH 1/2] Dump: introduce a Filesystem in Userspace
In reply to Eric BlakeQuoted 10 lines · On Mon, 9 May 2016 09:52:28 -0600 Eric Blake <[email protected]> wrote:
Quoted 7 lines · Nan Li
When running the command "dump-guest-memory", we usually need a large space of storage to save the dumpfile into disk. It costs not only much time to save a file in some of hard disks, but also costs limited storage in host. In order to reduce the saving time and make it convenient for users to dump the guest memory, we introduce a Filesystem in Userspace (FUSE) to save the dump file in RAM. It is selectable in the configure file, adding a compiling of package "fuse-devel". It doesn't change the way of dumping guest memory.
Why introduce FUSE? Can we reuse NBD instead?
Let me answer this one, because it's me who came up with the idea, although I wasn't involved in the actual implementation.
The idea is to get something more like Linux's /proc/kcore, but for a QEMU guest. So, yes, the same idea could be implemented as a standalone application which talks to QEMU using the gdb remote protocol and exposes the data in a structured form through a FUSE filesystem.
However, the performance of such a solution cannot get even close to that of exposing the data directly from QEMU. Maybe it's still the best way to start the project...
Regarding NBD ... correct me if I'm wrong, but I've always thought NBD can be used to export _disks_ from the QEMU instance, not guest RAM content.
Regards,
Petr T
Re: [Qemu-devel] [PATCH 1/2] Dump: introduce a Filesystem in Userspace
In reply to Daniel P. BerrangeQuoted 29 lines · On Mon, 9 May 2016 17:32:50 +0100 "Daniel P. Berrange" <[email protected]>…
Quoted 28 lines · Petr Tesarik
Quoted 10 lines · On Mon, 9 May 2016 17:13:07 +0100 "Daniel P. Berrange" <[email protected]>…
Quoted 9 lines · Eric Blake
Quoted 7 lines · Nan Li
When running the command "dump-guest-memory", we usually need a large space of storage to save the dumpfile into disk. It costs not only much time to save a file in some of hard disks, but also costs limited storage in host. In order to reduce the saving time and make it convenient for users to dump the guest memory, we introduce a Filesystem in Userspace (FUSE) to save the dump file in RAM. It is selectable in the configure file, adding a compiling of package "fuse-devel". It doesn't change the way of dumping guest memory.
Quoted 8 lines
Quoted 1 line
Why introduce FUSE? Can we reuse NBD instead?
The commit message talks of letting QEMU dump to RAM avoiding disk I/O. IOW, it seems like it could just dump to any tmpfs directory.
I'm not really seeing a compelling reason why QEMU needs to mount a fuse filesystem itself - whatever app is using QEMU could handle mounting of fs without QEMU's involvement at all.
The ultimate goal is to export internal QEMU state (memory content, register values) as an ELF file, so you could simply reuse any existing tools that can work with ELF dump files (gdb, crash, makedumpfile, readelf, etc.) instead of re-inventing the wheel for each of those tools.
Quoted 7 lines
Quoted 2 lines
This cannot be really done from outside of QEMU without too much overhead (how would you access guest memory from outside QEMU?).
Maybe I'm missing something, but IIUC the 'dump-guest-memory' monitor command in QEMU already dumps in ELF format which can be used by standard ELF tools. If you don't want that dump to hit disk, then you could mount a tmpfs and then tell QEMU to write to that.
It's not the same kind of beast:
1. You need double the amount of RAM in the host. Oh, yes, some folks like to create VMs with a RAM size of a few hundred GBs of RAM, and then it may not be negligible...
2. The memory must still be copied. This is made a bit worse by the fact that tmpfs does not pre-allocate enough RAM, so even copying a few GBs takes several seconds.
3. Most importantly, if the file is created on the fly, it's a live memory source, i.e. repeated reads will reflect changes in the running guest.
Some use cases are substantially slower with the dump-then-use approach. For example, makedumpfile can estimate the resulting dump size based on data from the running kernel. It reads only a tiny portion of system RAM to do the analysis, but since only makedumpfile knows the exact addresses, you would still need a full dump for that.
With the FUSE approach, guest pages are served on demand when the application requests them.
Petr T
Re: [Qemu-devel] [PATCH 1/2] Dump: introduce a Filesystem in Userspace
Quoted 54 lines · Petr Tesarik
Quoted 29 lines · On Mon, 9 May 2016 17:32:50 +0100 "Daniel P. Berrange" <[email protected]>…
Quoted 28 lines · Petr Tesarik
Quoted 10 lines · On Mon, 9 May 2016 17:13:07 +0100 "Daniel P. Berrange" <[email protected]>…
Quoted 9 lines · Eric Blake
Quoted 7 lines · Nan Li
When running the command "dump-guest-memory", we usually need a large space of storage to save the dumpfile into disk. It costs not only much time to save a file in some of hard disks, but also costs limited storage in host. In order to reduce the saving time and make it convenient for users to dump the guest memory, we introduce a Filesystem in Userspace (FUSE) to save the dump file in RAM. It is selectable in the configure file, adding a compiling of package "fuse-devel". It doesn't change the way of dumping guest memory.
Quoted 8 lines
Quoted 1 line
Why introduce FUSE? Can we reuse NBD instead?
The commit message talks of letting QEMU dump to RAM avoiding disk I/O. IOW, it seems like it could just dump to any tmpfs directory.
I'm not really seeing a compelling reason why QEMU needs to mount a fuse filesystem itself - whatever app is using QEMU could handle mounting of fs without QEMU's involvement at all.
The ultimate goal is to export internal QEMU state (memory content, register values) as an ELF file, so you could simply reuse any existing tools that can work with ELF dump files (gdb, crash, makedumpfile, readelf, etc.) instead of re-inventing the wheel for each of those tools.
Quoted 7 lines
Quoted 2 lines
This cannot be really done from outside of QEMU without too much overhead (how would you access guest memory from outside QEMU?).
Maybe I'm missing something, but IIUC the 'dump-guest-memory' monitor command in QEMU already dumps in ELF format which can be used by standard ELF tools. If you don't want that dump to hit disk, then you could mount a tmpfs and then tell QEMU to write to that.
It's not the same kind of beast:
1. You need double the amount of RAM in the host. Oh, yes, some folks like to create VMs with a RAM size of a few hundred GBs of RAM, and then it may not be negligible...
2. The memory must still be copied. This is made a bit worse by the fact that tmpfs does not pre-allocate enough RAM, so even copying a few GBs takes several seconds.
3. Most importantly, if the file is created on the fly, it's a live memory source, i.e. repeated reads will reflect changes in the running guest.
Quoted 8 lines
Some use cases are substantially slower with the dump-then-use approach. For example, makedumpfile can estimate the resulting dump size based on data from the running kernel. It reads only a tiny portion of system RAM to do the analysis, but since only makedumpfile knows the exact addresses, you would still need a full dump for that.
With the FUSE approach, guest pages are served on demand when the application requests them.
AFAICT, what you describe here is not what this patch set is actually doing. This patch isn't modifying the guest-dump-memory monitor command at all - it is just mounting a fuse filesystem and saying you use the guest-dump-memory as normal to write to that filesystem.
Regards,
Daniel
Signature · 4 lines
|: http://berrange.com -o- http://www.flickr.com/photos/dberrange/ :| |: http://libvirt.org -o- http://virt-manager.org :| |: http://autobuild.org -o- http://search.cpan.org/~danberr/ :| |: http://entangle-photo.org -o- http://live.gnome.org/gtk-vnc :|
Re: [Qemu-devel] [PATCH 1/2] Dump: introduce a Filesystem in Userspace
In reply to Petr TesarikQuoted 17 lines · Petr Tesarik
Quoted 10 lines · On Mon, 9 May 2016 09:52:28 -0600 Eric Blake <[email protected]> wrote:
Quoted 7 lines · Nan Li
When running the command "dump-guest-memory", we usually need a large space of storage to save the dumpfile into disk. It costs not only much time to save a file in some of hard disks, but also costs limited storage in host. In order to reduce the saving time and make it convenient for users to dump the guest memory, we introduce a Filesystem in Userspace (FUSE) to save the dump file in RAM. It is selectable in the configure file, adding a compiling of package "fuse-devel". It doesn't change the way of dumping guest memory.
Why introduce FUSE? Can we reuse NBD instead?
Let me answer this one, because it's me who came up with the idea, although I wasn't involved in the actual implementation.
Quoted 8 lines
The idea is to get something more like Linux's
/proc/kcore, but for a QEMU guest. So, yes, the same idea could be implemented as a standalone application which talks to QEMU using the gdb remote protocol and exposes the data in a structured form through a FUSE filesystem.However, the performance of such a solution cannot get even close to that of exposing the data directly from QEMU. Maybe it's still the best way to start the project...
IIUC, the performance penalty will be related to the copying of guest RAM. All the other supplementary information you want (register state etc) is low volume, so should not be performance critical to copy that over the QMP monitor command or via libvirt monitor command passthrough.
So if want to have an external program provide a /proc/kcore like service via FUSE, the problem we need to solve here is a mechanism for providing efficient access to QEMU memory.
I think this can be done quite simply by having QEMU guest RAM exposed via tmpfs or hugetlbfs as appropriate. This approach is what is already used for the vhost-user network backend in an external process which likewise needs copy-free access to guest RAM pages.
Obviously this requires that users start QEMU in this particular setup for RAM, but I don't think that's a particularly onerous requirement as any non-trivial management application will already know how to do this.
Quoted 3 lines
Regarding NBD ... correct me if I'm wrong, but I've always thought NBD can be used to export _disks_ from the QEMU instance, not guest RAM content.
Yeah, NBD seems like the wrong fit for this problem.
Regards,
Daniel
Signature · 4 lines
|: http://berrange.com -o- http://www.flickr.com/photos/dberrange/ :| |: http://libvirt.org -o- http://virt-manager.org :| |: http://autobuild.org -o- http://search.cpan.org/~danberr/ :| |: http://entangle-photo.org -o- http://live.gnome.org/gtk-vnc :|
Re: [Qemu-devel] [PATCH 1/2] Dump: introduce a Filesystem in Userspace
Quoted 23 lines · On Tue, 10 May 2016 09:48:48 +0100 "Daniel P. Berrange" <[email protected]>…
Quoted 22 lines · Petr Tesarik
Quoted 10 lines · On Mon, 9 May 2016 09:52:28 -0600 Eric Blake <[email protected]> wrote:
Quoted 7 lines · Nan Li
When running the command "dump-guest-memory", we usually need a large space of storage to save the dumpfile into disk. It costs not only much time to save a file in some of hard disks, but also costs limited storage in host. In order to reduce the saving time and make it convenient for users to dump the guest memory, we introduce a Filesystem in Userspace (FUSE) to save the dump file in RAM. It is selectable in the configure file, adding a compiling of package "fuse-devel". It doesn't change the way of dumping guest memory.
Why introduce FUSE? Can we reuse NBD instead?
Let me answer this one, because it's me who came up with the idea, although I wasn't involved in the actual implementation.
The idea is to get something more like Linux's
/proc/kcore, but for a QEMU guest. So, yes, the same idea could be implemented as a standalone application which talks to QEMU using the gdb remote protocol and exposes the data in a structured form through a FUSE filesystem.
Quoted 8 lines
Quoted 3 lines
However, the performance of such a solution cannot get even close to that of exposing the data directly from QEMU. Maybe it's still the best way to start the project...
IIUC, the performance penalty will be related to the copying of guest RAM. All the other supplementary information you want (register state etc) is low volume, so should not be performance critical to copy that over the QMP monitor command or via libvirt monitor command passthrough.
Agreed. Even if the number of guest CPUs ever rises to the order of thousands, the additional impact is negligible.
Quoted 3 lines
So if want to have an external program provide a
/proc/kcorelike service via FUSE, the problem we need to solve here is a mechanism for providing efficient access to QEMU memory.
Indeed. This is the main reason for tinkering with QEMU sources at all.
Quoted 4 lines
I think this can be done quite simply by having QEMU guest RAM exposed via tmpfs or hugetlbfs as appropriate. This approach is what is already used for the vhost-user network backend in an external process which likewise needs copy-free access to guest RAM pages.
Ha! We didn't realize this is an option. We can certainly have a look at implementing a generic mechanism for mapping QEMU guest RAM from another process on the host. And yes, this would address any performance concerns nicely.
Quoted 4 lines
Obviously this requires that users start QEMU in this particular setup for RAM, but I don't think that's a particularly onerous requirement as any non-trivial management application will already know how to do this.
Agreed. This is not an issue. Our main target would be libvirt, which adds quite a bit of infrastructure already. ;-)
Thanks for your thoughts!
Petr T
Quoted 11 lines · Nan Li
These two patches introduce a Filesystem in Userspace (FUSE) and add a "fuse-mount" command to support this filesystem.
(1)
When running the command "dump-guest-memory", we usually need a large space of storage to save the dumpfile into disk. It costs not only much time to save a file in some of hard disks, but also costs limited storage in host. In order to reduce the saving time and make it convenient for users to dump the guest memory, we introduce a Filesystem in Userspace (FUSE) to save the dump file in RAM. It is selectable in the configure file, adding a compiling of package "fuse-devel". It doesn't change the way of dumping guest memory.
This FUSE file system looks like a subset of tmpfs. Why don't you just use tmpfs?
Even if there was a reason to reinvent tmpfs, please do that as a separate project. The in-memory file system functionality is not specific to QEMU's dump-guest-memory.
Stefan
Quoted 11 lines · Nan Li
These two patches introduce a Filesystem in Userspace (FUSE) and add a "fuse-mount" command to support this filesystem.
(1)
When running the command "dump-guest-memory", we usually need a large space of storage to save the dumpfile into disk. It costs not only much time to save a file in some of hard disks, but also costs limited storage in host. In order to reduce the saving time and make it convenient for users to dump the guest memory, we introduce a Filesystem in Userspace (FUSE) to save the dump file in RAM. It is selectable in the configure file, adding a compiling of package "fuse-devel". It doesn't change the way of dumping guest memory.
Sorry, I hadn't read the sub-thread with Daniel Berrange.
Re: [Qemu-devel] [PATCH 1/2] Dump: introduce a Filesystem in Userspace
In reply to Petr TesarikQuoted 17 lines · Petr Tesarik
Quoted 10 lines · On Mon, 9 May 2016 09:52:28 -0600 Eric Blake <[email protected]> wrote:
Quoted 7 lines · Nan Li
When running the command "dump-guest-memory", we usually need a large space of storage to save the dumpfile into disk. It costs not only much time to save a file in some of hard disks, but also costs limited storage in host. In order to reduce the saving time and make it convenient for users to dump the guest memory, we introduce a Filesystem in Userspace (FUSE) to save the dump file in RAM. It is selectable in the configure file, adding a compiling of package "fuse-devel". It doesn't change the way of dumping guest memory.
Why introduce FUSE? Can we reuse NBD instead?
Let me answer this one, because it's me who came up with the idea, although I wasn't involved in the actual implementation.
Quoted 8 lines
The idea is to get something more like Linux's
/proc/kcore, but for a QEMU guest. So, yes, the same idea could be implemented as a standalone application which talks to QEMU using the gdb remote protocol and exposes the data in a structured form through a FUSE filesystem.However, the performance of such a solution cannot get even close to that of exposing the data directly from QEMU. Maybe it's still the best way to start the project...
If you want no overhead and are willing to pause the guest, use QEMU's gdb stub (directly, no extra FUSE file system layer). If you cannot pause the guest then take a copy of memory with dump-guest-memory to tmpfs.
There might be a middle-ground where you can copy-on-write pages and let the guest continue to run, but this is probably not worth the effort/complexity.
I find it hard to see where adding more code or using FUSE would make things better?
Stefan
Re: [Qemu-devel] [PATCH 1/2] Dump: introduce a Filesystem in Userspace
Quoted 31 lines
Quoted 1 line
Quoted 1 line · Stefan Hajnoczi
Quoted 8 lines · Petr Tesarik
Quoted 5 lines · On Mon, 9 May 2016 09:52:28 ‑0600 Eric Blake <[email protected]> wrote:
Quoted 4 lines · Nan Li
When running the command "dump‑guest‑memory", we usually need a large space of storage to save the dumpfile into disk. It costs not only much time to save a file in some of hard disks, but also costs limited storage in host. In order to reduce the saving time and make it convenient for users to
dump
Quoted 1 line
Quoted 1 line
Quoted 1 line
the guest memory, we introduce a Filesystem in Userspace (FUSE) to save
the
Quoted 1 line
Quoted 1 line
Quoted 1 line
dump file in RAM. It is selectable in the configure file, adding a
compiling
Quoted 7 lines
Quoted 3 lines
Quoted 1 line
of package "fuse‑devel". It doesn't change the way of dumping guest memory.
Why introduce FUSE? Can we reuse NBD instead?
Let me answer this one, because it's me who came up with the idea, although I wasn't involved in the actual implementation.
Quoted 8 lines
The idea is to get something more like Linux's
/proc/kcore, but for a QEMU guest. So, yes, the same idea could be implemented as a standalone application which talks to QEMU using the gdb remote protocol and exposes the data in a structured form through a FUSE filesystem.However, the performance of such a solution cannot get even close to that of exposing the data directly from QEMU. Maybe it's still the best way to start the project...
Quoted 9 lines
If you want no overhead and are willing to pause the guest, use QEMU's gdb stub (directly, no extra FUSE file system layer). If you cannot pause the guest then take a copy of memory with dump‑guest‑memory to tmpfs.
There might be a middle‑ground where you can copy‑on‑write pages and let the guest continue to run, but this is probably not worth the effort/complexity.
Yes, pausing the guest and then accessing the guest memory to do the core analysis work is much easier than handing the running guest. Thank you for your thoughts.
Quoted 4 lines
I find it hard to see where adding more code or using FUSE would make things better?
Stefan
Re: [Qemu-devel] [PATCH 1/2] Dump: introduce a Filesystem in Userspace
In reply to Petr TesarikQuoted 55 lines
Quoted 1 line
Quoted 1 line · Petr Tesarik
Quoted 8 lines · On Tue, 10 May 2016 09:48:48 +0100 "Daniel P. Berrange" <[email protected]>…
Quoted 7 lines · Petr Tesarik
Quoted 4 lines · On Mon, 9 May 2016 09:52:28 ‑0600 Eric Blake <[email protected]> wrote:
Quoted 3 lines · Nan Li
When running the command "dump‑guest‑memory", we usually need a large space of storage to save the dumpfile into disk. It costs not only much time to save a file in some of hard disks, but also costs limited storage in
host.
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
In order to reduce the saving time and make it convenient for users to
dump
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
the guest memory, we introduce a Filesystem in Userspace (FUSE) to save
the
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
dump file in RAM. It is selectable in the configure file, adding a
compiling
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
of package "fuse‑devel". It doesn't change the way of dumping guest
memory.
Quoted 11 lines
Quoted 11 lines
Quoted 2 lines
Why introduce FUSE? Can we reuse NBD instead?
Let me answer this one, because it's me who came up with the idea, although I wasn't involved in the actual implementation.
The idea is to get something more like Linux's
/proc/kcore, but for a QEMU guest. So, yes, the same idea could be implemented as a standalone application which talks to QEMU using the gdb remote protocol and exposes the data in a structured form through a FUSE filesystem.Quoted 8 lines
Quoted 3 lines
However, the performance of such a solution cannot get even close to that of exposing the data directly from QEMU. Maybe it's still the best way to start the project...
IIUC, the performance penalty will be related to the copying of guest RAM. All the other supplementary information you want (register state etc) is low volume, so should not be performance critical to copy that over the QMP monitor command or via libvirt monitor command passthrough.
Agreed. Even if the number of guest CPUs ever rises to the order of thousands, the additional impact is negligible.
Quoted 3 lines
So if want to have an external program provide a
/proc/kcorelike service via FUSE, the problem we need to solve here is a mechanism for providing efficient access to QEMU memory.Indeed. This is the main reason for tinkering with QEMU sources at all.
Quoted 4 lines
I think this can be done quite simply by having QEMU guest RAM exposed via tmpfs or hugetlbfs as appropriate. This approach is what is already used for the vhost‑user network backend in an external process which likewise needs copy‑free access to guest RAM pages.
Quoted 5 lines
Ha! We didn't realize this is an option. We can certainly have a look at implementing a generic mechanism for mapping QEMU guest RAM from another process on the host. And yes, this would address any performance concerns nicely.
Agreed. It sounds a good option. I will try to investigate it.
Quoted 11 lines
Quoted 4 lines
Obviously this requires that users start QEMU in this particular setup for RAM, but I don't think that's a particularly onerous requirement as any non‑trivial management application will already know how to do this.
Agreed. This is not an issue. Our main target would be libvirt, which adds quite a bit of infrastructure already. ;‑)
Thanks for your thoughts!
Petr T
Thanks very much for all your thoughts.
Nan Li
Re: [Qemu-devel] [PATCH 2/2] Dump: add command "fuse-mount"
In reply to Eric BlakeQuoted 21 lines
Quoted 1 line
Quoted 1 line · Eric Blake
Quoted 8 lines · Nan Li
Add a "fuse-mount" command to support the Filesystem in Userspace (FUSE). It can mount or unmount the filesystem with both hmp and qmp commands. It calls the API function
qemu_fuse_main(int argc, char *argv[]).Signed-off-by Nan Li <[email protected]>---
+++b/qapi-schema.jsonqapi-schema.json line 2290
Quoted 8 lines
qapi-schema.json +5
-0@@ -2283,6 +2283,21 @@ 'returns': 'DumpGuestMemoryCapability' } ## +# @fuse-mount: +# +# mount(unmount) fuse system on 'mountpoint'. +# +# @is_mount: optional if true, umount the fuse system from the mount points/umount/unmount/
Quoted 4 lines
New QMP commands should favor the use of '-' rather than '_' (as in 'is-mount'). But the name '
is_mount' does not even appear below, so you aren't documenting reality.
Right. This parameter should be unmount.
Quoted 9 lines
qapi-schema.json line 2296
Quoted 6 lines
qapi-schema.json +6
-0+# +# @mountpoint: the mount point (a path) of fuse system +# +# Returns: Nothing on success +# +# Since: 2.6You've missed 2.6. This has to be 2.7 or later.
OK. Thanks for pointing it out.
Quoted 8 lines
Review line 2298
Quoted 2 lines
(quoted diff) +2
-0+## +{ 'command': 'fuse-mount', 'data': {'unmount': 'bool', 'mountpoint': 'str'}}
Quoted 1 line
(quoted diff) +1
-0+Signature · 2 lines
Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org
Nan Li
Re: [Qemu-devel] [PATCH 1/2] Dump: introduce a Filesystem in Userspace
In reply to Stefan HajnocziQuoted 23 lines · On Tue, 10 May 2016 10:56:42 +0100 Stefan Hajnoczi <[email protected]> wrote:
Quoted 22 lines · Petr Tesarik
Quoted 10 lines · On Mon, 9 May 2016 09:52:28 -0600 Eric Blake <[email protected]> wrote:
Quoted 7 lines · Nan Li
When running the command "dump-guest-memory", we usually need a large space of storage to save the dumpfile into disk. It costs not only much time to save a file in some of hard disks, but also costs limited storage in host. In order to reduce the saving time and make it convenient for users to dump the guest memory, we introduce a Filesystem in Userspace (FUSE) to save the dump file in RAM. It is selectable in the configure file, adding a compiling of package "fuse-devel". It doesn't change the way of dumping guest memory.
Why introduce FUSE? Can we reuse NBD instead?
Let me answer this one, because it's me who came up with the idea, although I wasn't involved in the actual implementation.
The idea is to get something more like Linux's
/proc/kcore, but for a QEMU guest. So, yes, the same idea could be implemented as a standalone application which talks to QEMU using the gdb remote protocol and exposes the data in a structured form through a FUSE filesystem.
Quoted 6 lines
Quoted 3 lines
However, the performance of such a solution cannot get even close to that of exposing the data directly from QEMU. Maybe it's still the best way to start the project...
If you want no overhead and are willing to pause the guest, use QEMU's gdb stub (directly, no extra FUSE file system layer).
Well, the obvious downside of this solution is that you need GDB protocol support. AFAIK there are more tools which can work with ELF dump files than with the GDB protocol. Sure, I could add GDB protocol support to each and every one of them, but I fail to see how that is better use of time than adding an additional layer which allows to use any ELF-capable tool directly.
Quoted 10 lines
If you cannot
pause the guest then take a copy of memory with dump-guest-memory to tmpfs.There might be a middle-ground where you can copy-on-write pages and let the guest continue to run, but this is probably not worth the effort/complexity.
I find it hard to see where adding more code or using FUSE would make things better?
Please see my explanation in another branch of this thread why generating dump files on the fly is better for some use cases than saving a complete copy.
BTW FUSE is definitely not tmpfs. See the nice diagram on Wikipedia:
https://en.wikipedia.org/wiki/Filesystem_in_Userspace
Our main motivation is not better performance but more flexibility. OTOH why should we burn more CPU cycles than necessary?
Petr T
Re: [Qemu-devel] [PATCH 1/2] Dump: introduce a Filesystem in Userspace
Quoted 33 lines · Petr Tesarik
Quoted 23 lines · On Tue, 10 May 2016 10:56:42 +0100 Stefan Hajnoczi <[email protected]> wrote:
Quoted 22 lines · Petr Tesarik
Quoted 10 lines · On Mon, 9 May 2016 09:52:28 -0600 Eric Blake <[email protected]> wrote:
Quoted 7 lines · Nan Li
When running the command "dump-guest-memory", we usually need a large space of storage to save the dumpfile into disk. It costs not only much time to save a file in some of hard disks, but also costs limited storage in host. In order to reduce the saving time and make it convenient for users to dump the guest memory, we introduce a Filesystem in Userspace (FUSE) to save the dump file in RAM. It is selectable in the configure file, adding a compiling of package "fuse-devel". It doesn't change the way of dumping guest memory.
Why introduce FUSE? Can we reuse NBD instead?
Let me answer this one, because it's me who came up with the idea, although I wasn't involved in the actual implementation.
The idea is to get something more like Linux's
/proc/kcore, but for a QEMU guest. So, yes, the same idea could be implemented as a standalone application which talks to QEMU using the gdb remote protocol and exposes the data in a structured form through a FUSE filesystem.Quoted 6 lines
Quoted 3 lines
However, the performance of such a solution cannot get even close to that of exposing the data directly from QEMU. Maybe it's still the best way to start the project...
If you want no overhead and are willing to pause the guest, use QEMU's gdb stub (directly, no extra FUSE file system layer).
Quoted 6 lines
Well, the obvious downside of this solution is that you need GDB protocol support. AFAIK there are more tools which can work with ELF dump files than with the GDB protocol. Sure, I could add GDB protocol support to each and every one of them, but I fail to see how that is better use of time than adding an additional layer which allows to use any ELF-capable tool directly.
Out of interest, which tools are you thinking about?
I use gdb and crash. Would be interesting to learn about additional options that you are familiar with.
Stefan
Re: [Qemu-devel] [PATCH 1/2] Dump: introduce a Filesystem in Userspace
Quoted 41 lines · On Thu, 12 May 2016 11:09:02 +0100 Stefan Hajnoczi <[email protected]> wrote:
Quoted 33 lines · Petr Tesarik
Quoted 23 lines · On Tue, 10 May 2016 10:56:42 +0100 Stefan Hajnoczi <[email protected]> wrote:
Quoted 22 lines · Petr Tesarik
Quoted 10 lines · On Mon, 9 May 2016 09:52:28 -0600 Eric Blake <[email protected]> wrote:
Quoted 7 lines · Nan Li
When running the command "dump-guest-memory", we usually need a large space of storage to save the dumpfile into disk. It costs not only much time to save a file in some of hard disks, but also costs limited storage in host. In order to reduce the saving time and make it convenient for users to dump the guest memory, we introduce a Filesystem in Userspace (FUSE) to save the dump file in RAM. It is selectable in the configure file, adding a compiling of package "fuse-devel". It doesn't change the way of dumping guest memory.
Why introduce FUSE? Can we reuse NBD instead?
Let me answer this one, because it's me who came up with the idea, although I wasn't involved in the actual implementation.
The idea is to get something more like Linux's
/proc/kcore, but for a QEMU guest. So, yes, the same idea could be implemented as a standalone application which talks to QEMU using the gdb remote protocol and exposes the data in a structured form through a FUSE filesystem.Quoted 6 lines
Quoted 3 lines
However, the performance of such a solution cannot get even close to that of exposing the data directly from QEMU. Maybe it's still the best way to start the project...
If you want no overhead and are willing to pause the guest, use QEMU's gdb stub (directly, no extra FUSE file system layer).
Quoted 6 lines
Well, the obvious downside of this solution is that you need GDB protocol support. AFAIK there are more tools which can work with ELF dump files than with the GDB protocol. Sure, I could add GDB protocol support to each and every one of them, but I fail to see how that is better use of time than adding an additional layer which allows to use any ELF-capable tool directly.
Quoted 4 lines
Out of interest, which tools are you thinking about?
I use gdb and crash. Would be interesting to learn about additional options that you are familiar with.
The one that started my thinking was "makedumpfile". I'm also exploring ways of writing a standalone eppic application on top of libkdumpfile, and, of course, you can use libkdumpfile python bindings today already to write an analysis tool in python which will work equally well on dumps and live VMs.
Petr T