diff options
-rw-r--r-- | sys/kern/kern_cpu.c | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/sys/kern/kern_cpu.c b/sys/kern/kern_cpu.c index c72ead6..8320ee4 100644 --- a/sys/kern/kern_cpu.c +++ b/sys/kern/kern_cpu.c @@ -37,10 +37,11 @@ __FBSDID("$FreeBSD$"); #include <sys/module.h> #include <sys/proc.h> #include <sys/queue.h> +#include <sys/sbuf.h> #include <sys/sched.h> +#include <sys/smp.h> #include <sys/sysctl.h> #include <sys/systm.h> -#include <sys/sbuf.h> #include <sys/sx.h> #include <sys/timetc.h> #include <sys/taskqueue.h> @@ -243,6 +244,21 @@ cf_set_method(device_t dev, const struct cf_level *level, int priority) CF_MTX_LOCK(&sc->lock); +#ifdef SMP + /* + * If still booting and secondary CPUs not started yet, don't allow + * changing the frequency until they're online. This is because we + * can't switch to them using sched_bind() and thus we'd only be + * switching the main CPU. XXXTODO: Need to think more about how to + * handle having different CPUs at different frequencies. + */ + if (mp_ncpus > 1 && !smp_active) { + device_printf(dev, "rejecting change, SMP not started yet\n"); + error = ENXIO; + goto out; + } +#endif /* SMP */ + /* * If the requested level has a lower priority, don't allow * the new level right now. |