From: zhanghailiang <zhang.zhanghailiang@huawei.com>
To: Igor Mammedov <imammedo@redhat.com>
Cc: mst@redhat.com, hutao@cn.fujitsu.com, luonengjun@huawei.com,
peter.huangpeng@huawei.com, qemu-devel@nongnu.org,
pbonzini@redhat.com, gaowanlong@cn.fujitsu.com
Subject: Re: [Qemu-devel] [PATCH 2/2] numa/pc-dimm: Fix stat of memory size in node when hotplug memory
Date: Wed, 17 Sep 2014 16:22:18 +0800 [thread overview]
Message-ID: <541944BA.1080104@huawei.com> (raw)
In-Reply-To: <20140916132013.68f181ce@nial.usersys.redhat.com>
On 2014/9/16 19:20, Igor Mammedov wrote:
> On Tue, 16 Sep 2014 18:39:16 +0800
> zhanghailiang<zhang.zhanghailiang@huawei.com> wrote:
>
>> When do memory hotplug, if there is numa node, we should add
>> the memory size to the corresponding node memory size.
>>
>> For now, it mainly affects the result of hmp command "info numa".
>>
>> Signed-off-by: zhanghailiang<zhang.zhanghailiang@huawei.com>
>> ---
>> hw/i386/pc.c | 1 +
>> include/sysemu/sysemu.h | 1 +
>> numa.c | 13 +++++++++++++
>> 3 files changed, 15 insertions(+)
>>
>> diff --git a/hw/i386/pc.c b/hw/i386/pc.c
>> index 77b6782..bafe48e 100644
>> --- a/hw/i386/pc.c
>> +++ b/hw/i386/pc.c
>> @@ -1607,6 +1607,7 @@ static void pc_dimm_plug(HotplugHandler *hotplug_dev,
>> memory_region_add_subregion(&pcms->hotplug_memory,
>> addr - pcms->hotplug_memory_base, mr);
>> vmstate_register_ram(mr, dev);
>> + update_numa_node_mem_size(dimm->node, memory_region_size(mr), true);
>>
>> hhc = HOTPLUG_HANDLER_GET_CLASS(pcms->acpi_dev);
>> hhc->plug(HOTPLUG_HANDLER(pcms->acpi_dev), dev,&local_err);
>> diff --git a/include/sysemu/sysemu.h b/include/sysemu/sysemu.h
>> index d8539fd..5bc9d73 100644
>> --- a/include/sysemu/sysemu.h
>> +++ b/include/sysemu/sysemu.h
>> @@ -160,6 +160,7 @@ typedef struct node_info {
>> extern NodeInfo numa_info[MAX_NODES];
>> void set_numa_nodes(void);
>> void set_numa_modes(void);
>> +void update_numa_node_mem_size(int node, uint64_t size, bool hotplug);
>> extern QemuOptsList qemu_numa_opts;
>> int numa_init_func(QemuOpts *opts, void *opaque);
>>
>> diff --git a/numa.c b/numa.c
>> index 3b98135..bbfa16f 100644
>> --- a/numa.c
>> +++ b/numa.c
>> @@ -315,6 +315,19 @@ void memory_region_allocate_system_memory(MemoryRegion *mr, Object *owner,
>> }
>> }
>>
>> +void update_numa_node_mem_size(int node, uint64_t size, bool hotplug)
>> +{
>> + if (!nb_numa_nodes) {
>> + return;
>> + }
>> +
>> + if (hotplug) {
>> + numa_info[node].node_mem += size;
>> + } else {
>> + numa_info[node].node_mem -= size;
>> + }
>> +}
> I don't think is right thing to do.
> numa_info.node_mem provides mapping of initial memory specified with -m XXX option,
> and later used for building ACPI SRAT table.
>
Got it;)
> I'd suggest to fix 'info numa' command instead. Add to it ability to enumerate
> all memory devices, in that case when initial memory is converted to memory devices
> 'info numa' will continue to work correctly.
>
Hmm, Good idea, i will fix it.Thanks.
>> +
>> static int query_memdev(Object *obj, void *opaque)
>> {
>> MemdevList **list = opaque;
>
>
> .
>
prev parent reply other threads:[~2014-09-17 8:23 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-09-16 10:39 [Qemu-devel] [PATCH 0/2] fix two bugs about numa _and_ hotplug memory feature zhanghailiang
2014-09-16 10:39 ` [Qemu-devel] [PATCH 1/2] pc-dimm: No numa option shouldn't break " zhanghailiang
2014-09-17 8:32 ` Hu Tao
2014-09-17 9:25 ` zhanghailiang
2014-09-17 10:00 ` Tang Chen
2014-09-17 10:19 ` Andrey Korolyov
2014-09-18 0:58 ` Hu Tao
2014-09-19 12:26 ` Igor Mammedov
2014-09-22 9:03 ` Tang Chen
2014-09-22 9:46 ` zhanghailiang
2014-09-23 8:40 ` Igor Mammedov
2014-09-23 8:58 ` Tang Chen
2014-09-23 10:11 ` zhanghailiang
2014-09-23 10:32 ` Tang Chen
2014-09-23 11:12 ` Igor Mammedov
2014-09-23 12:38 ` zhanghailiang
2014-09-19 12:37 ` Igor Mammedov
2014-09-22 11:17 ` Michael S. Tsirkin
2014-09-23 9:01 ` Igor Mammedov
2014-09-23 10:07 ` zhanghailiang
2014-09-23 11:13 ` Igor Mammedov
2014-09-16 10:39 ` [Qemu-devel] [PATCH 2/2] numa/pc-dimm: Fix stat of memory size in node when hotplug memory zhanghailiang
2014-09-16 11:20 ` Igor Mammedov
2014-09-17 8:22 ` zhanghailiang [this message]
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=541944BA.1080104@huawei.com \
--to=zhang.zhanghailiang@huawei.com \
--cc=gaowanlong@cn.fujitsu.com \
--cc=hutao@cn.fujitsu.com \
--cc=imammedo@redhat.com \
--cc=luonengjun@huawei.com \
--cc=mst@redhat.com \
--cc=pbonzini@redhat.com \
--cc=peter.huangpeng@huawei.com \
--cc=qemu-devel@nongnu.org \
/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).