kernel - wakeup() lfence -> mfence
authorMatthew Dillon <dillon@apollo.backplane.com>
Fri, 25 Aug 2017 05:16:34 +0000 (22:16 -0700)
committerMatthew Dillon <dillon@apollo.backplane.com>
Fri, 25 Aug 2017 05:16:34 +0000 (22:16 -0700)
commit9b302485d4f8583183e666fd23820ad7eb08c968
treebca75ca5002dcb372746c837f042f3ceebc2026a
parentd0ae594624c94c3ea0a15231969800a607627b85
kernel - wakeup() lfence -> mfence

* wakeup() needs to use a mfence() before loading from the global cpumasks
  array.   lfence() is not sufficient.

* Issue arises where the mutex code sets a variable non-atomically and
  then calls wakeup().  If the write to the variable is reordered around
  wakeup()'s read of the global cpumask, then wakeup() can race the mutex
  link wait setup and cause the mutex to stall.
sys/kern/kern_synch.c