DragonFly commits List (threaded) for 2005-06
cvs commit: src/sys/kern lwkt_rwlock.c lwkt_thread.c
dillon 2005/06/20 00:31:05 PDT
DragonFly src repository
sys/kern lwkt_rwlock.c lwkt_thread.c
Fix a serious SMP bug. The RWLOCK support used by dev/raid/aac,
ACPI, and dev/drm improperly tries to use a token in lwkt_schedule().
Because lwkt_schedule() can be called from an IPI in the context of
the current thread it cannot safely manipulate the current thread,
much less the td_toks field.
To fix this problem the RW lock functions in lwkt_rwlock.c have to be
covered by a critical section as well as the token, and lwkt_schedule()
then simply checks to see if the token is owned by the current cpu. RWLocks
may require some rethinking.
The token code is designed to operate mostly without having to use a
critical section, but in order for this to work it depends on the td_toks
list not being ripped out from under it. The nested trytoken/release
call in lwkt_schedule() should not have caused mainline token code to
fail as it restored td_toks to the same state it was in on entry, but
we can't take that chance.
Revision Changes Path
1.8 +16 -0 src/sys/kern/lwkt_rwlock.c
1.75 +14 -7 src/sys/kern/lwkt_thread.c