From patchwork Fri Jul 20 14:34:38 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anthony PERARD X-Patchwork-Id: 172285 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 334342C0201 for ; Sat, 21 Jul 2012 00:40:12 +1000 (EST) Received: from localhost ([::1]:50778 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SsENG-00051C-4v for incoming@patchwork.ozlabs.org; Fri, 20 Jul 2012 10:40:10 -0400 Received: from eggs.gnu.org ([208.118.235.92]:40476) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SsEMs-0004j8-5P for qemu-devel@nongnu.org; Fri, 20 Jul 2012 10:39:51 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1SsEMq-0007wj-CV for qemu-devel@nongnu.org; Fri, 20 Jul 2012 10:39:46 -0400 Received: from smtp.citrix.com ([66.165.176.89]:55275) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SsEMq-0007wJ-5Q for qemu-devel@nongnu.org; Fri, 20 Jul 2012 10:39:44 -0400 X-IronPort-AV: E=Sophos;i="4.77,623,1336363200"; d="scan'208";a="32146763" Received: from ftlpmailmx01.citrite.net ([10.13.107.65]) by FTLPIPO01.CITRIX.COM with ESMTP/TLS/RC4-MD5; 20 Jul 2012 10:39:43 -0400 Received: from ukmail1.uk.xensource.com (10.80.16.128) by smtprelay.citrix.com (10.13.107.65) with Microsoft SMTP Server id 8.3.213.0; Fri, 20 Jul 2012 10:39:42 -0400 Received: from [10.80.3.61] (helo=perard.uk.xensource.com) by ukmail1.uk.xensource.com with esmtp (Exim 4.69) (envelope-from ) id 1SsEHz-0001KX-Qc; Fri, 20 Jul 2012 15:34:43 +0100 From: Anthony PERARD To: QEMU-devel Date: Fri, 20 Jul 2012 15:34:38 +0100 Message-ID: <1342794882-30648-2-git-send-email-anthony.perard@citrix.com> X-Mailer: git-send-email 1.7.2.5 In-Reply-To: <1342794882-30648-1-git-send-email-anthony.perard@citrix.com> References: <1342794882-30648-1-git-send-email-anthony.perard@citrix.com> MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 66.165.176.89 Cc: Anthony Liguori , Xen Devel , Stefano Stabellini , Avi Kivity , Anthony PERARD , Luiz Capitulino Subject: [Qemu-devel] [PATCH V2 1/5] QMP, Introduce xen-set-global-dirty-log command. 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 This command is used during a migration of a guest under Xen. It calls memory_global_dirty_log_start or memory_global_dirty_log_stop according to the argument pass to the command. Signed-off-by: Anthony PERARD Reviewed-by: Luiz Capitulino --- qapi-schema.json | 13 +++++++++++++ qmp-commands.hx | 24 ++++++++++++++++++++++++ xen-all.c | 15 +++++++++++++++ xen-stub.c | 5 +++++ 4 files changed, 57 insertions(+), 0 deletions(-) diff --git a/qapi-schema.json b/qapi-schema.json index a92adb1..e521ea4 100644 --- a/qapi-schema.json +++ b/qapi-schema.json @@ -1765,6 +1765,19 @@ { 'command': 'xen-save-devices-state', 'data': {'filename': 'str'} } ## +# @xen-set-global-dirty-log +# +# Enable or disable the global dirty log mode. +# +# @enable: true to enable, false to disable. +# +# Returns: nothing +# +# Since: 1.2 +## +{ 'command': 'xen-set-global-dirty-log', 'data': { 'enable': 'bool' } } + +## # @device_del: # # Remove a device from a guest diff --git a/qmp-commands.hx b/qmp-commands.hx index e3cf3c5..961f5c0 100644 --- a/qmp-commands.hx +++ b/qmp-commands.hx @@ -468,6 +468,30 @@ Example: EQMP { + .name = "xen-set-global-dirty-log", + .args_type = "enable:b", + .mhandler.cmd_new = qmp_marshal_input_xen_set_global_dirty_log, + }, + +SQMP +xen-set-global-dirty-log +------- + +Enable or disable the global dirty log mode. + +Arguments: + +- "enable": Enable it or disable it. + +Example: + +-> { "execute": "xen-set-global-dirty-log", + "arguments": { "enable": true } } +<- { "return": {} } + +EQMP + + { .name = "migrate", .args_type = "detach:-d,blk:-b,inc:-i,uri:s", .mhandler.cmd_new = qmp_marshal_input_migrate, diff --git a/xen-all.c b/xen-all.c index 61def2e..e9c7ebf 100644 --- a/xen-all.c +++ b/xen-all.c @@ -14,6 +14,7 @@ #include "hw/pc.h" #include "hw/xen_common.h" #include "hw/xen_backend.h" +#include "qmp-commands.h" #include "range.h" #include "xen-mapcache.h" @@ -36,6 +37,7 @@ static MemoryRegion ram_memory, ram_640k, ram_lo, ram_hi; static MemoryRegion *framebuffer; +static bool xen_in_migration; /* Compatibility with older version */ #if __XEN_LATEST_INTERFACE_VERSION__ < 0x0003020a @@ -552,10 +554,14 @@ static void xen_log_sync(MemoryListener *listener, MemoryRegionSection *section) static void xen_log_global_start(MemoryListener *listener) { + if (xen_enabled()) { + xen_in_migration = true; + } } static void xen_log_global_stop(MemoryListener *listener) { + xen_in_migration = false; } static void xen_eventfd_add(MemoryListener *listener, @@ -588,6 +594,15 @@ static MemoryListener xen_memory_listener = { .priority = 10, }; +void qmp_xen_set_global_dirty_log(bool enable, Error **errp) +{ + if (enable) { + memory_global_dirty_log_start(); + } else { + memory_global_dirty_log_stop(); + } +} + /* VCPU Operations, MMIO, IO ring ... */ static void xen_reset_vcpu(void *opaque) diff --git a/xen-stub.c b/xen-stub.c index 8ff2b79..5e66ba8 100644 --- a/xen-stub.c +++ b/xen-stub.c @@ -11,6 +11,7 @@ #include "qemu-common.h" #include "hw/xen.h" #include "memory.h" +#include "qmp-commands.h" void xenstore_store_pv_console_info(int i, CharDriverState *chr) { @@ -54,3 +55,7 @@ int xen_init(void) void xen_register_framebuffer(MemoryRegion *mr) { } + +void qmp_xen_set_global_dirty_log(bool enable, Error **errp) +{ +}