git: DragonFly_RELEASE_4_6 kernel - Fix TDF_EXITING bug, instrument potential live loops

Matthew Dillon dillon at crater.dragonflybsd.org
Sat Jul 23 21:00:56 PDT 2016


commit 0e151d4aecf43cc4b8623e60435f997c9f6e2bb7
Author: Matthew Dillon <dillon at apollo.backplane.com>
Date:   Sat Jul 23 18:59:33 2016 -0700

    kernel - Fix TDF_EXITING bug, instrument potential live loops
    
    * Fix a TDF_EXITING bug.  lwkt_switch_return() is called to fixup
      the 'previous' thread, meaning turning off TDF_RUNNING and handling
      TDF_EXITING.
    
      However, if TDF_EXITING is not set, the old thread can be used or
      acted upon / exited on by some other cpu the instant we clear
      TDF_RUNNING.  In this situation it is possible that the other cpu
      will set TDF_EXITING in the small window of opportunity just before
      we check ourselves, leading to serious thread management corruption.
    
    * The new pmap_inval*() code runs on Xinvltlb instead of as a IPIQ
      and can easily create significant latency between the two tests,
      whereas the old code ran as an IPIQ and could not due to the critical
      section.

Summary of changes:
 sys/kern/lwkt_thread.c | 51 +++++++++++++++++++++++++++++++++++++++++++-------
 1 file changed, 44 insertions(+), 7 deletions(-)

http://gitweb.dragonflybsd.org/dragonfly.git/commitdiff/0e151d4aecf43cc4b8623e60435f997c9f6e2bb7


-- 
DragonFly BSD source repository



More information about the Commits mailing list