Index: cpu.c =================================================================== RCS file: /cvs/src/sys/arch/arm64/arm64/cpu.c,v retrieving revision 1.100 diff -u -p -r1.100 cpu.c --- cpu.c 23 Nov 2023 01:00:44 -0000 1.100 +++ cpu.c 7 Jan 2024 05:06:45 -0000 @@ -946,9 +946,6 @@ cpu_attach(struct device *parent, struct cpu_init(); -#if NKSTAT > 0 - cpu_kstat_attach(ci); -#endif #ifdef MULTIPROCESSOR } #endif @@ -1040,6 +1037,11 @@ cpu_boot_secondary_processors(void) CPU_INFO_ITERATOR cii; CPU_INFO_FOREACH(cii, ci) { +#if NKSTAT > 0 + /* this is a convenient place to attach kstats to all cpus */ + cpu_kstat_attach(ci); +#endif + if ((ci->ci_flags & CPUF_AP) == 0) continue; if (ci->ci_flags & CPUF_PRIMARY) @@ -1193,10 +1195,6 @@ cpu_init_secondary(struct cpu_info *ci) spllower(IPL_NONE); -#if NKSTAT > 0 - cpu_kstat_attach(ci); -#endif - sched_toidle(); } @@ -1857,7 +1855,8 @@ cpu_kstat_attach(struct cpu_info *ci) const struct cpu_cores *coreselecter = cpu_cores_none; size_t i; - ks = kstat_create(ci->ci_dev->dv_xname, 0, "mach", 0, KSTAT_T_KV, 0); + ks = kstat_create(ci->ci_dev->dv_xname, 0, "arm-cpu", 0, + KSTAT_T_KV, 0); if (ks == NULL) { printf("%s: unable to create cpu kstats\n", ci->ci_dev->dv_xname); @@ -1867,7 +1866,10 @@ cpu_kstat_attach(struct cpu_info *ci) ck = malloc(sizeof(*ck), M_DEVBUF, M_WAITOK); + sched_peg_curproc(ci); midr = READ_SPECIALREG(midr_el1); + atomic_clearbits_int(&curproc->p_flag, P_CPUPEG); + impl = CPU_IMPL(midr); part = CPU_PART(midr);