part 4: mechanicslwn.net › images › pdf › google-class › 04-mechanics.pdf · linus's...

94
Part 4: Mechanics (aka A Patch's Progress) Jonathan Corbet LWN.net [email protected]

Upload: others

Post on 06-Jul-2020

1 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Part 4: Mechanicslwn.net › images › pdf › google-class › 04-mechanics.pdf · Linus's inbox -> BitKeeper -> git The process became more disciplined. How it works now 1 Initial

Part 4: Mechanics

(aka A Patch's Progress)

Jonathan CorbetLWN.net

[email protected]

Page 2: Part 4: Mechanicslwn.net › images › pdf › google-class › 04-mechanics.pdf · Linus's inbox -> BitKeeper -> git The process became more disciplined. How it works now 1 Initial

How patches get into the kernel

...a discussion of the process by which kernel decisions are made.

Page 3: Part 4: Mechanicslwn.net › images › pdf › google-class › 04-mechanics.pdf · Linus's inbox -> BitKeeper -> git The process became more disciplined. How it works now 1 Initial

Once upon a time

The process worked like this:1 Write a patch2 Email it to Linus3 Wait for a development kernel release4 Look for your patch in the code

Page 4: Part 4: Mechanicslwn.net › images › pdf › google-class › 04-mechanics.pdf · Linus's inbox -> BitKeeper -> git The process became more disciplined. How it works now 1 Initial

Once upon a time

The process worked like this:1 Write a patch2 Email it to Linus3 Wait for a development kernel release4 Look for your patch in the code5 Goto 2

Page 5: Part 4: Mechanicslwn.net › images › pdf › google-class › 04-mechanics.pdf · Linus's inbox -> BitKeeper -> git The process became more disciplined. How it works now 1 Initial

A few minor difficulties...

Developer frustrationLinus burnout episodesDropped patchesUnpredictable releases

Page 6: Part 4: Mechanicslwn.net › images › pdf › google-class › 04-mechanics.pdf · Linus's inbox -> BitKeeper -> git The process became more disciplined. How it works now 1 Initial

Over time...

“Lieutenants” started herding patches-ac tree

The tools got betterLinus's inbox -> BitKeeper -> git

The process became more disciplined

Page 7: Part 4: Mechanicslwn.net › images › pdf › google-class › 04-mechanics.pdf · Linus's inbox -> BitKeeper -> git The process became more disciplined. How it works now 1 Initial

How it works now

1 Initial idea and discussion2 Implementation / first post3 Review and revision4 Entry into subsystem tree/linux-next5 Merging into mainline6 Stable release7 Distribution releases

(With frequent “goto 3” steps)

Page 8: Part 4: Mechanicslwn.net › images › pdf › google-class › 04-mechanics.pdf · Linus's inbox -> BitKeeper -> git The process became more disciplined. How it works now 1 Initial

Many bad experiences and failures result from a lack of understanding this process (or willingness to work with it).

Page 9: Part 4: Mechanicslwn.net › images › pdf › google-class › 04-mechanics.pdf · Linus's inbox -> BitKeeper -> git The process became more disciplined. How it works now 1 Initial

1: The initial idea

No code yet

Tell people what you have in mindBut don't be surprised if you hear little back.

Page 10: Part 4: Mechanicslwn.net › images › pdf › google-class › 04-mechanics.pdf · Linus's inbox -> BitKeeper -> git The process became more disciplined. How it works now 1 Initial

What if it's secret?

Does it have to be secret?

Do you have community experience in house?

Ask them about it

Consider bringing in a consultant

Page 11: Part 4: Mechanicslwn.net › images › pdf › google-class › 04-mechanics.pdf · Linus's inbox -> BitKeeper -> git The process became more disciplined. How it works now 1 Initial

Example: the vmxnet3 “Network Plugin Architecture”

Page 12: Part 4: Mechanicslwn.net › images › pdf › google-class › 04-mechanics.pdf · Linus's inbox -> BitKeeper -> git The process became more disciplined. How it works now 1 Initial

2: Implementation / first post

We will get to some implementation hints later.

Page 13: Part 4: Mechanicslwn.net › images › pdf › google-class › 04-mechanics.pdf · Linus's inbox -> BitKeeper -> git The process became more disciplined. How it works now 1 Initial

Post early

Do not wait until it's “done.”

Page 14: Part 4: Mechanicslwn.net › images › pdf › google-class › 04-mechanics.pdf · Linus's inbox -> BitKeeper -> git The process became more disciplined. How it works now 1 Initial

Patch organization

Work should be broken into small, reviewable pieces

One logical change in each

Page 15: Part 4: Mechanicslwn.net › images › pdf › google-class › 04-mechanics.pdf · Linus's inbox -> BitKeeper -> git The process became more disciplined. How it works now 1 Initial

“Logical change”

What's a logical changeFix a bugImprove coding styleAdd a driverChange an API and its users...

Page 16: Part 4: Mechanicslwn.net › images › pdf › google-class › 04-mechanics.pdf · Linus's inbox -> BitKeeper -> git The process became more disciplined. How it works now 1 Initial

“Logical change”

What's not a logical change?Your current CMS history

Page 17: Part 4: Mechanicslwn.net › images › pdf › google-class › 04-mechanics.pdf · Linus's inbox -> BitKeeper -> git The process became more disciplined. How it works now 1 Initial

Yes...

...that means you need to go through your changes and make an entirely new patch series from them.

Page 18: Part 4: Mechanicslwn.net › images › pdf › google-class › 04-mechanics.pdf · Linus's inbox -> BitKeeper -> git The process became more disciplined. How it works now 1 Initial

While you are at it

The kernel must build and run after each step in the series.

i.e. “maintain bisectability”

Page 19: Part 4: Mechanicslwn.net › images › pdf › google-class › 04-mechanics.pdf · Linus's inbox -> BitKeeper -> git The process became more disciplined. How it works now 1 Initial

Don't overdo it

Lots of trivial tweaks can be combined into one patch.

Page 20: Part 4: Mechanicslwn.net › images › pdf › google-class › 04-mechanics.pdf · Linus's inbox -> BitKeeper -> git The process became more disciplined. How it works now 1 Initial

Changelogs

Changelog patches properly...or Andrew Morton will grump at you

Requirements:One-line descriptionDetailed descriptionSignoff and tags

Page 21: Part 4: Mechanicslwn.net › images › pdf › google-class › 04-mechanics.pdf · Linus's inbox -> BitKeeper -> git The process became more disciplined. How it works now 1 Initial

viafb: Add the viafb video capture driver Add a driver for the video capture port on VIA integrated chipsets. This version has a remaining OLPCism or two and expects to be talking to an ov7670; those can be improved as the need arises. This work was supported by the One Laptop Per Child project. Acked-by: Mauro Carvalho Chehab <[email protected]>Signed-off-by: Jonathan Corbet <[email protected]>

Page 22: Part 4: Mechanicslwn.net › images › pdf › google-class › 04-mechanics.pdf · Linus's inbox -> BitKeeper -> git The process became more disciplined. How it works now 1 Initial

Single-line description

Subsys: what the patch does

Often people will see only this line; it should be enough to know what is going on.

Page 23: Part 4: Mechanicslwn.net › images › pdf › google-class › 04-mechanics.pdf · Linus's inbox -> BitKeeper -> git The process became more disciplined. How it works now 1 Initial

The full description

What does the patch do?How does it do it?Why does it do it?How do we know it works?

Page 24: Part 4: Mechanicslwn.net › images › pdf › google-class › 04-mechanics.pdf · Linus's inbox -> BitKeeper -> git The process became more disciplined. How it works now 1 Initial

Full description

Performance change?Include the benchmarks

Bug fix?Include messages if applicableBug number(s)Original commit ID+title for regressions

User-space ABI changes?Note and document them

Page 25: Part 4: Mechanicslwn.net › images › pdf › google-class › 04-mechanics.pdf · Linus's inbox -> BitKeeper -> git The process became more disciplined. How it works now 1 Initial

The signoff

Signed-off-by: is your declaration that the patch can be merged into the kernel.

Page 26: Part 4: Mechanicslwn.net › images › pdf › google-class › 04-mechanics.pdf · Linus's inbox -> BitKeeper -> git The process became more disciplined. How it works now 1 Initial

Signed-off-by

Developer's Certificate of Origin 1.1

By making a contribution to this project, I certify that:

(a) The contribution was created in whole or in part by me and I have the right to submit it under the open source license indicated in the file; or

(b) The contribution is based upon previous work that, to the best of my knowledge, is covered under an appropriate open source license and I have the right under that license to submit that work with modifications, whether created in whole or in part by me, under the same open source license (unless I am permitted to submit under a different license), as indicated in the file; or

Page 27: Part 4: Mechanicslwn.net › images › pdf › google-class › 04-mechanics.pdf · Linus's inbox -> BitKeeper -> git The process became more disciplined. How it works now 1 Initial

DCO part 2

(c) The contribution was provided directly to me by some other person who certified (a), (b) or (c) and I have not modified it.

(d) I understand and agree that this project and the contribution are public and that a record of the contribution (including all personal information I submit with it, including my sign-off) is maintained indefinitely and may be redistributed consistent with this project or the open source license(s) involved.

Page 28: Part 4: Mechanicslwn.net › images › pdf › google-class › 04-mechanics.pdf · Linus's inbox -> BitKeeper -> git The process became more disciplined. How it works now 1 Initial

Patches will not be merged without an appropriate signoff.

Page 29: Part 4: Mechanicslwn.net › images › pdf › google-class › 04-mechanics.pdf · Linus's inbox -> BitKeeper -> git The process became more disciplined. How it works now 1 Initial

Anonymous patches

...are not accepted

Signed-off-by: must be a real name...or at least look like a real name

Page 30: Part 4: Mechanicslwn.net › images › pdf › google-class › 04-mechanics.pdf · Linus's inbox -> BitKeeper -> git The process became more disciplined. How it works now 1 Initial

Other tags

Cc:

The named developer was copied on a patch posting.

Acked-by:

The named developer agrees to the merging of this patch.

Page 31: Part 4: Mechanicslwn.net › images › pdf › google-class › 04-mechanics.pdf · Linus's inbox -> BitKeeper -> git The process became more disciplined. How it works now 1 Initial

Other tags

Reviewed-by:

The named developer has reviewed the patch and found it suitable for merging.

Reported-by:Tested-by:

Give credit to those who report bugs and test patches.

Page 32: Part 4: Mechanicslwn.net › images › pdf › google-class › 04-mechanics.pdf · Linus's inbox -> BitKeeper -> git The process became more disciplined. How it works now 1 Initial

Intro post

In front of a multi-patch series

What is the point of the series as a whole?

Include shortlog, diffstat output

The intro does not go into the commit history.

Page 33: Part 4: Mechanicslwn.net › images › pdf › google-class › 04-mechanics.pdf · Linus's inbox -> BitKeeper -> git The process became more disciplined. How it works now 1 Initial

Send the set to the right places

Patches posted as replies to the intro

“git send-email” works nicely

Page 34: Part 4: Mechanicslwn.net › images › pdf › google-class › 04-mechanics.pdf · Linus's inbox -> BitKeeper -> git The process became more disciplined. How it works now 1 Initial
Page 35: Part 4: Mechanicslwn.net › images › pdf › google-class › 04-mechanics.pdf · Linus's inbox -> BitKeeper -> git The process became more disciplined. How it works now 1 Initial

Who to send to?

Anybody who may have an interestThe subsystem maintainer(s)Others who have worked in the areaPeople who have offered comments...

General rule of thumb: be inclusive

Page 36: Part 4: Mechanicslwn.net › images › pdf › google-class › 04-mechanics.pdf · Linus's inbox -> BitKeeper -> git The process became more disciplined. How it works now 1 Initial

Finding maintainers

Where to look:The MAINTAINERS fileComments in the codeThe git history

Useful tool:scripts/get_maintainer.pl

Page 37: Part 4: Mechanicslwn.net › images › pdf › google-class › 04-mechanics.pdf · Linus's inbox -> BitKeeper -> git The process became more disciplined. How it works now 1 Initial

Finally...

Send to your self firstMake sure the result still appliesMozilla, gmail tend to be problematic

Send patches inlineNot as attachments

Page 38: Part 4: Mechanicslwn.net › images › pdf › google-class › 04-mechanics.pdf · Linus's inbox -> BitKeeper -> git The process became more disciplined. How it works now 1 Initial

3: Review and revision

Where patches are made ready for merging...also where things often go wrong

Page 39: Part 4: Mechanicslwn.net › images › pdf › google-class › 04-mechanics.pdf · Linus's inbox -> BitKeeper -> git The process became more disciplined. How it works now 1 Initial

The review process

People will ask for changesNo code is ever perfectIt's human nature to find something

You must be able to make changesInternal processes should reflect this

Page 40: Part 4: Mechanicslwn.net › images › pdf › google-class › 04-mechanics.pdf · Linus's inbox -> BitKeeper -> git The process became more disciplined. How it works now 1 Initial

Reviewers

Are in short supplyDo a thankless jobCan be grumpyMay seem obstructive

Are trying to keep Linux vital and strong.

Page 41: Part 4: Mechanicslwn.net › images › pdf › google-class › 04-mechanics.pdf · Linus's inbox -> BitKeeper -> git The process became more disciplined. How it works now 1 Initial

Dealing with reviewers

Thank them!

Respond to their comments“Thanks, I'll fix that”Or: why you think it is correct now

Actually fix things that need fixing

Page 42: Part 4: Mechanicslwn.net › images › pdf › google-class › 04-mechanics.pdf · Linus's inbox -> BitKeeper -> git The process became more disciplined. How it works now 1 Initial

When responding

Try not to get grumpy in return

Do not question their motives

Do not ignore criticisms

Page 43: Part 4: Mechanicslwn.net › images › pdf › google-class › 04-mechanics.pdf · Linus's inbox -> BitKeeper -> git The process became more disciplined. How it works now 1 Initial

For example, don't do this:

“This is just a Red Hat bureaucratic excuse to delay reiserfs.”

-- Hans Reiser, June, 2000

Page 44: Part 4: Mechanicslwn.net › images › pdf › google-class › 04-mechanics.pdf · Linus's inbox -> BitKeeper -> git The process became more disciplined. How it works now 1 Initial

When reposting patches

Cc reviewers who have commented

Say what you did“All review comments have been addressed” - if it's true

Mention anything else that has changedDon't make them start from the beginning

Page 45: Part 4: Mechanicslwn.net › images › pdf › google-class › 04-mechanics.pdf · Linus's inbox -> BitKeeper -> git The process became more disciplined. How it works now 1 Initial

Acked-by tags

Needed if your patchTouches files “owned” by othersReaches across subsystems

Page 46: Part 4: Mechanicslwn.net › images › pdf › google-class › 04-mechanics.pdf · Linus's inbox -> BitKeeper -> git The process became more disciplined. How it works now 1 Initial

viafb: Add the viafb video capture driver Add a driver for the video capture port on VIA integrated chipsets. This version has a remaining OLPCism or two and expects to be talking to an ov7670; those can be improved as the need arises. This work was supported by the One Laptop Per Child project. Acked-by: Mauro Carvalho Chehab <[email protected]>Signed-off-by: Jonathan Corbet <[email protected]>

Page 47: Part 4: Mechanicslwn.net › images › pdf › google-class › 04-mechanics.pdf · Linus's inbox -> BitKeeper -> git The process became more disciplined. How it works now 1 Initial

Acked-by tags

Needed if your patchTouches files “owned” by othersReaches across subsystems

Don't make them up!The person named must offer the tag

Page 48: Part 4: Mechanicslwn.net › images › pdf › google-class › 04-mechanics.pdf · Linus's inbox -> BitKeeper -> git The process became more disciplined. How it works now 1 Initial

Other tags

Add Cc: tags as appropriate

Add Reported-by: for specific bug fixes

Only add Tested-by: or Reviewed-by: if offered by the person involved.

Cc anybody whose name appears in a tag.

Page 49: Part 4: Mechanicslwn.net › images › pdf › google-class › 04-mechanics.pdf · Linus's inbox -> BitKeeper -> git The process became more disciplined. How it works now 1 Initial

Requests for major changes

“Please make a new mid-layer to handle this for your driver and the other three as well.”

A known process problemSuch requests can usually be gotten around.

Page 50: Part 4: Mechanicslwn.net › images › pdf › google-class › 04-mechanics.pdf · Linus's inbox -> BitKeeper -> git The process became more disciplined. How it works now 1 Initial

An example

“However, this is the second NFC driver (at least), and that means it's time to come up with a generic way of talking to NFC devices from user space. We cannot allow every NFC controller to have another set of arbitrary ioctl numbers.”-- Arnd Bergmann, 3/10/2011

Page 51: Part 4: Mechanicslwn.net › images › pdf › google-class › 04-mechanics.pdf · Linus's inbox -> BitKeeper -> git The process became more disciplined. How it works now 1 Initial

The staging tree

A home for substandard drivers

Not an ideal solution“The crap tree”Less likely to be picked up by distributors

But it can work if all else fails

Page 52: Part 4: Mechanicslwn.net › images › pdf › google-class › 04-mechanics.pdf · Linus's inbox -> BitKeeper -> git The process became more disciplined. How it works now 1 Initial

Staging rules

The code must compile

Must have a TODO fileSteps to take to move out of staging

Must have ongoing developer interestOtherwise it will be kicked out again

Page 53: Part 4: Mechanicslwn.net › images › pdf › google-class › 04-mechanics.pdf · Linus's inbox -> BitKeeper -> git The process became more disciplined. How it works now 1 Initial

One other thing

“One of the things that is hard for people who aren't regular denizens of LKML is to understand whose comments can be ignored.”-- Ted Ts'o

The kernel lists attract some loudmouths(But fewer than one might expect)

When in doubt, ask somebody you trust.

Page 54: Part 4: Mechanicslwn.net › images › pdf › google-class › 04-mechanics.pdf · Linus's inbox -> BitKeeper -> git The process became more disciplined. How it works now 1 Initial

4: Subsystem trees / linux-next

Subsystem maintainers...serve as the gatekeeper for specific areas of kernel code.

Page 55: Part 4: Mechanicslwn.net › images › pdf › google-class › 04-mechanics.pdf · Linus's inbox -> BitKeeper -> git The process became more disciplined. How it works now 1 Initial

Most active subsystem maintainers

David Miller (Networking)John Linville (Wireless networking)Greg Kroah-Hartman (USB, staging)Ingo Molnar (x86, core)Andrew Morton (All over)Mauro Chehab (Video4Linux)James Bottomley (SCSI)Dave Airlie (Graphics)Len Brown (ACPI)

Page 56: Part 4: Mechanicslwn.net › images › pdf › google-class › 04-mechanics.pdf · Linus's inbox -> BitKeeper -> git The process became more disciplined. How it works now 1 Initial

Note

These are the people you have to convince to merge your patch

Linus is rarely involved at this level

Page 57: Part 4: Mechanicslwn.net › images › pdf › google-class › 04-mechanics.pdf · Linus's inbox -> BitKeeper -> git The process became more disciplined. How it works now 1 Initial

What if there is no subsystem maintainer?

There are always unmaintained subsystems in the kernel

Options:Become the maintainerSend patches through Andrew Morton

Page 58: Part 4: Mechanicslwn.net › images › pdf › google-class › 04-mechanics.pdf · Linus's inbox -> BitKeeper -> git The process became more disciplined. How it works now 1 Initial

Subsystem tree

A (usually) git repository containing patches approved for merging

Where patches go after the (successful) conclusion of the review process.

Page 59: Part 4: Mechanicslwn.net › images › pdf › google-class › 04-mechanics.pdf · Linus's inbox -> BitKeeper -> git The process became more disciplined. How it works now 1 Initial

Conflicts

Your work might conflict with another's work in this subsystem.

The maintainer may ask for the patch to be rebased against the subsystem tree.

Page 60: Part 4: Mechanicslwn.net › images › pdf › google-class › 04-mechanics.pdf · Linus's inbox -> BitKeeper -> git The process became more disciplined. How it works now 1 Initial

linux-next

An integration point for subsystem trees120+ trees, currently

Contains changes for the next development cycle

Where inter-subsystem conflicts are found and fixed.

Page 61: Part 4: Mechanicslwn.net › images › pdf › google-class › 04-mechanics.pdf · Linus's inbox -> BitKeeper -> git The process became more disciplined. How it works now 1 Initial

Every day

The mainline tree is pulledEach subsystem tree is merged on top

Conflicts fixedBuild and boot tests run

The result is released as linux-next

Thus: a highly volatile environmentHard to work against

Page 62: Part 4: Mechanicslwn.net › images › pdf › google-class › 04-mechanics.pdf · Linus's inbox -> BitKeeper -> git The process became more disciplined. How it works now 1 Initial

Breaking linux-next

Your patch might break linux-nextSome sort of conflictBuild failures...

You'll get a cheery note from StephenRespond quickly

You may get bug reports from others too

Page 63: Part 4: Mechanicslwn.net › images › pdf › google-class › 04-mechanics.pdf · Linus's inbox -> BitKeeper -> git The process became more disciplined. How it works now 1 Initial

Bear in mind

linux-next != mainline

Being in linux-next does not guarantee mainline inclusion

but the chances are good

Page 64: Part 4: Mechanicslwn.net › images › pdf › google-class › 04-mechanics.pdf · Linus's inbox -> BitKeeper -> git The process became more disciplined. How it works now 1 Initial

Mainline inclusion

Mainline = Linus's kernel“The” Linux kernel

Page 65: Part 4: Mechanicslwn.net › images › pdf › google-class › 04-mechanics.pdf · Linus's inbox -> BitKeeper -> git The process became more disciplined. How it works now 1 Initial

The mainline cycle

Page 66: Part 4: Mechanicslwn.net › images › pdf › google-class › 04-mechanics.pdf · Linus's inbox -> BitKeeper -> git The process became more disciplined. How it works now 1 Initial

Merge window

Page 67: Part 4: Mechanicslwn.net › images › pdf › google-class › 04-mechanics.pdf · Linus's inbox -> BitKeeper -> git The process became more disciplined. How it works now 1 Initial

The merge window

New features are only accepted during the merge window

Usually

Only fixes thereafterOnly serious fixes for late -rc's

Page 68: Part 4: Mechanicslwn.net › images › pdf › google-class › 04-mechanics.pdf · Linus's inbox -> BitKeeper -> git The process became more disciplined. How it works now 1 Initial

“I'm going to go postal on the next maintainer who doesn't understand what “merge window” and “fixes only” means.”

--Linus Torvalds

Page 69: Part 4: Mechanicslwn.net › images › pdf › google-class › 04-mechanics.pdf · Linus's inbox -> BitKeeper -> git The process became more disciplined. How it works now 1 Initial
Page 70: Part 4: Mechanicslwn.net › images › pdf › google-class › 04-mechanics.pdf · Linus's inbox -> BitKeeper -> git The process became more disciplined. How it works now 1 Initial

The merge window

Starts after the 2.6.x release

Maintainers send pull requests

Linus merges like crazy~1000 patches/day

Eventually 2.6.n+1-rc1 is releasedMerge window closes again

Page 71: Part 4: Mechanicslwn.net › images › pdf › google-class › 04-mechanics.pdf · Linus's inbox -> BitKeeper -> git The process became more disciplined. How it works now 1 Initial

Merge window preparation

Takes time!

Maintainers want patches well before the merge window opens

Late patches will make them grumpy...and may have to wait a cycle

Page 72: Part 4: Mechanicslwn.net › images › pdf › google-class › 04-mechanics.pdf · Linus's inbox -> BitKeeper -> git The process became more disciplined. How it works now 1 Initial

After your patch is merged

You may get bug reportsRespond quickly

You may get regression reportsRespond instantly

Page 73: Part 4: Mechanicslwn.net › images › pdf › google-class › 04-mechanics.pdf · Linus's inbox -> BitKeeper -> git The process became more disciplined. How it works now 1 Initial

“Regressions are serious, top-priority emergencies. We drop everything and run around with our hair on fire when we hear about one (don't we?).”

-- Andrew Morton

Page 74: Part 4: Mechanicslwn.net › images › pdf › google-class › 04-mechanics.pdf · Linus's inbox -> BitKeeper -> git The process became more disciplined. How it works now 1 Initial

Regressions

Regressions must be fixedOr the patch will be reverted

Page 75: Part 4: Mechanicslwn.net › images › pdf › google-class › 04-mechanics.pdf · Linus's inbox -> BitKeeper -> git The process became more disciplined. How it works now 1 Initial

Fixes from others

Others may send fixes or improvements to your code

Congratulations, you are now a maintainer

Review them and:Merge them yourselfSupply an Acked-by lineExplain why the change should not be merged.

Page 76: Part 4: Mechanicslwn.net › images › pdf › google-class › 04-mechanics.pdf · Linus's inbox -> BitKeeper -> git The process became more disciplined. How it works now 1 Initial

6: Stable release

Finally your code is in a stable release

We're still not quite done...

Page 77: Part 4: Mechanicslwn.net › images › pdf › google-class › 04-mechanics.pdf · Linus's inbox -> BitKeeper -> git The process became more disciplined. How it works now 1 Initial

Stable updates

The -stable tree is maintained by Greg Kroah-Hartman

Contains important fixes to stable releases

Maintained for 3-6 months - sometimes more.

Page 78: Part 4: Mechanicslwn.net › images › pdf › google-class › 04-mechanics.pdf · Linus's inbox -> BitKeeper -> git The process became more disciplined. How it works now 1 Initial

Stable rules

Only fixes for serious bugsCrashesSecurity issues...

Fixes must be in mainline firstWill want to see commit ID

Page 79: Part 4: Mechanicslwn.net › images › pdf › google-class › 04-mechanics.pdf · Linus's inbox -> BitKeeper -> git The process became more disciplined. How it works now 1 Initial

Sending patches to -stable

Email to [email protected] mainline commit IDGood changelog is essential

Add a tag to the mainline commit:Cc: [email protected] will pick it up automatically

Page 80: Part 4: Mechanicslwn.net › images › pdf › google-class › 04-mechanics.pdf · Linus's inbox -> BitKeeper -> git The process became more disciplined. How it works now 1 Initial

7: Distributor kernels

Distributors do not ship mainline kernels

Usually something olderPlus their specific patchesPlus fixes for more bugsPlus random weird stuff

Page 81: Part 4: Mechanicslwn.net › images › pdf › google-class › 04-mechanics.pdf · Linus's inbox -> BitKeeper -> git The process became more disciplined. How it works now 1 Initial

Getting into distributions

Wait for them to move to current kernelsMonths for community distributionsYears for “enterprise” distributions

Distributions will sometimes backport driversConvince them their customers want it

Page 82: Part 4: Mechanicslwn.net › images › pdf › google-class › 04-mechanics.pdf · Linus's inbox -> BitKeeper -> git The process became more disciplined. How it works now 1 Initial

Finally...

Time to start something new!

Page 83: Part 4: Mechanicslwn.net › images › pdf › google-class › 04-mechanics.pdf · Linus's inbox -> BitKeeper -> git The process became more disciplined. How it works now 1 Initial

Subsystem maintainership

Time to become the maintainer when:Nobody else is doing itPatches come from multiple developersYou have the time and interest

Page 84: Part 4: Mechanicslwn.net › images › pdf › google-class › 04-mechanics.pdf · Linus's inbox -> BitKeeper -> git The process became more disciplined. How it works now 1 Initial

The maintainer's duties

Understand the subsystem as a wholeReview patches from developersCommit patches which are readyMerge changes upstream at the right timeTrack regressions

Revert bad patches as needed

Page 85: Part 4: Mechanicslwn.net › images › pdf › google-class › 04-mechanics.pdf · Linus's inbox -> BitKeeper -> git The process became more disciplined. How it works now 1 Initial

Patch review

Does it match the subsystem's design?No duplicated functionality, inconsistent interfaces, ...

Coding style problems?Obvious bugs?Can you test it?Conflicts with other developers' work?Does the changelog make sense?Are the right signoffs and tags there?

Do you trust the author?Should it go to -stable?

Page 86: Part 4: Mechanicslwn.net › images › pdf › google-class › 04-mechanics.pdf · Linus's inbox -> BitKeeper -> git The process became more disciplined. How it works now 1 Initial

The most important questions

Will it make it upstream?

Will it cause explosions when it gets there?

Page 87: Part 4: Mechanicslwn.net › images › pdf › google-class › 04-mechanics.pdf · Linus's inbox -> BitKeeper -> git The process became more disciplined. How it works now 1 Initial

Collecting patches

Use git!

Topic branches can be most helpful

Publish your treesFor the next merge windowLater stuff...

Page 88: Part 4: Mechanicslwn.net › images › pdf › google-class › 04-mechanics.pdf · Linus's inbox -> BitKeeper -> git The process became more disciplined. How it works now 1 Initial

Git hygiene

A couple of hints...

Avoid excessive merges with mainlineThey irritate LinusBase branches on a “well known” starting point

(a mainline or -rc release)

Do not rebase public branchesThat irritates other developers

Page 89: Part 4: Mechanicslwn.net › images › pdf › google-class › 04-mechanics.pdf · Linus's inbox -> BitKeeper -> git The process became more disciplined. How it works now 1 Initial

linux-next

You must put your tree into linux-nextDrop Stephen Rothwell a note

Understand the rulesOnly stuff for the next merge window (or two)This code should be truly ready

Be ready for bug reports

Page 90: Part 4: Mechanicslwn.net › images › pdf › google-class › 04-mechanics.pdf · Linus's inbox -> BitKeeper -> git The process became more disciplined. How it works now 1 Initial

Merging

Send a pull request upstream...usually to LinusDuring the merge window for new features

Include the needed informationTree location and branchList of commitsdiffstat outputUse 'git request-pull' for all of this

Page 91: Part 4: Mechanicslwn.net › images › pdf › google-class › 04-mechanics.pdf · Linus's inbox -> BitKeeper -> git The process became more disciplined. How it works now 1 Initial

Be conservative in what you send

“You can send me patches, but for me to pull a git patch from you, I need to know that you know what you're doing, and I need to be able to trust things *without* then having to go and check every individual change by hand.”-- Linus Torvalds

Page 92: Part 4: Mechanicslwn.net › images › pdf › google-class › 04-mechanics.pdf · Linus's inbox -> BitKeeper -> git The process became more disciplined. How it works now 1 Initial

Regressions

They happen

Communicate with the patch author

Be prepared to revert quicklyUnderstand the consequences of a revert

Page 93: Part 4: Mechanicslwn.net › images › pdf › google-class › 04-mechanics.pdf · Linus's inbox -> BitKeeper -> git The process became more disciplined. How it works now 1 Initial

Remember

Maintainership is not absolute power

Represent the kernel, not your employer

You can be routed around

Page 94: Part 4: Mechanicslwn.net › images › pdf › google-class › 04-mechanics.pdf · Linus's inbox -> BitKeeper -> git The process became more disciplined. How it works now 1 Initial

Questions?