git: 3f521425afcb - main - hwpstate_intel(4): use CPU_FOREACH instead of an IPI

From: Ryan Libby <rlibby_at_FreeBSD.org>
Date: Thu, 23 Jul 2026 17:43:29 UTC
The branch main has been updated by rlibby:

URL: https://cgit.FreeBSD.org/src/commit/?id=3f521425afcb79a623753c171bf6f3296cd556ec

commit 3f521425afcb79a623753c171bf6f3296cd556ec
Author:     Ryan Libby <rlibby@FreeBSD.org>
AuthorDate: 2026-07-23 17:40:18 +0000
Commit:     Ryan Libby <rlibby@FreeBSD.org>
CommitDate: 2026-07-23 17:40:18 +0000

    hwpstate_intel(4): use CPU_FOREACH instead of an IPI
    
    Reviewed by:    aokblast, kib, olce
    Differential Revision:  https://reviews.freebsd.org/D58336
---
 sys/x86/cpufreq/hwpstate_intel.c | 24 +++++++-----------------
 1 file changed, 7 insertions(+), 17 deletions(-)

diff --git a/sys/x86/cpufreq/hwpstate_intel.c b/sys/x86/cpufreq/hwpstate_intel.c
index 4cb80e4b2d44..fbc1d03079ac 100644
--- a/sys/x86/cpufreq/hwpstate_intel.c
+++ b/sys/x86/cpufreq/hwpstate_intel.c
@@ -347,22 +347,10 @@ out:
 	return (ret);
 }
 
-static void
-intel_hwpstate_hybrid_cb(void *ctx)
-{
-	uint32_t *small_cores = ctx;
-
-#ifdef __i386__
-	(void)small_cores;
-#else
-	atomic_add_32(small_cores, PCPU_GET(small_core));
-#endif
-}
-
 void
 intel_hwpstate_identify(driver_t *driver, device_t parent)
 {
-	uint32_t small_cores = 0;
+	int i;
 
 	if (device_find_child(parent, "hwpstate_intel", DEVICE_UNIT_ANY) != NULL)
 		return;
@@ -389,10 +377,12 @@ intel_hwpstate_identify(driver_t *driver, device_t parent)
 	 * the resulting package frequency depends on the last core that
 	 * sets the frequency.
 	 */
-	smp_rendezvous_cpus(all_cpus, smp_no_rendezvous_barrier,
-	    intel_hwpstate_hybrid_cb, smp_no_rendezvous_barrier, &small_cores);
-	if (small_cores > 0 && small_cores < mp_ncores)
-		hwpstate_pkg_ctrl_enable = false;
+	CPU_FOREACH(i) {
+		if (pcpu_find(i)->pc_small_core) {
+			hwpstate_pkg_ctrl_enable = false;
+			break;
+		}
+	}
 
 	if (BUS_ADD_CHILD(parent, 10, "hwpstate_intel", device_get_unit(parent))
 	    == NULL)