qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [RFC PATCH v1 2/5] cpu: Introduce CPUState::migration_i


From: David Gibson
Subject: Re: [Qemu-devel] [RFC PATCH v1 2/5] cpu: Introduce CPUState::migration_id
Date: Thu, 7 Jul 2016 10:53:36 +1000
User-agent: Mutt/1.6.1 (2016-04-27)

On Wed, Jul 06, 2016 at 02:29:18PM +0530, Bharata B Rao wrote:
> Add CPUState::migration_id and use that as instance_id in
> vmstate_register() call.
> 
> Introduce use-migration-id property that allows target machines to
> optionally switch to using migration_id instead of cpu_index.
> This will help allow successful migration in cases where holes are
> introduced in cpu_index range after CPU hot removals.
> 
> The default implementation of CPUClass:get_migration_id() continues
> to return cpu_index.
> 
> Suggested-by: Igor Mammedov <address@hidden>
> Signed-off-by: Bharata B Rao <address@hidden>
> ---
>  exec.c            |  5 +++--
>  include/qom/cpu.h |  6 ++++++
>  qom/cpu.c         | 21 +++++++++++++++++++++
>  3 files changed, 30 insertions(+), 2 deletions(-)
> 
> diff --git a/exec.c b/exec.c
> index fb73910..a8afeda 100644
> --- a/exec.c
> +++ b/exec.c
> @@ -619,12 +619,13 @@ static void cpu_release_index(CPUState *cpu)
>  void cpu_vmstate_register(CPUState *cpu)
>  {
>      CPUClass *cc = CPU_GET_CLASS(cpu);
> +    int instance_id = cc->get_migration_id(cpu);
>  
>      if (qdev_get_vmsd(DEVICE(cpu)) == NULL) {
> -        vmstate_register(NULL, cpu->cpu_index, &vmstate_cpu_common, cpu);
> +        vmstate_register(NULL, instance_id, &vmstate_cpu_common, cpu);
>      }
>      if (cc->vmsd != NULL) {
> -        vmstate_register(NULL, cpu->cpu_index, cc->vmsd, cpu);
> +        vmstate_register(NULL, instance_id, cc->vmsd, cpu);
>      }
>  }
>  
> diff --git a/include/qom/cpu.h b/include/qom/cpu.h
> index 29ccf5c..6d00143 100644
> --- a/include/qom/cpu.h
> +++ b/include/qom/cpu.h
> @@ -187,6 +187,7 @@ typedef struct CPUClass {
>      bool (*cpu_exec_interrupt)(CPUState *cpu, int interrupt_request);
>  
>      void (*disas_set_info)(CPUState *cpu, disassemble_info *info);
> +    int (*get_migration_id)(CPUState *cpu);
>  } CPUClass;
>  
>  #ifdef HOST_WORDS_BIGENDIAN
> @@ -273,6 +274,9 @@ struct qemu_work_item {
>   * @kvm_fd: vCPU file descriptor for KVM.
>   * @work_mutex: Lock to prevent multiple access to queued_work_*.
>   * @queued_work_first: First asynchronous work pending.
> + * @migration_id: Use as instance_id argument in cpu vmstate_register calls
> + * @use_migration_id: Set to enforce the use of CPUClass.get_migration_id()
> + *     over cpu_index during vmstate registration.

I don't really understand the purpose of the use-migration-id bool.
Can't you just leave the migration-id as cpu_index by default if you
don't want a different migration id.  AFAICT this flag is never
tested.

-- 
David Gibson                    | I'll have my music baroque, and my code
david AT gibson.dropbear.id.au  | minimalist, thank you.  NOT _the_ _other_
                                | _way_ _around_!
http://www.ozlabs.org/~dgibson

Attachment: signature.asc
Description: PGP signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]