[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH v4 04/16] pc: forbid BSP removal
From: |
Bandan Das |
Subject: |
Re: [Qemu-devel] [PATCH v4 04/16] pc: forbid BSP removal |
Date: |
Thu, 14 Jul 2016 17:02:40 -0400 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/24.5 (gnu/linux) |
Eduardo Habkost <address@hidden> writes:
...
>> >> DeviceState *dev, Error **errp)
>> >> {
>> >> + int idx;
>> >> HotplugHandlerClass *hhc;
>> >> Error *local_err = NULL;
>> >> PCMachineState *pcms = PC_MACHINE(hotplug_dev);
>> >>
>> >> + pc_find_cpu_slot(pcms, CPU(dev), &idx);
>> >
>> > Looks fragile: if one day we create any TYPE_CPU object that is
>> > not in possible_cpus array, idx is undefined. I suggest
>> > initializing idx to -1 above.
>>
>> Or just let pc_find_cpu_slot universally set it to -1 since
>> this series assumes that -1 means index isn't valid.
>
> I think it would be more intuitive if pc_find_cpu_slot() didn't
> touch *idx if no slot is found. But both ways sound good to me.
The caller then has to always take care of making sure there
is no bogus value in idx. Maybe, always calling if (pc_find_cpu_slot())
is better.
- [Qemu-devel] [PATCH v4 00/16] pc: add CPU hot-add/hot-remove with device_add/device_del, Igor Mammedov, 2016/07/14
- [Qemu-devel] [PATCH v4 03/16] pc: register created initial and hotpluged CPUs in one place pc_cpu_plug(), Igor Mammedov, 2016/07/14
- [Qemu-devel] [PATCH v4 02/16] pc: delay setting number of boot CPUs to machine_done time, Igor Mammedov, 2016/07/14
- [Qemu-devel] [PATCH v4 01/16] pc: set APIC ID based on socket/core/thread ids if it's not been set yet, Igor Mammedov, 2016/07/14
- [Qemu-devel] [PATCH v4 04/16] pc: forbid BSP removal, Igor Mammedov, 2016/07/14
- Re: [Qemu-devel] [PATCH v4 04/16] pc: forbid BSP removal, Igor Mammedov, 2016/07/15
- [Qemu-devel] [PATCH v5 04/16] pc: forbid BSP removal, Igor Mammedov, 2016/07/18
[Qemu-devel] [PATCH v4 05/16] pc: enforce adding CPUs contiguously and removing them in opposit order, Igor Mammedov, 2016/07/14
[Qemu-devel] [PATCH v5 05/16] pc: enforce adding CPUs contiguously and removing them in opposit order, Igor Mammedov, 2016/07/18
Re: [Qemu-devel] [PATCH v4 05/16] pc: enforce adding CPUs contiguously and removing them in opposit order, Eric Blake, 2016/07/18