aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Rientjes <rientjes@google.com>2010-12-30 13:54:16 -0500
committerIngo Molnar <mingo@elte.hu>2011-01-07 08:09:34 -0500
commitd906f0eb2f0e6d1a24c479f69a9c39e7e45c5ae8 (patch)
tree6e8736896daed1bb8c658a84eb89d7657b68b48c
parentd50e8fc7e38d88909448a723cb1f825bb3af30e2 (diff)
x86, numa: Fix CONFIG_DEBUG_PER_CPU_MAPS without NUMA emulation
"x86, numa: Fake node-to-cpumask for NUMA emulation" broke the build when CONFIG_DEBUG_PER_CPU_MAPS is set and CONFIG_NUMA_EMU is not. This is because it is possible to map a cpu to multiple nodes when NUMA emulation is used; the patch required a physical node address table to find those nodes that was only available when CONFIG_NUMA_EMU was enabled. This extracts the common debug functionality to its own function for CONFIG_DEBUG_PER_CPU_MAPS and uses it regardless of whether CONFIG_NUMA_EMU is set or not. NUMA emulation will now iterate over the set of possible nodes for each cpu and call the new debug function whereas only the cpu's node will be used without NUMA emulation enabled. Reported-by: Ingo Molnar <mingo@elte.hu> Signed-off-by: David Rientjes <rientjes@google.com> Acked-by: Yinghai Lu <yinghai@kernel.org> LKML-Reference: <alpine.DEB.2.00.1012301053590.12995@chino.kir.corp.google.com> Signed-off-by: Ingo Molnar <mingo@elte.hu>
-rw-r--r--arch/x86/mm/numa_64.c48
1 files changed, 37 insertions, 11 deletions
diff --git a/arch/x86/mm/numa_64.c b/arch/x86/mm/numa_64.c
index 3d73201ba347..1e72102e80c9 100644
--- a/arch/x86/mm/numa_64.c
+++ b/arch/x86/mm/numa_64.c
@@ -833,15 +833,48 @@ void __cpuinit numa_remove_cpu(int cpu)
833#endif /* !CONFIG_NUMA_EMU */ 833#endif /* !CONFIG_NUMA_EMU */
834 834
835#else /* CONFIG_DEBUG_PER_CPU_MAPS */ 835#else /* CONFIG_DEBUG_PER_CPU_MAPS */
836static struct cpumask __cpuinit *debug_cpumask_set_cpu(int cpu, int enable)
837{
838 int node = early_cpu_to_node(cpu);
839 struct cpumask *mask;
840 char buf[64];
841
842 mask = node_to_cpumask_map[node];
843 if (!mask) {
844 pr_err("node_to_cpumask_map[%i] NULL\n", node);
845 dump_stack();
846 return NULL;
847 }
848
849 cpulist_scnprintf(buf, sizeof(buf), mask);
850 printk(KERN_DEBUG "%s cpu %d node %d: mask now %s\n",
851 enable ? "numa_add_cpu" : "numa_remove_cpu",
852 cpu, node, buf);
853 return mask;
854}
836 855
837/* 856/*
838 * --------- debug versions of the numa functions --------- 857 * --------- debug versions of the numa functions ---------
839 */ 858 */
859#ifndef CONFIG_NUMA_EMU
860static void __cpuinit numa_set_cpumask(int cpu, int enable)
861{
862 struct cpumask *mask;
863
864 mask = debug_cpumask_set_cpu(cpu, enable);
865 if (!mask)
866 return;
867
868 if (enable)
869 cpumask_set_cpu(cpu, mask);
870 else
871 cpumask_clear_cpu(cpu, mask);
872}
873#else
840static void __cpuinit numa_set_cpumask(int cpu, int enable) 874static void __cpuinit numa_set_cpumask(int cpu, int enable)
841{ 875{
842 int node = early_cpu_to_node(cpu); 876 int node = early_cpu_to_node(cpu);
843 struct cpumask *mask; 877 struct cpumask *mask;
844 char buf[64];
845 int i; 878 int i;
846 879
847 for_each_online_node(i) { 880 for_each_online_node(i) {
@@ -851,24 +884,17 @@ static void __cpuinit numa_set_cpumask(int cpu, int enable)
851 if (addr < physnodes[node].start || 884 if (addr < physnodes[node].start ||
852 addr >= physnodes[node].end) 885 addr >= physnodes[node].end)
853 continue; 886 continue;
854 mask = node_to_cpumask_map[node]; 887 mask = debug_cpumask_set_cpu(cpu, enable);
855 if (mask == NULL) { 888 if (!mask)
856 pr_err("node_to_cpumask_map[%i] NULL\n", i);
857 dump_stack();
858 return; 889 return;
859 }
860 890
861 if (enable) 891 if (enable)
862 cpumask_set_cpu(cpu, mask); 892 cpumask_set_cpu(cpu, mask);
863 else 893 else
864 cpumask_clear_cpu(cpu, mask); 894 cpumask_clear_cpu(cpu, mask);
865
866 cpulist_scnprintf(buf, sizeof(buf), mask);
867 printk(KERN_DEBUG "%s cpu %d node %d: mask now %s\n",
868 enable ? "numa_add_cpu" : "numa_remove_cpu",
869 cpu, node, buf);
870 } 895 }
871} 896}
897#endif /* CONFIG_NUMA_EMU */
872 898
873void __cpuinit numa_add_cpu(int cpu) 899void __cpuinit numa_add_cpu(int cpu)
874{ 900{