Skip to content

Conversation

@zoybai
Copy link
Contributor

@zoybai zoybai commented Aug 7, 2018

Initial patch for CLH queue spinlock, which is simpler than MCS but has similar performance.

zoybai and others added 3 commits August 1, 2018 14:21
Integration with minor bug fixes and new colon delimiter for -o option
Sync with upstream before checking in new workloads
CLH is a starvation-free queue spinlock which has FCFS
(first come, first served) order like MCS spinlock.
CLH spinlock is simpler than MCS spinlock, and each thread
is spinning on its previous node's wait flag. Our CLH
spinlock has an optional parameter to disable SEVL and WFE.
@geoffreyblake
Copy link
Contributor

Can one of the admins verify this patch?

Yangzheng Bai added 5 commits August 8, 2018 12:01
clh_unlock() now returns node->prev directly. Also disable wfe()
for all non-aarch64 systems by default.
Now sweep mode has 5 tests:
-c 0ns -p 0ns (heavy load)
-c 200ns -p 0ns (baseline)
-c 1000ns -p 0ns (baseline)
-c 200ns -p 1000ns (median load)
-c 1000ns -p 5000ns (light load)
Because each thread may finish and join randomly, some thread may
reference other thread's __thread (thread local storage) even if
that thread has been joined (removed). This will cause segmentation
fault.

Another issue is DDEBUG mode printf may cause clh_spinlock live
lock if thread number is too high.
This may reflect the real unlock state
Need to save node->prev to a temporary variable, because once clh_unlock()
has been called, the current clh_node may be used by another thread for
many times and node->prev value might be changed. Therefore two thread
may end up using the same clh_node next time and cause circular linked
list problem (live-lock on the same clh_node)
@zoybai
Copy link
Contributor Author

zoybai commented Aug 13, 2018

Verified and Tested on both dual-socket Arm and x86 system, all sweep test passed, performance similar to MCS spinlock.

@zoybai zoybai merged commit 1365f59 into ARM-software:integration Aug 13, 2018
@zoybai zoybai deleted the lh_CLH_spinlocks branch August 13, 2018 18:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants