From: Nishanth Aravamudan <nacc@linux.vnet.ibm.com>
To: Eduardo Habkost <ehabkost@redhat.com>
Cc: "Michael S. Tsirkin" <mst@redhat.com>,
Alexey Kardashevskiy <aik@ozlabs.ru>,
Hu Tao <hutao@cn.fujitsu.com>,
qemu-devel@nongnu.org, qemu-ppc@nongnu.org,
Anton Blanchard <anton@samba.org>,
David Rientjes <rientjes@google.com>,
Igor Mammedov <imammedo@redhat.com>
Subject: [Qemu-devel] [PATCH 1/2] Rename nb_numa_nodes to num_numa_nodes
Date: Tue, 1 Jul 2014 13:11:08 -0700 [thread overview]
Message-ID: <20140701201108.GA21770@linux.vnet.ibm.com> (raw)
As suggested by Eduardo Habkost, rename nb_numa_nodes to num_numa_nodes
throughout the code, as that reflects the use of the variable more
clearly.
Signed-off-by: Nishanth Aravamudan <nacc@linux.vnet.ibm.com>
diff --git a/hw/i386/pc.c b/hw/i386/pc.c
index 2cf22b1..12472c6 100644
--- a/hw/i386/pc.c
+++ b/hw/i386/pc.c
@@ -698,23 +698,23 @@ static FWCfgState *bochs_bios_init(void)
* of nodes, one word for each VCPU->node and one word for each node to
* hold the amount of memory.
*/
- numa_fw_cfg = g_new0(uint64_t, 1 + apic_id_limit + nb_numa_nodes);
- numa_fw_cfg[0] = cpu_to_le64(nb_numa_nodes);
+ numa_fw_cfg = g_new0(uint64_t, 1 + apic_id_limit + num_numa_nodes);
+ numa_fw_cfg[0] = cpu_to_le64(num_numa_nodes);
for (i = 0; i < max_cpus; i++) {
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++) {
+ for (j = 0; j < num_numa_nodes; 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++) {
+ for (i = 0; i < num_numa_nodes; 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) *
+ (1 + apic_id_limit + num_numa_nodes) *
sizeof(*numa_fw_cfg));
return fw_cfg;
@@ -1121,10 +1121,10 @@ PcGuestInfo *pc_guest_info_init(ram_addr_t below_4g_mem_size,
guest_info->ram_size = below_4g_mem_size + above_4g_mem_size;
guest_info->apic_id_limit = pc_apic_id_limit(max_cpus);
guest_info->apic_xrupt_override = kvm_allows_irq0_override();
- guest_info->numa_nodes = nb_numa_nodes;
+ guest_info->numa_nodes = num_numa_nodes;
guest_info->node_mem = g_malloc0(guest_info->numa_nodes *
sizeof *guest_info->node_mem);
- for (i = 0; i < nb_numa_nodes; i++) {
+ for (i = 0; i < num_numa_nodes; i++) {
guest_info->node_mem[i] = numa_info[i].node_mem;
}
@@ -1134,7 +1134,7 @@ PcGuestInfo *pc_guest_info_init(ram_addr_t below_4g_mem_size,
for (i = 0; i < max_cpus; i++) {
unsigned int apic_id = x86_cpu_apic_id_from_index(i);
assert(apic_id < guest_info->apic_id_limit);
- for (j = 0; j < nb_numa_nodes; j++) {
+ for (j = 0; j < num_numa_nodes; j++) {
if (test_bit(i, numa_info[j].node_cpu)) {
guest_info->node_cpu[apic_id] = j;
break;
diff --git a/hw/ppc/spapr.c b/hw/ppc/spapr.c
index a8ba916..4b74fd6 100644
--- a/hw/ppc/spapr.c
+++ b/hw/ppc/spapr.c
@@ -226,7 +226,7 @@ static int spapr_fixup_cpu_dt(void *fdt, sPAPREnvironment *spapr)
}
}
- if (nb_numa_nodes > 1) {
+ if (num_numa_nodes > 1) {
ret = fdt_setprop(fdt, offset, "ibm,associativity", associativity,
sizeof(associativity));
if (ret < 0) {
@@ -608,7 +608,7 @@ static int spapr_populate_memory(sPAPREnvironment *spapr, void *fdt)
int i, off;
/* memory node(s) */
- if (nb_numa_nodes > 1 && numa_info[0].node_mem < ram_size) {
+ if (num_numa_nodes > 1 && numa_info[0].node_mem < ram_size) {
node0_size = numa_info[0].node_mem;
} else {
node0_size = ram_size;
@@ -642,7 +642,7 @@ static int spapr_populate_memory(sPAPREnvironment *spapr, void *fdt)
/* RAM: Node 1 and beyond */
mem_start = node0_size;
- for (i = 1; i < nb_numa_nodes; i++) {
+ for (i = 1; i < num_numa_nodes; i++) {
mem_reg_property[0] = cpu_to_be64(mem_start);
if (mem_start >= ram_size) {
node_size = 0;
@@ -792,7 +792,7 @@ static void spapr_reset_htab(sPAPREnvironment *spapr)
/* Update the RMA size if necessary */
if (spapr->vrma_adjust) {
- hwaddr node0_size = (nb_numa_nodes > 1) ?
+ hwaddr node0_size = (num_numa_nodes > 1) ?
numa_info[0].node_mem : ram_size;
spapr->rma_size = kvmppc_rma_size(node0_size, spapr->htab_shift);
}
@@ -1225,7 +1225,7 @@ static void ppc_spapr_init(MachineState *machine)
MemoryRegion *sysmem = get_system_memory();
MemoryRegion *ram = g_new(MemoryRegion, 1);
hwaddr rma_alloc_size;
- hwaddr node0_size = (nb_numa_nodes > 1) ? numa_info[0].node_mem : ram_size;
+ hwaddr node0_size = (num_numa_nodes > 1) ? numa_info[0].node_mem : ram_size;
uint32_t initrd_base = 0;
long kernel_size = 0, initrd_size = 0;
long load_limit, rtas_limit, fw_size;
diff --git a/include/sysemu/sysemu.h b/include/sysemu/sysemu.h
index d8539fd..d17bdbe 100644
--- a/include/sysemu/sysemu.h
+++ b/include/sysemu/sysemu.h
@@ -146,7 +146,7 @@ extern int mem_prealloc;
*/
#define MAX_CPUMASK_BITS 255
-extern int nb_numa_nodes; /* Number of NUMA nodes */
+extern int num_numa_nodes; /* Number of NUMA nodes */
extern int max_numa_nodeid; /* Highest specified NUMA node ID, plus one.
* For all nodes, nodeid < max_numa_nodeid
*/
diff --git a/monitor.c b/monitor.c
index 5bc70a6..392677a 100644
--- a/monitor.c
+++ b/monitor.c
@@ -1948,8 +1948,8 @@ static void do_info_numa(Monitor *mon, const QDict *qdict)
int i;
CPUState *cpu;
- monitor_printf(mon, "%d nodes\n", nb_numa_nodes);
- for (i = 0; i < nb_numa_nodes; i++) {
+ monitor_printf(mon, "%d nodes\n", num_numa_nodes);
+ for (i = 0; i < num_numa_nodes; i++) {
monitor_printf(mon, "node %d cpus:", i);
CPU_FOREACH(cpu) {
if (cpu->numa_node == i) {
diff --git a/numa.c b/numa.c
index 2fde740..5930df0 100644
--- a/numa.c
+++ b/numa.c
@@ -53,7 +53,7 @@ static void numa_node_parse(NumaNodeOptions *node, QemuOpts *opts, Error **errp)
if (node->has_nodeid) {
nodenr = node->nodeid;
} else {
- nodenr = nb_numa_nodes;
+ nodenr = num_numa_nodes;
}
if (nodenr >= MAX_NODES) {
@@ -136,7 +136,7 @@ int numa_init_func(QemuOpts *opts, void *opaque)
if (err) {
goto error;
}
- nb_numa_nodes++;
+ num_numa_nodes++;
break;
default:
abort();
@@ -174,31 +174,31 @@ void set_numa_nodes(void)
}
/* This must be always true if all nodes are present: */
- assert(nb_numa_nodes == max_numa_nodeid);
+ assert(num_numa_nodes == max_numa_nodeid);
- if (nb_numa_nodes > 0) {
+ if (num_numa_nodes > 0) {
uint64_t numa_total;
- if (nb_numa_nodes > MAX_NODES) {
- nb_numa_nodes = MAX_NODES;
+ if (num_numa_nodes > MAX_NODES) {
+ num_numa_nodes = MAX_NODES;
}
/* If no memory size is given for any node, assume the default case
* and distribute the available memory equally across all nodes
*/
- for (i = 0; i < nb_numa_nodes; i++) {
+ for (i = 0; i < num_numa_nodes; i++) {
if (numa_info[i].node_mem != 0) {
break;
}
}
- if (i == nb_numa_nodes) {
+ if (i == num_numa_nodes) {
uint64_t usedmem = 0;
/* On Linux, each node's border has to be 8MB aligned,
* the final node gets the rest.
*/
- for (i = 0; i < nb_numa_nodes - 1; i++) {
- numa_info[i].node_mem = (ram_size / nb_numa_nodes) &
+ for (i = 0; i < num_numa_nodes - 1; i++) {
+ numa_info[i].node_mem = (ram_size / num_numa_nodes) &
~((1 << 23UL) - 1);
usedmem += numa_info[i].node_mem;
}
@@ -206,7 +206,7 @@ void set_numa_nodes(void)
}
numa_total = 0;
- for (i = 0; i < nb_numa_nodes; i++) {
+ for (i = 0; i < num_numa_nodes; i++) {
numa_total += numa_info[i].node_mem;
}
if (numa_total != ram_size) {
@@ -216,7 +216,7 @@ void set_numa_nodes(void)
exit(1);
}
- for (i = 0; i < nb_numa_nodes; i++) {
+ for (i = 0; i < num_numa_nodes; i++) {
if (!bitmap_empty(numa_info[i].node_cpu, MAX_CPUMASK_BITS)) {
break;
}
@@ -225,9 +225,9 @@ void set_numa_nodes(void)
* must cope with this anyway, because there are BIOSes out there in
* real machines which also use this scheme.
*/
- if (i == nb_numa_nodes) {
+ if (i == num_numa_nodes) {
for (i = 0; i < max_cpus; i++) {
- set_bit(i, numa_info[i % nb_numa_nodes].node_cpu);
+ set_bit(i, numa_info[i % num_numa_nodes].node_cpu);
}
}
}
@@ -239,7 +239,7 @@ void set_numa_modes(void)
int i;
CPU_FOREACH(cpu) {
- for (i = 0; i < nb_numa_nodes; i++) {
+ for (i = 0; i < num_numa_nodes; i++) {
if (test_bit(cpu->cpu_index, numa_info[i].node_cpu)) {
cpu->numa_node = i;
}
@@ -282,7 +282,7 @@ void memory_region_allocate_system_memory(MemoryRegion *mr, Object *owner,
uint64_t addr = 0;
int i;
- if (nb_numa_nodes == 0 || !have_memdevs) {
+ if (num_numa_nodes == 0 || !have_memdevs) {
allocate_system_memory_nonnuma(mr, owner, name, ram_size);
return;
}
diff --git a/vl.c b/vl.c
index 6e084c2..0de54c5 100644
--- a/vl.c
+++ b/vl.c
@@ -195,7 +195,7 @@ struct FWBootEntry {
static QTAILQ_HEAD(, FWBootEntry) fw_boot_order =
QTAILQ_HEAD_INITIALIZER(fw_boot_order);
-int nb_numa_nodes;
+int num_numa_nodes;
int max_numa_nodeid;
NodeInfo numa_info[MAX_NODES];
@@ -2991,7 +2991,7 @@ int main(int argc, char **argv, char **envp)
bitmap_zero(numa_info[i].node_cpu, MAX_CPUMASK_BITS);
}
- nb_numa_nodes = 0;
+ num_numa_nodes = 0;
max_numa_nodeid = 0;
nb_nics = 0;
next reply other threads:[~2014-07-01 20:11 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-07-01 20:11 Nishanth Aravamudan [this message]
2014-07-01 20:13 ` [Qemu-devel] [PATCH 2/2 v5] numa: enable sparse node numbering on ppc Nishanth Aravamudan
2014-07-01 20:39 ` Eduardo Habkost
2014-07-01 20:50 ` Nishanth Aravamudan
2014-07-02 18:21 ` Eduardo Habkost
2014-07-02 21:02 ` Nishanth Aravamudan
2014-07-02 21:52 ` Eduardo Habkost
2014-07-01 20:42 ` [Qemu-devel] [PATCH 1/2] Rename nb_numa_nodes to num_numa_nodes Eduardo Habkost
2014-07-03 7:03 ` Michael S. Tsirkin
2014-07-03 16:31 ` Nishanth Aravamudan
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=20140701201108.GA21770@linux.vnet.ibm.com \
--to=nacc@linux.vnet.ibm.com \
--cc=aik@ozlabs.ru \
--cc=anton@samba.org \
--cc=ehabkost@redhat.com \
--cc=hutao@cn.fujitsu.com \
--cc=imammedo@redhat.com \
--cc=mst@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=qemu-ppc@nongnu.org \
--cc=rientjes@google.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).