Top Banner
Linux Device Drivers Sarah Sharp Dec 6, 2014
24

Linux Kernel Introduction

Jul 12, 2015

Download

Software

saharabeara
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: Linux Kernel Introduction

Linux Device Drivers

Sarah SharpDec 6, 2014

Page 2: Linux Kernel Introduction

Sarah Sharp

● USB 3.0 host controller driver author● Linux kernel developer for 9 years● Worked in Intel's Open Source

Technology Center (OTC) for 7 years● Driver maintainer for 5 years

Page 3: Linux Kernel Introduction

How did I get intoopen source?

● Didn't program until college● Portland State University● My boyfriend introduced me to

– open source, Linux, rockets

Page 4: Linux Kernel Introduction

Portland State Aerospace Society

Page 5: Linux Kernel Introduction

Rockets and Open Source

Page 6: Linux Kernel Introduction

How did I get intoLinux kernel development?

● Professor Bart Masseyintroduced me to– The local Linux kernel community

– Greg Kroah-Hartman

● Greg suggested usbfs2 project● Bart helped me get:

– College credit for kernel project

– Intel undergraduate research grant

Page 7: Linux Kernel Introduction

How did I get ajob in open source?

● Bart encouraged me to present at OSCON on usbfs2

● Kristin Accardi was onOSCON paper selection committee

● Through network(Bart → Greg → Kristen)I got a job

Page 8: Linux Kernel Introduction

Sarah Sharp: Linux kernelUSB 3.0 driver developer

● Hired by Intel in July 2007● USB 3.0 specification draft● FPGA prototypes● Driver merged in April 2009

Page 9: Linux Kernel Introduction

What is it like to be aLinux kernel developer?

● very tight-knit group, very slow turn over● 80% of kernel developers are paid● 20% are volunteers and students● all work done through mailing lists● a few IRC channels● rarely get together in person

Page 10: Linux Kernel Introduction

Linux kernel subsystems

● Many different parts of the kernel● Broken into subsystems● Each has a maintainer● Most have a mailing list● MAINTAINERS file● scripts/get_maintainer.pl

Page 11: Linux Kernel Introduction

What DoSubsystem Maintainers Do?

● Experts in their particular field● Usually 5-20 years of experience● Approve changes to their area● Often have 1-4 sub-maintainers● This is how Linux scales trust

Page 12: Linux Kernel Introduction

IntelLinux Kernel Maintainers

● ACPI - Rafael Wysocki, Zhang Rui● Bluetooth - Marcel Holtmann● NFC - Samuel Ortiz● USB 3.0 - Mathias Nyman● Intel graphics - Daniel Vetter● EFI - Matt Fleming● x86 - H. Peter Anvin, Peter Z● RAS, machine check - Tony Luck● Code ellision - Andi Kleen● NVMe - Matthew Wilcox

● IOMMU - Dave Woodhouse● Temperature - Fenghua Yu● DMA offload - Vinod Koul● Wimax - Inaky Perez-Gonzalez● Intel wifi - Johannes Berg● Intel idle - Len Brown● Intel ethernet - Jeff Kirsher, Jesse

Brandeburg, Carolyn Wyborny● Intel C600 SAS, IOAT - Dan

Williams● Serial, GMA500/600/3600, misc -

Alan Cox

Page 13: Linux Kernel Introduction

What is Being aLinux Kernel Maintainer Like?

● Hundreds of emails a day● 1:Many relationship with

contributors● Rapid development cycle● Looking at long-term health

of the project● Maintains code for 3 - 20 years● Reputation is on the line for

each patch

Page 14: Linux Kernel Introduction

“Meritocracy”

● Maintainers are vested● Developers will come and go● Long-standing contributors gain trust● Easier for them to do complex things● Harder for newcomers

Page 15: Linux Kernel Introduction

Community Trust andSocial Engineering

● Build a trust relationship with maintainers– Review patches

– Ask intelligent questions

– Submit small bug fixes

● Learn community norms– Email format

– Coding style

– Testing

Page 16: Linux Kernel Introduction

Tips forAsking Intelligent Questions

● Always Cc the maintainer● Do your research● Document where you looked● Be concise and precise● Ask a question you know the

answer to, then one you don't

Page 17: Linux Kernel Introduction

Tips forBug Reporting

● Always Cc the maintainer● System information is crucial

– What hardware?

– What kernel, what distro

– 32-bit vs 64-bit

– lspci, lsusb, acpidump

● Reproducibility thinking● Be responsive● Hold onto hardware

Page 18: Linux Kernel Introduction

Linux KernelQuality Assurance

● Regressions are not tolerated● Buggy new code is fixed or reverted● Shifting towards static analysis tools

– sparse, smatch, Coccinelle

● 0-day testing infrastructure● kselftest

Page 19: Linux Kernel Introduction

Getting into Linux kernel development

● Read the code, review other people's patches● Participate and ask questions on the mailing list● First patch tutorial

– http://kernelnewbies.org/FirstKernelPatch

● Staging cleanup patches– http://kernelnewbies.org/CheckpatchTips

● Linux kernel exercises– http://eudyptula-challenge.org/

Page 20: Linux Kernel Introduction

Leveling Up inLinux Kernel Development

● Larger patchsets● Use complex tools (sparse, Coccinelle)● Find an area you're passionate about● Look for todos, bugzilla entries● Before starting a large task:

– Always ask the maintainer

– build trust with the maintainer

Page 21: Linux Kernel Introduction

Tips for Code Review

● Keep a list of the feedback● Address ALL feedback in revisions● Track changes in your cover letter● If you disagree with a maintainer,

back yourself up with facts● Maintainers don't care about your deadline● Code must be complete and clean● Duplicate code or drivers won't be accepted

Page 22: Linux Kernel Introduction

More Linux Kernel Resources

● Linux Device Drivers book:http://lwn.net/Kernel/LDD3

● Linux Device Driver tutorial:https://github.com/gregkh/kernel-tutorial

● FOSS Outreach Program for Women (OPW)(paid open source and Linux kernel internships)http://gnome.org/opw

Page 23: Linux Kernel Introduction

Photo Attribution

● Tux: http://upload.wikimedia.org/wikipedia/commons/thumb/b/b0/NewTux.svg/400px-NewTux.svg.png

● Jamey and Sarah Sharp: https://www.flickr.com/photos/igalko/7570033604

● Sarah Sharp and PSAS photos CC BY-SA-NC Sarah Sharp

● Bart Massey: https://www.flickr.com/photos/reidab/9326868060

● OSCON sign: https://www.flickr.com/photos/kubina/912778997

● USB 3.0 host PCI card: https://www.flickr.com/photos/hades2k/9069181710

● Logitech webcam: https://www.flickr.com/photos/bshunrichs/162199777

● Greg Kroah-Hartman: https://www.flickr.com/photos/tian2992/6208491794

● David Brownell: https://www.flickr.com/photos/13825348@N03/sets/72157608741347102/detail/

Page 24: Linux Kernel Introduction

Photo Attribution

● Computer guts: https://www.flickr.com/photos/orijinal/4832982682

● Kernel Summit: https://www.flickr.com/photos/linuxfoundation/2987611750

● Mail: https://www.flickr.com/photos/donebythehandsofabrokenartist/15027178189

● Nerd merit badge: https://www.flickr.com/photos/momentum/4203541703

● Trust: https://www.flickr.com/photos/dobs/10726756606

● Question: https://www.flickr.com/photos/marcobellucci/3534516458

● Bug: https://www.flickr.com/photos/103499652@N04/14232715868

● Quality: https://www.flickr.com/photos/dieselbug2007/414348333

● Editing: https://www.flickr.com/photos/nics_events/2349631515