From: zhanghailiang <zhang.zhanghailiang@huawei.com>
To: Igor Mammedov <imammedo@redhat.com>
Cc: zhugh.fnst@cn.fujitsu.com, mst@redhat.com, hutao@cn.fujitsu.com,
qemu-devel@nongnu.org, Tang Chen <tangchen@cn.fujitsu.com>,
isimatu.yasuaki@jp.fujitsu.com, pbonzini@redhat.com
Subject: Re: [Qemu-devel] [RESEND PATCH v3 5/8] pc-dimm: Add pc_dimm_unrealize() for memory hot unplug support.
Date: Fri, 12 Sep 2014 13:30:36 +0800 [thread overview]
Message-ID: <541284FC.8050201@huawei.com> (raw)
In-Reply-To: <20140904152824.6ab1f113@nial.usersys.redhat.com>
On 2014/9/4 21:28, Igor Mammedov wrote:
> On Wed, 27 Aug 2014 16:08:36 +0800
> Tang Chen<tangchen@cn.fujitsu.com> wrote:
>
>> From: Hu Tao<hutao@cn.fujitsu.com>
>>
>> Implement unrealize function for pc-dimm device. It delete subregion from
> s/delete/removes/
>
>> hotplug region, and delete ram address range from guest ram list.
>>
>> Signed-off-by: Hu Tao<hutao@cn.fujitsu.com>
>> Signed-off-by: Tang Chen<tangchen@cn.fujitsu.com>
>> ---
>> hw/mem/pc-dimm.c | 10 ++++++++++
>> 1 file changed, 10 insertions(+)
>>
>> diff --git a/hw/mem/pc-dimm.c b/hw/mem/pc-dimm.c
>> index 20fe0dc..34109a2 100644
>> --- a/hw/mem/pc-dimm.c
>> +++ b/hw/mem/pc-dimm.c
>> @@ -270,12 +270,22 @@ static MemoryRegion *pc_dimm_get_memory_region(PCDIMMDevice *dimm)
>> return host_memory_backend_get_memory(dimm->hostmem,&error_abort);
>> }
>>
>> +static void pc_dimm_unrealize(DeviceState *dev, Error **errp)
>> +{
>> + PCDIMMDevice *dimm = PC_DIMM(dev);
>> + MemoryRegion *mr = pc_dimm_get_memory_region(dimm);
>> +
>> + memory_region_del_subregion(mr->container, mr);
> usually MemoryRegion is treated as opaque and it's fields
> accessed via memory_region_foo() helpers.
>
>> + vmstate_unregister_ram(mr, dev);
> these 2 lines look like a job for PCMachine which did original mapping/vmstate registration
>
Actually, this patch also fix the bug *when hotplug memory failing in
the place where after pc_dimm_plug but before the end of device_set_realized,
it does not clear the work done by pc_dimm_plug*.
For there is no callback like pc_dimm_plug_fail_cb for us to call when fail,
Maybe pc_dimm_unrealize is the only place where we can do the clear work...
Thanks,
zhanghailiang
>> +}
>> +
>> static void pc_dimm_class_init(ObjectClass *oc, void *data)
>> {
>> DeviceClass *dc = DEVICE_CLASS(oc);
>> PCDIMMDeviceClass *ddc = PC_DIMM_CLASS(oc);
>>
>> dc->realize = pc_dimm_realize;
>> + dc->unrealize = pc_dimm_unrealize;
>> dc->props = pc_dimm_properties;
>>
>> ddc->get_memory_region = pc_dimm_get_memory_region;
>
>
>
>
next prev parent reply other threads:[~2014-09-12 5:31 UTC|newest]
Thread overview: 26+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-08-27 8:08 [Qemu-devel] [RESEND PATCH v3 0/8] QEmu memory hot unplug support Tang Chen
2014-08-27 8:08 ` [Qemu-devel] [RESEND PATCH v3 1/8] acpi, piix4: Add memory hot unplug support for piix4 Tang Chen
2014-09-04 12:15 ` Igor Mammedov
2014-09-16 3:17 ` Tang Chen
2014-08-27 8:08 ` [Qemu-devel] [RESEND PATCH v3 2/8] acpi, ich9: Add memory hot unplug support for ich9 Tang Chen
2014-09-04 12:25 ` Igor Mammedov
2014-09-16 3:18 ` Tang Chen
2014-08-27 8:08 ` [Qemu-devel] [RESEND PATCH v3 3/8] pc: Add memory hot unplug support for pc machine Tang Chen
2014-09-04 12:44 ` Igor Mammedov
2014-09-04 13:16 ` Igor Mammedov
2014-08-27 8:08 ` [Qemu-devel] [RESEND PATCH v3 4/8] qdev: Add memory hot unplug support for bus-less devices Tang Chen
2014-09-04 13:22 ` Igor Mammedov
2014-09-16 8:42 ` Tang Chen
2014-08-27 8:08 ` [Qemu-devel] [RESEND PATCH v3 5/8] pc-dimm: Add pc_dimm_unrealize() for memory hot unplug support Tang Chen
2014-09-04 13:28 ` Igor Mammedov
2014-09-12 5:30 ` zhanghailiang [this message]
2014-09-12 13:17 ` Igor Mammedov
2014-09-24 7:02 ` Tang Chen
2014-08-27 8:08 ` [Qemu-devel] [RESEND PATCH v3 6/8] acpi: Add hardware implementation for memory hot unplug Tang Chen
2014-09-04 14:20 ` Igor Mammedov
2014-09-16 10:12 ` Tang Chen
2014-09-16 11:34 ` Igor Mammedov
2014-08-27 8:08 ` [Qemu-devel] [RESEND PATCH v3 7/8] pc, acpi bios: Add memory hot unplug interface Tang Chen
2014-09-04 13:53 ` Igor Mammedov
2014-08-27 8:08 ` [Qemu-devel] [RESEND PATCH v3 8/8] monitor: Add memory hot unplug support for device_del command Tang Chen
2014-09-04 14:02 ` 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=541284FC.8050201@huawei.com \
--to=zhang.zhanghailiang@huawei.com \
--cc=hutao@cn.fujitsu.com \
--cc=imammedo@redhat.com \
--cc=isimatu.yasuaki@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).