All of lore.kernel.org
 help / color / mirror / Atom feed
From: Igor Mammedov <imammedo@redhat.com>
To: Zhu Guihua <zhugh.fnst@cn.fujitsu.com>
Cc: mst@redhat.com, qemu-devel@nongnu.org, tangchen@cn.fujitsu.com,
	izumi.taku@jp.fujitsu.com, guz.fnst@cn.fujitsu.com,
	pbonzini@redhat.com
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	[thread overview]
Message-ID: <20150316152036.7474de98@nial.brq.redhat.com> (raw)
In-Reply-To: <3448ad1eb6aa4b28f6ae4cd92e82d24c3ae946ca.1426494342.git.zhugh.fnst@cn.fujitsu.com>

On Mon, 16 Mar 2015 16:58:17 +0800
Zhu Guihua <zhugh.fnst@cn.fujitsu.com> wrote:

> From: Tang Chen <tangchen@cn.fujitsu.com>
> 
> 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 <tangchen@cn.fujitsu.com>
> Signed-off-by: Zhu Guihua <zhugh.fnst@cn.fujitsu.com>
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,

  reply	other threads:[~2015-03-16 14:20 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-03-16  8:58 [Qemu-devel] [RESEND PATCH v4 0/6] QEMU memory hot unplug support Zhu Guihua
2015-03-16  8:58 ` [Qemu-devel] [RESEND PATCH v4 1/6] acpi, mem-hotplug: Add acpi_memory_slot_status() to get MemStatus Zhu Guihua
2015-03-16 13:58   ` Michael S. Tsirkin
2015-03-19  1:52     ` Zhu Guihua
2015-03-19  5:59       ` Michael S. Tsirkin
2015-03-16  8:58 ` [Qemu-devel] [RESEND PATCH v4 2/6] acpi, mem-hotplug: Add unplug request cb for memory device Zhu Guihua
2015-03-16 13:53   ` Igor Mammedov
2015-03-16  8:58 ` [Qemu-devel] [RESEND PATCH v4 3/6] pc-dimm: Add memory hot unplug request support for pc-dimm Zhu Guihua
2015-03-16 13:56   ` Igor Mammedov
2015-03-16  8:58 ` [Qemu-devel] [RESEND PATCH v4 4/6] acpi, mem-hotplug: Add unplug cb for memory device Zhu Guihua
2015-03-16 14:10   ` Igor Mammedov
2015-03-16  8:58 ` [Qemu-devel] [RESEND PATCH v4 5/6] pc-dimm: Add memory hot unplug support for pc-dimm Zhu Guihua
2015-03-16 14:20   ` Igor Mammedov [this message]
2015-03-16  8:58 ` [Qemu-devel] [RESEND PATCH v4 6/6] acpi: Add hardware implementation for memory hot unplug Zhu Guihua
2015-03-16 14:59   ` Igor Mammedov
2015-03-23 10:59     ` Zhu Guihua
2015-03-23 12:47       ` Igor Mammedov
2015-03-24  9:34         ` Zhu Guihua
2015-03-24 10:26           ` Igor Mammedov
2015-03-25  6:13             ` Zhu Guihua
2015-03-25 10:40               ` Igor Mammedov
2015-03-24  9:38     ` Zhu Guihua
2015-03-24 10:31       ` Igor Mammedov
2015-03-24 10:48         ` Zhu Guihua
2015-03-25 10:35           ` Igor Mammedov

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20150316152036.7474de98@nial.brq.redhat.com \
    --to=imammedo@redhat.com \
    --cc=guz.fnst@cn.fujitsu.com \
    --cc=izumi.taku@jp.fujitsu.com \
    --cc=mst@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=tangchen@cn.fujitsu.com \
    --cc=zhugh.fnst@cn.fujitsu.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.