git: DragonFly_RELEASE_5_0 kernel - Fix GCC reordering problem with td_critcount

Matthew Dillon dillon at crater.dragonflybsd.org
Mon Oct 2 18:57:14 PDT 2017


commit 97f867c71ca5932c4d03b69f25bceb72895c1514
Author: Matthew Dillon <dillon at apollo.backplane.com>
Date:   Mon Oct 2 18:42:34 2017 -0700

    kernel - Fix GCC reordering problem with td_critcount
    
    * Wrap all ++td->td_critcount and --td->td_critcount use cases
      with an inline which executes cpu_ccfence() before and after,
      to guarantee that GCC does not try to reorder the operation around
      critical memory changes.
    
    * This fixes a race in lockmgr() and possibly a few other places
      too.

Summary of changes:
 sys/kern/kern_mutex.c                      | 40 ++++++++++++++++--------------
 sys/kern/kern_spinlock.c                   |  3 ++-
 sys/kern/lwkt_thread.c                     |  1 +
 sys/platform/vkernel64/platform/machintr.c |  2 ++
 sys/platform/vkernel64/x86_64/exception.c  | 20 +++++++++------
 sys/sys/mutex2.h                           | 12 ++++-----
 sys/sys/spinlock2.h                        | 20 +++++++--------
 sys/sys/thread2.h                          | 28 ++++++++++++++++++---
 8 files changed, 78 insertions(+), 48 deletions(-)

http://gitweb.dragonflybsd.org/dragonfly.git/commitdiff/97f867c71ca5932c4d03b69f25bceb72895c1514


-- 
DragonFly BSD source repository


More information about the Commits mailing list