From 62a64f0d2b367aa304943ab5c8508059744c6016 Mon Sep 17 00:00:00 2001 From: scottl Date: Sat, 26 Apr 2014 20:27:54 +0000 Subject: Retire smp_active. It was racey and caused demonstrated problems with the cpufreq code. Replace its use with smp_started. There's at least one userland tool that still looks at the kern.smp.active sysctl, so preserve it but point it to smp_started as well. Discussed with: peter, jhb MFC after: 3 days Obtained from: Netflix --- sys/kern/subr_smp.c | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) (limited to 'sys/kern/subr_smp.c') diff --git a/sys/kern/subr_smp.c b/sys/kern/subr_smp.c index 5425a45..122fc4c 100644 --- a/sys/kern/subr_smp.c +++ b/sys/kern/subr_smp.c @@ -59,6 +59,9 @@ cpuset_t logical_cpus_mask; void (*cpustop_restartfunc)(void); #endif + +static int sysctl_kern_smp_active(SYSCTL_HANDLER_ARGS); + /* This is used in modules that need to work in both SMP and UP. */ cpuset_t all_cpus; @@ -78,9 +81,8 @@ SYSCTL_INT(_kern_smp, OID_AUTO, maxid, CTLFLAG_RD|CTLFLAG_CAPRD, &mp_maxid, 0, SYSCTL_INT(_kern_smp, OID_AUTO, maxcpus, CTLFLAG_RD|CTLFLAG_CAPRD, &mp_maxcpus, 0, "Max number of CPUs that the system was compiled for."); -int smp_active = 0; /* are the APs allowed to run? */ -SYSCTL_INT(_kern_smp, OID_AUTO, active, CTLFLAG_RW, &smp_active, 0, - "Number of Auxillary Processors (APs) that were successfully started"); +SYSCTL_PROC(_kern_smp, OID_AUTO, active, CTLFLAG_RD | CTLTYPE_INT, NULL, 0, + sysctl_kern_smp_active, "I", "Indicates system is running in SMP mode"); int smp_disabled = 0; /* has smp been disabled? */ SYSCTL_INT(_kern_smp, OID_AUTO, disabled, CTLFLAG_RDTUN|CTLFLAG_CAPRD, @@ -831,3 +833,15 @@ quiesce_all_cpus(const char *wmesg, int prio) return quiesce_cpus(all_cpus, wmesg, prio); } + +/* Extra care is taken with this sysctl because the data type is volatile */ +static int +sysctl_kern_smp_active(SYSCTL_HANDLER_ARGS) +{ + int error, active; + + active = smp_started; + error = SYSCTL_OUT(req, &active, sizeof(active)); + return (error); +} + -- cgit v1.1