Module Name: src Committed By: jmcneill Date: Mon Jul 20 14:19:41 UTC 2020
Modified Files: src/sys/arch/mips/mips: cpu_subr.c Log Message: Serialize CPU hatch annoucement printfs and wait for CPUs to start before returning from cpu_boot_secondary_processors. To generate a diff of this commit: cvs rdiff -u -r1.52 -r1.53 src/sys/arch/mips/mips/cpu_subr.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/sys/arch/mips/mips/cpu_subr.c diff -u src/sys/arch/mips/mips/cpu_subr.c:1.52 src/sys/arch/mips/mips/cpu_subr.c:1.53 --- src/sys/arch/mips/mips/cpu_subr.c:1.52 Mon Jul 20 10:53:47 2020 +++ src/sys/arch/mips/mips/cpu_subr.c Mon Jul 20 14:19:41 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: cpu_subr.c,v 1.52 2020/07/20 10:53:47 skrll Exp $ */ +/* $NetBSD: cpu_subr.c,v 1.53 2020/07/20 14:19:41 jmcneill Exp $ */ /*- * Copyright (c) 2010, 2019 The NetBSD Foundation, Inc. @@ -30,7 +30,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: cpu_subr.c,v 1.52 2020/07/20 10:53:47 skrll Exp $"); +__KERNEL_RCSID(0, "$NetBSD: cpu_subr.c,v 1.53 2020/07/20 14:19:41 jmcneill Exp $"); #include "opt_cputype.h" #include "opt_ddb.h" @@ -75,6 +75,8 @@ __KERNEL_RCSID(0, "$NetBSD: cpu_subr.c,v extern struct cpu_softc octeon_cpu_softc[]; #endif +static kmutex_t cpu_hatch_lock; + struct cpu_info cpu_info_store #if defined(MULTIPROCESSOR) && !defined(MIPS64_OCTEON) __section(".data1") @@ -949,7 +951,9 @@ cpu_hatch(struct cpu_info *ci) * Let this CPU do its own post-running initialization * (for things that have to be done on the local CPU). */ + mutex_enter(&cpu_hatch_lock); (*mips_locoresw.lsw_cpu_run)(ci); + mutex_exit(&cpu_hatch_lock); /* * Now turn on interrupts (and verify they are on). @@ -973,6 +977,8 @@ cpu_boot_secondary_processors(void) CPU_INFO_ITERATOR cii; struct cpu_info *ci; + mutex_init(&cpu_hatch_lock, MUTEX_DEFAULT, IPL_HIGH); + for (CPU_INFO_FOREACH(cii, ci)) { if (CPU_IS_PRIMARY(ci)) continue; @@ -988,8 +994,8 @@ cpu_boot_secondary_processors(void) atomic_or_ulong(&ci->ci_flags, CPUF_RUNNING); kcpuset_set(cpus_running, cpu_index(ci)); // Spin until the cpu calls idle_loop - for (u_int i = 0; i < 100; i++) { - if (kcpuset_isset(cpus_running, cpu_index(ci))) + for (u_int i = 0; i < 10000; i++) { + if (kcpuset_isset(kcpuset_running, cpu_index(ci))) break; delay(1000); }