- Remove the global definition of sched_lock in mutex.h to break

new code and third party modules which try to depend on it.
 - Initialize sched_lock in sched_4bsd.c.
 - Declare sched_lock in sparc64 pmap.c and assert that we're compiling
   with SCHED_4BSD to prevent accidental crashes from running ULE.  This
   is the sole remaining file outside of the scheduler that uses the
   global sched_lock.

Approved by:	re
This commit is contained in:
Jeff Roberson 2007-07-18 20:46:06 +00:00
parent 773890b9a8
commit 6ea38de8aa
4 changed files with 9 additions and 3 deletions

View File

@ -118,7 +118,6 @@ struct lock_class lock_class_mtx_spin = {
* System-wide mutexes
*/
struct mtx blocked_lock;
struct mtx sched_lock;
struct mtx Giant;
#ifdef LOCK_PROFILING
@ -775,7 +774,6 @@ mutex_init(void)
* Initialize mutexes.
*/
mtx_init(&Giant, "Giant", NULL, MTX_DEF | MTX_RECURSE);
mtx_init(&sched_lock, "sched lock", NULL, MTX_SPIN | MTX_RECURSE);
mtx_init(&blocked_lock, "blocked lock", NULL, MTX_SPIN);
blocked_lock.mtx_lock = 0xdeadc0de; /* Always blocked. */
mtx_init(&proc0.p_mtx, "process lock", NULL, MTX_DEF | MTX_DUPOK);

View File

@ -101,6 +101,7 @@ struct td_sched {
((ts)->ts_runq != 0 && (ts)->ts_runq != &runq)
static struct td_sched td_sched0;
struct mtx sched_lock;
static int sched_tdcnt; /* Total runnable threads in the system. */
static int sched_quantum; /* Roundrobin scheduling quantum in ticks. */
@ -578,6 +579,7 @@ schedinit(void)
thread0.td_sched = &td_sched0;
thread0.td_lock = &sched_lock;
td_sched0.ts_thread = &thread0;
mtx_init(&sched_lock, "sched lock", NULL, MTX_SPIN | MTX_RECURSE);
}
int

View File

@ -108,6 +108,13 @@
#define PMAP_SHPGPERPROC 200
#endif
/* XXX */
#include "opt_sched.h"
#ifndef SCHED_4BSD
#error "sparc64 only works with SCHED_4BSD which uses a global scheduler lock."
#endif
extern struct mtx sched_lock;
/*
* Virtual and physical address of message buffer.
*/

View File

@ -355,7 +355,6 @@ extern struct mtx_pool *mtxpool_sleep;
/*
* Global locks.
*/
extern struct mtx sched_lock;
extern struct mtx Giant;
extern struct mtx blocked_lock;