diff options
author | Nate Lawson <njl@FreeBSD.org> | 2007-10-30 22:18:08 +0000 |
---|---|---|
committer | Nate Lawson <njl@FreeBSD.org> | 2007-10-30 22:18:08 +0000 |
commit | a15e947d54924fdc21ca42ae8b35ecfab28e74eb (patch) | |
tree | 0b39398d493d89c2070c7dae5b8951b8667b5757 /sys | |
parent | f82a1d49879db9dcbfbf90328fc2e823a79a53a5 (diff) | |
download | src-a15e947d54924fdc21ca42ae8b35ecfab28e74eb.tar.gz src-a15e947d54924fdc21ca42ae8b35ecfab28e74eb.zip |
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.
Notes
Notes:
svn path=/head/; revision=173204
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 c72ead6a8cfe..8320ee4b9242 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. |