Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 5 Jan 2000 03:35:48 -0500 (EST)
From:      Luoqi Chen <luoqi@watermarkgroup.com>
To:        aron@cs.rice.edu, freebsd-hackers@FreeBSD.ORG
Subject:   Re:  FreeBSD-4.0 on SMP
Message-ID:  <200001050835.DAA26364@lor.watermarkgroup.com>

next in thread | raw e-mail | index | archive | help
> Hi,	
> 	I have a 4-processor machine but I want to configure FreeBSD-4.0
> to only use 1 of the processors for some tests. In addition I want the 
> local APIC to be enabled. It seems currently that the APIC is only enabled
> when the kernel is compiled with the SMP option. However, when I specify
> NCPU to be 1, the kernel panics. So the question is - is there a way to 
> just use one processor and still keep the APIC enabled ?
> 
> 
> 
> - Mohit
> 
Try again with the following patch,

Index: i386/mp_machdep.c
===================================================================
RCS file: /home/ncvs/src/sys/i386/i386/mp_machdep.c,v
retrieving revision 1.112
diff -u -r1.112 mp_machdep.c
--- i386/mp_machdep.c	1999/11/27 12:32:20	1.112
+++ i386/mp_machdep.c	2000/01/05 08:28:40
@@ -1097,7 +1097,7 @@
 processor_entry(proc_entry_ptr entry, int cpu)
 {
 	/* check for usability */
-	if ((cpu >= NCPU) || !(entry->cpu_flags & PROCENTRY_FLAG_EN))
+	if (!(entry->cpu_flags & PROCENTRY_FLAG_EN))
 		return 0;
 
 	/* check for BSP flag */
@@ -1109,11 +1109,13 @@
 	}
 
 	/* add another AP to list, if less than max number of CPUs */
-	else {
+	else if (cpu < NCPU) {
 		CPU_TO_ID(cpu) = entry->apic_id;
 		ID_TO_CPU(entry->apic_id) = cpu;
 		return 1;
 	}
+
+	return 0;
 }
 
 
Index: include/mpapic.h
===================================================================
RCS file: /home/ncvs/src/sys/i386/include/mpapic.h,v
retrieving revision 1.12
diff -u -r1.12 mpapic.h
--- include/mpapic.h	1999/08/28 00:44:19	1.12
+++ include/mpapic.h	2000/01/05 08:24:58
@@ -98,6 +98,8 @@
 static __inline int
 all_but_self_ipi(int vector)
 {
+	if (mp_ncpus <= 1)
+		return 0;
 	return apic_ipi(APIC_DEST_ALLESELF, vector, APIC_DELMODE_FIXED);
 }
 

-lq


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-hackers" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200001050835.DAA26364>