From patchwork Fri Jul 25 15:39:35 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sanidhya Kashyap X-Patchwork-Id: 373739 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 1605F140107 for ; Sat, 26 Jul 2014 01:45:34 +1000 (EST) Received: from localhost ([::1]:55500 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XAhga-0007mn-8B for incoming@patchwork.ozlabs.org; Fri, 25 Jul 2014 11:45:32 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:59427) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XAhci-0001No-26 for qemu-devel@nongnu.org; Fri, 25 Jul 2014 11:41:41 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XAhcZ-0001Zr-0m for qemu-devel@nongnu.org; Fri, 25 Jul 2014 11:41:32 -0400 Received: from mail-pa0-x235.google.com ([2607:f8b0:400e:c03::235]:65037) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XAhcY-0001Zj-PP for qemu-devel@nongnu.org; Fri, 25 Jul 2014 11:41:22 -0400 Received: by mail-pa0-f53.google.com with SMTP id kq14so6186784pab.26 for ; Fri, 25 Jul 2014 08:41:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=V3+EVXZ8HVPvuVqtC4lSSfdgm4s4+04zwysAkmYfvpo=; b=z4LbRYRQC4dL8zpmiVodDLDxERfZEW03sTsBgglKBbriP9/TQMj6xp8tBIevWIOT2q m0N5xOT7977GMG7wk19kPAj2xvGLzTCkCrlWalVscY7VFpYGZbJG/8wi0FBjbcaueQZZ pNWgOlqrSK3wHZSO0Mr+GolM/NI3dwOBQG18wBx6V1+3MheNbWJi27BgX/Rqxf7Pa3p4 zp8hPOLYLvlDhkUhLllvxRTZR9S3NMYdZlcbA2M+j5ocHrjqFW+fn5SagUYQelmJSlNk OXZAwSTLSsBJx1jpvjkmtJ4x+V3GuuPO3MGAemWpi1ZlPg2IK53mUrxd0OwTuOgXAKNC O8Tw== X-Received: by 10.66.141.71 with SMTP id rm7mr19709863pab.120.1406302881825; Fri, 25 Jul 2014 08:41:21 -0700 (PDT) Received: from localhost.localdomain ([106.219.148.212]) by mx.google.com with ESMTPSA id am3sm3693331pbd.18.2014.07.25.08.41.15 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 25 Jul 2014 08:41:21 -0700 (PDT) From: Sanidhya Kashyap To: qemu list Date: Fri, 25 Jul 2014 21:09:35 +0530 Message-Id: <1406302776-2306-12-git-send-email-sanidhya.iiith@gmail.com> X-Mailer: git-send-email 1.9.3 In-Reply-To: <1406302776-2306-1-git-send-email-sanidhya.iiith@gmail.com> References: <1406302776-2306-1-git-send-email-sanidhya.iiith@gmail.com> X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-Received-From: 2607:f8b0:400e:c03::235 Cc: Sanidhya Kashyap , "Dr. David Alan Gilbert" , Juan Quintela Subject: [Qemu-devel] [PATCH RFC v2 11/12] VMState test: cancel mechanism for an already running vmstate testing process X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Signed-off-by: Sanidhya Kashyap --- qapi-schema.json | 9 +++++++++ qmp-commands.hx | 19 +++++++++++++++++++ savevm.c | 16 ++++++++++++++-- 3 files changed, 42 insertions(+), 2 deletions(-) diff --git a/qapi-schema.json b/qapi-schema.json index 13e922e..91f1672 100644 --- a/qapi-schema.json +++ b/qapi-schema.json @@ -3574,3 +3574,12 @@ ## { 'command' : 'test-vmstates-set-period', 'data' : { 'period': 'int' } } + +## +# @log-dirty-bitmap-cancel +# +# cancel the testing vmstates process +# +# Since 2.2 +## +{ 'command': 'test-vmstates-cancel' } diff --git a/qmp-commands.hx b/qmp-commands.hx index 2f019b0..1035885 100644 --- a/qmp-commands.hx +++ b/qmp-commands.hx @@ -3865,3 +3865,22 @@ Example: <- { "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 8b75691..66597db 100644 --- a/savevm.c +++ b/savevm.c @@ -1365,8 +1365,12 @@ 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->period); + if (v->active_state) { + timer_mod(v->timer, v->period + + qemu_clock_get_ms(QEMU_CLOCK_REALTIME)); + } else { + goto testing_end; + } return; } @@ -1482,6 +1486,14 @@ void qmp_test_vmstates_set_period(int64_t period, Error **errp) v->period = period; } +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;