Patchwork [01/36] vmstate: Simplify test for CPU_SAVE_VERSION

login
register
mail settings
Submitter Juan Quintela
Date March 19, 2012, 10:57 p.m.
Message ID <516d0c71ba99dc1a9099417178852e691182644b.1332197811.git.quintela@redhat.com>
Download mbox | patch
Permalink /patch/147710/
State New
Headers show

Comments

Juan Quintela - March 19, 2012, 10:57 p.m.
Some cpu's definitions define CPU_SAVE_VERSION, others not, but they have
defined cpu_save/load.

Signed-off-by: Juan Quintela <quintela@redhat.com>
---
 exec.c |    6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)
Michael Roth - March 21, 2012, 8:35 p.m.
On Mon, Mar 19, 2012 at 11:57:29PM +0100, Juan Quintela wrote:
> Some cpu's definitions define CPU_SAVE_VERSION, others not, but they have
> defined cpu_save/load.

I'm guessing this patch becomes useful later in the series, but as it stands
I'm not seeing where this helps with cpus like target-alpha that have
cpu_save/load defined but not CPU_SAVE_VERSION, except to save off common
cpu fields as opposed to before when we saved nothing. Maybe a
add CPU_SAVE_SUPPORTED and check that instead? Or merge this elsewhere in
the series?

> 
> Signed-off-by: Juan Quintela <quintela@redhat.com>
> ---
>  exec.c |    6 ++++--
>  1 files changed, 4 insertions(+), 2 deletions(-)
> 
> diff --git a/exec.c b/exec.c
> index 265e895..9389a61 100644
> --- a/exec.c
> +++ b/exec.c
> @@ -657,7 +657,7 @@ void cpu_exec_init_all(void)
>  #endif
>  }
> 
> -#if defined(CPU_SAVE_VERSION) && !defined(CONFIG_USER_ONLY)
> +#if !defined(CONFIG_USER_ONLY)
> 
>  static int cpu_common_post_load(void *opaque, int version_id)
>  {
> @@ -724,11 +724,13 @@ void cpu_exec_init(CPUArchState *env)
>  #if defined(CONFIG_USER_ONLY)
>      cpu_list_unlock();
>  #endif
> -#if defined(CPU_SAVE_VERSION) && !defined(CONFIG_USER_ONLY)
> +#if !defined(CONFIG_USER_ONLY)
>      vmstate_register(NULL, cpu_index, &vmstate_cpu_common, env);
> +#if defined(CPU_SAVE_VERSION)
>      register_savevm(NULL, "cpu", cpu_index, CPU_SAVE_VERSION,
>                      cpu_save, cpu_load, env);
>  #endif
> +#endif
>  }
> 
>  /* Allocate a new translation block. Flush the translation buffer if
> -- 
> 1.7.7.6
> 
>
Juan Quintela - April 11, 2012, 10:06 a.m.
Michael Roth <mdroth@linux.vnet.ibm.com> wrote:
> On Mon, Mar 19, 2012 at 11:57:29PM +0100, Juan Quintela wrote:
>> Some cpu's definitions define CPU_SAVE_VERSION, others not, but they have
>> defined cpu_save/load.
>
> I'm guessing this patch becomes useful later in the series, but as it stands
> I'm not seeing where this helps with cpus like target-alpha that have
> cpu_save/load defined but not CPU_SAVE_VERSION, except to save off common
> cpu fields as opposed to before when we saved nothing. Maybe a
> add CPU_SAVE_SUPPORTED and check that instead? Or merge this elsewhere in
> the series?

We got completely rid of it in the end.  What was happening here is that
we were having code protected with CONFIG_USER_ONLY, and no migration
code should ever be used there.

As you guessed, later in the series, all is removed.

Later, Juan.

Patch

diff --git a/exec.c b/exec.c
index 265e895..9389a61 100644
--- a/exec.c
+++ b/exec.c
@@ -657,7 +657,7 @@  void cpu_exec_init_all(void)
 #endif
 }

-#if defined(CPU_SAVE_VERSION) && !defined(CONFIG_USER_ONLY)
+#if !defined(CONFIG_USER_ONLY)

 static int cpu_common_post_load(void *opaque, int version_id)
 {
@@ -724,11 +724,13 @@  void cpu_exec_init(CPUArchState *env)
 #if defined(CONFIG_USER_ONLY)
     cpu_list_unlock();
 #endif
-#if defined(CPU_SAVE_VERSION) && !defined(CONFIG_USER_ONLY)
+#if !defined(CONFIG_USER_ONLY)
     vmstate_register(NULL, cpu_index, &vmstate_cpu_common, env);
+#if defined(CPU_SAVE_VERSION)
     register_savevm(NULL, "cpu", cpu_index, CPU_SAVE_VERSION,
                     cpu_save, cpu_load, env);
 #endif
+#endif
 }

 /* Allocate a new translation block. Flush the translation buffer if