]> www.infradead.org Git - users/jedix/linux-maple.git/commitdiff
sparc64: Fixes NUMA node cpulist sysfs file in single NUMA node case.
authorThomas Tai <thomas.tai@oracle.com>
Fri, 2 Sep 2016 19:18:19 +0000 (12:18 -0700)
committerAllen Pais <allen.pais@oracle.com>
Tue, 8 Nov 2016 10:17:59 +0000 (15:47 +0530)
Forward port 23175351 to UEK4

The sysfs file /sys/devices/system/node/node0/cpulist is incorrect in the
single node case on sun4v machines as the machine description record in this
case does not contain any NUMA information. A default list from 0 to NR_CPUS
was used prior. This file is read by utilities such as 'numactl --hardware'
and lscpu to show CPU-to-node assignment.

In order to fix this issue, the numa_cpumask_lookup_table is cleared at
bootup. Whenever an extra cpu is bringup via __cpu_up, the corresponding
cpu mask is set in the numa_cpumask_lookup_table.

Orabug: 24500614
Orabug: 22546851

Signed-off-by: Chris Hyser <chris.hyser@oracle.com>
Signed-off-by: Thomas Tai <thomas.tai@oracle.com>
arch/sparc/kernel/cpumap.h
arch/sparc/kernel/smp_64.c
arch/sparc/mm/init_64.c

index 9dac398c434a4bab1b30333d2d39e1a23ffd88db..e6173aaccbc709983f51e0d63b337209f7cc13fc 100644 (file)
@@ -13,4 +13,6 @@ static inline int map_to_cpu(unsigned int index)
 }
 #endif
 
+void sparc64_update_numa_mask(unsigned int cpu);
+
 #endif
index c4b6221d0f20682287c6f0ec1502b7d0a902c8cf..6263c03ab2a5f929f1a54b98d0eac9031845c240 100644 (file)
@@ -1315,6 +1315,7 @@ int __cpu_up(unsigned int cpu, struct task_struct *tidle)
                        if (tlb_type != hypervisor)
                                smp_synchronize_one_tick(cpu);
                        cpu_map_rebuild();
+                       sparc64_update_numa_mask(cpu);
                }
        }
        return ret;
index c28abb62367c7bff002d94a1a403fd2d69a4fade..2fde60da480a074076fca1eb6e1d7f80b01b487b 100644 (file)
@@ -1266,7 +1266,10 @@ static void init_node_masks_nonnuma(void)
        for (i = 0; i < NR_CPUS; i++)
                numa_cpu_lookup_table[i] = 0;
 
-       cpumask_setall(&numa_cpumask_lookup_table[0]);
+       /* Add current cpu into numa_cpumask_lookup_table[0],
+        * the rest of the numa cpumask will be set in __cpu_up().
+        */
+       cpumask_set_cpu(smp_processor_id(), &numa_cpumask_lookup_table[0]);
 #endif
 }
 
@@ -1831,6 +1834,13 @@ static int __init bootmem_init_numa(void)
        return err;
 }
 
+void sparc64_update_numa_mask(unsigned int cpu)
+{
+       if (num_node_masks > 1)
+               return;
+
+       cpumask_set_cpu(cpu, &numa_cpumask_lookup_table[0]);
+}
 #else
 
 static int bootmem_init_numa(void)
@@ -1838,6 +1848,10 @@ static int bootmem_init_numa(void)
        return -1;
 }
 
+void sparc64_update_numa_mask(unsigned int cpu)
+{
+}
+
 #endif
 
 static void __init bootmem_init_nonnuma(void)