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

Matthew Dillon dillon at crater.dragonflybsd.org
Sat Jul 23 19:54:47 PDT 2016


commit 3a06728ed5a79bd111cf4a25581d00dfcdf01e54
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/3a06728ed5a79bd111cf4a25581d00dfcdf01e54


-- 
DragonFly BSD source repository



More information about the Commits mailing list