Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 12 Jul 2001 23:56:58 -0700 (PDT)
From:      Matthew Jacob <mjacob@feral.com>
To:        smp@freebsd.org
Subject:   CPU disabled by loader...
Message-ID:  <Pine.BSF.4.21.0107122353080.61694-100000@beppo>

next in thread | raw e-mail | index | archive | help

I have a very simple patch for alpha that allows me to disable CPUS at loader
time via the hints mechanism:

Index: mp_machdep.c
===================================================================
RCS file: /home/ncvs/src/sys/alpha/alpha/mp_machdep.c,v
retrieving revision 1.22
diff -u -r1.22 mp_machdep.c
--- mp_machdep.c	2001/06/29 11:10:25	1.22
+++ mp_machdep.c	2001/07/13 06:54:12
@@ -37,6 +37,7 @@
 #include <sys/pcpu.h>
 #include <sys/smp.h>
 #include <sys/sysctl.h>
+#include <sys/bus.h>
 
 #include <vm/vm.h>
 #include <vm/pmap.h>
@@ -324,7 +325,7 @@
 }
 
 void
-cpu_mp_start()
+cpu_mp_start(void)
 {
 	int i;
 
@@ -335,6 +336,7 @@
 	    ("mp_start() called on non-primary CPU"));
 	all_cpus = 1 << boot_cpu_id;
 	for (i = 0; i < hwrpb->rpb_pcs_cnt; i++) {
+		int dv;
 		struct pcs *pcsp;
 
 		if (i == boot_cpu_id)
@@ -361,7 +363,12 @@
 			}
 			continue;
 		}
-		all_cpus |= 1 << i;
+		dv = 0;
+		if (resource_int_value("cpu", i, "disable", &dv) == 0 && dv) {
+			printf("CPU %d disabled by loader.\n", i);
+			continue;
+		}
+		all_cpus |= (1 << i);
 		mp_ncpus++;
 	}
 	PCPU_SET(other_cpus, all_cpus & ~(1 << boot_cpu_id));

-------------------

This allows me to set

hint.cpu.N.disable="1" (for N=0..M Cpus)

at loader time or in my hints file. This can be desirable for any large SMP
system- you may have a system that has a flakey CPU that you just want to keep
out of the mix, but you don't want to pull the system apart.

I *think* I see how I'd do i386- but I thought I'd ask about this here as a
more general question of utility.

-matt



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




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?Pine.BSF.4.21.0107122353080.61694-100000>