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.
This commit is contained in:
Nate Lawson 2007-10-30 22:18:08 +00:00
parent f82a1d4987
commit a15e947d54

View File

@ -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.