Date: Tue, 11 Nov 2003 16:08:07 -0800 (PST) From: Peter Wemm <peter@FreeBSD.org> To: Perforce Change Reviews <perforce@freebsd.org> Subject: PERFORCE change 42065 for review Message-ID: <200311120008.hAC087LT013144@repoman.freebsd.org>
next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=42065 Change 42065 by peter@peter_daintree on 2003/11/11 16:07:34 IFC @42063 Affected files ... .. //depot/projects/hammer/sys/conf/files#35 integrate .. //depot/projects/hammer/sys/dev/sound/pcm/ac97.c#9 integrate .. //depot/projects/hammer/sys/i386/i386/mptable.c#4 integrate .. //depot/projects/hammer/sys/kern/kern_mutex.c#14 integrate .. //depot/projects/hammer/sys/kern/kern_thread.c#36 integrate .. //depot/projects/hammer/sys/kern/subr_turnstile.c#1 branch .. //depot/projects/hammer/sys/kern/subr_witness.c#20 integrate .. //depot/projects/hammer/sys/modules/mac_stub/Makefile#2 integrate .. //depot/projects/hammer/sys/pci/agp.c#9 integrate .. //depot/projects/hammer/sys/pci/agp_ali.c#7 integrate .. //depot/projects/hammer/sys/sys/_mutex.h#3 integrate .. //depot/projects/hammer/sys/sys/filedesc.h#5 integrate .. //depot/projects/hammer/sys/sys/proc.h#36 integrate .. //depot/projects/hammer/sys/sys/turnstile.h#1 branch Differences ... ==== //depot/projects/hammer/sys/conf/files#35 (text+ko) ==== @@ -1,4 +1,4 @@ -# $FreeBSD: src/sys/conf/files,v 1.847 2003/11/11 18:58:53 ume Exp $ +# $FreeBSD: src/sys/conf/files,v 1.848 2003/11/11 22:07:29 jhb Exp $ # # The long compile-with and dependency lines are required because of # limitations in config: backslash-newline doesn't work in strings, and @@ -1154,6 +1154,7 @@ kern/subr_smp.c optional smp kern/subr_taskqueue.c standard kern/subr_trap.c standard +kern/subr_turnstile.c standard kern/subr_witness.c optional witness kern/sys_generic.c standard kern/sys_pipe.c standard ==== //depot/projects/hammer/sys/dev/sound/pcm/ac97.c#9 (text+ko) ==== @@ -30,7 +30,7 @@ #include "mixer_if.h" -SND_DECLARE_FILE("$FreeBSD: src/sys/dev/sound/pcm/ac97.c,v 1.48 2003/10/12 11:51:24 des Exp $"); +SND_DECLARE_FILE("$FreeBSD: src/sys/dev/sound/pcm/ac97.c,v 1.49 2003/11/11 22:15:17 kuriyama Exp $"); MALLOC_DEFINE(M_AC97, "ac97", "ac97 codec"); @@ -138,6 +138,7 @@ { 0x414c4740, 0x0f, 0, "ALC202", 0 }, { 0x414c4720, 0x0f, 0, "ALC650", 0 }, { 0x414c4760, 0x0f, 0, "ALC655", 0 }, + { 0x414c4780, 0x0f, 0, "ALC658", 0 }, { 0x43525900, 0x07, 0, "CS4297", 0 }, { 0x43525910, 0x07, 0, "CS4297A", 0 }, { 0x43525920, 0x07, 0, "CS4294/98", 0 }, ==== //depot/projects/hammer/sys/i386/i386/mptable.c#4 (text+ko) ==== @@ -25,7 +25,7 @@ */ #include <sys/cdefs.h> -__FBSDID("$FreeBSD: src/sys/i386/i386/mptable.c,v 1.224 2003/11/11 17:14:26 jhb Exp $"); +__FBSDID("$FreeBSD: src/sys/i386/i386/mptable.c,v 1.225 2003/11/11 21:19:43 jhb Exp $"); #include "opt_mptable_force_htt.h" #include <sys/param.h> @@ -893,6 +893,8 @@ return (EINVAL); if (pci0 == -1 || pci0 + bus > mptable_maxbusid) return (ENXIO); + if (busses[pci0 + bus].bus_type != PCI) + return (ENXIO); args.bus = pci0 + bus; args.found = 0; mptable_walk_table(mptable_pci_probe_table_handler, &args); ==== //depot/projects/hammer/sys/kern/kern_mutex.c#14 (text+ko) ==== @@ -34,7 +34,7 @@ */ #include <sys/cdefs.h> -__FBSDID("$FreeBSD: src/sys/kern/kern_mutex.c,v 1.131 2003/07/31 18:52:18 jhb Exp $"); +__FBSDID("$FreeBSD: src/sys/kern/kern_mutex.c,v 1.132 2003/11/11 22:07:29 jhb Exp $"); #include "opt_adaptive_mutexes.h" #include "opt_ddb.h" @@ -52,6 +52,7 @@ #include <sys/sched.h> #include <sys/sbuf.h> #include <sys/sysctl.h> +#include <sys/turnstile.h> #include <sys/vmmeter.h> #include <machine/atomic.h> @@ -90,122 +91,6 @@ struct mtx sched_lock; struct mtx Giant; -/* - * Prototypes for non-exported routines. - */ -static void propagate_priority(struct thread *); - -static void -propagate_priority(struct thread *td) -{ - int pri = td->td_priority; - struct mtx *m = td->td_blocked; - - mtx_assert(&sched_lock, MA_OWNED); - for (;;) { - struct thread *td1; - - td = mtx_owner(m); - - if (td == NULL) { - /* - * This really isn't quite right. Really - * ought to bump priority of thread that - * next acquires the mutex. - */ - MPASS(m->mtx_lock == MTX_CONTESTED); - return; - } - - MPASS(td->td_proc != NULL); - MPASS(td->td_proc->p_magic == P_MAGIC); - KASSERT(!TD_IS_SLEEPING(td), ( - "sleeping thread (pid %d) owns a mutex", - td->td_proc->p_pid)); - if (td->td_priority <= pri) /* lower is higher priority */ - return; - - - /* - * If lock holder is actually running, just bump priority. - */ - if (TD_IS_RUNNING(td)) { - td->td_priority = pri; - return; - } - -#ifndef SMP - /* - * For UP, we check to see if td is curthread (this shouldn't - * ever happen however as it would mean we are in a deadlock.) - */ - KASSERT(td != curthread, ("Deadlock detected")); -#endif - - /* - * If on run queue move to new run queue, and quit. - * XXXKSE this gets a lot more complicated under threads - * but try anyhow. - */ - if (TD_ON_RUNQ(td)) { - MPASS(td->td_blocked == NULL); - sched_prio(td, pri); - return; - } - /* - * Adjust for any other cases. - */ - td->td_priority = pri; - - /* - * If we aren't blocked on a mutex, we should be. - */ - KASSERT(TD_ON_LOCK(td), ( - "process %d(%s):%d holds %s but isn't blocked on a mutex\n", - td->td_proc->p_pid, td->td_proc->p_comm, td->td_state, - m->mtx_object.lo_name)); - - /* - * Pick up the mutex that td is blocked on. - */ - m = td->td_blocked; - MPASS(m != NULL); - - /* - * Check if the thread needs to be moved up on - * the blocked chain - */ - if (td == TAILQ_FIRST(&m->mtx_blocked)) { - continue; - } - - td1 = TAILQ_PREV(td, threadqueue, td_lockq); - if (td1->td_priority <= pri) { - continue; - } - - /* - * Remove thread from blocked chain and determine where - * it should be moved up to. Since we know that td1 has - * a lower priority than td, we know that at least one - * thread in the chain has a lower priority and that - * td1 will thus not be NULL after the loop. - */ - TAILQ_REMOVE(&m->mtx_blocked, td, td_lockq); - TAILQ_FOREACH(td1, &m->mtx_blocked, td_lockq) { - MPASS(td1->td_proc->p_magic == P_MAGIC); - if (td1->td_priority > pri) - break; - } - - MPASS(td1 != NULL); - TAILQ_INSERT_BEFORE(td1, td, td_lockq); - CTR4(KTR_LOCK, - "propagate_priority: p %p moved before %p on [%p] %s", - td, td1, m, m->mtx_object.lo_name); - } -} - #ifdef MUTEX_PROFILING SYSCTL_NODE(_debug, OID_AUTO, mutex, CTLFLAG_RD, NULL, "mutex debugging"); SYSCTL_NODE(_debug_mutex, OID_AUTO, prof, CTLFLAG_RD, NULL, "mutex profiling"); @@ -484,8 +369,8 @@ void _mtx_lock_sleep(struct mtx *m, int opts, const char *file, int line) { + struct turnstile *ts; struct thread *td = curthread; - struct thread *td1; #if defined(SMP) && defined(ADAPTIVE_MUTEXES) struct thread *owner; #endif @@ -509,15 +394,15 @@ while (!_obtain_lock(m, td)) { - mtx_lock_spin(&sched_lock); + ts = turnstile_lookup(&m->mtx_object); v = m->mtx_lock; /* * Check if the lock has been released while spinning for - * the sched_lock. + * the turnstile chain lock. */ if (v == MTX_UNOWNED) { - mtx_unlock_spin(&sched_lock); + turnstile_release(&m->mtx_object); #ifdef __i386__ ia32_pause(); #endif @@ -531,14 +416,9 @@ * necessary. */ if (v == MTX_CONTESTED) { - td1 = TAILQ_FIRST(&m->mtx_blocked); - MPASS(td1 != NULL); + MPASS(ts != NULL); m->mtx_lock = (uintptr_t)td | MTX_CONTESTED; - LIST_INSERT_HEAD(&td->td_contested, m, mtx_contested); - - if (td1->td_priority < td->td_priority) - td->td_priority = td1->td_priority; - mtx_unlock_spin(&sched_lock); + turnstile_claim(ts); return; } @@ -550,7 +430,7 @@ if ((v & MTX_CONTESTED) == 0 && !atomic_cmpset_ptr(&m->mtx_lock, (void *)v, (void *)(v | MTX_CONTESTED))) { - mtx_unlock_spin(&sched_lock); + turnstile_release(&m->mtx_object); #ifdef __i386__ ia32_pause(); #endif @@ -564,7 +444,7 @@ */ owner = (struct thread *)(v & MTX_FLAGMASK); if (m != &Giant && TD_IS_RUNNING(owner)) { - mtx_unlock_spin(&sched_lock); + turnstile_release(&m->mtx_object); while (mtx_owner(m) == owner && TD_IS_RUNNING(owner)) { #ifdef __i386__ ia32_pause(); @@ -579,42 +459,6 @@ */ mtx_assert(m, MA_NOTOWNED); -#ifdef notyet - /* - * If we're borrowing an interrupted thread's VM context, we - * must clean up before going to sleep. - */ - if (td->td_ithd != NULL) { - struct ithd *it = td->td_ithd; - - if (it->it_interrupted) { - if (LOCK_LOG_TEST(&m->mtx_object, opts)) - CTR2(KTR_LOCK, - "_mtx_lock_sleep: %p interrupted %p", - it, it->it_interrupted); - intr_thd_fixup(it); - } - } -#endif - - /* - * Put us on the list of threads blocked on this mutex - * and add this mutex to the owning thread's list of - * contested mutexes if needed. - */ - if (TAILQ_EMPTY(&m->mtx_blocked)) { - td1 = mtx_owner(m); - LIST_INSERT_HEAD(&td1->td_contested, m, mtx_contested); - TAILQ_INSERT_TAIL(&m->mtx_blocked, td, td_lockq); - } else { - TAILQ_FOREACH(td1, &m->mtx_blocked, td_lockq) - if (td1->td_priority > td->td_priority) - break; - if (td1) - TAILQ_INSERT_BEFORE(td1, td, td_lockq); - else - TAILQ_INSERT_TAIL(&m->mtx_blocked, td, td_lockq); - } #ifdef KTR if (!cont_logged) { CTR6(KTR_CONTENTION, @@ -627,27 +471,9 @@ #endif /* - * Save who we're blocked on. + * Block on the turnstile. */ - td->td_blocked = m; - td->td_lockname = m->mtx_object.lo_name; - TD_SET_LOCK(td); - propagate_priority(td); - - if (LOCK_LOG_TEST(&m->mtx_object, opts)) - CTR3(KTR_LOCK, - "_mtx_lock_sleep: p %p blocked on [%p] %s", td, m, - m->mtx_object.lo_name); - - td->td_proc->p_stats->p_ru.ru_nvcsw++; - mi_switch(); - - if (LOCK_LOG_TEST(&m->mtx_object, opts)) - CTR3(KTR_LOCK, - "_mtx_lock_sleep: p %p free from blocked on [%p] %s", - td, m, m->mtx_object.lo_name); - - mtx_unlock_spin(&sched_lock); + turnstile_wait(ts, &m->mtx_object, mtx_owner(m)); } #ifdef KTR @@ -724,11 +550,8 @@ void _mtx_unlock_sleep(struct mtx *m, int opts, const char *file, int line) { + struct turnstile *ts; struct thread *td, *td1; - struct mtx *m1; - int pri; - - td = curthread; if (mtx_recursed(m)) { if (--(m->mtx_recurse) == 0) @@ -738,57 +561,47 @@ return; } - mtx_lock_spin(&sched_lock); + ts = turnstile_lookup(&m->mtx_object); if (LOCK_LOG_TEST(&m->mtx_object, opts)) CTR1(KTR_LOCK, "_mtx_unlock_sleep: %p contested", m); - td1 = TAILQ_FIRST(&m->mtx_blocked); #if defined(SMP) && defined(ADAPTIVE_MUTEXES) - if (td1 == NULL) { + if (ts == NULL) { _release_lock_quick(m); if (LOCK_LOG_TEST(&m->mtx_object, opts)) CTR1(KTR_LOCK, "_mtx_unlock_sleep: %p no sleepers", m); - mtx_unlock_spin(&sched_lock); + turnstile_release(&m->mtx_object); return; } +#else + MPASS(ts != NULL); #endif - MPASS(td->td_proc->p_magic == P_MAGIC); - MPASS(td1->td_proc->p_magic == P_MAGIC); - - TAILQ_REMOVE(&m->mtx_blocked, td1, td_lockq); - - LIST_REMOVE(m, mtx_contested); - if (TAILQ_EMPTY(&m->mtx_blocked)) { + /* XXX */ + td1 = turnstile_head(ts); + if (turnstile_signal(ts)) { _release_lock_quick(m); if (LOCK_LOG_TEST(&m->mtx_object, opts)) CTR1(KTR_LOCK, "_mtx_unlock_sleep: %p not held", m); - } else + } else { m->mtx_lock = MTX_CONTESTED; - - pri = PRI_MAX; - LIST_FOREACH(m1, &td->td_contested, mtx_contested) { - int cp = TAILQ_FIRST(&m1->mtx_blocked)->td_priority; - if (cp < pri) - pri = cp; + if (LOCK_LOG_TEST(&m->mtx_object, opts)) + CTR1(KTR_LOCK, "_mtx_unlock_sleep: %p still contested", + m); } + turnstile_unpend(ts); - if (pri > td->td_base_pri) - pri = td->td_base_pri; - td->td_priority = pri; - - if (LOCK_LOG_TEST(&m->mtx_object, opts)) - CTR2(KTR_LOCK, "_mtx_unlock_sleep: %p contested setrunqueue %p", - m, td1); - - td1->td_blocked = NULL; - TD_CLR_LOCK(td1); - if (!TD_CAN_RUN(td1)) { - mtx_unlock_spin(&sched_lock); + /* + * XXX: This is just a hack until preemption is done. However, + * once preemption is done we need to either wrap the + * turnstile_signal() and release of the actual lock in an + * extra critical section or change the preemption code to + * always just set a flag and never do instant-preempts. + */ + td = curthread; + if (td->td_critnest > 0 || td1->td_priority >= td->td_priority) return; - } - setrunqueue(td1); - - if (td->td_critnest == 1 && td1->td_priority < pri) { + mtx_lock_spin(&sched_lock); + if (!TD_IS_RUNNING(td1)) { #ifdef notyet if (td->td_ithd != NULL) { struct ithd *it = td->td_ithd; @@ -813,7 +626,6 @@ CTR2(KTR_LOCK, "_mtx_unlock_sleep: %p resuming lock=%p", m, (void *)m->mtx_lock); } - mtx_unlock_spin(&sched_lock); return; @@ -948,7 +760,6 @@ lock->lo_flags |= LO_DUPOK; m->mtx_lock = MTX_UNOWNED; - TAILQ_INIT(&m->mtx_blocked); LOCK_LOG_INIT(lock, opts); @@ -992,6 +803,9 @@ /* Setup thread0 so that mutexes work. */ LIST_INIT(&thread0.td_contested); + /* Setup turnstiles so that sleep mutexes work. */ + init_turnstiles(); + /* * Initialize mutexes. */ ==== //depot/projects/hammer/sys/kern/kern_thread.c#36 (text+ko) ==== @@ -27,7 +27,7 @@ */ #include <sys/cdefs.h> -__FBSDID("$FreeBSD: src/sys/kern/kern_thread.c,v 1.161 2003/08/26 11:33:15 davidxu Exp $"); +__FBSDID("$FreeBSD: src/sys/kern/kern_thread.c,v 1.162 2003/11/11 22:07:29 jhb Exp $"); #include <sys/param.h> #include <sys/systm.h> @@ -44,6 +44,7 @@ #include <sys/signalvar.h> #include <sys/sx.h> #include <sys/tty.h> +#include <sys/turnstile.h> #include <sys/user.h> #include <sys/jail.h> #include <sys/kse.h> @@ -190,6 +191,7 @@ vm_thread_new(td, 0); mtx_unlock(&Giant); cpu_thread_setup(td); + td->td_turnstile = turnstile_alloc(); td->td_sched = (struct td_sched *)&td[1]; } @@ -202,6 +204,7 @@ struct thread *td; td = (struct thread *)mem; + turnstile_free(td->td_turnstile); vm_thread_dispose(td); } ==== //depot/projects/hammer/sys/kern/subr_witness.c#20 (text+ko) ==== @@ -82,7 +82,7 @@ */ #include <sys/cdefs.h> -__FBSDID("$FreeBSD: src/sys/kern/subr_witness.c,v 1.161 2003/11/03 22:38:30 jhb Exp $"); +__FBSDID("$FreeBSD: src/sys/kern/subr_witness.c,v 1.162 2003/11/11 22:07:29 jhb Exp $"); #include "opt_ddb.h" #include "opt_witness.h" @@ -288,6 +288,8 @@ { "intr table", &lock_class_mtx_spin }, { "ithread table lock", &lock_class_mtx_spin }, { "sched lock", &lock_class_mtx_spin }, + { "turnstile chain", &lock_class_mtx_spin }, + { "td_contested", &lock_class_mtx_spin }, { "callout", &lock_class_mtx_spin }, /* * leaf locks @@ -342,9 +344,7 @@ LO_INITIALIZED, /* mtx_object.lo_flags */ { NULL, NULL }, /* mtx_object.lo_list */ NULL }, /* mtx_object.lo_witness */ - MTX_UNOWNED, 0, /* mtx_lock, mtx_recurse */ - TAILQ_HEAD_INITIALIZER(all_mtx.mtx_blocked), - { NULL, NULL } /* mtx_contested */ + MTX_UNOWNED, 0 /* mtx_lock, mtx_recurse */ }; /* ==== //depot/projects/hammer/sys/modules/mac_stub/Makefile#2 (text+ko) ==== @@ -1,9 +1,9 @@ -# $FreeBSD: src/sys/modules/mac_stub/Makefile,v 1.3 2003/08/21 15:43:01 rwatson Exp $ +# $FreeBSD: src/sys/modules/mac_stub/Makefile,v 1.4 2003/11/11 21:23:54 rwatson Exp $ -.PATH: ${.CURDIR}/../../security/mac_none +.PATH: ${.CURDIR}/../../security/mac_stub -KMOD= mac_none +KMOD= mac_stub SRCS= vnode_if.h \ - mac_none.c + mac_stub.c .include <bsd.kmod.mk> ==== //depot/projects/hammer/sys/pci/agp.c#9 (text+ko) ==== @@ -25,7 +25,7 @@ */ #include <sys/cdefs.h> -__FBSDID("$FreeBSD: src/sys/pci/agp.c,v 1.33 2003/10/23 18:08:56 jhb Exp $"); +__FBSDID("$FreeBSD: src/sys/pci/agp.c,v 1.34 2003/11/11 21:49:18 anholt Exp $"); #include "opt_bus.h" @@ -175,6 +175,11 @@ "allocating GATT for aperture of size %dM\n", apsize / (1024*1024)); + if (entries == 0) { + device_printf(dev, "bad aperture size\n"); + return NULL; + } + gatt = malloc(sizeof(struct agp_gatt), M_AGP, M_NOWAIT); if (!gatt) return 0; ==== //depot/projects/hammer/sys/pci/agp_ali.c#7 (text+ko) ==== @@ -25,7 +25,7 @@ */ #include <sys/cdefs.h> -__FBSDID("$FreeBSD: src/sys/pci/agp_ali.c,v 1.8 2003/08/22 07:13:20 imp Exp $"); +__FBSDID("$FreeBSD: src/sys/pci/agp_ali.c,v 1.9 2003/11/11 21:49:18 anholt Exp $"); #include "opt_bus.h" @@ -102,6 +102,10 @@ return error; sc->initial_aperture = AGP_GET_APERTURE(dev); + if (sc->initial_aperture == 0) { + device_printf(dev, "bad initial aperture size, disabling\n"); + return ENXIO; + } for (;;) { gatt = agp_alloc_gatt(dev); ==== //depot/projects/hammer/sys/sys/_mutex.h#3 (text+ko) ==== @@ -25,7 +25,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $FreeBSD: src/sys/sys/_mutex.h,v 1.9 2002/12/29 11:14:41 phk Exp $ + * $FreeBSD: src/sys/sys/_mutex.h,v 1.10 2003/11/11 22:07:29 jhb Exp $ */ #ifndef _SYS__MUTEX_H_ @@ -38,8 +38,6 @@ struct lock_object mtx_object; /* Common lock properties. */ volatile uintptr_t mtx_lock; /* Owner and flags. */ volatile u_int mtx_recurse; /* Number of recursive holds. */ - TAILQ_HEAD(, thread) mtx_blocked; /* Threads blocked on us. */ - LIST_ENTRY(mtx) mtx_contested; /* Next contested mtx. */ #ifdef MUTEX_PROFILING /* ==== //depot/projects/hammer/sys/sys/filedesc.h#5 (text+ko) ==== @@ -31,7 +31,7 @@ * SUCH DAMAGE. * * @(#)filedesc.h 8.1 (Berkeley) 6/2/93 - * $FreeBSD: src/sys/sys/filedesc.h,v 1.51 2003/06/02 16:05:32 tegge Exp $ + * $FreeBSD: src/sys/sys/filedesc.h,v 1.52 2003/11/11 22:07:29 jhb Exp $ */ #ifndef _SYS_FILEDESC_H_ @@ -137,6 +137,8 @@ #define FILEDESC_LOCKED(fd) mtx_owned(&(fd)->fd_mtx) #define FILEDESC_LOCK_ASSERT(fd, type) mtx_assert(&(fd)->fd_mtx, (type)) +struct thread; + int closef(struct file *fp, struct thread *p); int dupfdopen(struct thread *td, struct filedesc *fdp, int indx, int dfd, int mode, int error); ==== //depot/projects/hammer/sys/sys/proc.h#36 (text+ko) ==== @@ -36,7 +36,7 @@ * SUCH DAMAGE. * * @(#)proc.h 8.15 (Berkeley) 5/19/95 - * $FreeBSD: src/sys/sys/proc.h,v 1.356 2003/11/06 09:31:01 bde Exp $ + * $FreeBSD: src/sys/sys/proc.h,v 1.357 2003/11/11 22:07:29 jhb Exp $ */ #ifndef _SYS_PROC_H_ @@ -144,6 +144,7 @@ * n - not locked, lazy * o - ktrace lock * p - select lock (sellock) + * q - td_contested lock * r - p_peers lock * x - created at fork, only changes during single threading in exec * z - zombie threads/kse/ksegroup lock @@ -159,6 +160,7 @@ struct p_sched; struct td_sched; struct trapframe; +struct turnstile; /* * Here we define the four structures used for process information. @@ -259,11 +261,12 @@ TAILQ_ENTRY(thread) td_kglist; /* (*) All threads in this ksegrp. */ /* The two queues below should someday be merged. */ - TAILQ_ENTRY(thread) td_slpq; /* (j) Sleep queue. XXXKSE */ - TAILQ_ENTRY(thread) td_lockq; /* (j) Lock queue. XXXKSE */ + TAILQ_ENTRY(thread) td_slpq; /* (j) Sleep queue. */ + TAILQ_ENTRY(thread) td_lockq; /* (j) Lock queue. */ TAILQ_ENTRY(thread) td_runq; /* (j/z) Run queue(s). XXXKSE */ TAILQ_HEAD(, selinfo) td_selq; /* (p) List of selinfos. */ + struct turnstile *td_turnstile; /* (k) Associated turnstile. */ /* Cleared during fork1() or thread_sched_upcall(). */ #define td_startzero td_flags @@ -278,10 +281,10 @@ u_char td_lastcpu; /* (j) Last cpu we were on. */ u_char td_oncpu; /* (j) Which cpu we are on. */ short td_locks; /* (k) DEBUG: lockmgr count of locks. */ - struct mtx *td_blocked; /* (j) Mutex process is blocked on. */ + struct turnstile *td_blocked; /* (j) Lock process is blocked on. */ struct ithd *td_ithd; /* (b) For interrupt threads only. */ const char *td_lockname; /* (j) Name of lock blocked on. */ - LIST_HEAD(, mtx) td_contested; /* (j) Contested locks. */ + LIST_HEAD(, turnstile) td_contested; /* (q) Contested locks. */ struct lock_list_entry *td_sleeplocks; /* (k) Held sleep locks. */ int td_intr_nesting_level; /* (k) Interrupt recursion. */ int td_pinned; /* (k) Temporary cpu pin count. */ @@ -342,6 +345,7 @@ #define TDF_IDLETD 0x000020 /* This is one of the per-CPU idle threads. */ #define TDF_SELECT 0x000040 /* Selecting; wakeup/waiting danger. */ #define TDF_CVWAITQ 0x000080 /* Thread is on a cv_waitq (not slpq). */ +#define TDF_TSNOBLOCK 0x000100 /* Don't block on a turnstile due to race. */ #define TDF_ONSLEEPQ 0x000200 /* On the sleep queue. */ #define TDF_ASTPENDING 0x000800 /* Thread has some asynchronous events. */ #define TDF_TIMOFAIL 0x001000 /* Timeout from sleep after we were awake. */
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200311120008.hAC087LT013144>