RADAR: Dataflow Analysis for Concurrent Programs using Datarace Detection Ravi Chugh, Jan Voung, Ranjit Jhala, Sorin Lerner {rchugh, jvoung, jhala, lerner}

Slides:



Advertisements
Similar presentations
Dataflow Analysis for Datarace-Free Programs (ESOP 11) Arnab De Joint work with Deepak DSouza and Rupesh Nasre Indian Institute of Science, Bangalore.
Advertisements

On-the-fly Healing of Race Conditions in ARINC-653 Flight Software
A Randomized Dynamic Program Analysis for Detecting Real Deadlocks Pallavi Joshi  Chang-Seo Park  Koushik Sen  Mayur Naik ‡  Par Lab, EECS, UC Berkeley‡
1 Chao Wang, Yu Yang*, Aarti Gupta, and Ganesh Gopalakrishnan* NEC Laboratories America, Princeton, NJ * University of Utah, Salt Lake City, UT Dynamic.
Pointer Analysis – Part I Mayur Naik Intel Research, Berkeley CS294 Lecture March 17, 2009.
Flow insensitive pointer analysis: fixed S1: l := new Cons p := l S2: t := new Cons *p := t p := t l p S1 l p tS2 l p S1 t S2 l t S1 p S2 l t S1 p S2 l.
A Randomized Dynamic Program Analysis for Detecting Real Deadlocks Koushik Sen CS 265.
Scalable and Precise Dynamic Datarace Detection for Structured Parallelism Raghavan RamanJisheng ZhaoVivek Sarkar Rice University June 13, 2012 Martin.
Iterative Context Bounding for Systematic Testing of Multithreaded Programs Madan Musuvathi Shaz Qadeer Microsoft Research.
/ PSWLAB RacerX: Effective, Static Detection of Race Conditions and Deadlocks by Dawson Engler & Ken Ashcraft (published in SOSP03) Hong,Shin.
SOS: Saving Time in Dynamic Race Detection with Stationary Analysis Du Li, Witawas Srisa-an, Matthew B. Dwyer.
Thread-modular Abstraction Refinement Tom Henzinger Ranjit Jhala Rupak Majumdar Shaz Qadeer.
C. FlanaganSAS’04: Type Inference Against Races1 Type Inference Against Races Cormac Flanagan UC Santa Cruz Stephen N. Freund Williams College.
Thread-modular Abstraction Refinement Tom Henzinger Ranjit Jhala Rupak Majumdar [UC Berkeley] Shaz Qadeer [Microsoft Research]
Next Section: Pointer Analysis Outline: –What is pointer analysis –Intraprocedural pointer analysis –Interprocedural pointer analysis (Wilson & Lam) –Unification.
Automatically Proving the Correctness of Compiler Optimizations Sorin Lerner Todd Millstein Craig Chambers University of Washington.
Mayur Naik Alex Aiken John Whaley Stanford University Effective Static Race Detection for Java.
Race Checking by Context Inference Tom Henzinger Ranjit Jhala Rupak Majumdar UC Berkeley.
1 RELAY: Static Race Detection on Millions of Lines of Code Jan Voung, Ranjit Jhala, and Sorin Lerner UC San Diego speaker.
Staged Information Flow for JavaScript Ravi Chugh, Jeff Meister, Ranjit Jhala, Sorin Lerner UC San Diego.
1 A Modular Checker for Multithreaded Programs Cormac Flanagan HP Systems Research Center Joint work with Shaz Qadeer Sanjit A. Seshia.
Lazy Abstraction Lecture 2: Modular Analyses Ranjit Jhala UC San Diego With: Tom Henzinger, Rupak Majumdar, Ken McMillan, Gregoire Sutre.
Parallelizing Data Race Detection Benjamin Wester Facebook David Devecsery, Peter Chen, Jason Flinn, Satish Narayanasamy University of Michigan.
Ranjit Jhala Rupak Majumdar Interprocedural Analysis of Asynchronous Programs.
Cormac Flanagan UC Santa Cruz Velodrome: A Sound and Complete Dynamic Atomicity Checker for Multithreaded Programs Jaeheon Yi UC Santa Cruz Stephen Freund.
Deep Typechecking and Refactoring Zachary Tatlock, Chris Tucker, David Shuffleton, Ranjit Jhala, Sorin Lerner 1 University of California, San Diego.
Thread-modular Abstraction Refinement Thomas A. Henzinger, et al. CAV 2003 Seonggun Kim KAIST CS750b.
Control Flow Resolution in Dynamic Language Author: Štěpán Šindelář Supervisor: Filip Zavoral, Ph.D.
Application-Layer Anycasting By Samarat Bhattacharjee et al. Presented by Matt Miller September 30, 2002.
- 1 - Dongyoon Lee, Peter Chen, Jason Flinn, Satish Narayanasamy University of Michigan, Ann Arbor Chimera: Hybrid Program Analysis for Determinism * Chimera.
Programming Multi-Core Processors based Embedded Systems A Hands-On Experience on Cavium Octeon based Platforms Lab Exercises.
1 Effective Static Race Detection for Java Mayur, Alex, CS Department Stanford University Presented by Roy Ganor 14/2/08 Point-To Analysis Seminar.
Race Checking by Context Inference Tom Henzinger Ranjit Jhala Rupak Majumdar UC Berkeley.
Use of Coverity & Valgrind in Geant4 Gabriele Cosmo.
DoubleChecker: Efficient Sound and Precise Atomicity Checking Swarnendu Biswas, Jipeng Huang, Aritra Sengupta, and Michael D. Bond The Ohio State University.
On-Demand Dynamic Software Analysis Joseph L. Greathouse Ph.D. Candidate Advanced Computer Architecture Laboratory University of Michigan December 12,
Speculative Execution in a Distributed File System Ed Nightingale Peter Chen Jason Flinn University of Michigan.
Dataflow Analysis for Concurrent Programs using Datarace Detection Ravi Chugh, Jan W. Voung, Ranjit Jhala, Sorin Lerner LBA Reading Group Michelle Goodstein.
Detecting and Eliminating Potential Violation of Sequential Consistency for concurrent C/C++ program Duan Yuelu, Feng Xiaobing, Pen-chung Yew.
Michael Bond Katherine Coons Kathryn McKinley University of Texas at Austin.
Pointer Analysis Survey. Rupesh Nasre. Aug 24, 2007.
Demo of Scalable Pluggable Types Michael Ernst MIT Dagstuhl Seminar “Scalable Program Analysis” April 17, 2008.
Sound and Precise Analysis of Parallel Programs through Schedule Specialization Jingyue Wu, Yang Tang, Gang Hu, Heming Cui, Junfeng Yang Columbia University.
By: Rob von Behren, Jeremy Condit and Eric Brewer 2003 Presenter: Farnoosh MoshirFatemi Jan
Effective Static Deadlock Detection Mayur Naik* Chang-Seo Park +, Koushik Sen +, David Gay* *Intel Research, Berkeley + UC Berkeley.
Sampling Dynamic Dataflow Analyses Joseph L. Greathouse Advanced Computer Architecture Laboratory University of Michigan University of British Columbia.
Threads versus Events CSE451 Andrew Whitaker. This Class Threads vs. events is an ongoing debate  So, neat-and-tidy answers aren’t necessarily available.
Threads. Readings r Silberschatz et al : Chapter 4.
Effective Static Deadlock Detection Mayur Naik (Intel Research) Chang-Seo Park and Koushik Sen (UC Berkeley) David Gay (Intel Research)
AtomCaml: First-class Atomicity via Rollback Michael F. Ringenburg and Dan Grossman University of Washington International Conference on Functional Programming.
D A C U C P Speculative Alias Analysis for Executable Code Manel Fernández and Roger Espasa Computer Architecture Department Universitat Politècnica de.
Ranjit Jhala Rupak Majumdar Interprocedural Analysis of Asynchronous Programs.
/ PSWLAB Thread Modular Model Checking by Cormac Flanagan and Shaz Qadeer (published in Spin’03) Hong,Shin Thread Modular Model.
Soyeon Park, Shan Lu, Yuanyuan Zhou UIUC Reading Group by Theo.
Programming Multi-Core Processors based Embedded Systems A Hands-On Experience on Cavium Octeon based Platforms Lab Exercises: Lab 1 (Performance measurement)
Using Escape Analysis in Dynamic Data Race Detection Emma Harrington `15 Williams College
A User-Guided Approach to Program Analysis Ravi Mangal, Xin Zhang, Mayur Naik Georgia Tech Aditya Nori Microsoft Research.
Detecting Data Races in Multi-Threaded Programs
Presenter: Godmar Back
APEx: Automated Inference of Error Specifications for C APIs
Seminar in automatic tools for analyzing programs with dynamic memory
Ravi Mangal Mayur Naik Hongseok Yang
Amir Kamil and Katherine Yelick
Inlining and Devirtualization Hal Perkins Autumn 2011
When I Use NOLOCK AND OTHER HINTS
Amir Kamil and Katherine Yelick
Problems with Locks Andrew Whitaker CSE451.
Pointer analysis John Rollinson & Kaiyuan Li
CSC Multiprocessor Programming, Spring, 2011
Sampling Dynamic Dataflow Analyses
Presentation transcript:

RADAR: Dataflow Analysis for Concurrent Programs using Datarace Detection Ravi Chugh, Jan Voung, Ranjit Jhala, Sorin Lerner {rchugh, jvoung, jhala, cs.ucsd.edu UC San Diego

Studying Concurrency is Important

A “counting argument” > wget > grep –i “concurr” program_schedule.html | wc –l 6

All Jokes Aside… Architectural Trends Devilish Bugs Pressing Issue

Our Approach Leverage sequential work Sequential Dataflow Analysis Concurrent Dataflow Analysis

Sequential Reasoning is Incorrect if (p != null) { use(p); p = null; } p = new_or_die(); p != null x = compute(); p != null *p = x;

Sequential Optimization is Incorrect g = compute(); flag = 1; flag = 0; while (flag == 0) { /* spin */ } use(g); 0 Constant propagation would be incorrect Compilers forced to be conservative Optimization opportunities missed

Our Approach Sequential Dataflow Analysis Concurrent Dataflow Analysis RADAR

Concurrency Analysis Race Detector Our Approach Concurrent Dataflow Analysis Sequential Dataflow Analysis RADAR

Race Detector Modular Framework Sequential Non-Null Analysis Sequential Constant Analysis Sequential Dataflow Analysis Concurrent Dataflow Analysis RADAR Concurrent Non-Null Analysis Concurrent Constant Analysis

Modular Framework RADAR Race Detector Sequential Constant Analysis Concurrent Constant Analysis precisescalable

RADAR: Results Concurrent non-null analysis Scales to: –Apache (~130 KLOC) –OpenSSL (~210 KLOC) –subset of Linux kernel (~830 KLOC)

Example with Locks lock(l); if (p != null) { use(p); p = null; } unlock(l); lock(l); p = new_or_die(); x = compute(); *p = x; unlock(l);

lock(l); if (p != null) { use(p); p = null; } unlock(l); Can this be Optimized? lock(l); p = new_or_die(); unlock(l); x = compute(); lock(l); *p = x; unlock(l);

Optimized Version is Race-free lock(l); if (p != null) { use(p); p = null; } unlock(l); lock(l); p = new_or_die(); unlock(l); x = compute(); lock(l); *p = x; unlock(l);

lock(l); if (p != null) { use(p); p = null; } unlock(l); Oops… lock(l); p = new_or_die(); unlock(l); x = compute(); lock(l); *p = x; unlock(l);

lock(l); p = new_or_die(); p != null unlock(l); p != null x = compute(); p != null lock(l); p != null *p = x; p != null unlock(l); Sequential Non-Null Analysis lock(l); if (p != null) { p != null use(p); p != null p = null; p != null } unlock(l);

RADAR on Example lock(l); if (p != null) { p != null use(p); p != null p = null; p != null } unlock(l); lock(l); p = new_or_die(); p != null unlock(l); p != null x = compute(); p != null lock(l); p != null *p = x; p != null unlock(l);

lock(l); p = new_or_die(); p != null unlock(l); x = compute(); lock(l); *p = x; unlock(l); RADAR on Example Can fact be invalidated by concurrent thread? Can p be written by a concurrent thread?

lock(l); p = new_or_die(); p != null unlock(l); x = compute(); lock(l); *p = x; unlock(l); RADAR on Example pseudo-read(p) Race Detector Can p be written by a concurrent thread? Race No Race

lock(l); p = new_or_die(); p != null unlock(l); x = compute(); lock(l); *p = x; unlock(l); RADAR on Example pseudo-read(p) Can p be written by a concurrent thread? Race No Race Race Detector

lock(l); p = new_or_die(); p != null unlock(l); p != null x = compute(); lock(l); *p = x; unlock(l); RADAR on Example pseudo-read(p) Race Detector Race No Race

lock(l); p = new_or_die(); p != null unlock(l); p != null x = compute(); p != null lock(l); p != null *p = x; unlock(l); RADAR on Example UNSAFE

RADAR on Safe Example lock(l); p = new_or_die(); p != null x = compute(); *p = x; unlock(l); Race Detector Race No Race pseudo-read(p)

RADAR on Safe Example lock(l); p = new_or_die(); p != null x = compute(); p != null *p = x; unlock(l); Race Detector Race No Race pseudo-read(p)

RADAR on Safe Example lock(l); p = new_or_die(); p != null x = compute(); p != null *p = x; unlock(l); SAFE

More on RADAR 1.Round trip queries to race detector 2.Inter-procedural analysis

(1) Round-trip Queries lock(l); p = new_or_die(); p != null unlock(l); p != null x = compute(); p != null lock(l); p != null *p = x; p != null unlock(l); Possible Race Allow sequential analysis to run pseudo-read(p) Race Detector Race No Race Get superset of (concurrent) facts pseudo-read(p)

lock(l); p = new_or_die(); p != null unlock(l); p != null x = compute(); p != null lock(l); p != null *p = x; p != null unlock(l); (1) Round-trip Queries Insert all pseudo-reads at once pseudo-read(p) Race Detector Send whole program to race detector

(1) Round-trip Queries lock(l); p = new_or_die(); p != null unlock(l); p != null x = compute(); p != null lock(l); p != null *p = x; p != null unlock(l); pseudo-read(p) Get results back from Race Detector

(1) Round-trip Queries lock(l); p = new_or_die(); unlock(l); x = compute(); lock(l); *p = x; unlock(l); pseudo-read(p) Get results back from Race Detector Rerun analysis using race results

(1) Round-trip Queries lock(l); p = new_or_die(); p != null unlock(l); p != null x = compute(); lock(l); *p = x; unlock(l); Rerun analysis using race results

(1) Round-trip Queries lock(l); p = new_or_die(); p != null unlock(l); p != null x = compute(); p != null lock(l); p != null *p = x; unlock(l); UNSAFE

(2) Handling Procedures Unlock in foo allows interference lock(l); if (p != null) { foo(); *p = 10; } unlock(l); void foo () { if (*) { unlock(l); compute(); lock(l); } lock(l); p = null; unlock(l); Want to summarize effect of calling foo

(2) Handling Procedures lock(l); if (p != null) { foo(); *p = 10; } unlock(l); void foo () { if (*) { unlock(l); compute(); lock(l); } lock(l); p = null; unlock(l);

lock(l); if (p != null) { foo(); *p = 10; } unlock(l); (2) Handling Procedures pseudo-unlock(l); pseudo-read(p); pseudo-lock(l); In the caller, RADAR inserts: pseudo-unlock for every unlock in foo pseudo-reads

Evaluation Is RADAR scalable? Is RADAR precise? Where can we do better?

Experiments: Benchmarks Apache (130 KLOC) –worker threads + modules (e.g., caches) OpenSSL 0.9.8g (210 KLOC) –model a multi-threaded client Linux (830 KLOC) –subset from RELAY experiments

SequentialRace Detector += Non-Null Never race Optimistic (sequential) Non-Null Escapes ⇒ race Conservative

GAP SequentialRace Detector += Non-Null Never race Optimistic (sequential) Escapes ⇒ race Conservative Shared ⇒ race No locks ⇒ race

SequentialRace Detector += Non-Null Optimistic (sequential) Conservative Never race Escapes ⇒ race Shared ⇒ race No locks ⇒ race

Sources of Imprecision Alias analysis –affects sequential dataflow and race detection Lockset-based race analysis –ignores fork, join, condition variables RADAR framework –pseudo-read (for non-null fact) races with –“ x = NonNullAddress; ”

Related Work Programming-model-based approaches –[Knoop et al 96], [Grunwald et al 93], … –par-begin / par-end –handles introduction of facts between threads Thread-modular –[Owicki et al 76], [Jones 83], [Flanagan et al 03], … –more precise (use environment assumption) –inference not as scalable

Conclusion RADAR Race Detector Sequential Dataflow Analysis Concurrent Dataflow Analysis precisescalable

THANKS!

What is filtered for non-null? if (a->f != null) { b->f = null; deref(a->f); //filter if warned deref(b->f); //don’t filter }