[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH v4 04/16] pc: forbid BSP removal
From: |
Eduardo Habkost |
Subject: |
Re: [Qemu-devel] [PATCH v4 04/16] pc: forbid BSP removal |
Date: |
Thu, 14 Jul 2016 14:54:53 -0300 |
User-agent: |
Mutt/1.6.1 (2016-04-27) |
On Thu, Jul 14, 2016 at 06:54:33PM +0200, Igor Mammedov wrote:
> BSP is assumed to always present in QEMU code, so
> untile that assumptions are gone, deny removal request.
> In another words QEMU won't support BSP hot-unplug.
>
> Signed-off-by: Igor Mammedov <address@hidden>
> ---
> hw/i386/pc.c | 7 +++++++
> 1 file changed, 7 insertions(+)
>
> diff --git a/hw/i386/pc.c b/hw/i386/pc.c
> index 5a67f15..33c5f97 100644
> --- a/hw/i386/pc.c
> +++ b/hw/i386/pc.c
> @@ -1751,10 +1751,17 @@ out:
> static void pc_cpu_unplug_request_cb(HotplugHandler *hotplug_dev,
> 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.
I can change it when committing, if that's OK for you.
> + if (idx == 0) {
> + error_setg(&local_err, "1st CPU (BSP) is unpluggable");
> + goto out;
> + }
> +
> hhc = HOTPLUG_HANDLER_GET_CLASS(pcms->acpi_dev);
> hhc->unplug_request(HOTPLUG_HANDLER(pcms->acpi_dev), dev, &local_err);
>
> --
> 2.7.4
>
--
Eduardo
- [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