[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH 5/8] pc: init CPUState->cpu_index with index in
From: |
David Gibson |
Subject: |
Re: [Qemu-devel] [PATCH 5/8] pc: init CPUState->cpu_index with index in possible_cpus[] |
Date: |
Fri, 22 Jul 2016 11:41:52 +1000 |
User-agent: |
Mutt/1.6.2 (2016-07-01) |
On Thu, Jul 21, 2016 at 05:54:36PM +0200, Igor Mammedov wrote:
> It will enshure that cpu_index for a given cpu stays the same
> regardless of the order cpus has been created/deleted.
>
> No compat code is needed as for initial cpus index in
> possible_cpus[] matches cpu_index that's been auto-allocated
> in cpu_exec_init().
>
> Tha same applies for hotplug with cpu-add command if cpus are
> added sequentially in increasing order as 'id' matches cpu_index.
>
> If cpu-add had been used for creating out-of-order cpus,
> that created unmigratable instance since it were not possible
> to start target with the same cpu_index using old way
> of migrating instance with hotplugged cpus:
>
> * source QEMU with CLI (-smp 1,maxcpus=3 and cpu-add id=2)
> following set of cpu_index is allocated [0, 1] with
> apics set [0, 2] respectivelly
> * target QEMU is started with CLI -smp 2,maxcpus=3
> resulting in set of cpu_index [0, 1] but with
> set of apics [0, 1] wich doesn't match source.
>
> So we don't need compat code in this case as it's never worked
> and newelly added device_add support would use stable cpu_index
> set by machine to begin with, so it won't have above limitation
> and source QEMU could be migrated to destination regardless
> of the order cpus were created.
>
> Signed-off-by: Igor Mammedov <address@hidden>
Reviewed-by: David Gibson <address@hidden>
> ---
> hw/i386/pc.c | 4 ++++
> 1 file changed, 4 insertions(+)
>
> diff --git a/hw/i386/pc.c b/hw/i386/pc.c
> index ac7a4d5..316fb43 100644
> --- a/hw/i386/pc.c
> +++ b/hw/i386/pc.c
> @@ -1872,6 +1872,7 @@ static void pc_cpu_pre_plug(HotplugHandler *hotplug_dev,
> DeviceState *dev, Error **errp)
> {
> int idx;
> + CPUState *cs;
> CPUArchId *cpu_slot;
> X86CPUTopoInfo topo;
> X86CPU *cpu = X86_CPU(dev);
> @@ -1972,6 +1973,9 @@ static void pc_cpu_pre_plug(HotplugHandler *hotplug_dev,
> return;
> }
> cpu->thread_id = topo.smt_id;
> +
> + cs = CPU(cpu);
> + cs->cpu_index = idx;
> }
>
> static void pc_machine_device_pre_plug_cb(HotplugHandler *hotplug_dev,
--
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
signature.asc
Description: PGP signature
- [Qemu-devel] [PATCH 0/8] Fix migration issues with arbitrary cpu-hot(un)plug, Igor Mammedov, 2016/07/21
- [Qemu-devel] [PATCH 1/8] exec: reduce CONFIG_USER_ONLY ifdeffenery, Igor Mammedov, 2016/07/21
- [Qemu-devel] [PATCH 3/8] exec: set cpu_index only if it's been explictly set, Igor Mammedov, 2016/07/21
- [Qemu-devel] [PATCH 5/8] pc: init CPUState->cpu_index with index in possible_cpus[], Igor Mammedov, 2016/07/21
- Re: [Qemu-devel] [PATCH 5/8] pc: init CPUState->cpu_index with index in possible_cpus[],
David Gibson <=
- [Qemu-devel] [PATCH 4/8] qdev: fix object reference leak in case device.realize() fails, Igor Mammedov, 2016/07/21
- [Qemu-devel] [PATCH 6/8] spapr: init CPUState->cpu_index with index relative to core-id, Igor Mammedov, 2016/07/21
Re: [Qemu-devel] [PATCH 6/8] spapr: init CPUState->cpu_index with index relative to core-id, David Gibson, 2016/07/26
[Qemu-devel] [PATCH 7/8] Revert "pc: Enforce adding CPUs contiguously and removing them in opposite order", Igor Mammedov, 2016/07/21