Presentation is loading. Please wait.

Presentation is loading. Please wait.

Microdrivers A New Architecture for Device Drivers Vinod GanapathyArini Balakrishnan Michael SwiftSomesh Jha HotOS XI, 8 th May 2007 Computer Sciences.

Similar presentations


Presentation on theme: "Microdrivers A New Architecture for Device Drivers Vinod GanapathyArini Balakrishnan Michael SwiftSomesh Jha HotOS XI, 8 th May 2007 Computer Sciences."— Presentation transcript:

1 Microdrivers A New Architecture for Device Drivers Vinod GanapathyArini Balakrishnan Michael SwiftSomesh Jha HotOS XI, 8 th May 2007 Computer Sciences Department University of Wisconsin-Madison

2 HotOS XIMicrodrivers: A New Architecture for Device Drivers2 Introduction Device drivers account for a large fraction of kernel code Over 70% in Linux [Chou et al., 2001] Buggy device drivers are a major source of reliability problems Account for over 85% of Windows XP crashes [Orgovan and Tricker, 2003]

3 HotOS XIMicrodrivers: A New Architecture for Device Drivers3 Challenging to write and debug Writing a device driver Must handle asynchronous events Must obey kernel programming rules Debugging a device driver Non-reproducible failures Fewer advanced development tools Many drivers written by non-kernel experts Device drivers are hard to get right

4 HotOS XIMicrodrivers: A New Architecture for Device Drivers4 Macrokernels Kernel Driver Device Driver Device Applications Poor fault isolation

5 HotOS XIMicrodrivers: A New Architecture for Device Drivers5 Kernel User-space device drivers Driver Device Driver Runtime Device Applications

6 HotOS XIMicrodrivers: A New Architecture for Device Drivers6 But… Limited by existing kernel/driver interface [Van Maren, 1999] Written expecting local procedure calls New interfaces (e.g., new system calls) New device drivers [Chubb 2004, Leslie et al., 2005] Poor performance Incompatible with commodity OS

7 HotOS XIMicrodrivers: A New Architecture for Device Drivers7 Kernel Best of both worlds: Microdrivers Applications Kerndriver Device Userdriver Runtime Split device driver functionality Microdriver Performance-critical functionality Startup, shutdown, device configuration Common case Rare case

8 HotOS XIMicrodrivers: A New Architecture for Device Drivers8 How to produce a microdriver? Userdriver Runtime Use program analysis & transformation Traditional device driver Splitter and Code generator Kerndriver Runtime

9 HotOS XIMicrodrivers: A New Architecture for Device Drivers9 How big is the kernel driver? Studied 455 drivers from Linux-2.6.18 Identified critical functions Interrupt handlers Tasklets, bottom-halves Supply/receive data to/from the device Plus the functions that they transitively call Analysis is automatic Uses the call-graph of the device driver

10 HotOS XIMicrodrivers: A New Architecture for Device Drivers10 e100_xmit_frame e100_exec_cmd

11 HotOS XIMicrodrivers: A New Architecture for Device Drivers11 e100_xmit_frame e100_exec_cmd

12 HotOS XIMicrodrivers: A New Architecture for Device Drivers12 e100_xmit_frame e100_exec_cmd

13 HotOS XIMicrodrivers: A New Architecture for Device Drivers13 In-kernel driver code is reduced

14 HotOS XIMicrodrivers: A New Architecture for Device Drivers14 Mechanics

15 HotOS XIMicrodrivers: A New Architecture for Device Drivers15 Kernel Architecture of a microdriver Applications Device Userdriver Runtime Responsibilities Communication Object tracking Recovery Kerndriver Runtime

16 HotOS XIMicrodrivers: A New Architecture for Device Drivers16 Communication Mechanisms for control and data transfer Control transfer: LRPC [Bershad et al., 1990], Nooks XPC [Swift et al., 2003] Stubs in kerndriver for userdriver functions Upcall and downcall mechanism Data transfer: Copy function arguments Copy shared data structures Synchronization done by object tracker

17 HotOS XIMicrodrivers: A New Architecture for Device Drivers17 UserdriverKerndriver Object tracking 0x1280x512 0x1960x248 0x1280x1960x202 Upcall 0x512 0x248 0x296 0x2020x296 Synchronize shared data structures

18 HotOS XIMicrodrivers: A New Architecture for Device Drivers18 Object tracking: Key challenges Challenging cases Locks Device memory and registers DMA memory Solution Userdriver must synchronize and update version seen by the kerndriver Memory objects with special semantics

19 HotOS XIMicrodrivers: A New Architecture for Device Drivers19 Recovery Detect and recover from failed userdriver Ideally transparent to applications Detection done at interface Parameter checks and timeouts Recovery – compatible with prior work Shadow driver mechanism [Swift et al., 2004] SafeDrive recovery mechanism [Zhou et al., 2006]

20 HotOS XIMicrodrivers: A New Architecture for Device Drivers20 Benefits

21 HotOS XIMicrodrivers: A New Architecture for Device Drivers21 Kernel Improved fault isolation Applications Device Userdriver Runtime Fewer lines of in-kernel driver code Kerndriver Runtime

22 HotOS XIMicrodrivers: A New Architecture for Device Drivers22 Kernel Good common-case performance Applications Device Userdriver Runtime User/kernel crosses are infrequent Performance-critical functionality Kerndriver Runtime

23 HotOS XIMicrodrivers: A New Architecture for Device Drivers23 Kernel Compatibility with commodity OS Applications Device Userdriver Runtime Kernel/driver interface is unchanged Kerndriver Runtime

24 HotOS XIMicrodrivers: A New Architecture for Device Drivers24 Kernel Compatibility with commodity OS Applications Device Userdriver Runtime Can coexist with traditional drivers Device Driver Kerndriver Runtime

25 HotOS XIMicrodrivers: A New Architecture for Device Drivers25 Kernel Ease of driver development Applications Device Userdriver Runtime More tools available for driver development gdb,gprof, valgrind,… Kerndriver Runtime

26 HotOS XIMicrodrivers: A New Architecture for Device Drivers26 Pragmatics

27 HotOS XIMicrodrivers: A New Architecture for Device Drivers27 Generating a microdriver Userdriver Runtime Traditional device driver Splitter Traditional device driver Code generator Marshaling annotations Kern User Kerndriver Runtime

28 HotOS XIMicrodrivers: A New Architecture for Device Drivers28 Marshaling annotations char *nullterm string; struct net_device *list next; struct pcnet32_rx_head *array(rx_ringsize) rx_ring; Program analysis algorithms to infer need for annotations Need to serialize complex data structures

29 HotOS XIMicrodrivers: A New Architecture for Device Drivers29 Performance of a microdriver e1000 device driver from Linux-2.6.18 Intel PRO/1000 gigabit network adapter Methodology Split into kerndriver and userdriver Ran both halves in the kernel Used delays to simulate user/kernel crosses Infrastructure is still in construction! Testbed Dual-core 3Ghz Pentium-D machine.

30 HotOS XIMicrodrivers: A New Architecture for Device Drivers30 TCP-send performance 60 million machine cycles 26% rise 6.8% drop Relative performance Delay to simulate cost of user/kernel crossing (in microseconds)

31 HotOS XIMicrodrivers: A New Architecture for Device Drivers31 Open questions Will microdrivers improve system reliability in practice? Where are most of the bugs – in the kerndriver or in the userdriver? Will the transition to microdrivers expose otherwise latent bugs in device drivers?

32 HotOS XIMicrodrivers: A New Architecture for Device Drivers32 Microdrivers … … improve fault isolation … have good common-case performance … are compatible with commodity OSes … reduce the amount of code in the kernel … permit the use of user-mode tools for driver development … can be generated largely automatically from existing drivers

33 Vinod Ganapathy vg@cs.wisc.edu Arini Balakrishnan arinib@cs.wisc.edu Michael Swift swift@cs.wisc.edu Somesh Jha jha@cs.wisc.edu Microdrivers A New Architecture for Device Drivers Computer Sciences Department University of Wisconsin-Madison

34 HotOS XIMicrodrivers: A New Architecture for Device Drivers34 Supplementary Material

35 HotOS XIMicrodrivers: A New Architecture for Device Drivers35 UserdriverKerndriver Object tracking 0x1280x512 0x1960x248 0x1280x1960x202 Upcall 0x512 0x248 0x296 0x2020x296 Synchronize shared data structures

36 HotOS XIMicrodrivers: A New Architecture for Device Drivers36 The splitter Goal: Split the driver at function granularity Inputs: (1) Driver source code; (2) Hints specific to driver family irqreturn_t (int, void*, struct pt_regs*) int (struct sk_buff*, struct net_device*) Algorithm: Static call-graph based Identify and mark functions that match hints Mark functions called by these functions

37 HotOS XIMicrodrivers: A New Architecture for Device Drivers37 The code generator Goal: Generate code for the kerndriver, the userdriver, and the runtime library Input: (1) Splitter output; (2) Marshaling annotations char *nullterm string; struct net_device *list next; struct pcnet32_rx_head *array(rx_ringsize) rx_ring; Program analysis algorithms to infer need for annotations

38 HotOS XIMicrodrivers: A New Architecture for Device Drivers38 Related work Hardware-based isolation schemes Nooks [Swift et al., 2003], Using virtual machines [LeVasseur et al., 2004], Microkernel OSes Language-based isolation SafeDrive [Zhou et al., 2006], XFI [Erlingsson et al., 2006] User-space driver frameworks Fluke [Van Maren, 1999], FUSD [Elson, 2004] Automatic program partitioning Privtrans [Brumley and Song, 2004], Jif/Split [Zdancewic et al., 2001], Coign [Hunt and Scott, 1999]


Download ppt "Microdrivers A New Architecture for Device Drivers Vinod GanapathyArini Balakrishnan Michael SwiftSomesh Jha HotOS XI, 8 th May 2007 Computer Sciences."

Similar presentations


Ads by Google