aboutsummaryrefslogtreecommitdiff
path: root/sys/arm64/arm64/mp_machdep.c
diff options
context:
space:
mode:
authorAndrew Turner <andrew@FreeBSD.org>2019-02-28 14:40:43 +0000
committerAndrew Turner <andrew@FreeBSD.org>2019-02-28 14:40:43 +0000
commit01a8235ea61ced963f1e368405cc6d71c0c33bd0 (patch)
treede0b42ca5735c215a4c5ab2e61d97b8d6b130f50 /sys/arm64/arm64/mp_machdep.c
parentb5eab9d4615a0e1aad7280d45b413b94adf1799e (diff)
downloadsrc-01a8235ea61ced963f1e368405cc6d71c0c33bd0.tar.gz
src-01a8235ea61ced963f1e368405cc6d71c0c33bd0.zip
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
Notes
Notes: svn path=/head/; revision=344659
Diffstat (limited to 'sys/arm64/arm64/mp_machdep.c')
-rw-r--r--sys/arm64/arm64/mp_machdep.c19
1 files changed, 11 insertions, 8 deletions
diff --git a/sys/arm64/arm64/mp_machdep.c b/sys/arm64/arm64/mp_machdep.c
index b887aed3d19b..b2df286ee489 100644
--- a/sys/arm64/arm64/mp_machdep.c
+++ b/sys/arm64/arm64/mp_machdep.c
@@ -638,9 +638,10 @@ cpu_find_cpu0_fdt(u_int id, phandle_t node, u_int addr_size, pcell_t *reg)
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
@@ -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;
+ }
+ }
}
/*