Top Banner
Recovering Device Drivers Mike Swift, Muthu Annamalai, Brian Bershad, Hank Levy University of Washington
38

Recovering Device Drivers · Shadow Driver Overview! Shadow drivers hide driver failures from applications and the OS! Generic service infrastructure! Leverages existing driver/kernel

May 26, 2020

Download

Documents

dariahiddleston
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: Recovering Device Drivers · Shadow Driver Overview! Shadow drivers hide driver failures from applications and the OS! Generic service infrastructure! Leverages existing driver/kernel

Recovering DeviceDrivers

Mike Swift, Muthu Annamalai,Brian Bershad, Hank Levy

University of Washington

Page 2: Recovering Device Drivers · Shadow Driver Overview! Shadow drivers hide driver failures from applications and the OS! Generic service infrastructure! Leverages existing driver/kernel

Device Drivers Cause Crashes

! Device drivers are the most commoncause of system crashes! 85% of Windows XP crashes caused by

drivers

! Linux drivers 7x buggier than other kernelcode

! System reliability will not improve until wefix the driver problem

Page 3: Recovering Device Drivers · Shadow Driver Overview! Shadow drivers hide driver failures from applications and the OS! Generic service infrastructure! Leverages existing driver/kernel

Driver Crashes

Kernel

Driver

ApplicationApplication

Page 4: Recovering Device Drivers · Shadow Driver Overview! Shadow drivers hide driver failures from applications and the OS! Generic service infrastructure! Leverages existing driver/kernel

Kernel

Driver

SOSP 2003: Isolating Drivers

ApplicationApplication

Restarting failed drivers prevents system crashesby reinitializing driver & kernel data structures

Driver

Page 5: Recovering Device Drivers · Shadow Driver Overview! Shadow drivers hide driver failures from applications and the OS! Generic service infrastructure! Leverages existing driver/kernel

SOSP 2003: Isolating Drivers

Kernel

Application

Driver

Application

Restarting does not prevent application crashes! Loses application state in driver

! Exposes application to errors during restart

Page 6: Recovering Device Drivers · Shadow Driver Overview! Shadow drivers hide driver failures from applications and the OS! Generic service infrastructure! Leverages existing driver/kernel

Preventing Application Crashes

1. Rewrite driver to recover itself

Page 7: Recovering Device Drivers · Shadow Driver Overview! Shadow drivers hide driver failures from applications and the OS! Generic service infrastructure! Leverages existing driver/kernel

Preventing Application Crashes

1. Rewrite driver to recover itself

2. Rewrite applications to handle driverfailures

Page 8: Recovering Device Drivers · Shadow Driver Overview! Shadow drivers hide driver failures from applications and the OS! Generic service infrastructure! Leverages existing driver/kernel

Preventing Application Crashes

1. Rewrite driver to recover itself

2. Rewrite applications to handle driverfailures

3. Conceal driver failures with a genericrecovery service

Page 9: Recovering Device Drivers · Shadow Driver Overview! Shadow drivers hide driver failures from applications and the OS! Generic service infrastructure! Leverages existing driver/kernel

Generalizations About Drivers

1. Rebooting fixes failures

! Focus on transient errors

Page 10: Recovering Device Drivers · Shadow Driver Overview! Shadow drivers hide driver failures from applications and the OS! Generic service infrastructure! Leverages existing driver/kernel

Generalizations About Drivers

1. Rebooting fixes failures

! Focus on transient errors

2. They can be made to fail cleanly

! Recover by restarting driver

Page 11: Recovering Device Drivers · Shadow Driver Overview! Shadow drivers hide driver failures from applications and the OS! Generic service infrastructure! Leverages existing driver/kernel

Generalizations About Drivers

1. Rebooting fixes failures

! Focus on transient errors

2. They can be made to fail cleanly

! Recover by restarting driver

3. Small # of common interfaces

! Leverage well-known behavior withoutknowledge of implementation

Page 12: Recovering Device Drivers · Shadow Driver Overview! Shadow drivers hide driver failures from applications and the OS! Generic service infrastructure! Leverages existing driver/kernel

Outline

! Introduction

! The Shadow Driver System

! Overview

! Components

! Evaluation

! Conclusion

Page 13: Recovering Device Drivers · Shadow Driver Overview! Shadow drivers hide driver failures from applications and the OS! Generic service infrastructure! Leverages existing driver/kernel

Shadow Driver Overview

! Shadow drivers hide driver failures fromapplications and the OS

! Generic service infrastructure

! Leverages existing driver/kernel interface

! One shadow driver handles recovery for an entireclass of device drivers

Page 14: Recovering Device Drivers · Shadow Driver Overview! Shadow drivers hide driver failures from applications and the OS! Generic service infrastructure! Leverages existing driver/kernel

Shadow Driver Overview

! Shadow drivers hide driver failures fromapplications and the OS

! Generic service infrastructure

! Leverages existing driver/kernel interface

! One shadow driver handles recovery for an entireclass of device drivers

! What shadow drivers do:

! Prepare

! Recover

! Conceal

Page 15: Recovering Device Drivers · Shadow Driver Overview! Shadow drivers hide driver failures from applications and the OS! Generic service infrastructure! Leverages existing driver/kernel

Today’s Systems

Kernel

Device Driver

write(…

)

registe

r(…)

Page 16: Recovering Device Drivers · Shadow Driver Overview! Shadow drivers hide driver failures from applications and the OS! Generic service infrastructure! Leverages existing driver/kernel

writ

e(…)

write(…)

Shadowing a Working Driver

Kernel

Device Driver

Tap

ShadowDriver

write(…)

Page 17: Recovering Device Drivers · Shadow Driver Overview! Shadow drivers hide driver failures from applications and the OS! Generic service infrastructure! Leverages existing driver/kernel

Shadowing a Working Driver

Kernel

Device Driver

ShadowDriver

done

(…)

done(…)

done(…)

Tap

Page 18: Recovering Device Drivers · Shadow Driver Overview! Shadow drivers hide driver failures from applications and the OS! Generic service infrastructure! Leverages existing driver/kernel

Tap

Spoofing a Failed Driver

Kernel

Device Driver

ShadowDriver

Tapwrite(…

)

write(…)

Page 19: Recovering Device Drivers · Shadow Driver Overview! Shadow drivers hide driver failures from applications and the OS! Generic service infrastructure! Leverages existing driver/kernel

Device DriverDevice Driver

Recovering a Failed Driver

Kernel

ShadowDriver

TapTapTap

register

(…)

register(…)

Page 20: Recovering Device Drivers · Shadow Driver Overview! Shadow drivers hide driver failures from applications and the OS! Generic service infrastructure! Leverages existing driver/kernel

What Shadow Drivers Do

! Prepare:

! Monitor kernel-driver communication

! Recover:

! Restart driver after failure

! Conceal:

! Act as driver during recovery

Page 21: Recovering Device Drivers · Shadow Driver Overview! Shadow drivers hide driver failures from applications and the OS! Generic service infrastructure! Leverages existing driver/kernel

Preparing for Recovery

! Monitor kernel-driver communication tocapture relevant state

! Configuration operations

! Active connections

! Outstanding requests

Page 22: Recovering Device Drivers · Shadow Driver Overview! Shadow drivers hide driver failures from applications and the OS! Generic service infrastructure! Leverages existing driver/kernel

Recovering Driver

1. Reset driver

2. Repeat driver initialization calls

3. Transfer in state! Reopen active connections

! Replay configuration requests from log

! Resubmit active requests

Page 23: Recovering Device Drivers · Shadow Driver Overview! Shadow drivers hide driver failures from applications and the OS! Generic service infrastructure! Leverages existing driver/kernel

Recovering Driver

1. Reset driver

2. Repeat driver initialization calls

3. Transfer in state! Reopen active connections

! Replay configuration requests from log

! Resubmit active requests

" Shadow responds to driver’s kernel requests" Hide restart from kernel and driver

" Supply driver with existing resources

Page 24: Recovering Device Drivers · Shadow Driver Overview! Shadow drivers hide driver failures from applications and the OS! Generic service infrastructure! Leverages existing driver/kernel

Concealing Failure

! Shadow acts as driver! Applications and OS unaware that driver failed

! No device control

! General Strategies:1. Answer request from log

2. Act busy

3. Block caller

4. Queue request

5. Drop request

Page 25: Recovering Device Drivers · Shadow Driver Overview! Shadow drivers hide driver failures from applications and the OS! Generic service infrastructure! Leverages existing driver/kernel

Implementation

! Implemented in Linux 2.4.18 kernel

! Uses Nooks driver fault isolation system

! Supports three driver classes:

! Sound card

! Network interface card

! IDE storage

Page 26: Recovering Device Drivers · Shadow Driver Overview! Shadow drivers hide driver failures from applications and the OS! Generic service infrastructure! Leverages existing driver/kernel

Outline

! Introduction

! Shadow Driver System

! Evaluation

! Can shadow drivers conceal failure?

! At what cost?

! Performance

! Complexity

! Conclusion

Page 27: Recovering Device Drivers · Shadow Driver Overview! Shadow drivers hide driver failures from applications and the OS! Generic service infrastructure! Leverages existing driver/kernel

Drivers Tested

ide-disk, ide-cdIDE Storage

Intel Pro/1000 Gigabit Ethernet,Intel Pro/100 10/100, 3Com3c59x 10/100, AMD PCnet32,SMC Etherpower 100

Network

SoundBlaster Audigy,Soundblaster Live!, Intel 810Audio, Ensoniq 1371, CrystalSound 4232

Sound

DriversClass

Page 28: Recovering Device Drivers · Shadow Driver Overview! Shadow drivers hide driver failures from applications and the OS! Generic service infrastructure! Leverages existing driver/kernel

Evaluation

! Testing Methodology! Add bugs to driver

! Port real bugs

! Inject synthetic bugs

! Run application using driver

! Platforms:! Native: standard 2.4.18 kernel

! Shadow: fault isolation + shadow drivers

Page 29: Recovering Device Drivers · Shadow Driver Overview! Shadow drivers hide driver failures from applications and the OS! Generic service infrastructure! Leverages existing driver/kernel

Possible Outcomes

XX

X

!

Total system crash

Application crashed

Everything kept working

Page 30: Recovering Device Drivers · Shadow Driver Overview! Shadow drivers hide driver failures from applications and the OS! Generic service infrastructure! Leverages existing driver/kernel

!

!

!

!

!

!

!

!

!

!

XX

XX

XX

XX

XX

XX

XX

XX

XX

XX

Database

Encoder

Compiler

Packet Sniffer

Remote Window

Remote Copy

Game

Speech Synth.

Audio Recorder

Mp3 Player

ShadowNativeApp.

Sound

Network

Storage

XX

XX

XX

X

!

!

X

!

X

X

SOSP

Page 31: Recovering Device Drivers · Shadow Driver Overview! Shadow drivers hide driver failures from applications and the OS! Generic service infrastructure! Leverages existing driver/kernel

Large-Scale Fault Injection

0

20

40

60

80

100

Mp3

Player

Audio

Recorder

Remote

Copy

Sniffer Compiler Database

Perc

ent

of

Failu

res

Recovered

Sound Net Storage

Page 32: Recovering Device Drivers · Shadow Driver Overview! Shadow drivers hide driver failures from applications and the OS! Generic service infrastructure! Leverages existing driver/kernel

Large-Scale Fault Injection

0

20

40

60

80

100

Mp3

Player

Audio

Recorder

Remote

Copy

Sniffer Compiler Database

Perc

ent

of

Failu

res

Automatic Detection Manual Detection

Sound Net Storage

Page 33: Recovering Device Drivers · Shadow Driver Overview! Shadow drivers hide driver failures from applications and the OS! Generic service infrastructure! Leverages existing driver/kernel

Large-Scale Fault Injection

0

20

40

60

80

100

Mp3

Player

Audio

Recorder

Remote

Copy

Sniffer Compiler Database

Perc

ent

of

Failu

res

Automatic Detection Manual Detection

Failed Recovery

Sound Net Storage

Page 34: Recovering Device Drivers · Shadow Driver Overview! Shadow drivers hide driver failures from applications and the OS! Generic service infrastructure! Leverages existing driver/kernel

0

20

40

60

80

100

Mp3

Player

Audio

Recorder

Network

Send

Network

Receive

Compiler Database

Rel

ativ

e Per

form

ance

(%

)

Native Shadow

Relative Performance

Sound Net Storage

Page 35: Recovering Device Drivers · Shadow Driver Overview! Shadow drivers hide driver failures from applications and the OS! Generic service infrastructure! Leverages existing driver/kernel

0

20

40

60

80

100

Mp3

Player

Audio

Recorder

Network

Send

Network

Receive

Compiler Database

Rel

ativ

e Per

form

ance

(%

)

Native Shadow

Relative Performance

Sound Net Storage

Page 36: Recovering Device Drivers · Shadow Driver Overview! Shadow drivers hide driver failures from applications and the OS! Generic service infrastructure! Leverages existing driver/kernel

5,358

13,577

7,381

1 Device

Driver

L.O.C.

321

198

666

Shadow

Driver

L.O.C.

Storage

Network

Sound

Driver

Class

29,0008

264,500190

118,98148

All Drivers

L.O.C.

All Drivers

Count

Complexity

! Shadow Drivers: 3300 lines

! Nooks Fault Isolation: 23,000 lines

! Linux Kernel: 2.7 million lines

Page 37: Recovering Device Drivers · Shadow Driver Overview! Shadow drivers hide driver failures from applications and the OS! Generic service infrastructure! Leverages existing driver/kernel

Conclusion

! Shadow drivers protect applications fromdriver failures

! Shadow drivers leverage existing driverinterfaces for recovery

! Shadow drivers prevented 98% of applicationfailures in testing

! Shadow drivers have low cost

Page 38: Recovering Device Drivers · Shadow Driver Overview! Shadow drivers hide driver failures from applications and the OS! Generic service infrastructure! Leverages existing driver/kernel

Want More Information?

[email protected]

orinvite me for an interview