From: "Dr. David Alan Gilbert" <dgilbert@redhat.com>
To: Juan Quintela <quintela@redhat.com>
Cc: qemu-devel@nongnu.org, lvivier@redhat.com, peterx@redhat.com
Subject: Re: [Qemu-devel] [PATCH 2/2] migration: Make savevm.c target independent
Date: Thu, 18 May 2017 16:00:22 +0100 [thread overview]
Message-ID: <20170518150022.GF2079@work-vm> (raw)
In-Reply-To: <20170517160804.22245-3-quintela@redhat.com>
* Juan Quintela (quintela@redhat.com) wrote:
> It only needed TARGET_PAGE_SIZE/BITS/BITS_MIN values, so just export
> them from exec.h
>
> Signed-off-by: Juan Quintela <quintela@redhat.com>
Reviewed-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
> ---
> 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) += kvm-all.o
> obj-y += memory.o cputlb.o
> obj-y += memory_mapping.o
> obj-y += dump.o
> -obj-y += migration/ram.o migration/savevm.o
> +obj-y += migration/ram.o
> LIBS := $(libs_softmmu) $(LIBS)
>
> # Hardware support
> diff --git a/exec.c b/exec.c
> index e9a201a..447ac63 100644
> --- a/exec.c
> +++ b/exec.c
> @@ -3387,6 +3387,15 @@ size_t qemu_target_page_size(void)
> return TARGET_PAGE_SIZE;
> }
>
> +int qemu_target_page_bits(void)
> +{
> + return TARGET_PAGE_BITS;
> +}
> +
> +int qemu_target_page_bits_min(void)
> +{
> + return TARGET_PAGE_BITS_MIN;
> +}
> #endif
>
> /*
> diff --git a/include/exec/target_page.h b/include/exec/target_page.h
> index 0961591..e3a19cc 100644
> --- a/include/exec/target_page.h
> +++ b/include/exec/target_page.h
> @@ -16,5 +16,7 @@
> #define EXEC_TARGET_PAGE_H
>
> size_t qemu_target_page_size(void);
> +int qemu_target_page_bits(void);
> +int qemu_target_page_bits_min(void);
>
> #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 += migration.o socket.o fd.o exec.o
> -common-obj-y += tls.o channel.o
> +common-obj-y += tls.o channel.o savevm.o
> common-obj-y += colo-comm.o colo.o colo-failover.o
> common-obj-y += vmstate.o vmstate-types.o page_cache.o
> common-obj-y += 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 @@
> */
>
> #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)
>
> state->len = strlen(current_name);
> state->name = current_name;
> - state->target_page_bits = TARGET_PAGE_BITS;
> + state->target_page_bits = qemu_target_page_bits();
> }
>
> 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 = TARGET_PAGE_BITS_MIN;
> + state->target_page_bits = qemu_target_page_bits_min();
> return 0;
> }
>
> @@ -314,9 +313,9 @@ static int configuration_post_load(void *opaque, int version_id)
> return -EINVAL;
> }
>
> - if (state->target_page_bits != TARGET_PAGE_BITS) {
> + if (state->target_page_bits != 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;
> }
>
> @@ -332,7 +331,8 @@ static int configuration_post_load(void *opaque, int version_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();
> }
>
> static const VMStateDescription vmstate_target_page_bits = {
> @@ -1138,7 +1138,7 @@ void qemu_savevm_state_complete_precopy(QEMUFile *f, bool iterable_only)
> }
>
> vmdesc = 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) {
>
> --
> 2.9.3
>
--
Dr. David Alan Gilbert / dgilbert@redhat.com / Manchester, UK
next prev parent reply other threads:[~2017-05-18 15:01 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-05-17 16:08 [Qemu-devel] [PATCH 0/2] Make migration/ram.c target independent Juan Quintela
2017-05-17 16:08 ` [Qemu-devel] [PATCH 1/2] exec: Create include for target_page_size() Juan Quintela
2017-05-18 14:27 ` Dr. David Alan Gilbert
2017-05-17 16:08 ` [Qemu-devel] [PATCH 2/2] migration: Make savevm.c target independent Juan Quintela
2017-05-18 15:00 ` Dr. David Alan Gilbert [this message]
2017-05-18 10:04 ` [Qemu-devel] [PATCH 0/2] Make migration/ram.c " Juan Quintela
2017-05-18 10:31 ` Peter Xu
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20170518150022.GF2079@work-vm \
--to=dgilbert@redhat.com \
--cc=lvivier@redhat.com \
--cc=peterx@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=quintela@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).