From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:42051) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XG09t-0006Hg-Gx for qemu-devel@nongnu.org; Sat, 09 Aug 2014 02:29:50 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XG09h-0001go-U5 for qemu-devel@nongnu.org; Sat, 09 Aug 2014 02:29:41 -0400 Received: from mail-qa0-x22f.google.com ([2607:f8b0:400d:c00::22f]:57580) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XG09h-0001gA-OY for qemu-devel@nongnu.org; Sat, 09 Aug 2014 02:29:29 -0400 Received: by mail-qa0-f47.google.com with SMTP id i13so6227832qae.20 for ; Fri, 08 Aug 2014 23:29:29 -0700 (PDT) From: Sanidhya Kashyap Date: Sat, 9 Aug 2014 02:26:35 -0400 Message-Id: <1407565595-18861-7-git-send-email-sanidhya.iiith@gmail.com> In-Reply-To: <1407565595-18861-1-git-send-email-sanidhya.iiith@gmail.com> References: <1407565595-18861-1-git-send-email-sanidhya.iiith@gmail.com> Subject: [Qemu-devel] [RFC PATCH v3 6/6] VMState test: cancel mechanism for an already running vmstate testing process List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu list Cc: Sanidhya Kashyap , "Dr. David Alan Gilbert" , Juan Quintela Signed-off-by: Sanidhya Kashyap --- hmp-commands.hx | 14 ++++++++++++++ hmp.c | 6 ++++++ hmp.h | 1 + qapi-schema.json | 9 +++++++++ qmp-commands.hx | 20 ++++++++++++++++++++ savevm.c | 16 ++++++++++++++-- 6 files changed, 64 insertions(+), 2 deletions(-) diff --git a/hmp-commands.hx b/hmp-commands.hx index f74b935..eb543f8 100644 --- a/hmp-commands.hx +++ b/hmp-commands.hx @@ -1823,6 +1823,20 @@ STEXI Set the period to @var{period} (int) for vmstate testing process. ETEXI + { + .name = "test_vmstates_cancel", + .args_type = "", + .params = "", + .help = "cancel the current vmstates testing process", + .mhandler.cmd = hmp_test_vmstates_cancel, +}, + +STEXI +@item test_vmstates_cancel +@findex test_vmstates_cancel +Cancel the current vmstates testing process +ETEXI + STEXI @end table ETEXI diff --git a/hmp.c b/hmp.c index d1f3045..bda1672 100644 --- a/hmp.c +++ b/hmp.c @@ -1799,3 +1799,9 @@ void hmp_test_vmstates_set_period(Monitor *mon, const QDict *qdict) error_free(err); } } + +void hmp_test_vmstates_cancel(Monitor *mon, const QDict *qdict) +{ + qmp_test_vmstates_cancel(NULL); +} + diff --git a/hmp.h b/hmp.h index 32221e3..d72de64 100644 --- a/hmp.h +++ b/hmp.h @@ -98,6 +98,7 @@ void hmp_object_del(Monitor *mon, const QDict *qdict); void hmp_info_memdev(Monitor *mon, const QDict *qdict); void hmp_test_vmstates(Monitor *mon, const QDict *qdict); void hmp_test_vmstates_set_period(Monitor *mon, const QDict *qdict); +void hmp_test_vmstates_cancel(Monitor *mon, const QDict *qdict); void object_add_completion(ReadLineState *rs, int nb_args, const char *str); void object_del_completion(ReadLineState *rs, int nb_args, const char *str); void device_add_completion(ReadLineState *rs, int nb_args, const char *str); diff --git a/qapi-schema.json b/qapi-schema.json index cff9b0f..a1161a9 100644 --- a/qapi-schema.json +++ b/qapi-schema.json @@ -3577,3 +3577,12 @@ ## { 'command' : 'test-vmstates-set-period', 'data' : { 'period': 'int' } } + +## +# @test-vmstates-cancel +# +# cancel the testing vmstates process +# +# Since 2.2 +## +{ 'command': 'test-vmstates-cancel' } diff --git a/qmp-commands.hx b/qmp-commands.hx index bde4fc9..2e06611 100644 --- a/qmp-commands.hx +++ b/qmp-commands.hx @@ -3880,3 +3880,23 @@ Example: -> { "execute": "test-vmstates-set-period", "arguments": { "period": 1024 } } <- { "return": {} } EQMP + + { + .name = "test-vmstates-cancel", + .args_type = "", + .mhandler.cmd_new = qmp_marshal_input_test_vmstates_cancel, + }, + +SQMP +test-vmstates-cancel +-------------------- + +Cancel the current vmstate testing process. + +Arguments: None. + +Example: + +-> { "execute": "test-vmstates-cancel" } +<- { "return": {} } +EQMP diff --git a/savevm.c b/savevm.c index 6ef69a1..48b3579 100644 --- a/savevm.c +++ b/savevm.c @@ -1340,8 +1340,12 @@ static void test_vmstates_cb(void *opaque) if (saved_vm_running) { vm_start(); } - timer_mod(v->timer, qemu_clock_get_ms(QEMU_CLOCK_REALTIME) + - v->period); + if (v->active_state) { + timer_mod(v->timer, v->period + + qemu_clock_get_ms(QEMU_CLOCK_REALTIME)); + } else { + goto testing_end; + } return; } @@ -1453,6 +1457,14 @@ void qmp_test_vmstates_set_period(int64_t period, Error **errp) v->period = period; } +void qmp_test_vmstates_cancel(Error **errp) +{ + VMStateLogState *v = test_vmstates_get_current_state(); + if (v->active_state) { + v->active_state = false; + } +} + /* * ---------------------------------------------------------------------------- */ -- 1.9.3