Skip to content

Conversation

@zoybai
Copy link
Contributor

@zoybai zoybai commented Aug 13, 2018

New CLH spinlock workload

zoybai and others added 8 commits August 1, 2018 14:22
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.
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)
Lockhammer clh (Craig Landin Hagersten, 1994) queue spinlocks from Arm
@zoybai zoybai merged commit d34998a into master Aug 13, 2018
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