From nobody Tue May 7 21:03:11 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1495121736433927.9030789328243; Thu, 18 May 2017 08:35:36 -0700 (PDT) Received: from localhost ([::1]:54387 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dBNSg-0003hN-HU for importer@patchew.org; Thu, 18 May 2017 11:35:34 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:48520) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dBNRD-0002ns-3W for qemu-devel@nongnu.org; Thu, 18 May 2017 11:34:04 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dBNRB-000079-Lm for qemu-devel@nongnu.org; Thu, 18 May 2017 11:34:03 -0400 Received: from mx1.redhat.com ([209.132.183.28]:40172) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1dBNRB-00006n-Dc for qemu-devel@nongnu.org; Thu, 18 May 2017 11:34:01 -0400 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 5C556C05FFDD for ; Thu, 18 May 2017 15:34:00 +0000 (UTC) Received: from secure.mitica (ovpn-117-10.ams2.redhat.com [10.36.117.10]) by smtp.corp.redhat.com (Postfix) with ESMTP id 02D3B18206; Thu, 18 May 2017 15:33:56 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 5C556C05FFDD Authentication-Results: ext-mx08.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx08.extmail.prod.ext.phx2.redhat.com; spf=pass smtp.mailfrom=quintela@redhat.com DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com 5C556C05FFDD From: Juan Quintela To: qemu-devel@nongnu.org Date: Thu, 18 May 2017 17:33:49 +0200 Message-Id: <20170518153350.30094-2-quintela@redhat.com> In-Reply-To: <20170518153350.30094-1-quintela@redhat.com> References: <20170518153350.30094-1-quintela@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.32]); Thu, 18 May 2017 15:34:00 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH v2 1/2] exec: Create include for target_page_size() X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: lvivier@redhat.com, dgilbert@redhat.com, peterx@redhat.com Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" That is the only function that we need from exec.c, and having to include the whole sysemu.h for this. Signed-off-by: Juan Quintela Reviewed-by: Dr. David Alan Gilbert --- /me leans to be less sloppy with copyright notices thanks Dave --- exec.c | 1 + include/exec/target_page.h | 19 +++++++++++++++++++ include/sysemu/sysemu.h | 1 - migration/migration.c | 1 + migration/postcopy-ram.c | 1 + migration/savevm.c | 1 + 6 files changed, 23 insertions(+), 1 deletion(-) create mode 100644 include/exec/target_page.h diff --git a/exec.c b/exec.c index 96e3ac9..de2961b 100644 --- a/exec.c +++ b/exec.c @@ -24,6 +24,7 @@ #include "qemu/cutils.h" #include "cpu.h" #include "exec/exec-all.h" +#include "exec/target_page.h" #include "tcg.h" #include "hw/qdev-core.h" #if !defined(CONFIG_USER_ONLY) diff --git a/include/exec/target_page.h b/include/exec/target_page.h new file mode 100644 index 0000000..626eda8 --- /dev/null +++ b/include/exec/target_page.h @@ -0,0 +1,19 @@ +/* + * Target page sizes and friends for non target files + * + * Copyright (c) 2017 Red Hat Inc + * + * Authors: + * David Alan Gilbert + * Juan Quintela + * + * This work is licensed under the terms of the GNU GPL, version 2 or late= r. + * See the COPYING file in the top-level directory. + */ + +#ifndef EXEC_TARGET_PAGE_H +#define EXEC_TARGET_PAGE_H + +size_t qemu_target_page_size(void); + +#endif diff --git a/include/sysemu/sysemu.h b/include/sysemu/sysemu.h index 765358e..ed8fe3b 100644 --- a/include/sysemu/sysemu.h +++ b/include/sysemu/sysemu.h @@ -67,7 +67,6 @@ int qemu_reset_requested_get(void); void qemu_system_killed(int signal, pid_t pid); void qemu_system_reset(bool report); void qemu_system_guest_panicked(GuestPanicInformation *info); -size_t qemu_target_page_size(void); =20 void qemu_add_exit_notifier(Notifier *notify); void qemu_remove_exit_notifier(Notifier *notify); diff --git a/migration/migration.c b/migration/migration.c index 9fe474b..ad29e53 100644 --- a/migration/migration.c +++ b/migration/migration.c @@ -37,6 +37,7 @@ #include "qom/cpu.h" #include "exec/memory.h" #include "exec/address-spaces.h" +#include "exec/target_page.h" #include "io/channel-buffer.h" #include "io/channel-tls.h" #include "migration/colo.h" diff --git a/migration/postcopy-ram.c b/migration/postcopy-ram.c index 0e2a996..a37620d 100644 --- a/migration/postcopy-ram.c +++ b/migration/postcopy-ram.c @@ -19,6 +19,7 @@ #include "qemu/osdep.h" =20 #include "qemu-common.h" +#include "exec/target_page.h" #include "migration/migration.h" #include "migration/qemu-file.h" #include "postcopy-ram.h" diff --git a/migration/savevm.c b/migration/savevm.c index 8565103..8763700 100644 --- a/migration/savevm.c +++ b/migration/savevm.c @@ -43,6 +43,7 @@ #include "qemu/queue.h" #include "sysemu/cpus.h" #include "exec/memory.h" +#include "exec/target_page.h" #include "qmp-commands.h" #include "trace.h" #include "qemu/bitops.h" --=20 2.9.3 From nobody Tue May 7 21:03:11 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 149512183921770.77075226272655; Thu, 18 May 2017 08:37:19 -0700 (PDT) Received: from localhost ([::1]:54391 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dBNUK-0004ty-Tx for importer@patchew.org; Thu, 18 May 2017 11:37:16 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:48557) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dBNRG-0002q9-Ra for qemu-devel@nongnu.org; Thu, 18 May 2017 11:34:07 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dBNRF-000083-Ns for qemu-devel@nongnu.org; Thu, 18 May 2017 11:34:06 -0400 Received: from mx1.redhat.com ([209.132.183.28]:16264) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1dBNRF-00007h-Fr for qemu-devel@nongnu.org; Thu, 18 May 2017 11:34:05 -0400 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 776B87D0C1 for ; Thu, 18 May 2017 15:34:04 +0000 (UTC) Received: from secure.mitica (ovpn-117-10.ams2.redhat.com [10.36.117.10]) by smtp.corp.redhat.com (Postfix) with ESMTP id ABF2B4D73A; Thu, 18 May 2017 15:34:00 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 776B87D0C1 Authentication-Results: ext-mx02.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx02.extmail.prod.ext.phx2.redhat.com; spf=pass smtp.mailfrom=quintela@redhat.com DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com 776B87D0C1 From: Juan Quintela To: qemu-devel@nongnu.org Date: Thu, 18 May 2017 17:33:50 +0200 Message-Id: <20170518153350.30094-3-quintela@redhat.com> In-Reply-To: <20170518153350.30094-1-quintela@redhat.com> References: <20170518153350.30094-1-quintela@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.26]); Thu, 18 May 2017 15:34:04 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH v2 2/2] migration: Make savevm.c target independent X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: lvivier@redhat.com, dgilbert@redhat.com, peterx@redhat.com Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" It only needed TARGET_PAGE_SIZE/BITS/BITS_MIN values, so just export them from exec.h Signed-off-by: Juan Quintela Reviewed-by: Peter Xu Reviewed-by: Dr. David Alan Gilbert --- Makefile.target | 2 +- exec.c | 9 +++++++++ include/exec/target_page.h | 2 ++ migration/Makefile.objs | 2 +- migration/savevm.c | 14 +++++++------- 5 files changed, 20 insertions(+), 9 deletions(-) diff --git a/Makefile.target b/Makefile.target index 465a633..ce8dfe4 100644 --- a/Makefile.target +++ b/Makefile.target @@ -146,7 +146,7 @@ obj-$(CONFIG_KVM) +=3D kvm-all.o obj-y +=3D memory.o cputlb.o obj-y +=3D memory_mapping.o obj-y +=3D dump.o -obj-y +=3D migration/ram.o migration/savevm.o +obj-y +=3D migration/ram.o LIBS :=3D $(libs_softmmu) $(LIBS) =20 # Hardware support diff --git a/exec.c b/exec.c index de2961b..ff16f04 100644 --- a/exec.c +++ b/exec.c @@ -3444,6 +3444,15 @@ size_t qemu_target_page_size(void) return TARGET_PAGE_SIZE; } =20 +int qemu_target_page_bits(void) +{ + return TARGET_PAGE_BITS; +} + +int qemu_target_page_bits_min(void) +{ + return TARGET_PAGE_BITS_MIN; +} #endif =20 /* diff --git a/include/exec/target_page.h b/include/exec/target_page.h index 626eda8..96726c3 100644 --- a/include/exec/target_page.h +++ b/include/exec/target_page.h @@ -15,5 +15,7 @@ #define EXEC_TARGET_PAGE_H =20 size_t qemu_target_page_size(void); +int qemu_target_page_bits(void); +int qemu_target_page_bits_min(void); =20 #endif diff --git a/migration/Makefile.objs b/migration/Makefile.objs index 3272415..90f8c1f 100644 --- a/migration/Makefile.objs +++ b/migration/Makefile.objs @@ -1,5 +1,5 @@ common-obj-y +=3D migration.o socket.o fd.o exec.o -common-obj-y +=3D tls.o channel.o +common-obj-y +=3D tls.o channel.o savevm.o common-obj-y +=3D colo-comm.o colo.o colo-failover.o common-obj-y +=3D vmstate.o vmstate-types.o page_cache.o common-obj-y +=3D qemu-file.o diff --git a/migration/savevm.c b/migration/savevm.c index 8763700..d971e5e 100644 --- a/migration/savevm.c +++ b/migration/savevm.c @@ -27,7 +27,6 @@ */ =20 #include "qemu/osdep.h" -#include "cpu.h" #include "hw/boards.h" #include "hw/hw.h" #include "hw/qdev.h" @@ -288,7 +287,7 @@ static void configuration_pre_save(void *opaque) =20 state->len =3D strlen(current_name); state->name =3D current_name; - state->target_page_bits =3D TARGET_PAGE_BITS; + state->target_page_bits =3D qemu_target_page_bits(); } =20 static int configuration_pre_load(void *opaque) @@ -299,7 +298,7 @@ static int configuration_pre_load(void *opaque) * predates the variable-target-page-bits support and is using the * minimum possible value for this CPU. */ - state->target_page_bits =3D TARGET_PAGE_BITS_MIN; + state->target_page_bits =3D qemu_target_page_bits_min(); return 0; } =20 @@ -314,9 +313,9 @@ static int configuration_post_load(void *opaque, int ve= rsion_id) return -EINVAL; } =20 - if (state->target_page_bits !=3D TARGET_PAGE_BITS) { + if (state->target_page_bits !=3D qemu_target_page_bits()) { error_report("Received TARGET_PAGE_BITS is %d but local is %d", - state->target_page_bits, TARGET_PAGE_BITS); + state->target_page_bits, qemu_target_page_bits()); return -EINVAL; } =20 @@ -332,7 +331,8 @@ static int configuration_post_load(void *opaque, int ve= rsion_id) */ static bool vmstate_target_page_bits_needed(void *opaque) { - return TARGET_PAGE_BITS > TARGET_PAGE_BITS_MIN; + return qemu_target_page_bits() + > qemu_target_page_bits_min(); } =20 static const VMStateDescription vmstate_target_page_bits =3D { @@ -1138,7 +1138,7 @@ void qemu_savevm_state_complete_precopy(QEMUFile *f, = bool iterable_only) } =20 vmdesc =3D qjson_new(); - json_prop_int(vmdesc, "page_size", TARGET_PAGE_SIZE); + json_prop_int(vmdesc, "page_size", qemu_target_page_size()); json_start_array(vmdesc, "devices"); QTAILQ_FOREACH(se, &savevm_state.handlers, entry) { =20 --=20 2.9.3