Lockout: Efficient Tes0ng for Deadlock Bugs Ali - - PowerPoint PPT Presentation

lockout efficient tes0ng for deadlock bugs
SMART_READER_LITE
LIVE PREVIEW

Lockout: Efficient Tes0ng for Deadlock Bugs Ali - - PowerPoint PPT Presentation

Lockout: Efficient Tes0ng for Deadlock Bugs Ali Kheradmand, Baris Kasikci, George Candea 1 Deadlock Set of threads Each holding a lock


slide-1
SLIDE 1

Ali ¡Kheradmand, ¡Baris ¡Kasikci, ¡George ¡Candea ¡ ¡

Lockout: ¡Efficient ¡Tes0ng ¡for ¡Deadlock ¡Bugs ¡ ¡ ¡

1 ¡

slide-2
SLIDE 2

Deadlock ¡

  • Set ¡of ¡threads ¡ ¡
  • Each ¡holding ¡a ¡lock ¡needed ¡by ¡another ¡thread ¡
  • Wai?ng ¡for ¡another ¡lock ¡to ¡be ¡released ¡by ¡some ¡
  • ther ¡thread ¡

¡

2 ¡

slide-3
SLIDE 3

Why ¡Do ¡Deadlocks ¡MaBer? ¡

  • Common ¡in ¡modern ¡soDware ¡
  • Hard ¡to ¡detect ¡manually ¡
  • Occur ¡rarely ¡during ¡execu?on ¡

3 ¡

Chrome ¡ Apache ¡ Eclipse ¡ LimeWire ¡

slide-4
SLIDE 4

Deadlock ¡Detec?on ¡

  • Tradi?onal ¡tes?ng ¡

– Deadlocks ¡manifest ¡rarely ¡✗ ¡

  • Sta?c ¡detec?on ¡

– Fast ¡(run ¡offline) ¡✓ ¡ – Few ¡false ¡nega?ves ¡✓ ¡ – Many ¡false ¡posi?ves ¡✗ ¡

  • Dynamic ¡detec?on ¡

– Slow ¡(high ¡run?me ¡overhead) ¡✗ ¡ – Many ¡false ¡nega?ves ¡✗ ¡ – Few ¡false ¡posi?ves ¡✓ ¡ ¡

4 ¡

slide-5
SLIDE 5

5 ¡

Best ¡of ¡Two ¡Worlds ¡

  • Normal ¡tests ¡can’t ¡discover ¡enough ¡deadlocks ¡
  • Deadlock ¡avoidance ¡or ¡fixing ¡tools ¡tools ¡

(Dimmunix ¡[OSDI’08]) ¡take ¡a ¡long ¡?me ¡

  • Need ¡to ¡find ¡the ¡schedules ¡that ¡lead ¡to ¡a ¡deadlock ¡
  • How ¡to ¡increase ¡the ¡probability ¡of ¡

encountering ¡a ¡deadlock? ¡ Steer ¡the ¡program ¡towards ¡schedules ¡that ¡ ¡ are ¡likely ¡to ¡cause ¡a ¡deadlock ¡

slide-6
SLIDE 6

Lockout ¡

  • Systema?c ¡deadlock ¡tes?ng ¡
  • Increases ¡deadlock ¡probability ¡
  • By ¡steering ¡the ¡scheduling ¡
  • Leverages ¡past ¡program ¡execu?ons ¡

6 ¡

Trigger ¡more ¡deadlocks ¡with ¡the ¡same ¡test ¡suite ¡

slide-7
SLIDE 7

7 ¡

Outline ¡

  • Lockout ¡architecture ¡
  • Deadlock ¡triggering ¡algorithm ¡
  • Preliminary ¡results ¡
  • Summary ¡and ¡future ¡work ¡
slide-8
SLIDE 8

Lockout ¡Architecture ¡

cout << “Hello, World!\n”;

Instrumenta?on ¡

0100100 1010101 0101010 0100110 1010101

Sta?c ¡Phase ¡

Source ¡ Code ¡ Instrumented ¡ Binary ¡

8 ¡

Sta?c ¡ Analysis ¡ ¡ RaceMob ¡ [SOSP’13] ¡

slide-9
SLIDE 9

Lockout ¡Architecture ¡

Dynamic ¡Phase ¡

Run?me ¡

Previous ¡execu?ons ¡info ¡

Subsequent ¡execu?ons ¡

Instrumented ¡ Program ¡

9 ¡ End ¡of ¡execu?on ¡ Schedule ¡ perturba?on ¡

Events ¡

DeadlockFuzzer ¡ [PLDI’09] ¡

slide-10
SLIDE 10

10 ¡

Outline ¡

  • Lockout ¡architecture ¡
  • Deadlock ¡triggering ¡algorithm ¡
  • Preliminary ¡results ¡
  • Summary ¡and ¡future ¡work ¡
slide-11
SLIDE 11

Run?me ¡Lock ¡Order ¡Graph ¡(RLG) ¡

a b c lock ¡ lock(a) … lock(b) … lock(c)

  • 11 ¡

Poten?al ¡deadlock ¡

Thread ¡1 ¡

Lock ¡ ¡ acquisi?on ¡order ¡

slide-12
SLIDE 12

Deadlock ¡Triggering ¡

  • Selects ¡a ¡directed ¡cycle ¡in ¡RLG ¡
  • Delays ¡threads ¡accordingly ¡
  • Improves ¡simple ¡preemp?on ¡(CHESS ¡[OSDI’08]) ¡
  • Preemp?on ¡before ¡each ¡lock ¡

¡

12 ¡

d a b c lock(a)

  • lock(b)
slide-13
SLIDE 13

Run?me ¡

Deadlock ¡Triggering ¡

Thread ¡1 ¡

lock(a) lock(b) … unlock(b) unlock(a)

  • Thread ¡2 ¡
  • lock(b)

lock(c) … unlock(c) unlock(b)

  • Time ¡

13 ¡

Thread ¡3 ¡

  • lock(c)

lock(a) … unlock(a) unlock(c)

  • a

c b

slide-14
SLIDE 14
  • RT()

lock(b) RT()

  • lock(c)
  • RT()

lock(c) RT()

  • lock(a)
  • Before lock (a)

Thread ¡1 ¡

RT() lock(a) RT()

  • lock(b)
  • Thread ¡2 ¡

Time ¡ Thread ¡3 ¡

a c b

Run?me ¡

Before lock (a) Continue Before lock (b) Delay Before lock (c) Continue Delay

Deadlock ¡Triggering ¡

14 ¡

B e f

  • r

e l

  • c

k ( b )

  • Continue

Before lock (c) D e l a y

slide-15
SLIDE 15

Race ¡Dependent ¡Deadlocks ¡

  • Preempt ¡before ¡memory ¡accesses ¡
  • Ideally ¡only ¡shared ¡memory ¡accesses ¡
  • Can ¡be ¡approximated ¡by ¡preemp?ng ¡aDer ¡

locks ¡

  • Can ¡be ¡improved ¡using ¡sta?c ¡analysis ¡
  • Can ¡be ¡improved ¡using ¡data ¡race ¡detec?on ¡

15 ¡

slide-16
SLIDE 16

16 ¡

Outline ¡

  • Lockout ¡architecture ¡
  • Deadlock ¡triggering ¡algorithm ¡
  • Preliminary ¡results ¡
  • Summary ¡and ¡future ¡work ¡
slide-17
SLIDE 17

Lockout ¡Effec?veness ¡

17 ¡

Program ¡ Frac0on ¡of ¡execu0ons ¡resul0ng ¡in ¡deadlock ¡(%) ¡ Na0ve ¡ Simple ¡ preemp0on ¡ + ¡ Post-­‑lock ¡ preemp0on ¡ Deadlock ¡ triggering ¡ + ¡ ¡ Pre-­‑memory ¡ access ¡ preemp0on ¡ Deadlock ¡ triggering ¡ + ¡ Post-­‑lock ¡ preemp0on ¡ Microbench ¡ 0.00066 ¡% ¡ 0.5 ¡% ¡ 50 ¡% ¡ 50 ¡% ¡ SQLite ¡3.3.0 ¡ 0.00064 ¡% ¡ 4 ¡% ¡ 50 ¡% ¡ 50 ¡% ¡ HawkNL ¡1.6b3 ¡ 23 ¡% ¡ 64 ¡% ¡ 50 ¡% ¡ 50 ¡% ¡ Pbzip2 ¡1.1.6 ¡ 0 ¡% ¡ 0 ¡% ¡ 0 ¡% ¡ 0 ¡% ¡ HBpd ¡2.0.65 ¡ 0 ¡% ¡ ¡ 0 ¡% ¡ 0 ¡% ¡ 0 ¡% ¡

Frac?on ¡of ¡execu?ons ¡with ¡deadlocks ¡ increased ¡up ¡to ¡three ¡orders ¡of ¡magnitude ¡

slide-18
SLIDE 18

18 ¡

Outline ¡

  • Lockout ¡architecture ¡
  • Deadlock ¡triggering ¡algorithm ¡
  • Preliminary ¡results ¡
  • Summary ¡and ¡future ¡work ¡
slide-19
SLIDE 19

Lockout ¡

  • Increases ¡deadlock ¡probability ¡
  • Leverages ¡past ¡program ¡execu?ons ¡
  • Effec?ve ¡
  • Up ¡to ¡3 ¡orders ¡of ¡magnitude ¡more ¡deadlock ¡prone ¡
  • Open ¡source: ¡ ¡
  • hKps://github.com/dslab-­‑epfl/lockout ¡ ¡

19 ¡

slide-20
SLIDE 20

Future ¡Work ¡

  • Increasing ¡effec?veness ¡with ¡low ¡overhead ¡
  • Sta?c ¡analysis ¡(data ¡races, ¡shared ¡variables) ¡
  • Lockout ¡+ ¡Automa?c ¡failure ¡fixing/avoidance ¡

(Dimmunix ¡[OSDI’08], ¡CFix ¡[OSDI’12], ¡Aviso ¡ [ASPLOS’13]) ¡

  • In ¡produc?on ¡
  • For ¡tes?ng ¡
  • Crowdsourcing ¡(Aviso ¡[ASPLOS’13], ¡RaceMob ¡

[SOSP’13]) ¡ ¡

20 ¡