Skip to contentSkip to conversation

fix CONFIG_SMP=n generic builds

PATCH New Jesse Barnes 1 participant 1 message Jan 24, 2005

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 fix CONFIG_SMP=n generic builds

Quoted 6 lines · Tony

Uni-processor support is a mess right now. Dan's resurrection of Jesse's patches for generic-up support doesn't apply ... the prime culprit is discontig.c:find_per_node_space() which has been touched by several patches, so we still have lots of build errors for generic-up. tiger and zx1 systems do compile cleanly with CONFIG_SMP=n, but the tiger stalls:

Here's something that works for me with both generic and sn2 configs with and w/o CONFIG_SMP. Needs careful review (the new per-cpu MCA bits are broken for SMP, can you take a look Russ?).

Fix the CONFIG_IA64_GENERIC + CONFIG_SMP=n build by fixing up discontig, numa, and other CONFIG_SMP=n issues with the build. Note that some driver fixes are omitted (e.g. mmtimer and sn_hwperf) as they've already been sent separately. Eventually it would be good to get to the point where we can build kernels w/CONFIG_DISCONTIGMEM and w/o CONFIG_NUMA as well since that's the sort of kernel that will probably be most useful for kexec based crash dumping. This is one small step in that direction.

Thanks,
Jesse

# This is a BitKeeper generated diff -Nru style patch. #
# ChangeSet
# 2005/01/24 12:27:50-08:00 [email protected]
# config_smp=n support
#

# arch/ia64/kernel/numa.c
#   2005/01/24 12:27:33-08:00 [email protected] +57 -0
# 
# include/asm-ia64/sn/sn_cpuid.h
#   2005/01/24 12:27:33-08:00 [email protected] +0 -4
#   config_smp=n support
# 
# include/asm-ia64/smp.h
#   2005/01/24 12:27:33-08:00 [email protected] +1 -0
#   config_smp=n support
# 
# arch/ia64/mm/discontig.c
#   2005/01/24 12:27:33-08:00 [email protected] +58 -29
#   config_smp=n support
# 
# arch/ia64/kernel/smpboot.c
#   2005/01/24 12:27:33-08:00 [email protected] +0 -41
#   config_smp=n support
# 
# arch/ia64/kernel/setup.c
#   2005/01/24 12:27:33-08:00 [email protected] +2 -0
#   config_smp=n support
# 
# arch/ia64/kernel/numa.c
#   2005/01/24 12:27:33-08:00 [email protected] +0 -0
#   BitKeeper file /home/jbarnes/working/linux-2.5-up/arch/ia64/kernel/numa.c
# 
# arch/ia64/kernel/acpi.c
#   2005/01/24 12:27:28-08:00 [email protected] +3 -1
#   config_smp=n support
# 
# arch/ia64/kernel/Makefile
#   2005/01/24 12:27:28-08:00 [email protected] +1 -0
#   config_smp=n support
# 
diff -Nru a/arch/ia64/kernel/Makefile b/arch/ia64/kernel/Makefile
--- a/arch/ia64/kernel/Makefile	2005-01-24 12:37:30 -08:00
+++ b/arch/ia64/kernel/Makefile	2005-01-24 12:37:30 -08:00
@@ -17,6 +17,7 @@
 obj-$(CONFIG_IOSAPIC)		+= iosapic.o
 obj-$(CONFIG_MODULES)		+= module.o
 obj-$(CONFIG_SMP)		+= smp.o smpboot.o domain.o
+obj-$(CONFIG_NUMA)		+= numa.o
 obj-$(CONFIG_PERFMON)		+= perfmon_default_smpl.o
 obj-$(CONFIG_IA64_CYCLONE)	+= cyclone.o
 obj-$(CONFIG_IA64_MCA_RECOVERY)	+= mca_recovery.o
diff -Nru a/arch/ia64/kernel/acpi.c b/arch/ia64/kernel/acpi.c
--- a/arch/ia64/kernel/acpi.c	2005-01-24 12:37:30 -08:00
+++ b/arch/ia64/kernel/acpi.c	2005-01-24 12:37:30 -08:00
@@ -642,8 +642,10 @@
 			if (smp_boot_data.cpu_phys_id[cpu] != hard_smp_processor_id())
 				node_cpuid[i++].phys_id = smp_boot_data.cpu_phys_id[cpu];
 	}
-	build_cpu_to_node_map();
 # endif
+#endif
+#ifdef CONFIG_ACPI_NUMA
+	build_cpu_to_node_map();
 #endif
 	/* Make boot-up look pretty */
 	printk(KERN_INFO "%d CPUs available, %d CPUs total\n", available_cpus, total_cpus);
diff -Nru a/arch/ia64/kernel/numa.c b/arch/ia64/kernel/numa.c
--- /dev/null	Wed Dec 31 16:00:00 196900
+++ b/arch/ia64/kernel/numa.c	2005-01-24 12:37:30 -08:00
@@ -0,0 +1,57 @@
+/*
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ * ia64 kernel NUMA specific stuff
+ *
+ * Copyright (C) 2002 Erich Focht <[email protected]>
+ * Copyright (C) 2004 Silicon Graphics, Inc.
+ *   Jesse Barnes <[email protected]>
+ */
+#include <linux/config.h>
+#include <linux/topology.h>
+#include <linux/module.h>
+#include <asm/processor.h>
+#include <asm/smp.h>
+
+u8 cpu_to_node_map[NR_CPUS] __cacheline_aligned;
+EXPORT_SYMBOL(cpu_to_node_map);
+
+cpumask_t node_to_cpu_mask[MAX_NUMNODES] __cacheline_aligned;
+
+/**
+ * build_cpu_to_node_map - setup cpu to node and node to cpumask arrays
+ *
+ * Build cpu to node mapping and initialize the per node cpu masks using
+ * info from the node_cpuid array handed to us by ACPI.
+ */
+void __init build_cpu_to_node_map(void)
+{
+	int cpu, i, node;
+
+	for(node=0; node < MAX_NUMNODES; node++)
+		cpus_clear(node_to_cpu_mask[node]);
+
+	for(cpu = 0; cpu < NR_CPUS; ++cpu) {
+		node = -1;
+		for (i = 0; i < NR_CPUS; ++i)
+			if (cpu_physical_id(cpu) == node_cpuid[i].phys_id) {
+				node = node_cpuid[i].nid;
+				break;
+			}
+		cpu_to_node_map[cpu] = (node >= 0) ? node : 0;
+		if (node >= 0)
+			cpu_set(cpu, node_to_cpu_mask[node]);
+	}
+}
diff -Nru a/arch/ia64/kernel/setup.c b/arch/ia64/kernel/setup.c
--- a/arch/ia64/kernel/setup.c	2005-01-24 12:37:30 -08:00
+++ b/arch/ia64/kernel/setup.c	2005-01-24 12:37:30 -08:00
@@ -657,7 +657,9 @@
 		BUG();

ia64_mmu_init(ia64_imva(cpu_data));
+#ifdef CONFIG_SMP
set_mca_pointer(cpu_info, cpu_data);
+#endif

#ifdef CONFIG_IA32_SUPPORT
ia32_cpu_init();

arch/ia64/kernel/smpboot.c +0 -41
diff -Nru a/arch/ia64/kernel/smpboot.c b/arch/ia64/kernel/smpboot.c
@@ -477,47 +477,6 @@
 	}
 }
 
-#ifdef CONFIG_NUMA
-
-/* on which node is each logical CPU (one cacheline even for 64 CPUs) */
-u8 cpu_to_node_map[NR_CPUS] __cacheline_aligned;
-EXPORT_SYMBOL(cpu_to_node_map);
-/* which logical CPUs are on which nodes */
-cpumask_t node_to_cpu_mask[MAX_NUMNODES] __cacheline_aligned;
-
-/*
- * Build cpu to node mapping and initialize the per node cpu masks.
- */
-void __init
-build_cpu_to_node_map (void)
-{
-	int cpu, i, node;
-
-	for(node=0; node<MAX_NUMNODES; node++)
-		cpus_clear(node_to_cpu_mask[node]);
-	for(cpu = 0; cpu < NR_CPUS; ++cpu) {
-		/*
-		 * All Itanium NUMA platforms I know use ACPI, so maybe we
-		 * can drop this ifdef completely.                    [EF]
-		 */
-#ifdef CONFIG_ACPI_NUMA
-		node = -1;
-		for (i = 0; i < NR_CPUS; ++i)
-			if (cpu_physical_id(cpu) == node_cpuid[i].phys_id) {
-				node = node_cpuid[i].nid;
-				break;
-			}
-#else
-#		error Fixme: Dunno how to build CPU-to-node map.
-#endif
-		cpu_to_node_map[cpu] = (node >= 0) ? node : 0;
-		if (node >= 0)
-			cpu_set(cpu, node_to_cpu_mask[node]);
-	}
-}
-
-#endif /* CONFIG_NUMA */
-
 /*
  * Cycle through the APs sending Wakeup IPIs to boot each.
  */
arch/ia64/mm/discontig.c +58 -29

134 lines not on this page · raw message

include/asm-ia64/smp.h +1 -0
diff -Nru a/include/asm-ia64/smp.h b/include/asm-ia64/smp.h
@@ -126,6 +126,7 @@
 #else
 
 #define cpu_logical_id(cpuid)		0
+#define cpu_physical_id(i)	((ia64_getreg(_IA64_REG_CR_LID) >> 16) & 0xffff)
 
 #endif /* CONFIG_SMP */
 #endif /* _ASM_IA64_SMP_H */
include/asm-ia64/sn/sn_cpuid.h +0 -4
diff -Nru a/include/asm-ia64/sn/sn_cpuid.h b/include/asm-ia64/sn/sn_cpuid.h
@@ -81,10 +81,6 @@
  *
  */
 
-#ifndef CONFIG_SMP
-#define cpu_physical_id(cpuid)			((ia64_getreg(_IA64_REG_CR_LID) >> 16) & 0xffff)
-#endif
-
 
 #define get_node_number(addr)			NASID_GET(addr)