qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] [PATCH v2 7/6] exec: ensure the only one cpu_index allo


From: David Gibson
Subject: Re: [Qemu-devel] [PATCH v2 7/6] exec: ensure the only one cpu_index allocation method is used
Date: Thu, 28 Jul 2016 15:49:53 +1000
User-agent: Mutt/1.6.2 (2016-07-01)

On Wed, Jul 27, 2016 at 11:24:54AM +0200, Igor Mammedov wrote:
> Make sure that cpu_index auto allocation isn't used in
> combination with manual cpu_index assignment. And
> dissallow out of order cpu removal if auto allocation
> is in use.
> 
> Target that wishes to support out of order unplug should
> switch to manual cpu_index assignment. Following patch
> could be used as an example:
>  (pc: init CPUState->cpu_index with index in possible_cpus[]))
> 
> Signed-off-by: Igor Mammedov <address@hidden>

Reviewed-by: David Gibson <address@hidden>

> ---
>  exec.c | 7 +++++++
>  1 file changed, 7 insertions(+)
> 
> diff --git a/exec.c b/exec.c
> index 8e8416b..e0d8f18 100644
> --- a/exec.c
> +++ b/exec.c
> @@ -598,11 +598,14 @@ AddressSpace *cpu_get_address_space(CPUState *cpu, int 
> asidx)
>  }
>  #endif
>  
> +static bool cpu_index_auto_assigned;
> +
>  static int cpu_get_free_index(void)
>  {
>      CPUState *some_cpu;
>      int cpu_index = 0;
>  
> +    cpu_index_auto_assigned = true;
>      CPU_FOREACH(some_cpu) {
>          cpu_index++;
>      }
> @@ -620,6 +623,8 @@ void cpu_exec_exit(CPUState *cpu)
>          return;
>      }
>  
> +    assert(!(cpu_index_auto_assigned && cpu != QTAILQ_LAST(&cpus, 
> CPUTailQ)));
> +
>      QTAILQ_REMOVE(&cpus, cpu, node);
>      cpu->cpu_index = UNASSIGNED_CPU_INDEX;
>      cpu_list_unlock();
> @@ -662,6 +667,8 @@ void cpu_exec_init(CPUState *cpu, Error **errp)
>      if (cpu->cpu_index == UNASSIGNED_CPU_INDEX) {
>          cpu->cpu_index = cpu_get_free_index();
>          assert(cpu->cpu_index != UNASSIGNED_CPU_INDEX);
> +    } else {
> +        assert(!cpu_index_auto_assigned);
>      }
>      QTAILQ_INSERT_TAIL(&cpus, cpu, node);
>      cpu_list_unlock();

-- 
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]