git: df0aca0d7306 - main - smp: remove unused hlt_cpus_mask

From: Mitchell Horne <mhorne_at_FreeBSD.org>
Date: Mon, 13 Jul 2026 19:40:50 UTC
The branch main has been updated by mhorne:

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

commit df0aca0d73064a1a199dbae3857012951f96cf2d
Author:     Mitchell Horne <mhorne@FreeBSD.org>
AuthorDate: 2026-07-13 19:15:19 +0000
Commit:     Mitchell Horne <mhorne@FreeBSD.org>
CommitDate: 2026-07-13 19:40:42 +0000

    smp: remove unused hlt_cpus_mask
    
    It is a relic, apparently once populated by a machdep.hlt_cpus sysctl.
    The sysctl was removed, and ULE has never honored this mask. It is now
    safe to remove.
    
    Remove the mask, and its few remaining references in: sched_4bsd(4),
    hwpmc(4), and hwt(4).
    
    Reviewed by:    olce, kib
    MFC after:      1 week
    Sponsored by:   The FreeBSD Foundation
    Differential Revision:  https://reviews.freebsd.org/D58158
---
 sys/dev/hwt/hwt_ioctl.c |  5 -----
 sys/dev/hwt/hwt_vm.c    |  6 ------
 sys/kern/kern_pmc.c     |  3 +--
 sys/kern/sched_4bsd.c   | 17 -----------------
 sys/kern/subr_smp.c     |  1 -
 sys/sys/smp.h           |  1 -
 6 files changed, 1 insertion(+), 32 deletions(-)

diff --git a/sys/dev/hwt/hwt_ioctl.c b/sys/dev/hwt/hwt_ioctl.c
index 184c7e72f986..7d76a3feee55 100644
--- a/sys/dev/hwt/hwt_ioctl.c
+++ b/sys/dev/hwt/hwt_ioctl.c
@@ -304,11 +304,6 @@ hwt_ioctl_alloc_mode_cpu(struct thread *td, struct hwt_owner *ho,
 		return (error);
 
 	CPU_FOREACH_ISSET(cpu_id, &cpu_map) {
-#ifdef SMP
-		/* Ensure CPU is not halted. */
-		if (CPU_ISSET(cpu_id, &hlt_cpus_mask))
-			return (ENXIO);
-#endif
 #if 0
 		/* TODO: Check if the owner have this cpu configured already. */
 		ctx = hwt_owner_lookup_ctx_by_cpu(ho, halloc->cpu);
diff --git a/sys/dev/hwt/hwt_vm.c b/sys/dev/hwt/hwt_vm.c
index 42fc636e7abc..eca3f6170673 100644
--- a/sys/dev/hwt/hwt_vm.c
+++ b/sys/dev/hwt/hwt_vm.c
@@ -209,12 +209,6 @@ hwt_vm_start_cpu_mode(struct hwt_context *ctx)
 	CPU_ZERO(&enable_cpus);
 
 	CPU_FOREACH_ISSET(cpu_id, &ctx->cpu_map) {
-#ifdef SMP
-		/* Ensure CPU is not halted. */
-		if (CPU_ISSET(cpu_id, &hlt_cpus_mask))
-			continue;
-#endif
-
 		hwt_backend_configure(ctx, cpu_id, cpu_id);
 
 		CPU_SET(cpu_id, &enable_cpus);
diff --git a/sys/kern/kern_pmc.c b/sys/kern/kern_pmc.c
index 15afe1a46d07..90ce8c6a17c1 100644
--- a/sys/kern/kern_pmc.c
+++ b/sys/kern/kern_pmc.c
@@ -152,8 +152,7 @@ int
 pmc_cpu_is_active(int cpu)
 {
 #ifdef	SMP
-	return (pmc_cpu_is_present(cpu) &&
-	    !CPU_ISSET(cpu, &hlt_cpus_mask));
+	return (pmc_cpu_is_present(cpu));
 #else
 	return (1);
 #endif
diff --git a/sys/kern/sched_4bsd.c b/sys/kern/sched_4bsd.c
index a47fe3ce72c3..043a4d291c9f 100644
--- a/sys/kern/sched_4bsd.c
+++ b/sys/kern/sched_4bsd.c
@@ -1187,7 +1187,6 @@ forward_wakeup(int cpunum)
 
 	CPU_SETOF(me, &dontuse);
 	CPU_OR(&dontuse, &dontuse, &stopped_cpus);
-	CPU_OR(&dontuse, &dontuse, &hlt_cpus_mask);
 	CPU_ZERO(&map2);
 	if (forward_wakeup_use_loop) {
 		STAILQ_FOREACH(pc, &cpuhead, pc_allcpu) {
@@ -1389,7 +1388,6 @@ sched_4bsd_add(struct thread *td, int flags)
 	} else {
 		if (!single_cpu) {
 			tidlemsk = idle_cpus_mask;
-			CPU_ANDNOT(&tidlemsk, &tidlemsk, &hlt_cpus_mask);
 			CPU_CLR(cpuid, &tidlemsk);
 
 			if (!CPU_ISSET(cpuid, &idle_cpus_mask) &&
@@ -1827,22 +1825,7 @@ sched_4bsd_affinity(struct thread *td)
 static bool
 sched_4bsd_do_timer_accounting(void)
 {
-#ifdef SMP
-	/*
-	 * Don't do any accounting for the disabled HTT cores, since it
-	 * will provide misleading numbers for the userland.
-	 *
-	 * No locking is necessary here, since even if we lose the race
-	 * when hlt_cpus_mask changes it is not a big deal, really.
-	 *
-	 * Don't do that for ULE, since ULE doesn't consider hlt_cpus_mask
-	 * and unlike other schedulers it actually schedules threads to
-	 * those CPUs.
-	 */
-	return (!CPU_ISSET(PCPU_GET(cpuid), &hlt_cpus_mask));
-#else
 	return (true);
-#endif
 }
 
 static int
diff --git a/sys/kern/subr_smp.c b/sys/kern/subr_smp.c
index 148b366e7435..dd2e829aefbf 100644
--- a/sys/kern/subr_smp.c
+++ b/sys/kern/subr_smp.c
@@ -90,7 +90,6 @@ smp_topo_none(void)
 volatile cpuset_t stopped_cpus;
 volatile cpuset_t started_cpus;
 volatile cpuset_t suspended_cpus;
-cpuset_t hlt_cpus_mask;
 cpuset_t logical_cpus_mask;
 
 void (*cpustop_restartfunc)(void);
diff --git a/sys/sys/smp.h b/sys/sys/smp.h
index 493dc91043bd..ae767c238e96 100644
--- a/sys/sys/smp.h
+++ b/sys/sys/smp.h
@@ -161,7 +161,6 @@ extern volatile cpuset_t started_cpus;	/* cpus to let out of stop pen */
 extern volatile cpuset_t stopped_cpus;	/* cpus in stop pen */
 extern volatile cpuset_t suspended_cpus; /* cpus [near] sleeping in susp pen */
 extern volatile cpuset_t toresume_cpus;	/* cpus to let out of suspend pen */
-extern cpuset_t hlt_cpus_mask;		/* XXX 'mask' is detail in old impl */
 extern cpuset_t logical_cpus_mask;
 #endif /* SMP */