SMP kernel on UP machines?

David Rhodus drhodus at catpa.com
Mon Dec 29 12:34:47 PST 2003


Emiel Kollof wrote:

Hi,

Does that work? I have a CPU that's supposed to do HTT. Yet when I try
to boot an SMP kernel, it just fails at boot complaining it can't find a
local APIC, yet my machine _does_ have one.
It might be an idea to allow SMP kernels to boot on UP anyway for
distribution purposes. In CURRENT SMP is default and works fine on UP
machines. It doesn't slow down the machines much either.
Cheers,
Emiel
 

Give this a try, this cleans up so we no longer need the HTT option
compiled into the kernel and should give you HTT support on your
UP machine.
-DR
Index: conf/options.i386
===================================================================
RCS file: /cvs/src/sys/conf/options.i386,v
retrieving revision 1.4
diff -u -r1.4 options.i386
--- conf/options.i386	20 Dec 2003 05:52:19 -0000	1.4
+++ conf/options.i386	29 Dec 2003 19:42:57 -0000
@@ -32,7 +32,6 @@
 
 # i386 SMP options
 APIC_IO			opt_global.h
-HTT
 
 # Change KVM size.  Changes things all over the kernel.
 KVA_PAGES		opt_global.h
Index: conf/options.pc98
===================================================================
RCS file: /cvs/src/sys/conf/options.pc98,v
retrieving revision 1.4
diff -u -r1.4 options.pc98
--- conf/options.pc98	20 Dec 2003 05:52:19 -0000	1.4
+++ conf/options.pc98	29 Dec 2003 19:43:10 -0000
@@ -32,7 +32,6 @@
 
 # i386 SMP options
 APIC_IO			opt_global.h
-HTT
 
 # Change KVM size.  Changes things all over the kernel.
 KVA_PAGES		opt_global.h
Index: i386/conf/GENERIC
===================================================================
RCS file: /cvs/src/sys/i386/conf/GENERIC,v
retrieving revision 1.6
diff -u -r1.6 GENERIC
--- i386/conf/GENERIC	27 Dec 2003 03:17:21 -0000	1.6
+++ i386/conf/GENERIC	29 Dec 2003 19:42:28 -0000
@@ -65,9 +65,6 @@
 #options 	SMP			# Symmetric MultiProcessor Kernel
 #options 	APIC_IO			# Symmetric (APIC) I/O
 
-# To support HyperThreading, HTT is needed in addition to SMP and APIC_IO
-#options 	HTT			# HyperThreading Technology
-
 # Debugging for Development
 options         DDB
 options         INVARIANTS
Index: i386/conf/LINT
===================================================================
RCS file: /cvs/src/sys/i386/conf/LINT,v
retrieving revision 1.14
diff -u -r1.14 LINT
--- i386/conf/LINT	20 Dec 2003 05:52:23 -0000	1.14
+++ i386/conf/LINT	29 Dec 2003 19:42:22 -0000
@@ -123,7 +123,6 @@
 # Mandatory:
 options 	SMP			# Symmetric MultiProcessor Kernel
 options 	APIC_IO			# Symmetric (APIC) I/O
-options 	HTT			# HyperThreading Technology
 
 #
 # Rogue SMP hardware:
Index: i386/i386/machdep.c
===================================================================
RCS file: /cvs/src/sys/i386/i386/machdep.c,v
retrieving revision 1.50
diff -u -r1.50 machdep.c
--- i386/i386/machdep.c	28 Dec 2003 06:11:30 -0000	1.50
+++ i386/i386/machdep.c	29 Dec 2003 20:04:31 -0000
@@ -2593,7 +2593,6 @@
 
 
 #include "opt_cpu.h"
-#include "opt_htt.h"
 
 
 /*
Index: i386/i386/mp_machdep.c
===================================================================
RCS file: /cvs/src/sys/i386/i386/mp_machdep.c,v
retrieving revision 1.19
diff -u -r1.19 mp_machdep.c
--- i386/i386/mp_machdep.c	20 Dec 2003 05:52:26 -0000	1.19
+++ i386/i386/mp_machdep.c	29 Dec 2003 20:22:31 -0000
@@ -27,7 +27,6 @@
  */
 
 #include "opt_cpu.h"
-#include "opt_htt.h"
 
 #ifdef SMP
 #include <machine/smptests.h>
@@ -231,10 +230,9 @@
 
 #define MP_ANNOUNCE_POST	0x19
 
-#ifdef HTT
 static int need_hyperthreading_fixup;
 static u_int logical_cpus;
-#endif
+u_int	logical_cpus_mask;
 
 /** XXX FIXME: where does this really belong, isa.h/isa.c perhaps? */
 int	current_postcode;
@@ -303,9 +301,7 @@
 static int	search_for_sig(u_int32_t target, int count);
 static void	mp_enable(u_int boot_addr);
 
-#ifdef HTT
 static void	mptable_hyperthread_fixup(u_int id_mask);
-#endif
 static void	mptable_pass1(void);
 static int	mptable_pass2(void);
 static void	default_mp_table(int type);
@@ -744,9 +740,7 @@
 	void*	position;
 	int	count;
 	int	type;
-#ifdef HTT
 	u_int	id_mask;
-#endif
 
 	POSTCODE(MPTABLE_PASS1_POST);
 
@@ -760,9 +754,7 @@
 	mp_nbusses = 0;
 	mp_napics = 0;
 	nintrs = 0;
-#ifdef HTT
 	id_mask = 0;
-#endif
 
 	/* check for use of 'default' configuration */
 	if (MPFPS_MPFB1 != 0) {
@@ -795,10 +787,8 @@
 				if (((proc_entry_ptr)position)->cpu_flags
 				    & PROCENTRY_FLAG_EN) {
 					++mp_naps;
-#ifdef HTT
 					id_mask |= 1 <<
 					    ((proc_entry_ptr)position)->apic_id;
-#endif
 				}
 				break;
 			case 1: /* bus_entry */
@@ -833,10 +823,8 @@
 		mp_naps = MAXCPU;
 	}
 
-#ifdef HTT
 	/* See if we need to fixup HT logical CPUs. */
 	mptable_hyperthread_fixup(id_mask);
-#endif
 	
 	/*
 	 * Count the BSP.
@@ -862,9 +850,7 @@
 static int
 mptable_pass2(void)
 {
-#ifdef HTT
 	struct PROCENTRY proc;
-#endif
 	int     x;
 	mpcth_t cth;
 	int     totalSize;
@@ -877,12 +863,10 @@
 
 	POSTCODE(MPTABLE_PASS2_POST);
 
-#ifdef HTT
 	/* Initialize fake proc entry for use with HT fixup. */
 	bzero(&proc, sizeof(proc));
 	proc.type = 0;
 	proc.cpu_flags = PROCENTRY_FLAG_EN;
-#endif
 
 	pgeflag = 0;		/* XXX - Not used under SMP yet.  */
 
@@ -962,7 +946,6 @@
 			if (processor_entry(position, cpu))
 				++cpu;
 
-#ifdef HTT
 			if (need_hyperthreading_fixup) {
 				/*
 				 * Create fake mptable processor entries
@@ -973,10 +956,10 @@
 				for (i = 1; i < logical_cpus; i++) {
 					proc.apic_id++;
 					(void)processor_entry(&proc, cpu);
+					logical_cpus_mask |= (1 << cpu);
 					cpu++;
 				}
 			}
-#endif
 			break;
 		case 1:
 			if (bus_entry(position, bus))
@@ -1009,7 +992,6 @@
 	return 0;
 }
 
-#ifdef HTT
 /*
  * Check if we should perform a hyperthreading "fix-up" to
  * enumerate any logical CPU's that aren't already listed
@@ -1058,7 +1040,6 @@
 	need_hyperthreading_fixup = 1;
 	mp_naps *= logical_cpus;
 }
-#endif
 
 void
 assign_apic_irq(int apic, int intpin, int irq)




More information about the Kernel mailing list