Download - AVIO class present
![Page 1: AVIO class present](https://reader034.vdocuments.site/reader034/viewer/2022051513/5478ecd4b4795990098b462c/html5/thumbnails/1.jpg)
AVIO: Detecting Atomicity Violations via AccessInterleaving Invariants
Dacong (Tony) Yan
January 25, 2011
![Page 2: AVIO class present](https://reader034.vdocuments.site/reader034/viewer/2022051513/5478ecd4b4795990098b462c/html5/thumbnails/2.jpg)
Motivation
CSE 788.07, Dacong (Tony) Yan AVIO: Detecting Atomicity Violations via Access Interleaving Invariants 2/21
![Page 3: AVIO class present](https://reader034.vdocuments.site/reader034/viewer/2022051513/5478ecd4b4795990098b462c/html5/thumbnails/3.jpg)
Motivation
CSE 788.07, Dacong (Tony) Yan AVIO: Detecting Atomicity Violations via Access Interleaving Invariants 3/21
![Page 4: AVIO class present](https://reader034.vdocuments.site/reader034/viewer/2022051513/5478ecd4b4795990098b462c/html5/thumbnails/4.jpg)
Agenda
Motivation
AVIO Idea
AVIO Algorithms
AVIO Implementations
Discussion
CSE 788.07, Dacong (Tony) Yan AVIO: Detecting Atomicity Violations via Access Interleaving Invariants 4/21
![Page 5: AVIO class present](https://reader034.vdocuments.site/reader034/viewer/2022051513/5478ecd4b4795990098b462c/html5/thumbnails/5.jpg)
AVIO Idea
Idea: access interleaving invariants!
CSE 788.07, Dacong (Tony) Yan AVIO: Detecting Atomicity Violations via Access Interleaving Invariants 5/21
![Page 6: AVIO class present](https://reader034.vdocuments.site/reader034/viewer/2022051513/5478ecd4b4795990098b462c/html5/thumbnails/6.jpg)
AVIO Idea
Idea: access interleaving invariants!
CSE 788.07, Dacong (Tony) Yan AVIO: Detecting Atomicity Violations via Access Interleaving Invariants 5/21
![Page 7: AVIO class present](https://reader034.vdocuments.site/reader034/viewer/2022051513/5478ecd4b4795990098b462c/html5/thumbnails/7.jpg)
Eight Cases of Access Interleavings
CSE 788.07, Dacong (Tony) Yan AVIO: Detecting Atomicity Violations via Access Interleaving Invariants 6/21
![Page 8: AVIO class present](https://reader034.vdocuments.site/reader034/viewer/2022051513/5478ecd4b4795990098b462c/html5/thumbnails/8.jpg)
AVIO Idea
Two Phases
Training: extracts access interleaving invariants from a large set ofcorrect runs;Detection: monitors the program execution, and checks whether thefour buggy cases occur.
Discussion
Correctness: are correct runs indeed correct?Sufficiency: is the number of correct runs large enough?
CSE 788.07, Dacong (Tony) Yan AVIO: Detecting Atomicity Violations via Access Interleaving Invariants 7/21
![Page 9: AVIO class present](https://reader034.vdocuments.site/reader034/viewer/2022051513/5478ecd4b4795990098b462c/html5/thumbnails/9.jpg)
AVIO Idea
Two Phases
Training: extracts access interleaving invariants from a large set ofcorrect runs;
Detection: monitors the program execution, and checks whether thefour buggy cases occur.
Discussion
Correctness: are correct runs indeed correct?Sufficiency: is the number of correct runs large enough?
CSE 788.07, Dacong (Tony) Yan AVIO: Detecting Atomicity Violations via Access Interleaving Invariants 7/21
![Page 10: AVIO class present](https://reader034.vdocuments.site/reader034/viewer/2022051513/5478ecd4b4795990098b462c/html5/thumbnails/10.jpg)
AVIO Idea
Two Phases
Training: extracts access interleaving invariants from a large set ofcorrect runs;Detection: monitors the program execution, and checks whether thefour buggy cases occur.
Discussion
Correctness: are correct runs indeed correct?Sufficiency: is the number of correct runs large enough?
CSE 788.07, Dacong (Tony) Yan AVIO: Detecting Atomicity Violations via Access Interleaving Invariants 7/21
![Page 11: AVIO class present](https://reader034.vdocuments.site/reader034/viewer/2022051513/5478ecd4b4795990098b462c/html5/thumbnails/11.jpg)
AVIO Idea
Two Phases
Training: extracts access interleaving invariants from a large set ofcorrect runs;Detection: monitors the program execution, and checks whether thefour buggy cases occur.
Discussion
Correctness: are correct runs indeed correct?Sufficiency: is the number of correct runs large enough?
CSE 788.07, Dacong (Tony) Yan AVIO: Detecting Atomicity Violations via Access Interleaving Invariants 7/21
![Page 12: AVIO class present](https://reader034.vdocuments.site/reader034/viewer/2022051513/5478ecd4b4795990098b462c/html5/thumbnails/12.jpg)
AVIO Algorithms
![Page 13: AVIO class present](https://reader034.vdocuments.site/reader034/viewer/2022051513/5478ecd4b4795990098b462c/html5/thumbnails/13.jpg)
Detection Algorithm
What is an access inverleaving invariant?
A pair of accesses (P-Instruction, I-Instruction).
Detection procedure:
CSE 788.07, Dacong (Tony) Yan AVIO: Detecting Atomicity Violations via Access Interleaving Invariants 9/21
![Page 14: AVIO class present](https://reader034.vdocuments.site/reader034/viewer/2022051513/5478ecd4b4795990098b462c/html5/thumbnails/14.jpg)
Detection Algorithm
What is an access inverleaving invariant?
A pair of accesses (P-Instruction, I-Instruction).
Detection procedure:
CSE 788.07, Dacong (Tony) Yan AVIO: Detecting Atomicity Violations via Access Interleaving Invariants 9/21
![Page 15: AVIO class present](https://reader034.vdocuments.site/reader034/viewer/2022051513/5478ecd4b4795990098b462c/html5/thumbnails/15.jpg)
Detection Algorithm
What is an access inverleaving invariant?
A pair of accesses (P-Instruction, I-Instruction).
Detection procedure:
CSE 788.07, Dacong (Tony) Yan AVIO: Detecting Atomicity Violations via Access Interleaving Invariants 9/21
![Page 16: AVIO class present](https://reader034.vdocuments.site/reader034/viewer/2022051513/5478ecd4b4795990098b462c/html5/thumbnails/16.jpg)
Extraction Algorithm
Idea: eliminate non-invariants from the whole set of pairs ofaccesses.
1. Suppose ai is an invariant: ai ∈ AISet;2. If ai is violated in correct runs, remove ai from AISet.
Pseudocode
CSE 788.07, Dacong (Tony) Yan AVIO: Detecting Atomicity Violations via Access Interleaving Invariants 10/21
![Page 17: AVIO class present](https://reader034.vdocuments.site/reader034/viewer/2022051513/5478ecd4b4795990098b462c/html5/thumbnails/17.jpg)
Extraction Algorithm
Idea: eliminate non-invariants from the whole set of pairs ofaccesses.
1. Suppose ai is an invariant: ai ∈ AISet;2. If ai is violated in correct runs, remove ai from AISet.
Pseudocode
CSE 788.07, Dacong (Tony) Yan AVIO: Detecting Atomicity Violations via Access Interleaving Invariants 10/21
![Page 18: AVIO class present](https://reader034.vdocuments.site/reader034/viewer/2022051513/5478ecd4b4795990098b462c/html5/thumbnails/18.jpg)
Extraction Algorithm
Idea: eliminate non-invariants from the whole set of pairs ofaccesses.
1. Suppose ai is an invariant: ai ∈ AISet;2. If ai is violated in correct runs, remove ai from AISet.
Pseudocode
CSE 788.07, Dacong (Tony) Yan AVIO: Detecting Atomicity Violations via Access Interleaving Invariants 10/21
![Page 19: AVIO class present](https://reader034.vdocuments.site/reader034/viewer/2022051513/5478ecd4b4795990098b462c/html5/thumbnails/19.jpg)
AVIO Implementations
![Page 20: AVIO class present](https://reader034.vdocuments.site/reader034/viewer/2022051513/5478ecd4b4795990098b462c/html5/thumbnails/20.jpg)
AVIO-H
L1 cache line extension
Hardware-based decision procedure
CSE 788.07, Dacong (Tony) Yan AVIO: Detecting Atomicity Violations via Access Interleaving Invariants 12/21
![Page 21: AVIO class present](https://reader034.vdocuments.site/reader034/viewer/2022051513/5478ecd4b4795990098b462c/html5/thumbnails/21.jpg)
AVIO-H
L1 cache line extension
Hardware-based decision procedure
CSE 788.07, Dacong (Tony) Yan AVIO: Detecting Atomicity Violations via Access Interleaving Invariants 12/21
![Page 22: AVIO class present](https://reader034.vdocuments.site/reader034/viewer/2022051513/5478ecd4b4795990098b462c/html5/thumbnails/22.jpg)
AVIO-S
Two access tables
Local access table: latest access information per threadGlobal access table: thread id of latest write among all threads
Detection at I-instruction
P-instruction: extracts from local access tableRemote access: extracts from global access table
CSE 788.07, Dacong (Tony) Yan AVIO: Detecting Atomicity Violations via Access Interleaving Invariants 13/21
![Page 23: AVIO class present](https://reader034.vdocuments.site/reader034/viewer/2022051513/5478ecd4b4795990098b462c/html5/thumbnails/23.jpg)
AVIO-S
Two access tables
Local access table: latest access information per threadGlobal access table: thread id of latest write among all threads
Detection at I-instruction
P-instruction: extracts from local access tableRemote access: extracts from global access table
CSE 788.07, Dacong (Tony) Yan AVIO: Detecting Atomicity Violations via Access Interleaving Invariants 13/21
![Page 24: AVIO class present](https://reader034.vdocuments.site/reader034/viewer/2022051513/5478ecd4b4795990098b462c/html5/thumbnails/24.jpg)
Discussion
![Page 25: AVIO class present](https://reader034.vdocuments.site/reader034/viewer/2022051513/5478ecd4b4795990098b462c/html5/thumbnails/25.jpg)
Q1: How can we fix this bug?
CSE 788.07, Dacong (Tony) Yan AVIO: Detecting Atomicity Violations via Access Interleaving Invariants 15/21
![Page 26: AVIO class present](https://reader034.vdocuments.site/reader034/viewer/2022051513/5478ecd4b4795990098b462c/html5/thumbnails/26.jpg)
Solution: busy-waiting
CSE 788.07, Dacong (Tony) Yan AVIO: Detecting Atomicity Violations via Access Interleaving Invariants 16/21
![Page 27: AVIO class present](https://reader034.vdocuments.site/reader034/viewer/2022051513/5478ecd4b4795990098b462c/html5/thumbnails/27.jpg)
Q2: Will AVIO report this violation?
Q2.1: Will < (shared == null)rd , (shared = newObj)wr > beincluded in AISet? Yes!
Q2.2: Will the buggy interleaving be detected? Yes!
CSE 788.07, Dacong (Tony) Yan AVIO: Detecting Atomicity Violations via Access Interleaving Invariants 17/21
![Page 28: AVIO class present](https://reader034.vdocuments.site/reader034/viewer/2022051513/5478ecd4b4795990098b462c/html5/thumbnails/28.jpg)
Q2: Will AVIO report this violation?
Q2.1: Will < (shared == null)rd , (shared = newObj)wr > beincluded in AISet?
Yes!
Q2.2: Will the buggy interleaving be detected? Yes!
CSE 788.07, Dacong (Tony) Yan AVIO: Detecting Atomicity Violations via Access Interleaving Invariants 17/21
![Page 29: AVIO class present](https://reader034.vdocuments.site/reader034/viewer/2022051513/5478ecd4b4795990098b462c/html5/thumbnails/29.jpg)
Q2: Will AVIO report this violation?
Q2.1: Will < (shared == null)rd , (shared = newObj)wr > beincluded in AISet? Yes!
Q2.2: Will the buggy interleaving be detected? Yes!
CSE 788.07, Dacong (Tony) Yan AVIO: Detecting Atomicity Violations via Access Interleaving Invariants 17/21
![Page 30: AVIO class present](https://reader034.vdocuments.site/reader034/viewer/2022051513/5478ecd4b4795990098b462c/html5/thumbnails/30.jpg)
Q2: Will AVIO report this violation?
Q2.1: Will < (shared == null)rd , (shared = newObj)wr > beincluded in AISet? Yes!
Q2.2: Will the buggy interleaving be detected?
Yes!
CSE 788.07, Dacong (Tony) Yan AVIO: Detecting Atomicity Violations via Access Interleaving Invariants 17/21
![Page 31: AVIO class present](https://reader034.vdocuments.site/reader034/viewer/2022051513/5478ecd4b4795990098b462c/html5/thumbnails/31.jpg)
Q2: Will AVIO report this violation?
Q2.1: Will < (shared == null)rd , (shared = newObj)wr > beincluded in AISet? Yes!
Q2.2: Will the buggy interleaving be detected? Yes!
CSE 788.07, Dacong (Tony) Yan AVIO: Detecting Atomicity Violations via Access Interleaving Invariants 17/21
![Page 32: AVIO class present](https://reader034.vdocuments.site/reader034/viewer/2022051513/5478ecd4b4795990098b462c/html5/thumbnails/32.jpg)
Q3: Why does AVIO-H have much lower overhead?
Answer: extra bits needed by the algorithm can be piggybacked in thecache coherence protocol, inducing very little extra cost.
CSE 788.07, Dacong (Tony) Yan AVIO: Detecting Atomicity Violations via Access Interleaving Invariants 18/21
![Page 33: AVIO class present](https://reader034.vdocuments.site/reader034/viewer/2022051513/5478ecd4b4795990098b462c/html5/thumbnails/33.jpg)
Q3: Why does AVIO-H have much lower overhead?
Answer: extra bits needed by the algorithm can be piggybacked in thecache coherence protocol, inducing very little extra cost.
CSE 788.07, Dacong (Tony) Yan AVIO: Detecting Atomicity Violations via Access Interleaving Invariants 18/21
![Page 34: AVIO class present](https://reader034.vdocuments.site/reader034/viewer/2022051513/5478ecd4b4795990098b462c/html5/thumbnails/34.jpg)
Q4: Why does AVIO-H report more false positives?
CSE 788.07, Dacong (Tony) Yan AVIO: Detecting Atomicity Violations via Access Interleaving Invariants 19/21
![Page 35: AVIO class present](https://reader034.vdocuments.site/reader034/viewer/2022051513/5478ecd4b4795990098b462c/html5/thumbnails/35.jpg)
Q4: Why does AVIO-H report more false positives?
Will an atomicity violation warning be raised by AVIO-H?
False sharing
CSE 788.07, Dacong (Tony) Yan AVIO: Detecting Atomicity Violations via Access Interleaving Invariants 20/21
![Page 36: AVIO class present](https://reader034.vdocuments.site/reader034/viewer/2022051513/5478ecd4b4795990098b462c/html5/thumbnails/36.jpg)
Q4: Why does AVIO-H report more false positives?
Will an atomicity violation warning be raised by AVIO-H?
False sharing
CSE 788.07, Dacong (Tony) Yan AVIO: Detecting Atomicity Violations via Access Interleaving Invariants 20/21
![Page 37: AVIO class present](https://reader034.vdocuments.site/reader034/viewer/2022051513/5478ecd4b4795990098b462c/html5/thumbnails/37.jpg)
Thank you!