All of lore.kernel.org
 help / color / mirror / Atom feed
From: Michael Tokarev <mjt@tls.msk.ru>
To: zhanghailiang <zhang.zhanghailiang@huawei.com>
Cc: qemu-trivial@nongnu.org, luonengjun@huawei.com,
	qemu-devel@nongnu.org, peter.huangpeng@huawei.com,
	Gonglei <arei.gonglei@huawei.com>,
	pbonzini@redhat.com, imammedo@redhat.com,
	Luiz Capitulino <lcapitulino@redhat.com>
Subject: Re: [Qemu-trivial] [Qemu-devel] [PATCH v6] numa: make 'info numa' take into account hotplugged memory
Date: Sun, 02 Nov 2014 10:03:17 +0300	[thread overview]
Message-ID: <5455D735.2030202@msgid.tls.msk.ru> (raw)
In-Reply-To: <5451F52A.7050305@huawei.com>

30.10.2014 11:22, zhanghailiang wrote:
> Hi Michael,
> 
> Can you help applying this patch to -trivial branch?
> It has been reviewed, and it mainly fix bug for hmp command of 'info numa'.
> Which i don't know if it should go qemu-stable, for this is not a blocker.
> 
> Maybe go trivial branch is a better choice.

And the original patch description is:

>>>>>> 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".

What does the "for now" means in this context?  Is the patch
incpmplete somehow and we should expect more code in this
area/theme?

In the patch we have:

+void query_numa_node_mem(uint64_t *node_mem)
+{
+    int i;
+
+    if (nb_numa_nodes <= 0) {
+        return;
+    }
+
+    numa_stat_memory_devices(node_mem);
+    for (i = 0; i < nb_numa_nodes; i++) {
+        node_mem[i] += numa_info[i].node_mem;
+    }
+}

Please note that while the node_mem is a pointer, it is used as
an array.  In C, pointers and arrays in this context is the same
thing, but I think it is better to make the fact that it is an
array explicit in the function prototype, to be like this:

+void query_numa_node_mem(uint64_t node_mem[])

(But I don't know how various tools like coverity et al will react
to this.  Gcc and any other C compiler should be fine).

The same stands for other function prototype.

I'm not sure this qualifies as -trivial really.  Yes the change
does not affect anything but the `info' command, and is rather
simple, but... I'm not sure.

Thanks.

/mjt



WARNING: multiple messages have this Message-ID (diff)
From: Michael Tokarev <mjt@tls.msk.ru>
To: zhanghailiang <zhang.zhanghailiang@huawei.com>
Cc: qemu-trivial@nongnu.org, luonengjun@huawei.com,
	qemu-devel@nongnu.org, peter.huangpeng@huawei.com,
	Gonglei <arei.gonglei@huawei.com>,
	pbonzini@redhat.com, imammedo@redhat.com,
	Luiz Capitulino <lcapitulino@redhat.com>
Subject: Re: [Qemu-devel] [Qemu-trivial] [PATCH v6] numa: make 'info numa' take into account hotplugged memory
Date: Sun, 02 Nov 2014 10:03:17 +0300	[thread overview]
Message-ID: <5455D735.2030202@msgid.tls.msk.ru> (raw)
In-Reply-To: <5451F52A.7050305@huawei.com>

30.10.2014 11:22, zhanghailiang wrote:
> Hi Michael,
> 
> Can you help applying this patch to -trivial branch?
> It has been reviewed, and it mainly fix bug for hmp command of 'info numa'.
> Which i don't know if it should go qemu-stable, for this is not a blocker.
> 
> Maybe go trivial branch is a better choice.

And the original patch description is:

>>>>>> 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".

What does the "for now" means in this context?  Is the patch
incpmplete somehow and we should expect more code in this
area/theme?

In the patch we have:

+void query_numa_node_mem(uint64_t *node_mem)
+{
+    int i;
+
+    if (nb_numa_nodes <= 0) {
+        return;
+    }
+
+    numa_stat_memory_devices(node_mem);
+    for (i = 0; i < nb_numa_nodes; i++) {
+        node_mem[i] += numa_info[i].node_mem;
+    }
+}

Please note that while the node_mem is a pointer, it is used as
an array.  In C, pointers and arrays in this context is the same
thing, but I think it is better to make the fact that it is an
array explicit in the function prototype, to be like this:

+void query_numa_node_mem(uint64_t node_mem[])

(But I don't know how various tools like coverity et al will react
to this.  Gcc and any other C compiler should be fine).

The same stands for other function prototype.

I'm not sure this qualifies as -trivial really.  Yes the change
does not affect anything but the `info' command, and is rather
simple, but... I'm not sure.

Thanks.

/mjt

  reply	other threads:[~2014-11-02  7:03 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-10-17  8:50 [Qemu-devel] [PATCH v6] numa: make 'info numa' take into account hotplugged memory zhanghailiang
2014-10-17  9:02 ` Gonglei
2014-10-23  0:32   ` zhanghailiang
2014-10-27  9:40     ` zhanghailiang
2014-10-27 12:46       ` Luiz Capitulino
2014-10-28  0:38         ` zhanghailiang
2014-10-30  8:22         ` [Qemu-trivial] " zhanghailiang
2014-10-30  8:22           ` zhanghailiang
2014-11-02  7:03           ` Michael Tokarev [this message]
2014-11-02  7:03             ` [Qemu-devel] [Qemu-trivial] " Michael Tokarev
2014-11-03  7:56             ` [Qemu-trivial] [Qemu-devel] " Markus Armbruster
2014-11-03  7:56               ` [Qemu-devel] [Qemu-trivial] " Markus Armbruster
2014-11-03  8:06               ` Michael Tokarev
2014-11-03  8:06                 ` [Qemu-devel] " Michael Tokarev
2014-11-03 14:39                 ` [Qemu-trivial] " Markus Armbruster
2014-11-03 14:39                   ` Markus Armbruster
2014-11-03 11:54             ` [Qemu-trivial] " zhanghailiang
2014-11-03 11:54               ` [Qemu-devel] [Qemu-trivial] " zhanghailiang

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=5455D735.2030202@msgid.tls.msk.ru \
    --to=mjt@tls.msk.ru \
    --cc=arei.gonglei@huawei.com \
    --cc=imammedo@redhat.com \
    --cc=lcapitulino@redhat.com \
    --cc=luonengjun@huawei.com \
    --cc=pbonzini@redhat.com \
    --cc=peter.huangpeng@huawei.com \
    --cc=qemu-devel@nongnu.org \
    --cc=qemu-trivial@nongnu.org \
    --cc=zhang.zhanghailiang@huawei.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.