[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [RESEND PATCH v4 5/6] pc-dimm: Add memory hot unplug su
From: |
Igor Mammedov |
Subject: |
Re: [Qemu-devel] [RESEND PATCH v4 5/6] pc-dimm: Add memory hot unplug support for pc-dimm |
Date: |
Mon, 16 Mar 2015 15:20:36 +0100 |
On Mon, 16 Mar 2015 16:58:17 +0800
Zhu Guihua <address@hidden> wrote:
> From: Tang Chen <address@hidden>
>
> Implement unplug cb for pc-dimm. It calls memory unplug cb to reset
> some memory status, removes the corresponding memory region, and
> unregisters vmstate.
>
> Signed-off-by: Tang Chen <address@hidden>
> Signed-off-by: Zhu Guihua <address@hidden>
Please, squash this patch into previous.
> ---
> hw/i386/pc.c | 26 ++++++++++++++++++++++++--
> 1 file changed, 24 insertions(+), 2 deletions(-)
>
> diff --git a/hw/i386/pc.c b/hw/i386/pc.c
> index 9c7c318..141fa6a 100644
> --- a/hw/i386/pc.c
> +++ b/hw/i386/pc.c
> @@ -1689,6 +1689,23 @@ out:
> error_propagate(errp, local_err);
> }
>
> +static void pc_dimm_unplug(HotplugHandler *hotplug_dev,
> + DeviceState *dev, Error **errp)
> +{
> + PCMachineState *pcms = PC_MACHINE(hotplug_dev);
> + PCDIMMDevice *dimm = PC_DIMM(dev);
> + PCDIMMDeviceClass *ddc = PC_DIMM_GET_CLASS(dimm);
> + MemoryRegion *mr = ddc->get_memory_region(dimm);
> + HotplugHandlerClass *hhc;
> + Error *local_err = NULL;
> +
> + hhc = HOTPLUG_HANDLER_GET_CLASS(pcms->acpi_dev);
> + hhc->unplug(HOTPLUG_HANDLER(pcms->acpi_dev), dev, &local_err);
potentially leaking local_err, should be propagated to errp
and maybe in case of error here we shouldn't proceed with removal.
> +
> + memory_region_del_subregion(&pcms->hotplug_memory, mr);
> + vmstate_unregister_ram(mr, dev);
> +}
> +
> static void pc_cpu_plug(HotplugHandler *hotplug_dev,
> DeviceState *dev, Error **errp)
> {
> @@ -1742,8 +1759,13 @@ static void
> pc_machine_device_unplug_request_cb(HotplugHandler *hotplug_dev,
> static void pc_machine_device_unplug_cb(HotplugHandler *hotplug_dev,
> DeviceState *dev, Error **errp)
> {
> - error_setg(errp, "acpi: device unplug for not supported device"
> - " type: %s", object_get_typename(OBJECT(dev)));
> + if (object_dynamic_cast(OBJECT(dev), TYPE_PC_DIMM)) {
> + pc_dimm_unplug(hotplug_dev, dev, errp);
> + object_unparent(OBJECT(dev));
Pls, do unparenting in pc_dimm_unplug()
> + } else {
> + error_setg(errp, "acpi: device unplug for not supported device"
> + " type: %s", object_get_typename(OBJECT(dev)));
> + }
> }
>
> static HotplugHandler *pc_get_hotpug_handler(MachineState *machine,
- Re: [Qemu-devel] [RESEND PATCH v4 1/6] acpi, mem-hotplug: Add acpi_memory_slot_status() to get MemStatus, (continued)
[Qemu-devel] [RESEND PATCH v4 2/6] acpi, mem-hotplug: Add unplug request cb for memory device, Zhu Guihua, 2015/03/16
[Qemu-devel] [RESEND PATCH v4 3/6] pc-dimm: Add memory hot unplug request support for pc-dimm, Zhu Guihua, 2015/03/16
[Qemu-devel] [RESEND PATCH v4 4/6] acpi, mem-hotplug: Add unplug cb for memory device, Zhu Guihua, 2015/03/16
[Qemu-devel] [RESEND PATCH v4 5/6] pc-dimm: Add memory hot unplug support for pc-dimm, Zhu Guihua, 2015/03/16
- Re: [Qemu-devel] [RESEND PATCH v4 5/6] pc-dimm: Add memory hot unplug support for pc-dimm,
Igor Mammedov <=
[Qemu-devel] [RESEND PATCH v4 6/6] acpi: Add hardware implementation for memory hot unplug, Zhu Guihua, 2015/03/16
- Re: [Qemu-devel] [RESEND PATCH v4 6/6] acpi: Add hardware implementation for memory hot unplug, Igor Mammedov, 2015/03/16
- Re: [Qemu-devel] [RESEND PATCH v4 6/6] acpi: Add hardware implementation for memory hot unplug, Zhu Guihua, 2015/03/23
- Re: [Qemu-devel] [RESEND PATCH v4 6/6] acpi: Add hardware implementation for memory hot unplug, Igor Mammedov, 2015/03/23
- Re: [Qemu-devel] [RESEND PATCH v4 6/6] acpi: Add hardware implementation for memory hot unplug, Zhu Guihua, 2015/03/24
- Re: [Qemu-devel] [RESEND PATCH v4 6/6] acpi: Add hardware implementation for memory hot unplug, Igor Mammedov, 2015/03/24
- Re: [Qemu-devel] [RESEND PATCH v4 6/6] acpi: Add hardware implementation for memory hot unplug, Zhu Guihua, 2015/03/25
- Re: [Qemu-devel] [RESEND PATCH v4 6/6] acpi: Add hardware implementation for memory hot unplug, Igor Mammedov, 2015/03/25
Re: [Qemu-devel] [RESEND PATCH v4 6/6] acpi: Add hardware implementation for memory hot unplug, Zhu Guihua, 2015/03/24
Re: [Qemu-devel] [RESEND PATCH v4 6/6] acpi: Add hardware implementation for memory hot unplug, Igor Mammedov, 2015/03/24