git: 40d2b3135204 - main - arm64: Split out the loop to wait for APs
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Wed, 28 May 2025 13:34:59 UTC
The branch main has been updated by andrew:
URL: https://cgit.FreeBSD.org/src/commit/?id=40d2b313520451493d799d83612c664bd766a3ec
commit 40d2b313520451493d799d83612c664bd766a3ec
Author: Andrew Turner <andrew@FreeBSD.org>
AuthorDate: 2025-05-27 19:38:04 +0000
Commit: Andrew Turner <andrew@FreeBSD.org>
CommitDate: 2025-05-27 19:50:11 +0000
arm64: Split out the loop to wait for APs
This will be reused in a later change.
Sponsored by: Arm Ltd
Differential Revision: https://reviews.freebsd.org/D50365
---
sys/arm64/arm64/mp_machdep.c | 45 ++++++++++++++++++++++++--------------------
1 file changed, 25 insertions(+), 20 deletions(-)
diff --git a/sys/arm64/arm64/mp_machdep.c b/sys/arm64/arm64/mp_machdep.c
index bca6487e487a..4ef0019d3f8f 100644
--- a/sys/arm64/arm64/mp_machdep.c
+++ b/sys/arm64/arm64/mp_machdep.c
@@ -139,11 +139,30 @@ is_boot_cpu(uint64_t target_cpu)
return (PCPU_GET_MPIDR(cpuid_to_pcpu[0]) == (target_cpu & CPU_AFF_MASK));
}
+static bool
+wait_for_aps(void)
+{
+ for (int i = 0, started = 0; i < 2000; i++) {
+ if (atomic_load_acq_int(&smp_started) != 0) {
+ return (true);
+ }
+ /*
+ * Don't time out while we are making progress. Some large
+ * systems can take a while to start all CPUs.
+ */
+ if (smp_cpus > started) {
+ i = 0;
+ started = smp_cpus;
+ }
+ DELAY(1000);
+ }
+
+ return (false);
+}
+
static void
release_aps(void *dummy __unused)
{
- int i, started;
-
/* Only release CPUs if they exist */
if (mp_ncpus == 1)
return;
@@ -164,24 +183,10 @@ release_aps(void *dummy __unused)
printf("Release APs...");
- started = 0;
- for (i = 0; i < 2000; i++) {
- if (atomic_load_acq_int(&smp_started) != 0) {
- printf("done\n");
- return;
- }
- /*
- * Don't time out while we are making progress. Some large
- * systems can take a while to start all CPUs.
- */
- if (smp_cpus > started) {
- i = 0;
- started = smp_cpus;
- }
- DELAY(1000);
- }
-
- printf("APs not started\n");
+ if (wait_for_aps())
+ printf("done\n");
+ else
+ printf("APs not started\n");
}
SYSINIT(start_aps, SI_SUB_SMP, SI_ORDER_FIRST, release_aps, NULL);