diff options
author | njl <njl@FreeBSD.org> | 2007-10-30 22:18:08 +0000 |
---|---|---|
committer | njl <njl@FreeBSD.org> | 2007-10-30 22:18:08 +0000 |
commit | 53b7cf834ce41e3dedf10a3d8c01b957e5cf2907 (patch) | |
tree | 0b39398d493d89c2070c7dae5b8951b8667b5757 /sys | |
parent | fb7d38331162808946b7a5b8403973e269dec20d (diff) | |
download | FreeBSD-src-53b7cf834ce41e3dedf10a3d8c01b957e5cf2907.zip FreeBSD-src-53b7cf834ce41e3dedf10a3d8c01b957e5cf2907.tar.gz |
If we're on an SMP kernel and there is more than 1 CPU, reject any attempts
to change the freq before the other CPUs are active. The current code
always attempts to change all CPUs to match each other, and the requisite
sched_bind() call won't work before APs are launched.
Diffstat (limited to 'sys')
-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. |