From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:50919) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1X4Ca4-0006d1-VS for qemu-devel@nongnu.org; Mon, 07 Jul 2014 13:20:06 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1X4CZv-0000hK-Pl for qemu-devel@nongnu.org; Mon, 07 Jul 2014 13:19:56 -0400 Received: from mail-pa0-x233.google.com ([2607:f8b0:400e:c03::233]:33347) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1X4CZv-0000gu-F3 for qemu-devel@nongnu.org; Mon, 07 Jul 2014 13:19:47 -0400 Received: by mail-pa0-f51.google.com with SMTP id hz1so5734748pad.24 for ; Mon, 07 Jul 2014 10:19:46 -0700 (PDT) From: Sanidhya Kashyap Date: Mon, 7 Jul 2014 22:48:04 +0530 Message-Id: <1404753484-26693-6-git-send-email-sanidhya.iiith@gmail.com> In-Reply-To: <1404753484-26693-1-git-send-email-sanidhya.iiith@gmail.com> References: <1404753484-26693-1-git-send-email-sanidhya.iiith@gmail.com> Subject: [Qemu-devel] [RFC PATCH v1 5/5] 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 This patch helps in cancelling an already executing vmstate testing process. 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 | 17 +++++++++++++++-- 6 files changed, 65 insertions(+), 2 deletions(-) diff --git a/hmp-commands.hx b/hmp-commands.hx index efe4354..6187d59 100644 --- a/hmp-commands.hx +++ b/hmp-commands.hx @@ -1818,6 +1818,20 @@ STEXI Set the sinterval to @var{sinterval} (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 7378727..d47877b 100644 --- a/hmp.c +++ b/hmp.c @@ -1742,3 +1742,9 @@ void hmp_test_vmstates_set_sinterval(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 737dae2..af720bc 100644 --- a/hmp.h +++ b/hmp.h @@ -96,6 +96,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_sinterval(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 2eb8bc4..1e914c5 100644 --- a/qapi-schema.json +++ b/qapi-schema.json @@ -3502,3 +3502,12 @@ ## { 'command' : 'test-vmstates-set-sinterval', 'data' : { 'sinterval': 'int' } } + +## +# @log-dirty-bitmap-cancel +# +# cancel the testing vmstates process +# +# Since 2.1 +## +{ 'command': 'test-vmstates-cancel' } diff --git a/qmp-commands.hx b/qmp-commands.hx index 2c25dde..a336b50 100644 --- a/qmp-commands.hx +++ b/qmp-commands.hx @@ -3805,3 +3805,23 @@ Example: -> { "execute": "test-vmstates-set-sinterval", "arguments": { "sinterval": 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 8a81355..c760bdb 100644 --- a/savevm.c +++ b/savevm.c @@ -1229,8 +1229,13 @@ static void vmstate_test_cb(void *opaque) if (saved_vm_running) { vm_start(); } - timer_mod(v->timer, qemu_clock_get_ms(QEMU_CLOCK_REALTIME) + - v->sleep_interval); + + if (v->active_state) { + timer_mod(v->timer, v->sleep_interval + + qemu_clock_get_ms(QEMU_CLOCK_REALTIME)); + } else { + goto testing_end; + } return; } @@ -1298,6 +1303,14 @@ void qmp_test_vmstates_set_sinterval(int64_t sinterval, Error **errp) v->sleep_interval = sinterval; } +void qmp_test_vmstates_cancel(Error **errp) +{ + VMStateLogState *v = vmstate_current_state(); + if (v->active_state) { + v->active_state = false; + } +} + void qmp_xen_save_devices_state(const char *filename, Error **errp) { QEMUFile *f; -- 1.9.3