Presentation is loading. Please wait.

Presentation is loading. Please wait.

Detecting Atomicity Violations via Access Interleaving Invariants

Similar presentations


Presentation on theme: "Detecting Atomicity Violations via Access Interleaving Invariants"— Presentation transcript:

1 Detecting Atomicity Violations via Access Interleaving Invariants
AVIO Detecting Atomicity Violations via Access Interleaving Invariants S. Lu, J. Tucek, F. Qin and Y. Zhou UIUC

2 Outline Introduction Algorithm Implementation Evaluation Conclusion

3 Motivation Concurrency bugs hard to detect
Appear only with specific interleaving Hard to detect during development Or even to repeat for post-mortem analysis CMP architecture is only going to make matters worse

4 Problem Tools like LockSet and Happens Before not enough
Some buggy programs are actually race-free. Too many false positive Data Races NOT always bug! (benign races) Require knowledge of program synchronization semantics Barriers etc cause headaches

5 Problem - Example Race-free but buggy program.
Data-Race detection is not enough What programmers want is not race-free program, but atomicity! What actually happened What the programmer wanted

6 AVIO idea - Atomicity ATOMICITY: The data manipulation of concurrently executed actions is equivalent to that of some serial execution of them Using locks, the programmer is actually trying to enforce atomicity. Bugs come from violation of unconscious atomicity intention

7 Access-Interleaving (AI) Invariance
If an access to a variable and the previous access to the same variable from the same thread are NEVER interleaved unserializably (example a), then we have an Access-Interleaving Invariance. Example b cannot be interleaved serializably.

8 Access-Invariant Violation
Violation of Access-Invariant when the programmer wanted atomic access, but failed to ensure that with locks, or other mechanisms Atomicity Violation types: P 1: Read X 1: Write X 2: Write X 2: Read X I

9 Access-Invariant Violation (cont)

10 Capturing Atomicity Intention
AVIO automatically extracts AI invariants Run the program N times N different interleaves will probably be produced If the atomicity of two consecutive accesses to the same variable from the same thread has been violated at least T times, assume that the programmer does NOT wish atomic access. T times will ensure that a bug will not be considered acceptable.

11 Capturing Atomicity Intention

12 AVIO Implementation 2 implementations:
Hardware Software The hardware implementation is fast, but coarse-grained The software is fine-grained, but sloooooow.

13 AVIO-H(ardware) CMP, physically indexed (?) private L1, unified L2.
Invalidation-based cache coherence protocol Minimal changes to L1 (0.4% space increase) and the coherence protocol Add bit to I-instructions to identify them and notify L1

14 AVIO-H cont. INV=1: someone recently wrote to this line and invalidated my copy DG=1: someone downgraded my exclusive rights. PI: type of previous instr. of the same thread accessing the same line. Note: unserializable access must contact L2 to either get the copy, or upgrade rights → hide latency

15 AVIO-H drawbacks False sharing
Padding, or increase granularity (at the expense of space) Cache Evictions, Context Switches, load-store queue, write-coalescing Happen way too rare, improbable between two accesses that were supposed to be atomic → Sweep, sweep, sweep and under the rug. It will catch violations caused by OoO issues Wait till retirement to raise the exception PREFETCH? What if someone prefetches X (and downgrades my rights) and does not use it?

16 AVIO-S(oftware) Pin binary instrumentation tool
More precise than the AVIO-H, deals with the problems of the latter. Obviously, far more slower.

17 Evaluation - Platform AVIO-S runs on 4 Intel processors (which ones?)
AVIO-H on Simics/SimFlex 4 core CMP, in-order x86, cycle-accurate 0.4% slowdown due to increased L1-size T = 0, during 100 training runs (with different inputs)

18 Evaluation – Applications tested

19 Evaluation – Bug Detection
Detects more bugs than other methods Note that AVIO was trained on different inputs.

20 Evaluation – False Positives
Less false positives than all other methods AVIO-S better than AVIO-H T = 0 can mask bugs, if bugs occurred during training runs

21 Evaluation - Overhead AVIO-H has minimum overhead (0.5%)
AVIO-S better than other methods (25x)

22 Evaluation – Training Sensitivity
100 training runs seem to be enough.

23 AVIO Drawbacks Mainly the same problems with profilers:
If initial input not correctly chosen, or not all path exercised, AVIO will fail. Unable to detect atomicity violations that involve multiple variables (as most tools) (Software) Training overhead could be problematic

24 Conclusion AVIO is a fast tool to detect atomicity violations
AVIO-H may be worth its hardware cost As long as training overhead (not reported) remains reasonable. Questions


Download ppt "Detecting Atomicity Violations via Access Interleaving Invariants"

Similar presentations


Ads by Google