summaryrefslogtreecommitdiffstats
path: root/sys/i386
diff options
context:
space:
mode:
authorbmilekic <bmilekic@FreeBSD.org>2001-01-19 01:59:14 +0000
committerbmilekic <bmilekic@FreeBSD.org>2001-01-19 01:59:14 +0000
commit37decc93f5a2dfb49438d1e77245218780583ef6 (patch)
tree2e4b859fb1993ec2fe69e3e946d14a9fdc9cf441 /sys/i386
parent5977e97236d57a51dc2ddf0634bb4a69d30dc36f (diff)
downloadFreeBSD-src-37decc93f5a2dfb49438d1e77245218780583ef6.zip
FreeBSD-src-37decc93f5a2dfb49438d1e77245218780583ef6.tar.gz
Implement MTX_RECURSE flag for mtx_init().
All calls to mtx_init() for mutexes that recurse must now include the MTX_RECURSE bit in the flag argument variable. This change is in preparation for an upcoming (further) mutex API cleanup. The witness code will call panic() if a lock is found to recurse but the MTX_RECURSE bit was not set during the lock's initialization. The old MTX_RECURSE "state" bit (in mtx_lock) has been renamed to MTX_RECURSED, which is more appropriate given its meaning. The following locks have been made "recursive," thus far: eventhandler, Giant, callout, sched_lock, possibly some others declared in the architecture-specific code, all of the network card driver locks in pci/, as well as some other locks in dev/ stuff that I've found to be recursive. Reviewed by: jhb
Diffstat (limited to 'sys/i386')
-rw-r--r--sys/i386/i386/machdep.c8
-rw-r--r--sys/i386/isa/if_el.c2
2 files changed, 5 insertions, 5 deletions
diff --git a/sys/i386/i386/machdep.c b/sys/i386/i386/machdep.c
index a6d27ea..225ec00 100644
--- a/sys/i386/i386/machdep.c
+++ b/sys/i386/i386/machdep.c
@@ -422,7 +422,7 @@ again:
TAILQ_INIT(&callwheel[i]);
}
- mtx_init(&callout_lock, "callout", MTX_SPIN);
+ mtx_init(&callout_lock, "callout", MTX_SPIN | MTX_RECURSE);
#if defined(USERCONFIG)
userconfig();
@@ -441,7 +441,7 @@ again:
SLIST_INIT(&cpuhead);
SLIST_INSERT_HEAD(&cpuhead, GLOBALDATA, gd_allcpu);
- mtx_init(&sched_lock, "sched lock", MTX_SPIN | MTX_COLD);
+ mtx_init(&sched_lock, "sched lock", MTX_SPIN | MTX_COLD | MTX_RECURSE);
#ifdef SMP
/*
@@ -1939,7 +1939,7 @@ init386(first)
/*
* We need this mutex before the console probe.
*/
- mtx_init(&clock_lock, "clk", MTX_SPIN | MTX_COLD);
+ mtx_init(&clock_lock, "clk", MTX_SPIN | MTX_COLD | MTX_RECURSE);
/*
* Initialize the console before we print anything out.
@@ -1954,7 +1954,7 @@ init386(first)
/*
* Giant is used early for at least debugger traps and unexpected traps.
*/
- mtx_init(&Giant, "Giant", MTX_DEF | MTX_COLD);
+ mtx_init(&Giant, "Giant", MTX_DEF | MTX_COLD | MTX_RECURSE);
#ifdef DDB
kdb_init();
diff --git a/sys/i386/isa/if_el.c b/sys/i386/isa/if_el.c
index b77edc1..ed53636 100644
--- a/sys/i386/isa/if_el.c
+++ b/sys/i386/isa/if_el.c
@@ -149,7 +149,7 @@ el_probe(device_t dev)
sc->el_btag = rman_get_bustag(sc->el_res);
sc->el_bhandle = rman_get_bushandle(sc->el_res);
mtx_init(&sc->el_mtx,
- device_get_nameunit(dev), MTX_DEF);
+ device_get_nameunit(dev), MTX_DEF | MTX_RECURSE);
EL_LOCK(sc);
/* Now attempt to grab the station address from the PROM
OpenPOWER on IntegriCloud