From: cheloha Date: Tue, 10 Jan 2023 01:01:18 +0000 (+0000) Subject: i386: identifycpu(): only calibrate_cyclecounter() on primary CPU X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=ae6209ab7d3a89efddabb67562af7d6f2b7eb38f;p=openbsd i386: identifycpu(): only calibrate_cyclecounter() on primary CPU On i386 during identifycpu(), we call calibrate_cyclecounter() for every CPU in the system. This is pointless: every new call clobbers the cpuspeed measured during the prior call. It is also extremely slow: every call to calibrate_cyclecounter() takes about 1 second. Instead, let's only call calibrate_cyclecounter() once, on the primary CPU. Multiprocessor i386 machines will now boot much faster. ok deraadt@ --- diff --git a/sys/arch/i386/i386/machdep.c b/sys/arch/i386/i386/machdep.c index bbf214750f1..708893b00fc 100644 --- a/sys/arch/i386/i386/machdep.c +++ b/sys/arch/i386/i386/machdep.c @@ -1,4 +1,4 @@ -/* $OpenBSD: machdep.c,v 1.659 2023/01/10 00:49:45 cheloha Exp $ */ +/* $OpenBSD: machdep.c,v 1.660 2023/01/10 01:01:18 cheloha Exp $ */ /* $NetBSD: machdep.c,v 1.214 1996/11/10 03:16:17 thorpej Exp $ */ /*- @@ -1861,7 +1861,8 @@ identifycpu(struct cpu_info *ci) } break; } - calibrate_cyclecounter(); + if (CPU_IS_PRIMARY(ci)) + calibrate_cyclecounter(); /* set cpuspeed */ } if (cpuid_level != -1)