Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 28 Feb 2019 14:40:43 +0000 (UTC)
From:      Andrew Turner <andrew@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r344659 - head/sys/arm64/arm64
Message-ID:  <201902281440.x1SEehMr084056@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: andrew
Date: Thu Feb 28 14:40:43 2019
New Revision: 344659
URL: https://svnweb.freebsd.org/changeset/base/344659

Log:
  Add the hw.ncpu tunable to arm64.
  
  This allows us to limit the number of CPUs to use, e.g. to debug problems
  seen when enabling multiple clusters.
  
  Reviewed by:	manu
  Sponsored by:	DARPA, AFRL
  Differential Revision:	https://reviews.freebsd.org/D19404

Modified:
  head/sys/arm64/arm64/mp_machdep.c

Modified: head/sys/arm64/arm64/mp_machdep.c
==============================================================================
--- head/sys/arm64/arm64/mp_machdep.c	Thu Feb 28 09:42:03 2019	(r344658)
+++ head/sys/arm64/arm64/mp_machdep.c	Thu Feb 28 14:40:43 2019	(r344659)
@@ -638,10 +638,11 @@ cpu_find_cpu0_fdt(u_int id, phandle_t node, u_int addr
 void
 cpu_mp_setmaxid(void)
 {
-#if defined(DEV_ACPI) || defined(FDT)
 	int cores;
-#endif
 
+	mp_ncpus = 1;
+	mp_maxid = 0;
+
 	switch(arm64_bus_method) {
 #ifdef DEV_ACPI
 	case ARM64_BUS_ACPI:
@@ -653,7 +654,6 @@ cpu_mp_setmaxid(void)
 				    cores);
 			mp_ncpus = cores;
 			mp_maxid = cores - 1;
-			return;
 		}
 		break;
 #endif
@@ -667,18 +667,21 @@ cpu_mp_setmaxid(void)
 				    cores);
 			mp_ncpus = cores;
 			mp_maxid = cores - 1;
-			return;
 		}
 		break;
 #endif
 	default:
+		if (bootverbose)
+			printf("No CPU data, limiting to 1 core\n");
 		break;
 	}
 
-	if (bootverbose)
-		printf("No CPU data, limiting to 1 core\n");
-	mp_ncpus = 1;
-	mp_maxid = 0;
+	if (TUNABLE_INT_FETCH("hw.ncpu", &cores)) {
+		if (cores > 0 && cores < mp_ncpus) {
+			mp_ncpus = cores;
+			mp_maxid = cores - 1;
+		}
+	}
 }
 
 /*



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