cvs commit: src/sys/kern lwkt_rwlock.c lwkt_thread.c

Matthew Dillon dillon at crater.dragonflybsd.org
Mon Jun 20 00:32:17 PDT 2005


dillon      2005/06/20 00:31:05 PDT

DragonFly src repository

  Modified files:
    sys/kern             lwkt_rwlock.c lwkt_thread.c 
  Log:
  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


http://www.dragonflybsd.org/cvsweb/src/sys/kern/lwkt_rwlock.c.diff?r1=1.7&r2=1.8&f=u
http://www.dragonflybsd.org/cvsweb/src/sys/kern/lwkt_thread.c.diff?r1=1.74&r2=1.75&f=u





More information about the Commits mailing list