From: "Andreas Färber" <afaerber@suse.de>
To: Wanlong Gao <gaowanlong@cn.fujitsu.com>,
Paolo Bonzini <pbonzini@redhat.com>
Cc: aliguori@us.ibm.com, Eduardo Habkost <ehabkost@redhat.com>,
qemu-devel@nongnu.org, lcapitulino@redhat.com, bsd@redhat.com,
y-goto@jp.fujitsu.com
Subject: Re: [Qemu-devel] [PATCH V4 02/10] NUMA: Add numa_info structure to contain numa nodes info
Date: Fri, 05 Jul 2013 22:09:47 +0200 [thread overview]
Message-ID: <51D7280B.6070908@suse.de> (raw)
In-Reply-To: <20130705193239.GS13956@otherpad.lan.raisama.net>
Am 05.07.2013 21:32, schrieb Eduardo Habkost:
> On Thu, Jul 04, 2013 at 05:53:09PM +0800, Wanlong Gao wrote:
>> Add the numa_info structure to contain the numa nodes memory,
>> VCPUs information and the future added numa nodes host memory
>> policies.
>>
>> Signed-off-by: Andre Przywara <andre.przywara@amd.com>
>> Signed-off-by: Wanlong Gao <gaowanlong@cn.fujitsu.com>
>
> Reviewed-by: Eduardo Habkost <ehabkost@redhat.com>
>
>> ---
>> cpus.c | 2 +-
>> hw/i386/pc.c | 4 ++--
>> hw/net/eepro100.c | 1 -
>> include/sysemu/sysemu.h | 8 ++++++--
>> monitor.c | 2 +-
>> vl.c | 24 ++++++++++++------------
>> 6 files changed, 22 insertions(+), 19 deletions(-)
>>
>> diff --git a/cpus.c b/cpus.c
>> index 20958e5..496d5ce 100644
>> --- a/cpus.c
>> +++ b/cpus.c
>> @@ -1180,7 +1180,7 @@ void set_numa_modes(void)
>> for (env = first_cpu; env != NULL; env = env->next_cpu) {
>> cpu = ENV_GET_CPU(env);
>> for (i = 0; i < nb_numa_nodes; i++) {
>> - if (test_bit(cpu->cpu_index, node_cpumask[i])) {
>> + if (test_bit(cpu->cpu_index, numa_info[i].node_cpu)) {
>> cpu->numa_node = i;
>> }
>> }
>> diff --git a/hw/i386/pc.c b/hw/i386/pc.c
>> index 78f92e2..78b5a72 100644
>> --- a/hw/i386/pc.c
>> +++ b/hw/i386/pc.c
>> @@ -650,14 +650,14 @@ static FWCfgState *bochs_bios_init(void)
>> unsigned int apic_id = x86_cpu_apic_id_from_index(i);
>> assert(apic_id < apic_id_limit);
>> for (j = 0; j < nb_numa_nodes; j++) {
>> - if (test_bit(i, node_cpumask[j])) {
>> + if (test_bit(i, numa_info[j].node_cpu)) {
>> numa_fw_cfg[apic_id + 1] = cpu_to_le64(j);
>> break;
>> }
>> }
>> }
>> for (i = 0; i < nb_numa_nodes; i++) {
>> - numa_fw_cfg[apic_id_limit + 1 + i] = cpu_to_le64(node_mem[i]);
>> + numa_fw_cfg[apic_id_limit + 1 + i] = cpu_to_le64(numa_info[i].node_mem);
>> }
>> fw_cfg_add_bytes(fw_cfg, FW_CFG_NUMA, numa_fw_cfg,
>> (1 + apic_id_limit + nb_numa_nodes) *
>> diff --git a/hw/net/eepro100.c b/hw/net/eepro100.c
>> index dc99ea6..478c688 100644
>> --- a/hw/net/eepro100.c
>> +++ b/hw/net/eepro100.c
>> @@ -105,7 +105,6 @@
>> #define PCI_IO_SIZE 64
>> #define PCI_FLASH_SIZE (128 * KiB)
>>
>> -#define BIT(n) (1 << (n))
>> #define BITS(n, m) (((0xffffffffU << (31 - n)) >> (31 - n + m)) << m)
>>
>> /* The SCB accepts the following controls for the Tx and Rx units: */
>> diff --git a/include/sysemu/sysemu.h b/include/sysemu/sysemu.h
>> index 2fb71af..70fd2ed 100644
>> --- a/include/sysemu/sysemu.h
>> +++ b/include/sysemu/sysemu.h
>> @@ -9,6 +9,7 @@
>> #include "qapi-types.h"
>> #include "qemu/notify.h"
>> #include "qemu/main-loop.h"
>> +#include "qemu/bitmap.h"
>>
>> /* vl.c */
>>
>> @@ -130,8 +131,11 @@ extern QEMUClock *rtc_clock;
>> #define MAX_NODES 64
>> #define MAX_CPUMASK_BITS 255
>> extern int nb_numa_nodes;
>> -extern uint64_t node_mem[MAX_NODES];
>> -extern unsigned long *node_cpumask[MAX_NODES];
>> +struct node_info {
NodeInfo
>> + uint64_t node_mem;
>> + DECLARE_BITMAP(node_cpu, MAX_CPUMASK_BITS);
>> +};
Please add a typedef and use that everywhere below.
>> +extern struct node_info numa_info[MAX_NODES];
I wonder if those structs should be QOM Objects instead, so that we can
use link<> properties from CPUState. I think Paolo suggested something
in that direction?
Regards,
Andreas
>>
>> #define MAX_OPTION_ROMS 16
>> typedef struct QEMUOptionRom {
>> diff --git a/monitor.c b/monitor.c
>> index 9be515c..93ac045 100644
>> --- a/monitor.c
>> +++ b/monitor.c
>> @@ -1820,7 +1820,7 @@ static void do_info_numa(Monitor *mon, const QDict *qdict)
>> }
>> monitor_printf(mon, "\n");
>> monitor_printf(mon, "node %d size: %" PRId64 " MB\n", i,
>> - node_mem[i] >> 20);
>> + numa_info[i].node_mem >> 20);
>> }
>> }
>>
>> diff --git a/vl.c b/vl.c
>> index 6f2e17a..5207b8e 100644
>> --- a/vl.c
>> +++ b/vl.c
>> @@ -250,8 +250,7 @@ static QTAILQ_HEAD(, FWBootEntry) fw_boot_order =
>> QTAILQ_HEAD_INITIALIZER(fw_boot_order);
>>
>> int nb_numa_nodes;
>> -uint64_t node_mem[MAX_NODES];
>> -unsigned long *node_cpumask[MAX_NODES];
>> +struct node_info numa_info[MAX_NODES];
>>
>> uint8_t qemu_uuid[16];
>>
>> @@ -1367,7 +1366,7 @@ static void numa_node_parse_cpus(int nodenr, const char *cpus)
>> goto error;
>> }
>>
>> - bitmap_set(node_cpumask[nodenr], value, endvalue-value+1);
>> + bitmap_set(numa_info[nodenr].node_cpu, value, endvalue-value+1);
>> return;
>>
>> error:
>> @@ -1399,7 +1398,7 @@ static int numa_init_func(QemuOpts *opts, void *opaque)
>> }
>>
>> mem_size = qemu_opt_get_size(opts, "mem", 0);
>> - node_mem[nodenr] = mem_size;
>> + numa_info[nodenr].node_mem = mem_size;
>>
>> if (qemu_opt_foreach(opts, numa_add_cpus, &nodenr, 1) < 0) {
>> return -1;
>> @@ -2961,8 +2960,8 @@ int main(int argc, char **argv, char **envp)
>> translation = BIOS_ATA_TRANSLATION_AUTO;
>>
>> for (i = 0; i < MAX_NODES; i++) {
>> - node_mem[i] = 0;
>> - node_cpumask[i] = bitmap_new(MAX_CPUMASK_BITS);
>> + numa_info[i].node_mem = 0;
>> + bitmap_zero(numa_info[i].node_cpu, MAX_CPUMASK_BITS);
>> }
>>
>> nb_numa_nodes = 0;
>> @@ -4228,7 +4227,7 @@ int main(int argc, char **argv, char **envp)
>> * and distribute the available memory equally across all nodes
>> */
>> for (i = 0; i < nb_numa_nodes; i++) {
>> - if (node_mem[i] != 0)
>> + if (numa_info[i].node_mem != 0)
>> break;
>> }
>> if (i == nb_numa_nodes) {
>> @@ -4238,14 +4237,15 @@ int main(int argc, char **argv, char **envp)
>> * the final node gets the rest.
>> */
>> for (i = 0; i < nb_numa_nodes - 1; i++) {
>> - node_mem[i] = (ram_size / nb_numa_nodes) & ~((1 << 23UL) - 1);
>> - usedmem += node_mem[i];
>> + numa_info[i].node_mem = (ram_size / nb_numa_nodes) &
>> + ~((1 << 23UL) - 1);
>> + usedmem += numa_info[i].node_mem;
>> }
>> - node_mem[i] = ram_size - usedmem;
>> + numa_info[i].node_mem = ram_size - usedmem;
>> }
>>
>> for (i = 0; i < nb_numa_nodes; i++) {
>> - if (!bitmap_empty(node_cpumask[i], MAX_CPUMASK_BITS)) {
>> + if (!bitmap_empty(numa_info[i].node_cpu, MAX_CPUMASK_BITS)) {
>> break;
>> }
>> }
>> @@ -4255,7 +4255,7 @@ int main(int argc, char **argv, char **envp)
>> */
>> if (i == nb_numa_nodes) {
>> for (i = 0; i < max_cpus; i++) {
>> - set_bit(i, node_cpumask[i % nb_numa_nodes]);
>> + set_bit(i, numa_info[i % nb_numa_nodes].node_cpu);
>> }
>> }
>> }
>> --
>> 1.8.3.2.634.g7a3187e
>>
>>
>
--
SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg, Germany
GF: Jeff Hawn, Jennifer Guild, Felix Imendörffer; HRB 16746 AG Nürnberg
next prev parent reply other threads:[~2013-07-05 20:10 UTC|newest]
Thread overview: 38+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-07-04 9:53 [Qemu-devel] [PATCH V4 00/10] Add support for binding guest numa nodes to host numa nodes Wanlong Gao
2013-07-04 9:53 ` [Qemu-devel] [PATCH V4 01/10] NUMA: Support multiple CPU ranges on -numa option Wanlong Gao
2013-07-05 18:41 ` Eduardo Habkost
2013-07-08 19:02 ` Eric Blake
2013-07-08 19:25 ` Eduardo Habkost
2013-07-08 19:25 ` Anthony Liguori
2013-07-09 3:28 ` Wanlong Gao
2013-07-09 3:34 ` Eric Blake
2013-07-14 11:34 ` Paolo Bonzini
2013-07-15 21:33 ` Eric Blake
2013-07-16 6:24 ` Paolo Bonzini
2013-07-04 9:53 ` [Qemu-devel] [PATCH V4 02/10] NUMA: Add numa_info structure to contain numa nodes info Wanlong Gao
2013-07-05 19:32 ` Eduardo Habkost
2013-07-05 20:09 ` Andreas Färber [this message]
2013-07-04 9:53 ` [Qemu-devel] [PATCH V4 03/10] NUMA: Add Linux libnuma detection Wanlong Gao
2013-07-04 9:53 ` [Qemu-devel] [PATCH V4 04/10] NUMA: parse guest numa nodes memory policy Wanlong Gao
2013-07-04 9:53 ` [Qemu-devel] [PATCH V4 05/10] NUMA: handle Error in cpus, mpol and hostnode parser Wanlong Gao
2013-07-04 9:53 ` [Qemu-devel] [PATCH V4 06/10] NUMA: split out the common range parser Wanlong Gao
2013-07-04 9:53 ` [Qemu-devel] [PATCH V4 07/10] NUMA: set guest numa nodes memory policy Wanlong Gao
2013-07-04 9:53 ` [Qemu-devel] [PATCH V4 08/10] NUMA: add qmp command set-mpol to set memory policy for NUMA node Wanlong Gao
2013-07-08 18:25 ` Luiz Capitulino
2013-07-08 18:34 ` Luiz Capitulino
2013-07-08 18:50 ` Andreas Färber
2013-07-08 19:03 ` Luiz Capitulino
2013-07-15 11:18 ` Wanlong Gao
2013-07-08 19:16 ` Eric Blake
2013-07-04 9:53 ` [Qemu-devel] [PATCH V4 09/10] NUMA: add hmp command set-mpol Wanlong Gao
2013-07-08 18:32 ` Luiz Capitulino
2013-07-04 9:53 ` [Qemu-devel] [PATCH V4 10/10] NUMA: show host memory policy info in info numa command Wanlong Gao
2013-07-05 18:49 ` Eduardo Habkost
2013-07-08 18:36 ` Luiz Capitulino
2013-07-04 19:49 ` [Qemu-devel] [PATCH V4 00/10] Add support for binding guest numa nodes to host numa nodes Paolo Bonzini
2013-07-04 21:15 ` Laszlo Ersek
2013-07-05 0:55 ` Wanlong Gao
2013-07-05 0:54 ` Wanlong Gao
2013-07-05 19:18 ` Eduardo Habkost
2013-07-11 10:32 ` Peter Huang(Peng)
2013-07-11 13:10 ` Eduardo Habkost
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=51D7280B.6070908@suse.de \
--to=afaerber@suse.de \
--cc=aliguori@us.ibm.com \
--cc=bsd@redhat.com \
--cc=ehabkost@redhat.com \
--cc=gaowanlong@cn.fujitsu.com \
--cc=lcapitulino@redhat.com \
--cc=pbonzini@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=y-goto@jp.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.