Index: sys/dev/hwpmc/hwpmc_mod.c =================================================================== --- sys/dev/hwpmc/hwpmc_mod.c +++ sys/dev/hwpmc/hwpmc_mod.c @@ -76,6 +76,9 @@ #include "hwpmc_soft.h" #include "hwpmc_vm.h" +/* Bitmask of CPUs requiring servicing at hardclock time */ +static volatile cpuset_t pmc_cpumask; + /* * Types */ @@ -2019,6 +2022,8 @@ * are being processed. */ case PMC_FN_DO_SAMPLES: + if (!PMC_CPU_HAS_SAMPLES(PCPU_GET(cpuid))) + return (0); /* * Clear the cpu specific bit in the CPU mask before Index: sys/kern/kern_clock.c =================================================================== --- sys/kern/kern_clock.c +++ sys/kern/kern_clock.c @@ -461,8 +461,7 @@ thread_unlock(td); #ifdef HWPMC_HOOKS - if (PMC_CPU_HAS_SAMPLES(PCPU_GET(cpuid))) - PMC_CALL_HOOK_UNLOCKED(curthread, PMC_FN_DO_SAMPLES, NULL); + PMC_CALL_HOOK_UNLOCKED(curthread, PMC_FN_DO_SAMPLES, NULL); if (td->td_intr_frame != NULL) PMC_SOFT_CALL_TF( , , clock, hard, td->td_intr_frame); #endif @@ -548,8 +547,7 @@ } #ifdef HWPMC_HOOKS - if (PMC_CPU_HAS_SAMPLES(PCPU_GET(cpuid))) - PMC_CALL_HOOK_UNLOCKED(curthread, PMC_FN_DO_SAMPLES, NULL); + PMC_CALL_HOOK_UNLOCKED(curthread, PMC_FN_DO_SAMPLES, NULL); if (td->td_intr_frame != NULL) PMC_SOFT_CALL_TF( , , clock, hard, td->td_intr_frame); #endif Index: sys/kern/kern_pmc.c =================================================================== --- sys/kern/kern_pmc.c +++ sys/kern/kern_pmc.c @@ -66,9 +66,6 @@ /* Interrupt handler */ int __read_mostly (*pmc_intr)(int cpu, struct trapframe *tf) = NULL; -/* Bitmask of CPUs requiring servicing at hardclock time */ -volatile cpuset_t pmc_cpumask; - /* * A global count of SS mode PMCs. When non-zero, this means that * we have processes that are sampling the system as a whole. Index: sys/sys/pmckern.h =================================================================== --- sys/sys/pmckern.h +++ sys/sys/pmckern.h @@ -164,9 +164,6 @@ /* SX lock protecting the hook */ extern struct sx pmc_sx; -/* Per-cpu flags indicating availability of sampling data */ -extern volatile cpuset_t pmc_cpumask; - /* Count of system-wide sampling PMCs in existence */ extern volatile int pmc_ss_count;