1.24k likes | 1.4k Views
SigRace: Signature-Based Data Race Detection. Abdullah Muzahid , Dario Suarez*, Shanxiang Qi & Josep Torrellas. Computer Science Department University of Illinois at Urbana-Champaign http://iacoma.cs.uiuc.edu. *Universidad de Zaragoza, Spain. Debugging Multithreaded Programs.
E N D
SigRace: Signature-Based Data Race Detection Abdullah Muzahid, Dario Suarez*, Shanxiang Qi & Josep Torrellas Computer Science DepartmentUniversity of Illinois at Urbana-Champaignhttp://iacoma.cs.uiuc.edu *Universidad de Zaragoza, Spain
Debugging Multithreaded Programs “Debugging a multithreaded program has a lot in common with medieval torture methods” -- Random quote found via Google search
T1 T2 lock L x++ unlock L x++ Data Race • Two threads access the same variable without intervening synchronization and at least one is a write • Common bug • Hard to detect and reproduce
Dynamic Data Race Detection • Mainly two approaches
Dynamic Data Race Detection • Mainly two approaches • Lockset: Finds violation of locking discipline
Dynamic Data Race Detection • Mainly two approaches • Lockset: Finds violation of locking discipline • Happened-Before: Finds concurrent conflicting accesses
Happened-Before Approach Thread 0 Thread 1 [0, 0] [0, 0]
Happened-Before Approach Thread 0 Thread 1 [0, 0] [0, 0] Lock L [1, 0]
Happened-Before Approach Thread 0 Thread 1 [0, 0] [0, 0] Lock L [1, 0] Unlock L [2, 0]
Happened-Before Approach Thread 0 Thread 1 [0, 0] [0, 0] Lock L [1, 0] Unlock L [2, 0]
Happened-Before Approach Thread 0 Thread 1 [0, 0] [0, 0] Lock L [1, 0] Unlock L [2, 0] Lock L
Happened-Before Approach Thread 0 Thread 1 [0, 0] [0, 0] Lock L [1, 0] [0, 1] Unlock L [2, 0] Lock L
Happened-Before Approach Thread 0 Thread 1 [0, 0] [0, 0] Lock L [1, 0] [0, 1] Unlock L [2, 0] + Lock L [2, 1]
Happened-Before Approach Thread 0 Thread 1 [0, 0] [0, 0] • Epoch : sync to sync Lock L [1, 0] Unlock L [2, 0] Lock L [2, 1]
Happened-Before Approach Thread 0 Thread 1 a [0, 0] [0, 0] • Epoch : sync to sync d Lock L b [1, 0] Unlock L [2, 0] c Lock L [2, 1] e
Happened-Before Approach Thread 0 Thread 1 a [0, 0] [0, 0] d Lock L b [1, 0] Unlock L [2, 0] c Lock L [2, 1] e • Epoch : sync to sync
Happened-Before Approach Thread 0 Thread 1 a [0, 0] [0, 0] d Lock L b [1, 0] Unlock L [2, 0] c Lock L [2, 1] e • Epoch : sync to sync
Happened-Before Approach Thread 0 Thread 1 a [0, 0] [0, 0] d Lock L b [1, 0] Unlock L [2, 0] c Lock L [2, 1] e • Epoch : sync to sync
Happened-Before Approach Thread 0 Thread 1 a [0, 0] [0, 0] d Lock L b [1, 0] Unlock L [2, 0] c Lock L [2, 1] e • Epoch : sync to sync • a, b happened before e
Happened-Before Approach Thread 0 Thread 1 a [0, 0] [0, 0] d Lock L b [1, 0] Unlock L [2, 0] c Lock L [2, 1] e • Epoch : sync to sync • a, b happened before e
Happened-Before Approach Thread 0 Thread 1 a [0, 0] [0, 0] d Lock L b [1, 0] Unlock L [2, 0] c Lock L [2, 1] e • Epoch : sync to sync • a, b happened before e • c, d unordered
Happened-Before Approach Thread 0 Thread 1 a [0, 0] [0, 0] d Lock L = x b [1, 0] Data Race Unlock L [2, 0] c Lock L [2, 1] x = e • Epoch : sync to sync • a, b happened before e • c, d unordered
Software Implementation • Need to instrument every memory access • 10x – 50x slowdown • Not suitable for production runs
P1 P2 Hardware Implementation … … C1 C2
P1 P2 Hardware Implementation … … C1 C2 TS TS
P1 P2 Hardware Implementation ts1 x … … C1 C2 TS TS
P1 P2 Hardware Implementation WR ts1 x ts2 x … … C1 C2 TS … TS ts2
P1 P2 Hardware Implementation check WR ts1 x ts2 x ts2 … … C1 C2 TS … TS ts2
Limitations of HW Approaches P1 P2 • Modify cache and coherence protocol C1 … … C2 …
Limitations of HW Approaches P1 P2 check • Modify cache and coherence protocol • Perform checking at least on every coherence transaction ts1 C1 … … C2 ts2 … ts2
Limitations of HW Approaches P1 P2 • Modify cache and coherence protocol • Perform checking at least on every coherence transaction • Lose detection ability when cache line is displaced or invalidated C1 … … C2
Our Contributions • SigRace: Novel HW mechanism for race detection based on signatures • Simple HW • Cache and coherence protocol are unchanged • Higher coverage than existing HW schemes • Detect races even if the line is displaced/invalidated • Usable on-the-fly in production runs • SigRace finds 150% more injected races than a state-of-the-art HW proposal
Outline • Motivation • Main Idea • Implementation • Results • Conclusions
Main Idea Address Signature + Happened-before
ROB ld/st … address … Permute [Ceze et al, ISCA06] Hardware Address Signatures
Hardware Address Signatures • Logical AND for intersection • Has false positives but not false negatives
sync Epoch sync Using Signatures for Race Detection
Epoch Using Signatures for Race Detection sync TS Sig sync
Epoch Using Signatures for Race Detection sync • Block is a fixed number of dynamic instructions (not a cache block or basic block or atomic block) Block TS1 Sig1 sync
Epoch Using Signatures for Race Detection sync Block TS1 Sig1 sync Race Detection Module
Epoch Using Signatures for Race Detection sync Block TS1 Ø sync Race Detection Module
Epoch Using Signatures for Race Detection sync Block TS1 Sig2 sync Race Detection Module
Epoch Using Signatures for Race Detection sync Block TS1 Sig2 sync Race Detection Module
Epoch Using Signatures for Race Detection sync Block TS1 Ø sync Race Detection Module
Epoch Using Signatures for Race Detection sync sync Block TS2 Sig3 Race Detection Module
Epoch Using Signatures for Race Detection sync sync Block TS2 Sig3 Race Detection Module