qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-devel] [PATCH 1/2] Rename nb_numa_nodes to num_numa_nodes


From: Nishanth Aravamudan
Subject: [Qemu-devel] [PATCH 1/2] Rename nb_numa_nodes to num_numa_nodes
Date: Tue, 1 Jul 2014 13:11:08 -0700
User-agent: Mutt/1.5.21 (2010-09-15)

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 <address@hidden>

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;
 




reply via email to

[Prev in Thread] Current Thread [Next in Thread]