Re: [Qemu-devel] [PATCH v4 08/11] dump-guest-memory: add qmp event DUMP_COMPLETED

2015-12-02 Thread Peter Xu
On Wed, Dec 02, 2015 at 07:45:52AM -0700, Eric Blake wrote: > On 12/01/2015 06:11 PM, Fam Zheng wrote: > > Please explicitly mention that successful dump emits DUMP_COMPLETED without > > error, and failed dump emits DUMP_COMPLETED that has an error str. > > In fact, I wonder if it would also be

Re: [Qemu-devel] [PATCH v4 09/11] DumpState: adding total_size and written_size fields

2015-12-02 Thread Peter Xu
On Wed, Dec 02, 2015 at 09:32:57AM +0800, Fam Zheng wrote: > On Tue, 12/01 21:28, Peter Xu wrote: > > @@ -333,6 +333,8 @@ static void write_data(DumpState *s, void *buf, int > > length, Error **errp) > > if (ret < 0) { > > error_setg(errp

Re: [Qemu-devel] [PATCH v4 08/11] dump-guest-memory: add qmp event DUMP_COMPLETED

2015-12-02 Thread Peter Xu
On Wed, Dec 02, 2015 at 09:11:31AM +0800, Fam Zheng wrote: > On Tue, 12/01 21:28, Peter Xu wrote: > > + > > +## > > +# @DUMP_COMPLETED > > +# > > +# Emitted when background dump has completed > > +# > > +# @error: #optional human-readable error string

[Qemu-devel] [PATCH v5 10/11] Dump: add qmp command "query-dump"

2015-12-06 Thread Peter Xu
ump >From completed and total, we could know how much work finished by calculating: 100.0 * completed / total (%) Also, enrich DUMP_COMPLETED event to contain dump results when finished. Signed-off-by: Peter Xu <pet...@redhat.com> --- docs/qmp-events.txt | 5 - dump.

[Qemu-devel] [PATCH v5 08/11] dump-guest-memory: add qmp event DUMP_COMPLETED

2015-12-06 Thread Peter Xu
One new QMP event DUMP_COMPLETED is added. When a dump finishes, one DUMP_COMPLETED event will occur to notify the user. Signed-off-by: Peter Xu <pet...@redhat.com> --- docs/qmp-events.txt | 16 dump.c | 15 --- qapi-schema.json| 3 ++-

[Qemu-devel] [PATCH v5 04/11] dump-guest-memory: add dump_in_progress() helper function

2015-12-06 Thread Peter Xu
For now, it has no effect. It will be used in dump detach support. Signed-off-by: Peter Xu <pet...@redhat.com> --- dump.c| 13 + include/qemu-common.h | 4 qmp.c | 14 ++ 3 files changed, 31 insertions(+) diff --git a/dump.c b/

[Qemu-devel] [PATCH v5 07/11] dump-guest-memory: add "detach" support

2015-12-06 Thread Peter Xu
If "detach" is provided, one thread is created to do the dump work, while main thread will return immediately. For each GuestPhysBlock, adding one more field "mr" to points to MemoryRegion that it belongs, also ref the mr before use. Signed-off-by: Peter Xu <pet...@

[Qemu-devel] [PATCH v5 05/11] dump-guest-memory: introduce dump_process() helper function.

2015-12-06 Thread Peter Xu
No functional change. Cleanup only. Signed-off-by: Peter Xu <pet...@redhat.com> --- dump.c| 31 +-- include/sysemu/dump.h | 3 +++ 2 files changed, 24 insertions(+), 10 deletions(-) diff --git a/dump.c b/dump.c index ccd56c8..f0ee9a8

[Qemu-devel] [PATCH v5 06/11] dump-guest-memory: disable dump when in INMIGRATE state

2015-12-06 Thread Peter Xu
Signed-off-by: Peter Xu <pet...@redhat.com> --- dump.c | 5 + 1 file changed, 5 insertions(+) diff --git a/dump.c b/dump.c index f0ee9a8..aa9d1f8 100644 --- a/dump.c +++ b/dump.c @@ -1625,6 +1625,11 @@ void qmp_dump_guest_memory(bool paging, const char *file, DumpState *s;

[Qemu-devel] [PATCH v5 11/11] Dump: add hmp command "info dump"

2015-12-06 Thread Peter Xu
It will calculate percentage of finished work from completed and total. Signed-off-by: Peter Xu <pet...@redhat.com> --- hmp-commands-info.hx | 14 ++ hmp.c| 18 ++ hmp.h| 1 + 3 files changed, 33 insertions(+) diff --git

Re: [Qemu-devel] [PATCH v5 06/11] dump-guest-memory: disable dump when in INMIGRATE state

2015-12-06 Thread Peter Xu
On Mon, Dec 07, 2015 at 02:14:11PM +0800, Fam Zheng wrote: > On Mon, 12/07 13:56, Peter Xu wrote: > > +if (runstate_check(RUN_STATE_INMIGRATE)) { > > +error_setg(errp, "Dump not allowed during incoming migration."); > > +return; > >

Re: [Qemu-devel] [PATCH v5 10/11] Dump: add qmp command "query-dump"

2015-12-06 Thread Peter Xu
On Mon, Dec 07, 2015 at 02:21:44PM +0800, Fam Zheng wrote: > On Mon, 12/07 13:56, Peter Xu wrote: > > /* send DUMP_COMPLETED message (unconditionally) */ > > -qapi_event_send_dump_completed(!!local_err, (local_err ? \ > > +result = qmp_query_dump(NULL); > >

[Qemu-devel] [PATCH v5 09/11] DumpState: adding total_size and written_size fields

2015-12-06 Thread Peter Xu
Here, total_size is the size in bytes to be dumped (raw data, which means before compression), while written_size are bytes handled (raw size too). Signed-off-by: Peter Xu <pet...@redhat.com> --- dump.c| 32 include/sysemu/dump.h | 9 ++

[Qemu-devel] [PATCH v5 02/11] dump-guest-memory: add "detach" flag for QMP/HMP interfaces.

2015-12-06 Thread Peter Xu
This patch only adds the interfaces, but does not implement them. "detach" parameter is made optional, to make sure that all the old dump-guest-memory requests will still be able to work. Signed-off-by: Peter Xu <pet...@redhat.com> --- dump.c | 5 +++-- hmp-

[Qemu-devel] [PATCH v5 00/11] Add basic "detach" support for dump-guest-memory

2015-12-06 Thread Peter Xu
turn immediately. - When dump finished, will receive event DUMP_COMPLETED. - test query-dump before/during/after dump - test kdump with zlib compression, w/ and w/o detach - libvirt - test "virsh dump --memory-only" with default format and kdump-zlib format, work as usual P

[Qemu-devel] [PATCH v5 01/11] dump-guest-memory: cleanup: removing dump_{error|cleanup}().

2015-12-06 Thread Peter Xu
It might be a little bit confusing and error prone to do dump_cleanup() in these two functions. A better way is to do dump_cleanup() before dump finish, no matter whether dump has succeeded or not. Signed-off-by: Peter Xu <pet...@redhat.com> Reviewed-by: Fam Zheng <f...@redhat.com>

[Qemu-devel] [PATCH v5 03/11] dump-guest-memory: using static DumpState, add DumpStatus

2015-12-06 Thread Peter Xu
Instead of malloc/free each time for DumpState, make it static. Added DumpStatus to show status for dump. This is to be used for detached dump. Signed-off-by: Peter Xu <pet...@redhat.com> --- dump.c| 21 - include/sysemu/dump.h | 2 ++ qapi-schem

[Qemu-devel] [PATCH v6 00/11] Add basic "detach" support for dump-guest-memory

2015-12-08 Thread Peter Xu
uery-dump before/during/after dump - test kdump with zlib compression, w/ and w/o detach - libvirt - test "virsh dump --memory-only" with default format and kdump-zlib format, work as usual Peter Xu (11): dump-guest-memory: cleanup: removing dump_{error|cleanup}(). dump-guest-me

[Qemu-devel] [PATCH v6 01/11] dump-guest-memory: cleanup: removing dump_{error|cleanup}().

2015-12-08 Thread Peter Xu
It might be a little bit confusing and error prone to do dump_cleanup() in these two functions. A better way is to do dump_cleanup() before dump finish, no matter whether dump has succeeded or not. Signed-off-by: Peter Xu <pet...@redhat.com> Reviewed-by: Fam Zheng <f...@redhat.com>

[Qemu-devel] [PATCH v6 05/11] dump-guest-memory: introduce dump_process() helper function.

2015-12-08 Thread Peter Xu
No functional change. Cleanup only. Signed-off-by: Peter Xu <pet...@redhat.com> Reviewed-by: Fam Zheng <f...@redhat.com> --- dump.c| 31 +-- include/sysemu/dump.h | 3 +++ 2 files changed, 24 insertions(+), 10 deletions(-) diff --gi

[Qemu-devel] [PATCH v6 10/11] Dump: add hmp command "info dump"

2015-12-08 Thread Peter Xu
It will calculate percentage of finished work from completed and total. Signed-off-by: Peter Xu <pet...@redhat.com> --- hmp-commands-info.hx | 14 ++ hmp.c| 17 + hmp.h| 1 + 3 files changed, 32 insertions(+) diff --git a/hmp-co

[Qemu-devel] [PATCH v6 06/11] dump-guest-memory: disable dump when in INMIGRATE state

2015-12-08 Thread Peter Xu
Signed-off-by: Peter Xu <pet...@redhat.com> Reviewed-by: Fam Zheng <f...@redhat.com> --- dump.c | 5 + 1 file changed, 5 insertions(+) diff --git a/dump.c b/dump.c index f0ee9a8..aa9d1f8 100644 --- a/dump.c +++ b/dump.c @@ -1625,6 +1625,11 @@ void qmp_dump_guest_memory(bool p

[Qemu-devel] [PATCH v6 02/11] dump-guest-memory: add "detach" flag for QMP/HMP interfaces.

2015-12-08 Thread Peter Xu
This patch only adds the interfaces, but does not implement them. "detach" parameter is made optional, to make sure that all the old dump-guest-memory requests will still be able to work. Signed-off-by: Peter Xu <pet...@redhat.com> Reviewed-by: Fam Zheng <f...@redh

[Qemu-devel] [PATCH v6 09/11] Dump: add qmp command "query-dump"

2015-12-08 Thread Peter Xu
ump >From completed and total, we could know how much work finished by calculating: 100.0 * completed / total (%) Signed-off-by: Peter Xu <pet...@redhat.com> --- dump.c | 22 ++ qapi-schema.json | 32 +++- qm

[Qemu-devel] [PATCH v6 04/11] dump-guest-memory: add dump_in_progress() helper function

2015-12-08 Thread Peter Xu
For now, it has no effect. It will be used in dump detach support. Signed-off-by: Peter Xu <pet...@redhat.com> Reviewed-by: Fam Zheng <f...@redhat.com> --- dump.c| 13 + include/qemu-common.h | 4 qmp.c | 14 ++ 3 files

[Qemu-devel] [PATCH v6 11/11] dump-guest-memory: add qmp event DUMP_COMPLETED

2015-12-08 Thread Peter Xu
One new QMP event DUMP_COMPLETED is added. When a dump finishes, one DUMP_COMPLETED event will occur to notify the user. Signed-off-by: Peter Xu <pet...@redhat.com> --- docs/qmp-events.txt | 18 ++ dump.c | 19 +-- qapi/event.json

[Qemu-devel] [PATCH v6 07/11] dump-guest-memory: add "detach" support

2015-12-08 Thread Peter Xu
If "detach" is provided, one thread is created to do the dump work, while main thread will return immediately. For each GuestPhysBlock, adding one more field "mr" to points to MemoryRegion that it belongs, also ref the mr before use. Signed-off-by: Peter Xu <pet...@redha

[Qemu-devel] [PATCH v6 08/11] DumpState: adding total_size and written_size fields

2015-12-08 Thread Peter Xu
Here, total_size is the size in bytes to be dumped (raw data, which means before compression), while written_size are bytes handled (raw size too). Signed-off-by: Peter Xu <pet...@redhat.com> Reviewed-by: Fam Zheng <f...@redhat.com> --- dump.c

[Qemu-devel] [PATCH v6 03/11] dump-guest-memory: using static DumpState, add DumpStatus

2015-12-08 Thread Peter Xu
Instead of malloc/free each time for DumpState, make it static. Added DumpStatus to show status for dump. This is to be used for detached dump. Signed-off-by: Peter Xu <pet...@redhat.com> Reviewed-by: Fam Zheng <f...@redhat.com> --- dump.c| 21 --

Re: [Qemu-devel] [PATCH v3 02/12] dump-guest-memory: add "detach" flag for QMP/HMP interfaces.

2015-12-01 Thread Peter Xu
On Tue, Dec 01, 2015 at 04:09:48PM +0100, Paolo Bonzini wrote: > > > On 01/12/2015 03:18, Peter Xu wrote: > > I think (2) is better in term of lines of codes (and also > > clear). However I may need to keep the QMP interface (to keep the > > has_detach parameter in qmp

Re: [Qemu-devel] [PATCH v4 03/11] dump-guest-memory: using static DumpState, add DumpStatus

2015-12-01 Thread Peter Xu
On Wed, Dec 02, 2015 at 08:46:49AM +0800, Fam Zheng wrote: > On Tue, 12/01 21:28, Peter Xu wrote: > > +if (*errp) { > > +s->status = DUMP_STATUS_FAILED; > > +} else { > > +s->status = DUMP_STATUS_COMPLETED; > > +} > > + >

Re: [Qemu-devel] [PATCH v4 01/11] dump-guest-memory: cleanup: removing dump_{error|cleanup}().

2015-12-01 Thread Peter Xu
On Wed, Dec 02, 2015 at 08:37:36AM +0800, Fam Zheng wrote: > On Tue, 12/01 21:28, Peter Xu wrote: > > It might be a little bit confusing to do dump_cleanup() in these two > > functions and error prone. A better way is to do dump_cleanup() > > I would say "It might

Re: [Qemu-devel] [PATCH v4 09/11] DumpState: adding total_size and written_size fields

2015-12-02 Thread Peter Xu
On Wed, Dec 02, 2015 at 05:49:18PM +0800, Fam Zheng wrote: > On Wed, 12/02 16:49, Peter Xu wrote: > > On Wed, Dec 02, 2015 at 09:32:57AM +0800, Fam Zheng wrote: > > > > @@ -1301,6 +1303,7 @@ static void write_dump_pages(DumpState *s, Error > > > > **errp)

Re: [Qemu-devel] [PATCH v4 06/11] dump-guest-memory: disable dump when in INMIGRATE state

2015-12-01 Thread Peter Xu
On Wed, Dec 02, 2015 at 08:50:48AM +0800, Fam Zheng wrote: > On Tue, 12/01 21:28, Peter Xu wrote: > > /* if there is a dump in background, we should wait until the dump > > * finished */ > > if (dump_in_progress()) { > > error_setg(errp, "Th

Re: [Qemu-devel] [PATCH v5 00/11] Add basic "detach" support for dump-guest-memory

2015-12-07 Thread Peter Xu
On Mon, Dec 07, 2015 at 03:13:02PM -0700, Eric Blake wrote: > On 12/06/2015 10:56 PM, Peter Xu wrote: > > - patch 8 > > - add "DumpQueryResult" in DUMP_COMPLETED event [Eric] > > (since DumpQueryResult is introduced in patch 10, so doing it in > > pa

Re: [Qemu-devel] [PATCH v4 09/11] DumpState: adding total_size and written_size fields

2015-12-02 Thread Peter Xu
On Wed, Dec 02, 2015 at 08:51:48PM +0800, Fam Zheng wrote: > On Wed, 12/02 18:41, Peter Xu wrote: > > On Wed, Dec 02, 2015 at 05:49:18PM +0800, Fam Zheng wrote: > > Label "out" is out of the loop. So, when error happens, it sets the > > errp and directly jump out o

Re: [Qemu-devel] [PATCH v4 08/11] dump-guest-memory: add qmp event DUMP_COMPLETED

2015-12-02 Thread Peter Xu
On Wed, Dec 02, 2015 at 09:01:16AM -0700, Eric Blake wrote: > On 12/02/2015 08:21 AM, Peter Xu wrote: > > Will the raw memory total size useful in any way? I am totally ok to > > add this, just failed to find a way for user to use it besides > > calculating fini

Re: [Qemu-devel] [PATCH REPOST 0/2] Add basic "detach" support for dump-guest-memory

2015-11-24 Thread Peter Xu
On 11/25/2015 10:46 AM, Fam Zheng wrote: > On Tue, 11/24 06:49, Eric Blake wrote: >> On 11/24/2015 04:37 AM, Fam Zheng wrote: >> I think the patch should be dropped, and periodic progress reports should be emitted from within the dump loops that do the heavy lifting. For the

Re: [Qemu-devel] [PATCH REPOST 0/2] Add basic "detach" support for dump-guest-memory

2015-11-24 Thread Peter Xu
On 11/24/2015 08:05 PM, Paolo Bonzini wrote: > > > On 24/11/2015 04:10, Fam Zheng wrote: >> What about all the hot-plug commands that changes the memory layout? > > If the guest is stopped, they shouldn't. device_add does not enable new > BARs for example, the guest does that after it

[Qemu-devel] [PATCH v2 5/8] dump-query: add "dump-query" command to query dump status

2015-11-26 Thread Peter Xu
This patch is only adding the QMP/HMP interface for "dump-query" command, but not implementing them. This command could be used to query background dump status. Please refer to the next patch to see how dump status are defined. Currently, only fake results are returned. Signed-off-by

[Qemu-devel] [PATCH v2 6/8] dump-query: implement "status" of "dump-query" command.

2015-11-26 Thread Peter Xu
t;IN_PROGRESS", "percentage": "{0..100}%" } 3. no dump is running, and the last dump has finished: { "status": "SUCCEEDED|FAILED", "percentage": "N/A" } It's mostly done. Except that we might need more accurate "perce

[Qemu-devel] [PATCH v2 0/8] Add basic "detach" support for dump-guest-memory

2015-11-26 Thread Peter Xu
st detached dump, command return immediately. When dump finished, will receive event DUMP_COMPLETED with a message. - test dump-query before/during/after dump - test kdump with zlib compression, w/ and w/o detach - libvirt - test "virsh dump --memory-only" with default form

[Qemu-devel] [PATCH v2 1/8] dump-guest-memory: cleanup: removing dump_{error|cleanup}().

2015-11-26 Thread Peter Xu
that might happen when dump got errors within the process (e.g., when write_dump_header() fails, it will skip calling dump_cleanup(), which will leads to memory leak for list elements in DumpState). Signed-off-by: Peter Xu <pet...@redhat.com> --- dump.

Re: [Qemu-devel] [PATCH v2 0/8] Add basic "detach" support for dump-guest-memory

2015-11-26 Thread Peter Xu
Hi, all, Sorry that I forgot to CC reviewers and maintainers when posting the patch set. :( Please review! Thanks. Peter On 11/27/2015 10:48 AM, Peter Xu wrote: > Sorry that this v2 series cannot be aligned with the v1 series. One > patch is added at the begining of the series to do som

[Qemu-devel] [PATCH v2 2/8] dump-guest-memory: add "detach" flag for QMP/HMP interfaces.

2015-11-26 Thread Peter Xu
This patch only adds the interfaces, but not implements them. "detach" parameter is made optional, to make sure that all the old dump-guest-memory requests will still be able to work. Signed-off-by: Peter Xu <pet...@redhat.com> --- dump.c | 5 +++-- hmp-commands.hx

[Qemu-devel] [PATCH v2 4/8] dump-guest-memory: add qmp event DUMP_COMPLETED

2015-11-26 Thread Peter Xu
To get aligned with QMP interface, one new QMP event DUMP_COMPLETED is added. It is used when user specified "detach" in dump, and triggered when the dump finishes. Error message will be appended to this event if the dump has failed. Signed-off-by: Peter Xu <pet...@redhat.com&g

[Qemu-devel] [PATCH v2 8/8] dump-query: make the percentage accurate.

2015-11-26 Thread Peter Xu
By calculating the total_size and written_size of memory, we could get relatively accurate percentage of finished dump. Signed-off-by: Peter Xu <pet...@redhat.com> --- dump.c | 7 +-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/dump.c b/dump.c index 65bd5fb..0fcad28

[Qemu-devel] [PATCH v2 3/8] dump-guest-memory: add basic "detach" support.

2015-11-26 Thread Peter Xu
should make sure each MemoryRegion would only be referenced for once. One global struct "GlobalDumpState" is added to store some global informations for dump procedures. One mutex is used to protect the global dump info. Signed-off-by: Peter Xu <pet...@redhat.com> --- dump.c

[Qemu-devel] [PATCH v2 7/8] DumpState: adding total_size and written_size fields

2015-11-26 Thread Peter Xu
Signed-off-by: Peter Xu <pet...@redhat.com> --- dump.c| 36 +--- include/sysemu/dump.h | 9 + 2 files changed, 42 insertions(+), 3 deletions(-) diff --git a/dump.c b/dump.c index 25298b7..65bd5fb 100644 --- a/dump.c +++ b/dump.c

Re: [Qemu-devel] [PATCH v2 3/8] dump-guest-memory: add basic "detach" support.

2015-11-27 Thread Peter Xu
On Fri, Nov 27, 2015 at 11:14:17AM +0100, Paolo Bonzini wrote: > > > On 27/11/2015 07:27, Peter Xu wrote: > > If embed the mr pointer into GuestPhyBlock, then we might need to > > ref/unref one MemoryRegion for multiple times (and I am not sure how > > many, maybe it

Re: [Qemu-devel] [PATCH v2 3/8] dump-guest-memory: add basic "detach" support.

2015-11-27 Thread Peter Xu
On Fri, Nov 27, 2015 at 11:31:00AM +0100, Paolo Bonzini wrote: > [snip] > > + > > +static GlobalDumpState *dump_state_get_global(void) > > +{ > > +static bool init = false; > > +static GlobalDumpState global_dump_state; > > +if (unlikely(!init)) { > > +

Re: [Qemu-devel] [PATCH v2 5/8] dump-query: add "dump-query" command to query dump status

2015-11-27 Thread Peter Xu
On Fri, Nov 27, 2015 at 11:17:52AM +0100, Paolo Bonzini wrote: > > > On 27/11/2015 08:03, Peter Xu wrote: > > > > +{ 'struct': 'DumpStatus', > > > > + 'data': { 'status': 'str', 'percentage': 'str' } } > > > > > > I suggest using enum

Re: [Qemu-devel] [PATCH v2 6/8] dump-query: implement "status" of "dump-query" command.

2015-11-27 Thread Peter Xu
On Fri, Nov 27, 2015 at 11:22:48AM +0100, Paolo Bonzini wrote: > > > On 27/11/2015 03:48, Peter Xu wrote: > > This patch implements the status changes inside dump process. When > > query dump status, three possible results could be: > > > > 1. never started d

Re: [Qemu-devel] [PATCH v2 3/8] dump-guest-memory: add basic "detach" support.

2015-11-26 Thread Peter Xu
On 11/27/2015 01:14 PM, Fam Zheng wrote: > On Fri, 11/27 10:48, Peter Xu wrote: >> This patch implements "detach" for "dump-guest-memory" command. When >> specified, one background thread is created to do the dump work. >> >> When there is a

Re: [Qemu-devel] [PATCH v2 4/8] dump-guest-memory: add qmp event DUMP_COMPLETED

2015-11-26 Thread Peter Xu
On 11/27/2015 01:19 PM, Fam Zheng wrote: > On Fri, 11/27 10:48, Peter Xu wrote: >> @@ -1659,8 +1660,17 @@ static void dump_process(DumpState *s, Error **errp) >> static void *dump_thread(void *data) >> { >> GlobalDumpState *global = (GlobalDumpState *)data;

Re: [Qemu-devel] [PATCH v2 1/8] dump-guest-memory: cleanup: removing dump_{error|cleanup}().

2015-11-26 Thread Peter Xu
On 11/27/2015 12:28 PM, Fam Zheng wrote: > I think when write_dump_header() returns a failure, it does call > dump_cleanup(), in create_header{32,64}. > > But the changes of code in this patch look sane to me, and the new error > handling is definitely looking better. Yes, you are right. I

Re: [Qemu-devel] [PATCH v2 2/8] dump-guest-memory: add "detach" flag for QMP/HMP interfaces.

2015-11-26 Thread Peter Xu
On 11/27/2015 12:31 PM, Fam Zheng wrote: > On Fri, 11/27 10:48, Peter Xu wrote: >> This patch only adds the interfaces, but not implements them. >> "detach" parameter is made optional, to make sure that all the old >> dump-guest-memory requests will still be

Re: [Qemu-devel] [PATCH v2 0/8] Add basic "detach" support for dump-guest-memory

2015-11-26 Thread Peter Xu
On 11/27/2015 01:28 PM, Fam Zheng wrote: > Looks good overall! I've replied patches with a few questions. Thanks! > > Fam Thanks! Will wait for more comments and post v3 later. Peter

Re: [Qemu-devel] [PATCH v2 5/8] dump-query: add "dump-query" command to query dump status

2015-11-26 Thread Peter Xu
On 11/27/2015 01:25 PM, Fam Zheng wrote: > On Fri, 11/27 10:48, Peter Xu wrote: >> This patch is only adding the QMP/HMP interface for "dump-query" >> command, but not implementing them. This command could be used to >> query background dump status. Please refer

Re: [Qemu-devel] [PATCH v2 4/8] dump-guest-memory: add qmp event DUMP_COMPLETED

2015-11-27 Thread Peter Xu
On Fri, Nov 27, 2015 at 11:15:35AM +0100, Paolo Bonzini wrote: > > > On 27/11/2015 03:48, Peter Xu wrote: > > +## > > +# @DUMP_COMPLETED > > +# > > +# Emitted when background dump has completed > > +# > > +# Since: 2.6 > > +## > > +{

Re: [Qemu-devel] [PATCH v2 3/8] dump-guest-memory: add basic "detach" support.

2015-11-27 Thread Peter Xu
On Fri, Nov 27, 2015 at 01:14:25PM +0800, Fam Zheng wrote: > On Fri, 11/27 10:48, Peter Xu wrote: [snip] > > This patch doesn't handle the incoming migration case, i.e. when QEMU is > started with "-incoming", or "-incoming defer". Dump can go wrong when

Re: [Qemu-devel] question: about exec/poison.h

2015-11-30 Thread Peter Xu
On Mon, Nov 30, 2015 at 10:12:10AM +0100, Paolo Bonzini wrote: > > > On 30/11/2015 04:47, Peter Xu wrote: > > > > I met one problem when trying to add a new public function in dump.h > > named "dump_state_get_global" and using it in hmp.c. > > Do

Re: [Qemu-devel] question: about exec/poison.h

2015-11-30 Thread Peter Xu
On Mon, Nov 30, 2015 at 10:28:08AM +0100, Markus Armbruster wrote: > Paolo Bonzini <pbonz...@redhat.com> writes: > > > On 30/11/2015 04:47, Peter Xu wrote: > >> > >> I met one problem when trying to add a new public function in dump.h > >> named

[Qemu-devel] question: about exec/poison.h

2015-11-29 Thread Peter Xu
Hi, all, I met one problem when trying to add a new public function in dump.h named "dump_state_get_global" and using it in hmp.c. What I got is something like: In file included from /root/git/qemu/hmp.c:35:0: /root/git/qemu/include/sysemu/dump.h:26:34: error: attempt to use poisoned

Re: [Qemu-devel] [PATCH v2 4/8] dump-guest-memory: add qmp event DUMP_COMPLETED

2015-11-30 Thread Peter Xu
On Mon, Nov 30, 2015 at 11:18:48AM -0700, Eric Blake wrote: > On 11/26/2015 07:48 PM, Peter Xu wrote: > > To get aligned with QMP interface, one new QMP event DUMP_COMPLETED > > is added. It is used when user specified "detach" in dump, and > > triggered when t

Re: [Qemu-devel] [PATCH v3 02/12] dump-guest-memory: add "detach" flag for QMP/HMP interfaces.

2015-11-30 Thread Peter Xu
On Mon, Nov 30, 2015 at 03:05:10PM -0700, Eric Blake wrote: > On 11/30/2015 04:32 AM, Peter Xu wrote: > > This patch only adds the interfaces, but not implements them. > > "detach" parameter is made optional, to make sure that all the old > > dump-guest-memory requ

Re: [Qemu-devel] [PATCH v3 03/12] dump-guest-memory: using static DumpState, add DumpStatus

2015-11-30 Thread Peter Xu
On Mon, Nov 30, 2015 at 03:08:24PM -0700, Eric Blake wrote: > On 11/30/2015 04:32 AM, Peter Xu wrote: > > Instead of malloc/free each time for DumpState, make it > > static. Added DumpStatus to show status for dump. > > > > This is to be used for detach d

Re: [Qemu-devel] [PATCH v3 08/12] dump-guest-memory: add qmp event DUMP_COMPLETED

2015-11-30 Thread Peter Xu
On Mon, Nov 30, 2015 at 03:12:31PM -0700, Eric Blake wrote: > On 11/30/2015 04:32 AM, Peter Xu wrote: > > +Example: > > + > > +{ "event": "DUMP_COMPLETED", > > + "data": {} } > > Please keep this file sorted. The insertion s

Re: [Qemu-devel] [PATCH v2 2/8] dump-guest-memory: add "detach" flag for QMP/HMP interfaces.

2015-11-30 Thread Peter Xu
On Mon, Nov 30, 2015 at 11:21:23AM -0700, Eric Blake wrote: > On 11/26/2015 07:48 PM, Peter Xu wrote: > > This patch only adds the interfaces, but not implements them. > > s/not implements/does not implement/ > > > "detach" parameter is made optional, to make su

Re: [Qemu-devel] [PATCH v3 03/12] dump-guest-memory: using static DumpState, add DumpStatus

2015-11-30 Thread Peter Xu
On Mon, Nov 30, 2015 at 02:00:28PM +0100, Paolo Bonzini wrote: > > +/* init dump state with specific status */ > > +static void dump_state_prepare(DumpState *s, DumpStatus status) > > +{ > > +bzero(s, sizeof(*s)); > > +s->status = status; > > Either use memcpy, or > > s = (DumpState)

Re: [Qemu-devel] [PATCH v3 05/12] dump-guest-memory: introduce dump_process() helper function.

2015-11-30 Thread Peter Xu
On Mon, Nov 30, 2015 at 01:55:01PM +0100, Paolo Bonzini wrote: > > > On 30/11/2015 12:32, Peter Xu wrote: > > if (*errp) { > > s->status = DUMP_STATUS_FAILED; > > Why not move this "if" to dump_process as well? Yes. I did that in another pa

Re: [Qemu-devel] [PATCH v2 5/8] dump-query: add "dump-query" command to query dump status

2015-11-30 Thread Peter Xu
On Mon, Nov 30, 2015 at 11:27:35AM -0700, Eric Blake wrote: > On 11/26/2015 07:48 PM, Peter Xu wrote: > > This patch is only adding the QMP/HMP interface for "dump-query" > > command, but not implementing them. This command could be used to > > query backg

Re: [Qemu-devel] [PATCH v3 12/12] Dump: enhance the documentations.

2015-11-30 Thread Peter Xu
On Mon, Nov 30, 2015 at 03:22:37PM -0700, Eric Blake wrote: > On 11/30/2015 04:32 AM, Peter Xu wrote: > > Add more documents to mention about "query-dump" and DUMP_COMPLETED > > events. > > > > Signed-off-by: Peter Xu <pet...@redhat.com> > &g

Re: [Qemu-devel] [PATCH v3 10/12] Dump: add qmp command "query-dump"

2015-11-30 Thread Peter Xu
On Mon, Nov 30, 2015 at 03:17:01PM -0700, Eric Blake wrote: > On 11/30/2015 04:32 AM, Peter Xu wrote: > > +DumpQueryResult *qmp_query_dump(Error **errp) > > +{ > > +DumpQueryResult *result = g_malloc0(sizeof(*result)); > > Might be nicer as g_new0(DumpQuery

Re: [Qemu-devel] [PATCH v3 10/12] Dump: add qmp command "query-dump"

2015-11-30 Thread Peter Xu
On Mon, Nov 30, 2015 at 01:56:42PM +0100, Paolo Bonzini wrote: > > > On 30/11/2015 12:32, Peter Xu wrote: > > +{ > > +DumpQueryResult *result = g_malloc0(sizeof(*result)); > > +DumpState *state = dump_state_get_global(); > > +result->sta

[Qemu-devel] [PATCH v3 02/12] dump-guest-memory: add "detach" flag for QMP/HMP interfaces.

2015-11-30 Thread Peter Xu
This patch only adds the interfaces, but not implements them. "detach" parameter is made optional, to make sure that all the old dump-guest-memory requests will still be able to work. Signed-off-by: Peter Xu <pet...@redhat.com> --- dump.c | 5 +++-- hmp-commands.hx

[Qemu-devel] [PATCH v3 06/12] dump-guest-memory: disable dump when in INMIGRATE state

2015-11-30 Thread Peter Xu
Signed-off-by: Peter Xu <pet...@redhat.com> --- dump.c | 6 +- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/dump.c b/dump.c index c8ae5c3..5b9def3 100644 --- a/dump.c +++ b/dump.c @@ -1628,13 +1628,17 @@ void qmp_dump_guest_memory(bool paging, const char *file, Dum

[Qemu-devel] [PATCH v3 11/12] Dump: add hmp command "info dump"

2015-11-30 Thread Peter Xu
It will calculate percentage of finished work from written_bytes and total_bytes. Signed-off-by: Peter Xu <pet...@redhat.com> --- hmp-commands-info.hx | 14 ++ hmp.c| 18 ++ hmp.h| 1 + 3 files changed, 33 insertions(+) diff

Re: [Qemu-devel] question: about exec/poison.h

2015-11-30 Thread Peter Xu
On Mon, Nov 30, 2015 at 11:36:41AM +0100, Paolo Bonzini wrote: > > > On 30/11/2015 10:47, Peter Xu wrote: > > So from what I understand from your reply, I could include the > > percentage value into "query-dump", right? :) > > If you have the written and

[Qemu-devel] [PATCH v3 00/12] Add basic "detach" support for dump-guest-memory

2015-11-30 Thread Peter Xu
ommand return immediately. When dump finished, will receive event DUMP_COMPLETED with a message. - test query-dump before/during/after dump - test kdump with zlib compression, w/ and w/o detach - libvirt - test "virsh dump --memory-only" with default format and kdump-zlib f

[Qemu-devel] [PATCH v3 01/12] dump-guest-memory: cleanup: removing dump_{error|cleanup}().

2015-11-30 Thread Peter Xu
It might be a little bit confusing to do dump_cleanup() in these two functions and error prone. A better way is to do dump_cleanup() before dump finish, no matter whether dump has succeeded or not. Signed-off-by: Peter Xu <pet...@redhat.com> --- dump.

[Qemu-devel] [PATCH v3 05/12] dump-guest-memory: introduce dump_process() helper function.

2015-11-30 Thread Peter Xu
No functional change. Cleanup only. Signed-off-by: Peter Xu <pet...@redhat.com> --- dump.c| 19 ++- include/sysemu/dump.h | 3 +++ 2 files changed, 17 insertions(+), 5 deletions(-) diff --git a/dump.c b/dump.c index 110dbf9..c8ae5c3 100644 --- a/dump.c

[Qemu-devel] [PATCH v3 08/12] dump-guest-memory: add qmp event DUMP_COMPLETED

2015-11-30 Thread Peter Xu
One new QMP event DUMP_COMPLETED is added. It is used when user specified "detach" in dump, and triggered when the dump finishes (either succeeded or failed). If failed, one "err" data will be passed with specific error message. Signed-off-by: Peter Xu <pet...@redhat.com>

[Qemu-devel] [PATCH v3 04/12] dump-guest-memory: add dump_in_progress() helper function

2015-11-30 Thread Peter Xu
For now, it has no effect. It will be used in dump detach support. Signed-off-by: Peter Xu <pet...@redhat.com> --- dump.c| 13 + include/qemu-common.h | 4 qmp.c | 14 ++ 3 files changed, 31 insertions(+) diff --git a/dump.c b/

[Qemu-devel] [PATCH v3 03/12] dump-guest-memory: using static DumpState, add DumpStatus

2015-11-30 Thread Peter Xu
Instead of malloc/free each time for DumpState, make it static. Added DumpStatus to show status for dump. This is to be used for detach dump. Signed-off-by: Peter Xu <pet...@redhat.com> --- dump.c| 30 +++--- include/sysemu/dump.h | 2 ++

[Qemu-devel] [PATCH v3 07/12] dump-guest-memory: add "detach" support

2015-11-30 Thread Peter Xu
If "detach" is provided, one thread is created to do the dump work, while main thread will return immediately. For each GuestPhysBlock, adding one more field "mr" to points to MemoryRegion that it belongs, also ref the mr before use. Signed-off-by: Peter Xu <pet...@

[Qemu-devel] [PATCH v3 12/12] Dump: enhance the documentations.

2015-11-30 Thread Peter Xu
Add more documents to mention about "query-dump" and DUMP_COMPLETED events. Signed-off-by: Peter Xu <pet...@redhat.com> --- qapi-schema.json | 7 +-- qmp-commands.hx | 4 +++- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/qapi-schema.json b/qapi-schema.js

[Qemu-devel] [PATCH v3 10/12] Dump: add qmp command "query-dump"

2015-11-30 Thread Peter Xu
atest dump >From written_bytes and total_bytes, we could see how much work finished by calculating: 100.0 * written_bytes / total_bytes (%) Signed-off-by: Peter Xu <pet...@redhat.com> --- dump.c | 10 ++ qapi-schema.json | 29 + qm

[Qemu-devel] [PATCH v3 09/12] DumpState: adding total_size and written_size fields

2015-11-30 Thread Peter Xu
Here, total_size is the size in bytes to be dumped (raw data, which means before compression), while written_size are bytes handled (raw size too). Signed-off-by: Peter Xu <pet...@redhat.com> --- dump.c| 32 include/sysemu/dump.h | 9 ++

Re: [Qemu-devel] question: about exec/poison.h

2015-11-30 Thread Peter Xu
On Mon, Nov 30, 2015 at 09:06:45AM +0100, Markus Armbruster wrote: > Peter Xu <pet...@redhat.com> writes: > > > Hi, all, > > > > I met one problem when trying to add a new public function in dump.h > > named "dump_state_get_global" and using

Re: [Qemu-devel] [PATCH v3 10/12] Dump: add qmp command "query-dump"

2015-12-01 Thread Peter Xu
On Tue, Dec 01, 2015 at 10:54:48AM +0100, Paolo Bonzini wrote: > > > On 01/12/2015 04:57, Peter Xu wrote: > >> > You need a mutex around the reads of ->status and ->written_size. > > Could I avoid using mutex here? Let me try to explain what I > > thought.

Re: [Qemu-devel] [PATCH v3 10/12] Dump: add qmp command "query-dump"

2015-12-01 Thread Peter Xu
On Tue, Dec 01, 2015 at 01:37:37PM +0100, Paolo Bonzini wrote: > atomic_mb_{read,set} does order accesses to the variable against > all other accesses. In this case I'd prefer it to smp_wmb/rmb, because > the writes to written_size are far from the writes to status. Yes... It should be again

Re: [Qemu-devel] [PATCH v3 10/12] Dump: add qmp command "query-dump"

2015-12-01 Thread Peter Xu
On Tue, Dec 01, 2015 at 01:47:08PM +0100, Paolo Bonzini wrote: > > > On 01/12/2015 13:45, Peter Xu wrote: > >> > It's a matter of taste though. What you wrote above is certainly okay > >> > as well. > > Thanks for the explanation. Then I will choose

[Qemu-devel] [PATCH v4 02/11] dump-guest-memory: add "detach" flag for QMP/HMP interfaces.

2015-12-01 Thread Peter Xu
This patch only adds the interfaces, but does not implement them. "detach" parameter is made optional, to make sure that all the old dump-guest-memory requests will still be able to work. Signed-off-by: Peter Xu <pet...@redhat.com> --- dump.c | 5 +++-- hmp-

[Qemu-devel] [PATCH v4 00/11] Add basic "detach" support for dump-guest-memory

2015-12-01 Thread Peter Xu
[Paolo] Test Done: - QMP & HMP - test default dump (sync), work as usual - test detached dump, command return immediately. - When dump finished, will receive event DUMP_COMPLETED. - test query-dump before/during/after dump - test kdump with zlib compression, w/ and w/o detach - lib

[Qemu-devel] [PATCH v4 10/11] Dump: add qmp command "query-dump"

2015-12-01 Thread Peter Xu
ump >From completed and total, we could know how much work finished by calculating: 100.0 * completed / total (%) Signed-off-by: Peter Xu <pet...@redhat.com> --- dump.c | 23 +-- qapi-schema.json | 34 -- qm

[Qemu-devel] [PATCH v4 11/11] Dump: add hmp command "info dump"

2015-12-01 Thread Peter Xu
It will calculate percentage of finished work from completed and total. Signed-off-by: Peter Xu <pet...@redhat.com> --- hmp-commands-info.hx | 14 ++ hmp.c| 18 ++ hmp.h| 1 + 3 files changed, 33 insertions(+) diff --git

[Qemu-devel] [PATCH v4 01/11] dump-guest-memory: cleanup: removing dump_{error|cleanup}().

2015-12-01 Thread Peter Xu
It might be a little bit confusing to do dump_cleanup() in these two functions and error prone. A better way is to do dump_cleanup() before dump finish, no matter whether dump has succeeded or not. Signed-off-by: Peter Xu <pet...@redhat.com> --- dump.

[Qemu-devel] [PATCH v4 06/11] dump-guest-memory: disable dump when in INMIGRATE state

2015-12-01 Thread Peter Xu
Signed-off-by: Peter Xu <pet...@redhat.com> --- dump.c | 6 +- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/dump.c b/dump.c index e46749d..65d1f7e 100644 --- a/dump.c +++ b/dump.c @@ -1626,13 +1626,17 @@ void qmp_dump_guest_memory(bool paging, const char *file, Dum

[Qemu-devel] [PATCH v4 04/11] dump-guest-memory: add dump_in_progress() helper function

2015-12-01 Thread Peter Xu
For now, it has no effect. It will be used in dump detach support. Signed-off-by: Peter Xu <pet...@redhat.com> --- dump.c| 13 + include/qemu-common.h | 4 qmp.c | 14 ++ 3 files changed, 31 insertions(+) diff --git a/dump.c b/

  1   2   3   4   5   6   7   8   9   10   >