From patchwork Wed Jan 30 10:35:57 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Orit Wasserman X-Patchwork-Id: 216825 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 A70DC2C007A for ; Wed, 30 Jan 2013 21:57:33 +1100 (EST) Received: from localhost ([::1]:34728 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1U0V19-0006Tz-CM for incoming@patchwork.ozlabs.org; Wed, 30 Jan 2013 05:35:47 -0500 Received: from eggs.gnu.org ([208.118.235.92]:43916) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1U0V0a-0005UL-SI for qemu-devel@nongnu.org; Wed, 30 Jan 2013 05:35:14 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1U0V0Z-0006lj-Ky for qemu-devel@nongnu.org; Wed, 30 Jan 2013 05:35:12 -0500 Received: from mx1.redhat.com ([209.132.183.28]:28347) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1U0V0Z-0006kD-Bq for qemu-devel@nongnu.org; Wed, 30 Jan 2013 05:35:11 -0500 Received: from int-mx10.intmail.prod.int.phx2.redhat.com (int-mx10.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id r0UAZ9FV002523 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Wed, 30 Jan 2013 05:35:09 -0500 Received: from dhcp-1-120.tlv.redhat.com (vpn-200-67.tlv.redhat.com [10.35.200.67]) by int-mx10.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id r0UAYiS6022984; Wed, 30 Jan 2013 05:35:02 -0500 From: Orit Wasserman To: qemu-devel@nongnu.org Date: Wed, 30 Jan 2013 12:35:57 +0200 Message-Id: <1359542158-30060-5-git-send-email-owasserm@redhat.com> In-Reply-To: <1359542158-30060-1-git-send-email-owasserm@redhat.com> References: <1359542158-30060-1-git-send-email-owasserm@redhat.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.23 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 209.132.183.28 Cc: aliguori@us.ibm.com, quintela@redhat.com, lcapitulino@redhat.com, Orit Wasserman , pbonzini@redhat.com Subject: [Qemu-devel] [PATCH 4/5] Disable XBZRLE during migrate to file if it is active 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 XBZRLE is not effective when migrating to file. Disabling it automatically will remove the need to update the command line to allow loading a guest from a file that was in XBZRLE format. Signed-off-by: Orit Wasserman --- include/migration/migration.h | 1 + migration-exec.c | 6 ++++++ migration.c | 9 +++++++++ 3 files changed, 16 insertions(+) diff --git a/include/migration/migration.h b/include/migration/migration.h index a8c9639..8577a0f 100644 --- a/include/migration/migration.h +++ b/include/migration/migration.h @@ -129,6 +129,7 @@ int xbzrle_encode_buffer(uint8_t *old_buf, uint8_t *new_buf, int slen, int xbzrle_decode_buffer(uint8_t *src, int slen, uint8_t *dst, int dlen); int migrate_use_xbzrle(void); +void migrate_disable_xbzrle(void); int64_t migrate_xbzrle_cache_size(void); int64_t xbzrle_cache_resize(int64_t new_size); diff --git a/migration-exec.c b/migration-exec.c index a051a6e..98ba41a 100644 --- a/migration-exec.c +++ b/migration-exec.c @@ -61,6 +61,12 @@ void exec_start_outgoing_migration(MigrationState *s, const char *command, Error { FILE *f; + /* there is no point in using XBZRLE when migrating to file */ + if (migrate_use_xbzrle()) { + DPRINTF("XBZRLE active during migrate to file - disabling\n"); + migrate_disable_xbzrle(); + } + f = popen(command, "w"); if (f == NULL) { error_setg_errno(errp, errno, "failed to popen the migration target"); diff --git a/migration.c b/migration.c index 77c1971..e32635e 100644 --- a/migration.c +++ b/migration.c @@ -510,6 +510,15 @@ int migrate_use_xbzrle(void) return s->enabled_capabilities[MIGRATION_CAPABILITY_XBZRLE]; } +void migrate_disable_xbzrle(void) +{ + MigrationState *s; + + s = migrate_get_current(); + + s->enabled_capabilities[MIGRATION_CAPABILITY_XBZRLE] = false; +} + int64_t migrate_xbzrle_cache_size(void) { MigrationState *s;