avio class present

Post on 29-Nov-2014

310 Views

Category:

Technology

2 Downloads

Preview:

Click to see full reader

DESCRIPTION

 

TRANSCRIPT

AVIO: Detecting Atomicity Violations via AccessInterleaving Invariants

Dacong (Tony) Yan

January 25, 2011

Motivation

CSE 788.07, Dacong (Tony) Yan AVIO: Detecting Atomicity Violations via Access Interleaving Invariants 2/21

Motivation

CSE 788.07, Dacong (Tony) Yan AVIO: Detecting Atomicity Violations via Access Interleaving Invariants 3/21

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

AVIO Idea

Idea: access interleaving invariants!

CSE 788.07, Dacong (Tony) Yan AVIO: Detecting Atomicity Violations via Access Interleaving Invariants 5/21

AVIO Idea

Idea: access interleaving invariants!

CSE 788.07, Dacong (Tony) Yan AVIO: Detecting Atomicity Violations via Access Interleaving Invariants 5/21

Eight Cases of Access Interleavings

CSE 788.07, Dacong (Tony) Yan AVIO: Detecting Atomicity Violations via Access Interleaving Invariants 6/21

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

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

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

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

AVIO Algorithms

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

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

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

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

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

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

AVIO Implementations

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

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

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

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

Discussion

Q1: How can we fix this bug?

CSE 788.07, Dacong (Tony) Yan AVIO: Detecting Atomicity Violations via Access Interleaving Invariants 15/21

Solution: busy-waiting

CSE 788.07, Dacong (Tony) Yan AVIO: Detecting Atomicity Violations via Access Interleaving Invariants 16/21

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

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

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

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

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

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

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

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

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

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

Thank you!

top related