DragonFly commits List (threaded) for 2006-05
[
Date Prev][
Date Next]
[
Thread Prev][
Thread Next]
[
Date Index][
Thread Index]
cvs commit: src/sys/ddb db_ps.c src/sys/kern lwkt_thread.c lwkt_token.c src/sys/sys spinlock2.h thread.h
dillon 2006/05/19 11:26:29 PDT
DragonFly src repository
Modified files:
sys/ddb db_ps.c
sys/kern lwkt_thread.c lwkt_token.c
sys/sys spinlock2.h thread.h
Log:
Recent lwkt_token work broke UP builds. Fix the token code to operate
properly for both UP and SMP builds. The SMP build uses spinlocks to
control access and also to do the preemption check. The tokens are
explicitly obtained when a thread is switched in and released when a
thread is (non-preemptively) switched out. Spinlocks cannot be
used for this purpose on UP because they are coded to a degenerate
case on a UP build.
On a UP build an explicit preemption check is needed, but no spinlock or
per-thread counter is required because the definition of a token is that
it is only 'held' while a thread is actually running or preempted. So,
by definition, a token can always be obtained and held by a thread on UP
EXCEPT in the case where a preempting thread is trying to obtain a token
held by the preempted thread.
Conditionalize elements in the lwkt_token structure definition to guarentee
that SMP fields cannot be used in UP builds or vise-versa. The lwkt_token
structure is made the same size for both builds. Also remove some of
the degenerate spinlock functions (spin_trylock() and spin_tryunlock())
for UP builds to force a compile-time error if an attempt is made to use
them. spin_lock*() and spin_unlock*() are retained as degenerate cases
on UP.
Reported-by: Sascha Wildner <saw@xxxxxxxxx>, walt <wa1ter@xxxxxxxxxxxxx>
Revision Changes Path
1.17 +2 -0 src/sys/ddb/db_ps.c
1.95 +2 -0 src/sys/kern/lwkt_thread.c
1.25 +74 -6 src/sys/kern/lwkt_token.c
1.7 +10 -16 src/sys/sys/spinlock2.h
1.79 +20 -3 src/sys/sys/thread.h
http://www.dragonflybsd.org/cvsweb/src/sys/ddb/db_ps.c.diff?r1=1.16&r2=1.17&f=u
http://www.dragonflybsd.org/cvsweb/src/sys/kern/lwkt_thread.c.diff?r1=1.94&r2=1.95&f=u
http://www.dragonflybsd.org/cvsweb/src/sys/kern/lwkt_token.c.diff?r1=1.24&r2=1.25&f=u
http://www.dragonflybsd.org/cvsweb/src/sys/sys/spinlock2.h.diff?r1=1.6&r2=1.7&f=u
http://www.dragonflybsd.org/cvsweb/src/sys/sys/thread.h.diff?r1=1.78&r2=1.79&f=u
[
Date Prev][
Date Next]
[
Thread Prev][
Thread Next]
[
Date Index][
Thread Index]