11da177e4SLinus Torvalds 21da177e4SLinus Torvalds How to Get Your Change Into the Linux Kernel 31da177e4SLinus Torvalds or 41da177e4SLinus Torvalds Care And Operation Of Your Linus Torvalds 51da177e4SLinus Torvalds 61da177e4SLinus Torvalds 71da177e4SLinus Torvalds 81da177e4SLinus TorvaldsFor a person or company who wishes to submit a change to the Linux 91da177e4SLinus Torvaldskernel, the process can sometimes be daunting if you're not familiar 101da177e4SLinus Torvaldswith "the system." This text is a collection of suggestions which 111da177e4SLinus Torvaldscan greatly increase the chances of your change being accepted. 121da177e4SLinus Torvalds 13d00c4559SJonathan CorbetThis document contains a large number of suggestions in a relatively terse 14d00c4559SJonathan Corbetformat. For detailed information on how the kernel development process 15d00c4559SJonathan Corbetworks, see Documentation/development-process. Also, read 16d00c4559SJonathan CorbetDocumentation/SubmitChecklist for a list of items to check before 17d00c4559SJonathan Corbetsubmitting code. If you are submitting a driver, also read 18082bd1caSJonathan CorbetDocumentation/SubmittingDrivers; for device tree binding patches, read 19082bd1caSJonathan CorbetDocumentation/devicetree/bindings/submitting-patches.txt. 201da177e4SLinus Torvalds 218e3072a2SJosh TriplettMany of these steps describe the default behavior of the git version 228e3072a2SJosh Triplettcontrol system; if you use git to prepare your patches, you'll find much 238e3072a2SJosh Triplettof the mechanical work done for you, though you'll still need to prepare 24d00c4559SJonathan Corbetand document a sensible set of patches. In general, use of git will make 25d00c4559SJonathan Corbetyour life as a kernel developer easier. 261da177e4SLinus Torvalds 271da177e4SLinus Torvalds-------------------------------------------- 281da177e4SLinus TorvaldsSECTION 1 - CREATING AND SENDING YOUR CHANGE 291da177e4SLinus Torvalds-------------------------------------------- 301da177e4SLinus Torvalds 311da177e4SLinus Torvalds 327994cc15SJonathan Corbet0) Obtain a current source tree 337994cc15SJonathan Corbet------------------------------- 347994cc15SJonathan Corbet 357994cc15SJonathan CorbetIf you do not have a repository with the current kernel source handy, use 367994cc15SJonathan Corbetgit to obtain one. You'll want to start with the mainline repository, 377994cc15SJonathan Corbetwhich can be grabbed with: 387994cc15SJonathan Corbet 397994cc15SJonathan Corbet git clone git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git 407994cc15SJonathan Corbet 417994cc15SJonathan CorbetNote, however, that you may not want to develop against the mainline tree 427994cc15SJonathan Corbetdirectly. Most subsystem maintainers run their own trees and want to see 437994cc15SJonathan Corbetpatches prepared against those trees. See the "T:" entry for the subsystem 447994cc15SJonathan Corbetin the MAINTAINERS file to find that tree, or simply ask the maintainer if 457994cc15SJonathan Corbetthe tree is not listed there. 467994cc15SJonathan Corbet 477994cc15SJonathan CorbetIt is still possible to download kernel releases via tarballs (as described 487994cc15SJonathan Corbetin the next section), but that is the hard way to do kernel development. 491da177e4SLinus Torvalds 501da177e4SLinus Torvalds1) "diff -up" 511da177e4SLinus Torvalds------------ 521da177e4SLinus Torvalds 537994cc15SJonathan CorbetIf you must generate your patches by hand, use "diff -up" or "diff -uprN" 547994cc15SJonathan Corbetto create patches. Git generates patches in this form by default; if 557994cc15SJonathan Corbetyou're using git, you can skip this section entirely. 561da177e4SLinus Torvalds 571da177e4SLinus TorvaldsAll changes to the Linux kernel occur in the form of patches, as 581da177e4SLinus Torvaldsgenerated by diff(1). When creating your patch, make sure to create it 591da177e4SLinus Torvaldsin "unified diff" format, as supplied by the '-u' argument to diff(1). 601da177e4SLinus TorvaldsAlso, please use the '-p' argument which shows which C function each 611da177e4SLinus Torvaldschange is in - that makes the resultant diff a lot easier to read. 621da177e4SLinus TorvaldsPatches should be based in the root kernel source directory, 631da177e4SLinus Torvaldsnot in any lower subdirectory. 641da177e4SLinus Torvalds 651da177e4SLinus TorvaldsTo create a patch for a single file, it is often sufficient to do: 661da177e4SLinus Torvalds 67d00c4559SJonathan Corbet SRCTREE= linux 681da177e4SLinus Torvalds MYFILE= drivers/net/mydriver.c 691da177e4SLinus Torvalds 701da177e4SLinus Torvalds cd $SRCTREE 711da177e4SLinus Torvalds cp $MYFILE $MYFILE.orig 721da177e4SLinus Torvalds vi $MYFILE # make your change 731da177e4SLinus Torvalds cd .. 741da177e4SLinus Torvalds diff -up $SRCTREE/$MYFILE{.orig,} > /tmp/patch 751da177e4SLinus Torvalds 761da177e4SLinus TorvaldsTo create a patch for multiple files, you should unpack a "vanilla", 771da177e4SLinus Torvaldsor unmodified kernel source tree, and generate a diff against your 781da177e4SLinus Torvaldsown source tree. For example: 791da177e4SLinus Torvalds 80d00c4559SJonathan Corbet MYSRC= /devel/linux 811da177e4SLinus Torvalds 82d00c4559SJonathan Corbet tar xvfz linux-3.19.tar.gz 83d00c4559SJonathan Corbet mv linux-3.19 linux-3.19-vanilla 84d00c4559SJonathan Corbet diff -uprN -X linux-3.19-vanilla/Documentation/dontdiff \ 85d00c4559SJonathan Corbet linux-3.19-vanilla $MYSRC > /tmp/patch 861da177e4SLinus Torvalds 871da177e4SLinus Torvalds"dontdiff" is a list of files which are generated by the kernel during 881da177e4SLinus Torvaldsthe build process, and should be ignored in any diff(1)-generated 89d00c4559SJonathan Corbetpatch. 901da177e4SLinus Torvalds 911da177e4SLinus TorvaldsMake sure your patch does not include any extra files which do not 921da177e4SLinus Torvaldsbelong in a patch submission. Make sure to review your patch -after- 93013542caSBenjamin Herrgenerating it with diff(1), to ensure accuracy. 941da177e4SLinus Torvalds 958e3072a2SJosh TriplettIf your changes produce a lot of deltas, you need to split them into 968e3072a2SJosh Triplettindividual patches which modify things in logical stages; see section 976e7ac7b4SSébastien Hinderer#3. This will facilitate review by other kernel developers, 988e3072a2SJosh Triplettvery important if you want your patch accepted. 991da177e4SLinus Torvalds 1008e3072a2SJosh TriplettIf you're using git, "git rebase -i" can help you with this process. If 1018e3072a2SJosh Triplettyou're not using git, quilt <http://savannah.nongnu.org/projects/quilt> 1028e3072a2SJosh Triplettis another popular alternative. 10384da7c08SRandy Dunlap 10484da7c08SRandy Dunlap 1051da177e4SLinus Torvalds 1061da177e4SLinus Torvalds2) Describe your changes. 107d00c4559SJonathan Corbet------------------------- 1081da177e4SLinus Torvalds 1097b9828d4SJohannes WeinerDescribe your problem. Whether your patch is a one-line bug fix or 1107b9828d4SJohannes Weiner5000 lines of a new feature, there must be an underlying problem that 1117b9828d4SJohannes Weinermotivated you to do this work. Convince the reviewer that there is a 1127b9828d4SJohannes Weinerproblem worth fixing and that it makes sense for them to read past the 1137b9828d4SJohannes Weinerfirst paragraph. 1141da177e4SLinus Torvalds 1157b9828d4SJohannes WeinerDescribe user-visible impact. Straight up crashes and lockups are 1167b9828d4SJohannes Weinerpretty convincing, but not all bugs are that blatant. Even if the 1177b9828d4SJohannes Weinerproblem was spotted during code review, describe the impact you think 1187b9828d4SJohannes Weinerit can have on users. Keep in mind that the majority of Linux 1197b9828d4SJohannes Weinerinstallations run kernels from secondary stable trees or 1207b9828d4SJohannes Weinervendor/product-specific trees that cherry-pick only specific patches 1217b9828d4SJohannes Weinerfrom upstream, so include anything that could help route your change 1227b9828d4SJohannes Weinerdownstream: provoking circumstances, excerpts from dmesg, crash 1237b9828d4SJohannes Weinerdescriptions, performance regressions, latency spikes, lockups, etc. 1247b9828d4SJohannes Weiner 1257b9828d4SJohannes WeinerQuantify optimizations and trade-offs. If you claim improvements in 1267b9828d4SJohannes Weinerperformance, memory consumption, stack footprint, or binary size, 1277b9828d4SJohannes Weinerinclude numbers that back them up. But also describe non-obvious 1287b9828d4SJohannes Weinercosts. Optimizations usually aren't free but trade-offs between CPU, 1297b9828d4SJohannes Weinermemory, and readability; or, when it comes to heuristics, between 1307b9828d4SJohannes Weinerdifferent workloads. Describe the expected downsides of your 1317b9828d4SJohannes Weineroptimization so that the reviewer can weigh costs against benefits. 1327b9828d4SJohannes Weiner 1337b9828d4SJohannes WeinerOnce the problem is established, describe what you are actually doing 1347b9828d4SJohannes Weinerabout it in technical detail. It's important to describe the change 1357b9828d4SJohannes Weinerin plain English for the reviewer to verify that the code is behaving 1367b9828d4SJohannes Weineras you intend it to. 1371da177e4SLinus Torvalds 1382ae19acaSTheodore Ts'oThe maintainer will thank you if you write your patch description in a 1392ae19acaSTheodore Ts'oform which can be easily pulled into Linux's source code management 1402ae19acaSTheodore Ts'osystem, git, as a "commit log". See #15, below. 1412ae19acaSTheodore Ts'o 1427b9828d4SJohannes WeinerSolve only one problem per patch. If your description starts to get 1437b9828d4SJohannes Weinerlong, that's a sign that you probably need to split up your patch. 1447b9828d4SJohannes WeinerSee #3, next. 1451da177e4SLinus Torvalds 146d89b1945SRandy DunlapWhen you submit or resubmit a patch or patch series, include the 147d89b1945SRandy Dunlapcomplete patch description and justification for it. Don't just 148d89b1945SRandy Dunlapsay that this is version N of the patch (series). Don't expect the 149d00c4559SJonathan Corbetsubsystem maintainer to refer back to earlier patch versions or referenced 150d89b1945SRandy DunlapURLs to find the patch description and put that into the patch. 151d89b1945SRandy DunlapI.e., the patch (series) and its description should be self-contained. 152d00c4559SJonathan CorbetThis benefits both the maintainers and reviewers. Some reviewers 153d89b1945SRandy Dunlapprobably didn't even receive earlier versions of the patch. 154d89b1945SRandy Dunlap 15574a475acSJosh TriplettDescribe your changes in imperative mood, e.g. "make xyzzy do frotz" 15674a475acSJosh Triplettinstead of "[This patch] makes xyzzy do frotz" or "[I] changed xyzzy 15774a475acSJosh Triplettto do frotz", as if you are giving orders to the codebase to change 15874a475acSJosh Triplettits behaviour. 15974a475acSJosh Triplett 160d89b1945SRandy DunlapIf the patch fixes a logged bug entry, refer to that bug entry by 1619547c706SJosh Triplettnumber and URL. If the patch follows from a mailing list discussion, 1629547c706SJosh Triplettgive a URL to the mailing list archive; use the https://lkml.kernel.org/ 1639547c706SJosh Triplettredirector with a Message-Id, to ensure that the links cannot become 1649547c706SJosh Triplettstale. 1659547c706SJosh Triplett 1669547c706SJosh TriplettHowever, try to make your explanation understandable without external 1679547c706SJosh Triplettresources. In addition to giving a URL to a mailing list archive or 1689547c706SJosh Triplettbug, summarize the relevant points of the discussion that led to the 1699547c706SJosh Triplettpatch as submitted. 1701da177e4SLinus Torvalds 1710af52703SGeert UytterhoevenIf you want to refer to a specific commit, don't just refer to the 1720af52703SGeert UytterhoevenSHA-1 ID of the commit. Please also include the oneline summary of 1730af52703SGeert Uytterhoeventhe commit, to make it easier for reviewers to know what it is about. 1740af52703SGeert UytterhoevenExample: 1750af52703SGeert Uytterhoeven 1760af52703SGeert Uytterhoeven Commit e21d2170f36602ae2708 ("video: remove unnecessary 1770af52703SGeert Uytterhoeven platform_set_drvdata()") removed the unnecessary 1780af52703SGeert Uytterhoeven platform_set_drvdata(), but left the variable "dev" unused, 1790af52703SGeert Uytterhoeven delete it. 1800af52703SGeert Uytterhoeven 1817994cc15SJonathan CorbetYou should also be sure to use at least the first twelve characters of the 1827994cc15SJonathan CorbetSHA-1 ID. The kernel repository holds a *lot* of objects, making 1837994cc15SJonathan Corbetcollisions with shorter IDs a real possibility. Bear in mind that, even if 1847994cc15SJonathan Corbetthere is no collision with your six-character ID now, that condition may 1857994cc15SJonathan Corbetchange five years from now. 1867994cc15SJonathan Corbet 1878401aa1fSJacob KellerIf your patch fixes a bug in a specific commit, e.g. you found an issue using 1888401aa1fSJacob Kellergit-bisect, please use the 'Fixes:' tag with the first 12 characters of the 1897994cc15SJonathan CorbetSHA-1 ID, and the one line summary. For example: 1908401aa1fSJacob Keller 1918401aa1fSJacob Keller Fixes: e21d2170f366 ("video: remove unnecessary platform_set_drvdata()") 1928401aa1fSJacob Keller 1938401aa1fSJacob KellerThe following git-config settings can be used to add a pretty format for 1948401aa1fSJacob Kelleroutputting the above style in the git log or git show commands 1958401aa1fSJacob Keller 1968401aa1fSJacob Keller [core] 1978401aa1fSJacob Keller abbrev = 12 1988401aa1fSJacob Keller [pretty] 1998401aa1fSJacob Keller fixes = Fixes: %h (\"%s\") 2001da177e4SLinus Torvalds 2011da177e4SLinus Torvalds3) Separate your changes. 202d00c4559SJonathan Corbet------------------------- 2031da177e4SLinus Torvalds 204d00c4559SJonathan CorbetSeparate each _logical change_ into a separate patch. 2051da177e4SLinus Torvalds 2061da177e4SLinus TorvaldsFor example, if your changes include both bug fixes and performance 2071da177e4SLinus Torvaldsenhancements for a single driver, separate those changes into two 2081da177e4SLinus Torvaldsor more patches. If your changes include an API update, and a new 2091da177e4SLinus Torvaldsdriver which uses that new API, separate those into two patches. 2101da177e4SLinus Torvalds 2111da177e4SLinus TorvaldsOn the other hand, if you make a single change to numerous files, 2121da177e4SLinus Torvaldsgroup those changes into a single patch. Thus a single logical change 2131da177e4SLinus Torvaldsis contained within a single patch. 2141da177e4SLinus Torvalds 215d00c4559SJonathan CorbetThe point to remember is that each patch should make an easily understood 216d00c4559SJonathan Corbetchange that can be verified by reviewers. Each patch should be justifiable 217d00c4559SJonathan Corbeton its own merits. 218d00c4559SJonathan Corbet 2191da177e4SLinus TorvaldsIf one patch depends on another patch in order for a change to be 2201da177e4SLinus Torvaldscomplete, that is OK. Simply note "this patch depends on patch X" 2211da177e4SLinus Torvaldsin your patch description. 2221da177e4SLinus Torvalds 2237994cc15SJonathan CorbetWhen dividing your change into a series of patches, take special care to 2247994cc15SJonathan Corbetensure that the kernel builds and runs properly after each patch in the 2257994cc15SJonathan Corbetseries. Developers using "git bisect" to track down a problem can end up 2267994cc15SJonathan Corbetsplitting your patch series at any point; they will not thank you if you 2277994cc15SJonathan Corbetintroduce bugs in the middle. 2287994cc15SJonathan Corbet 2295b0ed2c6SXose Vazquez PerezIf you cannot condense your patch set into a smaller set of patches, 2305b0ed2c6SXose Vazquez Perezthen only post say 15 or so at a time and wait for review and integration. 2315b0ed2c6SXose Vazquez Perez 2325b0ed2c6SXose Vazquez Perez 2331da177e4SLinus Torvalds 2346de16ebaSJonathan Corbet4) Style-check your changes. 2356de16ebaSJonathan Corbet---------------------------- 2360a920b5bSAndy Whitcroft 2370a920b5bSAndy WhitcroftCheck your patch for basic style violations, details of which can be 2380a920b5bSAndy Whitcroftfound in Documentation/CodingStyle. Failure to do so simply wastes 239f56d35e7SLinus Nilssonthe reviewers time and will get your patch rejected, probably 2400a920b5bSAndy Whitcroftwithout even being read. 2410a920b5bSAndy Whitcroft 2426de16ebaSJonathan CorbetOne significant exception is when moving code from one file to 2436de16ebaSJonathan Corbetanother -- in this case you should not modify the moved code at all in 2446de16ebaSJonathan Corbetthe same patch which moves it. This clearly delineates the act of 2456de16ebaSJonathan Corbetmoving the code and your changes. This greatly aids review of the 2466de16ebaSJonathan Corbetactual differences and allows tools to better track the history of 2476de16ebaSJonathan Corbetthe code itself. 2480a920b5bSAndy Whitcroft 2496de16ebaSJonathan CorbetCheck your patches with the patch style checker prior to submission 2506de16ebaSJonathan Corbet(scripts/checkpatch.pl). Note, though, that the style checker should be 2516de16ebaSJonathan Corbetviewed as a guide, not as a replacement for human judgment. If your code 2526de16ebaSJonathan Corbetlooks better with a violation then its probably best left alone. 2536de16ebaSJonathan Corbet 2546de16ebaSJonathan CorbetThe checker reports at three levels: 2556de16ebaSJonathan Corbet - ERROR: things that are very likely to be wrong 2566de16ebaSJonathan Corbet - WARNING: things requiring careful review 2576de16ebaSJonathan Corbet - CHECK: things requiring thought 2586de16ebaSJonathan Corbet 2596de16ebaSJonathan CorbetYou should be able to justify all violations that remain in your 2606de16ebaSJonathan Corbetpatch. 2610a920b5bSAndy Whitcroft 2620a920b5bSAndy Whitcroft 263ccae8616SJonathan Corbet5) Select the recipients for your patch. 264ccae8616SJonathan Corbet---------------------------------------- 2650a920b5bSAndy Whitcroft 266ccae8616SJonathan CorbetYou should always copy the appropriate subsystem maintainer(s) on any patch 267ccae8616SJonathan Corbetto code that they maintain; look through the MAINTAINERS file and the 268ccae8616SJonathan Corbetsource code revision history to see who those maintainers are. The 269ccae8616SJonathan Corbetscript scripts/get_maintainer.pl can be very useful at this step. If you 270d6eff078SSébastien Hinderercannot find a maintainer for the subsystem you are working on, Andrew 271ccae8616SJonathan CorbetMorton (akpm@linux-foundation.org) serves as a maintainer of last resort. 2721da177e4SLinus Torvalds 273ccae8616SJonathan CorbetYou should also normally choose at least one mailing list to receive a copy 274ccae8616SJonathan Corbetof your patch set. linux-kernel@vger.kernel.org functions as a list of 275ccae8616SJonathan Corbetlast resort, but the volume on that list has caused a number of developers 276ccae8616SJonathan Corbetto tune it out. Look in the MAINTAINERS file for a subsystem-specific 277ccae8616SJonathan Corbetlist; your patch will probably get more attention there. Please do not 278ccae8616SJonathan Corbetspam unrelated lists, though. 2791da177e4SLinus Torvalds 280ccae8616SJonathan CorbetMany kernel-related lists are hosted on vger.kernel.org; you can find a 281ccae8616SJonathan Corbetlist of them at http://vger.kernel.org/vger-lists.html. There are 282ccae8616SJonathan Corbetkernel-related lists hosted elsewhere as well, though. 2835b0ed2c6SXose Vazquez Perez 2845b0ed2c6SXose Vazquez PerezDo not send more than 15 patches at once to the vger mailing lists!!! 2855b0ed2c6SXose Vazquez Perez 2861da177e4SLinus TorvaldsLinus Torvalds is the final arbiter of all changes accepted into the 28799ddcc7eSLinus TorvaldsLinux kernel. His e-mail address is <torvalds@linux-foundation.org>. 288ccae8616SJonathan CorbetHe gets a lot of e-mail, and, at this point, very few patches go through 289ccae8616SJonathan CorbetLinus directly, so typically you should do your best to -avoid- 29099ddcc7eSLinus Torvaldssending him e-mail. 2911da177e4SLinus Torvalds 292ccae8616SJonathan CorbetIf you have a patch that fixes an exploitable security bug, send that patch 293ccae8616SJonathan Corbetto security@kernel.org. For severe bugs, a short embargo may be considered 294253508caSNik Nybyto allow distributors to get the patch out to users; in such cases, 295ccae8616SJonathan Corbetobviously, the patch should not be sent to any public lists. 2961da177e4SLinus Torvalds 297ccae8616SJonathan CorbetPatches that fix a severe bug in a released kernel should be directed 298ccae8616SJonathan Corbettoward the stable maintainers by putting a line like this: 2991da177e4SLinus Torvalds 300ccae8616SJonathan Corbet Cc: stable@vger.kernel.org 3011da177e4SLinus Torvalds 3028cda4c3aSLuke Dashjrinto the sign-off area of your patch (note, NOT an email recipient). You 3038cda4c3aSLuke Dashjrshould also read Documentation/stable_kernel_rules.txt in addition to this 3048cda4c3aSLuke Dashjrfile. 3051da177e4SLinus Torvalds 306ccae8616SJonathan CorbetNote, however, that some subsystem maintainers want to come to their own 307ccae8616SJonathan Corbetconclusions on which patches should go to the stable trees. The networking 308ccae8616SJonathan Corbetmaintainer, in particular, would rather not see individual developers 309ccae8616SJonathan Corbetadding lines like the above to their patches. 3101da177e4SLinus Torvalds 311ccae8616SJonathan CorbetIf changes affect userland-kernel interfaces, please send the MAN-PAGES 312ccae8616SJonathan Corbetmaintainer (as listed in the MAINTAINERS file) a man-pages patch, or at 313ccae8616SJonathan Corbetleast a notification of the change, so that some information makes its way 314ccae8616SJonathan Corbetinto the manual pages. User-space API changes should also be copied to 315ccae8616SJonathan Corbetlinux-api@vger.kernel.org. 3161da177e4SLinus Torvalds 3171da177e4SLinus TorvaldsFor small patches you may want to CC the Trivial Patch Monkey 31882d27b2bSMarkus Heidelbergtrivial@kernel.org which collects "trivial" patches. Have a look 31982d27b2bSMarkus Heidelberginto the MAINTAINERS file for its current manager. 32082d27b2bSMarkus HeidelbergTrivial patches must qualify for one of the following rules: 3211da177e4SLinus Torvalds Spelling fixes in documentation 322ccae8616SJonathan Corbet Spelling fixes for errors which could break grep(1) 3231da177e4SLinus Torvalds Warning fixes (cluttering with useless warnings is bad) 3241da177e4SLinus Torvalds Compilation fixes (only if they are actually correct) 3251da177e4SLinus Torvalds Runtime fixes (only if they actually fix things) 326ccae8616SJonathan Corbet Removing use of deprecated functions/macros 3271da177e4SLinus Torvalds Contact detail and documentation fixes 3281da177e4SLinus Torvalds Non-portable code replaced by portable code (even in arch-specific, 3291da177e4SLinus Torvalds since people copy, as long as it's trivial) 3308e9cb8fdSPavel Machek Any fix by the author/maintainer of the file (ie. patch monkey 3311da177e4SLinus Torvalds in re-transmission mode) 33284da7c08SRandy Dunlap 3331da177e4SLinus Torvalds 3341da177e4SLinus Torvalds 335ccae8616SJonathan Corbet6) No MIME, no links, no compression, no attachments. Just plain text. 336d00c4559SJonathan Corbet----------------------------------------------------------------------- 3371da177e4SLinus Torvalds 3381da177e4SLinus TorvaldsLinus and other kernel developers need to be able to read and comment 3391da177e4SLinus Torvaldson the changes you are submitting. It is important for a kernel 3401da177e4SLinus Torvaldsdeveloper to be able to "quote" your changes, using standard e-mail 3411da177e4SLinus Torvaldstools, so that they may comment on specific portions of your code. 3421da177e4SLinus Torvalds 343bdc89213SSébastien HindererFor this reason, all patches should be submitted by e-mail "inline". 3441da177e4SLinus TorvaldsWARNING: Be wary of your editor's word-wrap corrupting your patch, 3451da177e4SLinus Torvaldsif you choose to cut-n-paste your patch. 3461da177e4SLinus Torvalds 3471da177e4SLinus TorvaldsDo not attach the patch as a MIME attachment, compressed or not. 3481da177e4SLinus TorvaldsMany popular e-mail applications will not always transmit a MIME 3491da177e4SLinus Torvaldsattachment as plain text, making it impossible to comment on your 3501da177e4SLinus Torvaldscode. A MIME attachment also takes Linus a bit more time to process, 3511da177e4SLinus Torvaldsdecreasing the likelihood of your MIME-attached change being accepted. 3521da177e4SLinus Torvalds 3531da177e4SLinus TorvaldsException: If your mailer is mangling patches then someone may ask 3541da177e4SLinus Torvaldsyou to re-send them using MIME. 3551da177e4SLinus Torvalds 356097091c0SMichael OpdenackerSee Documentation/email-clients.txt for hints about configuring 357097091c0SMichael Opdenackeryour e-mail client so that it sends your patches untouched. 3581da177e4SLinus Torvalds 359ccae8616SJonathan Corbet7) E-mail size. 360d00c4559SJonathan Corbet--------------- 3611da177e4SLinus Torvalds 3621da177e4SLinus TorvaldsLarge changes are not appropriate for mailing lists, and some 3634932be77SRandy Dunlapmaintainers. If your patch, uncompressed, exceeds 300 kB in size, 3641da177e4SLinus Torvaldsit is preferred that you store your patch on an Internet-accessible 365d00c4559SJonathan Corbetserver, and provide instead a URL (link) pointing to your patch. But note 366d00c4559SJonathan Corbetthat if your patch exceeds 300 kB, it almost certainly needs to be broken up 367d00c4559SJonathan Corbetanyway. 3681da177e4SLinus Torvalds 3690eea2314SJonathan Corbet8) Respond to review comments. 3700eea2314SJonathan Corbet------------------------------ 3711da177e4SLinus Torvalds 3720eea2314SJonathan CorbetYour patch will almost certainly get comments from reviewers on ways in 3730eea2314SJonathan Corbetwhich the patch can be improved. You must respond to those comments; 3740eea2314SJonathan Corbetignoring reviewers is a good way to get ignored in return. Review comments 3750eea2314SJonathan Corbetor questions that do not lead to a code change should almost certainly 3760eea2314SJonathan Corbetbring about a comment or changelog entry so that the next reviewer better 3770eea2314SJonathan Corbetunderstands what is going on. 3781da177e4SLinus Torvalds 3790eea2314SJonathan CorbetBe sure to tell the reviewers what changes you are making and to thank them 3800eea2314SJonathan Corbetfor their time. Code review is a tiring and time-consuming process, and 3810eea2314SJonathan Corbetreviewers sometimes get grumpy. Even in that case, though, respond 3820eea2314SJonathan Corbetpolitely and address the problems they have pointed out. 3831da177e4SLinus Torvalds 3841da177e4SLinus Torvalds 3850eea2314SJonathan Corbet9) Don't get discouraged - or impatient. 3860eea2314SJonathan Corbet---------------------------------------- 3871da177e4SLinus Torvalds 3880eea2314SJonathan CorbetAfter you have submitted your change, be patient and wait. Reviewers are 3890eea2314SJonathan Corbetbusy people and may not get to your patch right away. 3901da177e4SLinus Torvalds 3910eea2314SJonathan CorbetOnce upon a time, patches used to disappear into the void without comment, 3920eea2314SJonathan Corbetbut the development process works more smoothly than that now. You should 3930eea2314SJonathan Corbetreceive comments within a week or so; if that does not happen, make sure 3940eea2314SJonathan Corbetthat you have sent your patches to the right place. Wait for a minimum of 3950eea2314SJonathan Corbetone week before resubmitting or pinging reviewers - possibly longer during 3960eea2314SJonathan Corbetbusy times like merge windows. 3971da177e4SLinus Torvalds 3981da177e4SLinus Torvalds 399ccae8616SJonathan Corbet10) Include PATCH in the subject 400d00c4559SJonathan Corbet-------------------------------- 4011da177e4SLinus Torvalds 4021da177e4SLinus TorvaldsDue to high e-mail traffic to Linus, and to linux-kernel, it is common 4031da177e4SLinus Torvaldsconvention to prefix your subject line with [PATCH]. This lets Linus 4041da177e4SLinus Torvaldsand other kernel developers more easily distinguish patches from other 4051da177e4SLinus Torvaldse-mail discussions. 4061da177e4SLinus Torvalds 4071da177e4SLinus Torvalds 4081da177e4SLinus Torvalds 409ccae8616SJonathan Corbet11) Sign your work 410d00c4559SJonathan Corbet------------------ 4111da177e4SLinus Torvalds 4121da177e4SLinus TorvaldsTo improve tracking of who did what, especially with patches that can 4131da177e4SLinus Torvaldspercolate to their final resting place in the kernel through several 4141da177e4SLinus Torvaldslayers of maintainers, we've introduced a "sign-off" procedure on 4151da177e4SLinus Torvaldspatches that are being emailed around. 4161da177e4SLinus Torvalds 4171da177e4SLinus TorvaldsThe sign-off is a simple line at the end of the explanation for the 4181da177e4SLinus Torvaldspatch, which certifies that you wrote it or otherwise have the right to 419db12fb83SZac Storerpass it on as an open-source patch. The rules are pretty simple: if you 4201da177e4SLinus Torvaldscan certify the below: 4211da177e4SLinus Torvalds 422cbd83da8SLinus Torvalds Developer's Certificate of Origin 1.1 4231da177e4SLinus Torvalds 4241da177e4SLinus Torvalds By making a contribution to this project, I certify that: 4251da177e4SLinus Torvalds 4261da177e4SLinus Torvalds (a) The contribution was created in whole or in part by me and I 4271da177e4SLinus Torvalds have the right to submit it under the open source license 4281da177e4SLinus Torvalds indicated in the file; or 4291da177e4SLinus Torvalds 4301da177e4SLinus Torvalds (b) The contribution is based upon previous work that, to the best 4311da177e4SLinus Torvalds of my knowledge, is covered under an appropriate open source 4321da177e4SLinus Torvalds license and I have the right under that license to submit that 4331da177e4SLinus Torvalds work with modifications, whether created in whole or in part 4341da177e4SLinus Torvalds by me, under the same open source license (unless I am 4351da177e4SLinus Torvalds permitted to submit under a different license), as indicated 4361da177e4SLinus Torvalds in the file; or 4371da177e4SLinus Torvalds 4381da177e4SLinus Torvalds (c) The contribution was provided directly to me by some other 4391da177e4SLinus Torvalds person who certified (a), (b) or (c) and I have not modified 4401da177e4SLinus Torvalds it. 4411da177e4SLinus Torvalds 442cbd83da8SLinus Torvalds (d) I understand and agree that this project and the contribution 443cbd83da8SLinus Torvalds are public and that a record of the contribution (including all 444cbd83da8SLinus Torvalds personal information I submit with it, including my sign-off) is 445cbd83da8SLinus Torvalds maintained indefinitely and may be redistributed consistent with 446cbd83da8SLinus Torvalds this project or the open source license(s) involved. 447cbd83da8SLinus Torvalds 4481da177e4SLinus Torvaldsthen you just add a line saying 4491da177e4SLinus Torvalds 4509fd5559cSAlexey Dobriyan Signed-off-by: Random J Developer <random@developer.example.org> 4511da177e4SLinus Torvalds 452af45f32dSGreg KHusing your real name (sorry, no pseudonyms or anonymous contributions.) 453af45f32dSGreg KH 4541da177e4SLinus TorvaldsSome people also put extra tags at the end. They'll just be ignored for 4551da177e4SLinus Torvaldsnow, but you can do this to mark internal company procedures or just 4561da177e4SLinus Torvaldspoint out some special detail about the sign-off. 4571da177e4SLinus Torvalds 458adbd5886SWilly TarreauIf you are a subsystem or branch maintainer, sometimes you need to slightly 459adbd5886SWilly Tarreaumodify patches you receive in order to merge them, because the code is not 460adbd5886SWilly Tarreauexactly the same in your tree and the submitters'. If you stick strictly to 461adbd5886SWilly Tarreaurule (c), you should ask the submitter to rediff, but this is a totally 462adbd5886SWilly Tarreaucounter-productive waste of time and energy. Rule (b) allows you to adjust 463adbd5886SWilly Tarreauthe code, but then it is very impolite to change one submitter's code and 464adbd5886SWilly Tarreaumake him endorse your bugs. To solve this problem, it is recommended that 465adbd5886SWilly Tarreauyou add a line between the last Signed-off-by header and yours, indicating 466adbd5886SWilly Tarreauthe nature of your changes. While there is nothing mandatory about this, it 467adbd5886SWilly Tarreauseems like prepending the description with your mail and/or name, all 468adbd5886SWilly Tarreauenclosed in square brackets, is noticeable enough to make it obvious that 469adbd5886SWilly Tarreauyou are responsible for last-minute changes. Example : 470adbd5886SWilly Tarreau 471adbd5886SWilly Tarreau Signed-off-by: Random J Developer <random@developer.example.org> 472adbd5886SWilly Tarreau [lucky@maintainer.example.org: struct foo moved from foo.c to foo.h] 473adbd5886SWilly Tarreau Signed-off-by: Lucky K Maintainer <lucky@maintainer.example.org> 474adbd5886SWilly Tarreau 475305af08cSJeremiah MahlerThis practice is particularly helpful if you maintain a stable branch and 476adbd5886SWilly Tarreauwant at the same time to credit the author, track changes, merge the fix, 477adbd5886SWilly Tarreauand protect the submitter from complaints. Note that under no circumstances 478adbd5886SWilly Tarreaucan you change the author's identity (the From header), as it is the one 479adbd5886SWilly Tarreauwhich appears in the changelog. 480adbd5886SWilly Tarreau 481305af08cSJeremiah MahlerSpecial note to back-porters: It seems to be a common and useful practice 482adbd5886SWilly Tarreauto insert an indication of the origin of a patch at the top of the commit 483adbd5886SWilly Tarreaumessage (just after the subject line) to facilitate tracking. For instance, 4847994cc15SJonathan Corbethere's what we see in a 3.x-stable release: 485adbd5886SWilly Tarreau 4867994cc15SJonathan CorbetDate: Tue Oct 7 07:26:38 2014 -0400 487adbd5886SWilly Tarreau 4887994cc15SJonathan Corbet libata: Un-break ATA blacklist 489adbd5886SWilly Tarreau 4907994cc15SJonathan Corbet commit 1c40279960bcd7d52dbdf1d466b20d24b99176c8 upstream. 491adbd5886SWilly Tarreau 4927994cc15SJonathan CorbetAnd here's what might appear in an older kernel once a patch is backported: 493adbd5886SWilly Tarreau 494adbd5886SWilly Tarreau Date: Tue May 13 22:12:27 2008 +0200 495adbd5886SWilly Tarreau 496adbd5886SWilly Tarreau wireless, airo: waitbusy() won't delay 497adbd5886SWilly Tarreau 498adbd5886SWilly Tarreau [backport of 2.6 commit b7acbdfbd1f277c1eb23f344f899cfa4cd0bf36a] 499adbd5886SWilly Tarreau 500adbd5886SWilly TarreauWhatever the format, this information provides a valuable help to people 5017994cc15SJonathan Corbettracking your trees, and to people trying to troubleshoot bugs in your 502adbd5886SWilly Tarreautree. 503adbd5886SWilly Tarreau 5041da177e4SLinus Torvalds 505ccae8616SJonathan Corbet12) When to use Acked-by: and Cc: 506d00c4559SJonathan Corbet--------------------------------- 5070a920b5bSAndy Whitcroft 5080f44cd23SAndrew MortonThe Signed-off-by: tag indicates that the signer was involved in the 5090f44cd23SAndrew Mortondevelopment of the patch, or that he/she was in the patch's delivery path. 5100f44cd23SAndrew Morton 5110f44cd23SAndrew MortonIf a person was not directly involved in the preparation or handling of a 5120f44cd23SAndrew Mortonpatch but wishes to signify and record their approval of it then they can 513d00c4559SJonathan Corbetask to have an Acked-by: line added to the patch's changelog. 5140f44cd23SAndrew Morton 5150f44cd23SAndrew MortonAcked-by: is often used by the maintainer of the affected code when that 5160f44cd23SAndrew Mortonmaintainer neither contributed to nor forwarded the patch. 5170f44cd23SAndrew Morton 5180f44cd23SAndrew MortonAcked-by: is not as formal as Signed-off-by:. It is a record that the acker 5190f44cd23SAndrew Mortonhas at least reviewed the patch and has indicated acceptance. Hence patch 5200f44cd23SAndrew Mortonmergers will sometimes manually convert an acker's "yep, looks good to me" 521d00c4559SJonathan Corbetinto an Acked-by: (but note that it is usually better to ask for an 522d00c4559SJonathan Corbetexplicit ack). 5230f44cd23SAndrew Morton 5240f44cd23SAndrew MortonAcked-by: does not necessarily indicate acknowledgement of the entire patch. 5250f44cd23SAndrew MortonFor example, if a patch affects multiple subsystems and has an Acked-by: from 5260f44cd23SAndrew Mortonone subsystem maintainer then this usually indicates acknowledgement of just 5270f44cd23SAndrew Mortonthe part which affects that maintainer's code. Judgement should be used here. 5280f44cd23SAndrew MortonWhen in doubt people should refer to the original discussion in the mailing 5290f44cd23SAndrew Mortonlist archives. 5300f44cd23SAndrew Morton 531ef40203aSJonathan CorbetIf a person has had the opportunity to comment on a patch, but has not 532ef40203aSJonathan Corbetprovided such comments, you may optionally add a "Cc:" tag to the patch. 533ef40203aSJonathan CorbetThis is the only tag which might be added without an explicit action by the 534d00c4559SJonathan Corbetperson it names - but it should indicate that this person was copied on the 535d00c4559SJonathan Corbetpatch. This tag documents that potentially interested parties 536d00c4559SJonathan Corbethave been included in the discussion. 5370f44cd23SAndrew Morton 538ef40203aSJonathan Corbet 539ccae8616SJonathan Corbet13) Using Reported-by:, Tested-by:, Reviewed-by:, Suggested-by: and Fixes: 540d00c4559SJonathan Corbet-------------------------------------------------------------------------- 541bbb0a424SJonathan Corbet 542d75ef707SDan CarpenterThe Reported-by tag gives credit to people who find bugs and report them and it 543d75ef707SDan Carpenterhopefully inspires them to help us again in the future. Please note that if 544d75ef707SDan Carpenterthe bug was reported in private, then ask for permission first before using the 545d75ef707SDan CarpenterReported-by tag. 546ef40203aSJonathan Corbet 547ef40203aSJonathan CorbetA Tested-by: tag indicates that the patch has been successfully tested (in 548ef40203aSJonathan Corbetsome environment) by the person named. This tag informs maintainers that 549ef40203aSJonathan Corbetsome testing has been performed, provides a means to locate testers for 550ef40203aSJonathan Corbetfuture patches, and ensures credit for the testers. 551ef40203aSJonathan Corbet 552ef40203aSJonathan CorbetReviewed-by:, instead, indicates that the patch has been reviewed and found 553ef40203aSJonathan Corbetacceptable according to the Reviewer's Statement: 554ef40203aSJonathan Corbet 555ef40203aSJonathan Corbet Reviewer's statement of oversight 556ef40203aSJonathan Corbet 557ef40203aSJonathan Corbet By offering my Reviewed-by: tag, I state that: 558ef40203aSJonathan Corbet 559ef40203aSJonathan Corbet (a) I have carried out a technical review of this patch to 560ef40203aSJonathan Corbet evaluate its appropriateness and readiness for inclusion into 561ef40203aSJonathan Corbet the mainline kernel. 562ef40203aSJonathan Corbet 563ef40203aSJonathan Corbet (b) Any problems, concerns, or questions relating to the patch 564ef40203aSJonathan Corbet have been communicated back to the submitter. I am satisfied 565ef40203aSJonathan Corbet with the submitter's response to my comments. 566ef40203aSJonathan Corbet 567ef40203aSJonathan Corbet (c) While there may be things that could be improved with this 568ef40203aSJonathan Corbet submission, I believe that it is, at this time, (1) a 569ef40203aSJonathan Corbet worthwhile modification to the kernel, and (2) free of known 570ef40203aSJonathan Corbet issues which would argue against its inclusion. 571ef40203aSJonathan Corbet 572ef40203aSJonathan Corbet (d) While I have reviewed the patch and believe it to be sound, I 573ef40203aSJonathan Corbet do not (unless explicitly stated elsewhere) make any 574ef40203aSJonathan Corbet warranties or guarantees that it will achieve its stated 575ef40203aSJonathan Corbet purpose or function properly in any given situation. 576ef40203aSJonathan Corbet 577ef40203aSJonathan CorbetA Reviewed-by tag is a statement of opinion that the patch is an 578ef40203aSJonathan Corbetappropriate modification of the kernel without any remaining serious 579ef40203aSJonathan Corbettechnical issues. Any interested reviewer (who has done the work) can 580ef40203aSJonathan Corbetoffer a Reviewed-by tag for a patch. This tag serves to give credit to 581ef40203aSJonathan Corbetreviewers and to inform maintainers of the degree of review which has been 582ef40203aSJonathan Corbetdone on the patch. Reviewed-by: tags, when supplied by reviewers known to 583ef40203aSJonathan Corbetunderstand the subject area and to perform thorough reviews, will normally 5845801da1bSPavel Machekincrease the likelihood of your patch getting into the kernel. 585ef40203aSJonathan Corbet 5868543ae12SMugunthan V NA Suggested-by: tag indicates that the patch idea is suggested by the person 5878543ae12SMugunthan V Nnamed and ensures credit to the person for the idea. Please note that this 5888543ae12SMugunthan V Ntag should not be added without the reporter's permission, especially if the 5898543ae12SMugunthan V Nidea was not posted in a public forum. That said, if we diligently credit our 5908543ae12SMugunthan V Nidea reporters, they will, hopefully, be inspired to help us again in the 5918543ae12SMugunthan V Nfuture. 5928543ae12SMugunthan V N 5938401aa1fSJacob KellerA Fixes: tag indicates that the patch fixes an issue in a previous commit. It 5948401aa1fSJacob Kelleris used to make it easy to determine where a bug originated, which can help 5958401aa1fSJacob Kellerreview a bug fix. This tag also assists the stable kernel team in determining 5968401aa1fSJacob Kellerwhich stable kernel versions should receive your fix. This is the preferred 5978401aa1fSJacob Kellermethod for indicating a bug fixed by the patch. See #2 above for more details. 5988401aa1fSJacob Keller 599ef40203aSJonathan Corbet 600ccae8616SJonathan Corbet14) The canonical patch format 6017994cc15SJonathan Corbet------------------------------ 6027994cc15SJonathan Corbet 6037994cc15SJonathan CorbetThis section describes how the patch itself should be formatted. Note 6047994cc15SJonathan Corbetthat, if you have your patches stored in a git repository, proper patch 6057994cc15SJonathan Corbetformatting can be had with "git format-patch". The tools cannot create 6067994cc15SJonathan Corbetthe necessary text, though, so read the instructions below anyway. 60784da7c08SRandy Dunlap 60875f8426cSPaul JacksonThe canonical patch subject line is: 60975f8426cSPaul Jackson 610d6b9acc0SPaul Jackson Subject: [PATCH 001/123] subsystem: summary phrase 61175f8426cSPaul Jackson 61275f8426cSPaul JacksonThe canonical patch message body contains the following: 61375f8426cSPaul Jackson 614ccae8616SJonathan Corbet - A "from" line specifying the patch author (only needed if the person 615ccae8616SJonathan Corbet sending the patch is not the author). 61675f8426cSPaul Jackson 61775f8426cSPaul Jackson - An empty line. 61875f8426cSPaul Jackson 6192a076f40SJoe Perches - The body of the explanation, line wrapped at 75 columns, which will 6202a076f40SJoe Perches be copied to the permanent changelog to describe this patch. 62175f8426cSPaul Jackson 62275f8426cSPaul Jackson - The "Signed-off-by:" lines, described above, which will 62375f8426cSPaul Jackson also go in the changelog. 62475f8426cSPaul Jackson 62575f8426cSPaul Jackson - A marker line containing simply "---". 62675f8426cSPaul Jackson 62775f8426cSPaul Jackson - Any additional comments not suitable for the changelog. 62875f8426cSPaul Jackson 62975f8426cSPaul Jackson - The actual patch (diff output). 63075f8426cSPaul Jackson 63175f8426cSPaul JacksonThe Subject line format makes it very easy to sort the emails 63275f8426cSPaul Jacksonalphabetically by subject line - pretty much any email reader will 63375f8426cSPaul Jacksonsupport that - since because the sequence number is zero-padded, 63475f8426cSPaul Jacksonthe numerical and alphabetic sort is the same. 63575f8426cSPaul Jackson 636d6b9acc0SPaul JacksonThe "subsystem" in the email's Subject should identify which 637d6b9acc0SPaul Jacksonarea or subsystem of the kernel is being patched. 638d6b9acc0SPaul Jackson 639d6b9acc0SPaul JacksonThe "summary phrase" in the email's Subject should concisely 640d6b9acc0SPaul Jacksondescribe the patch which that email contains. The "summary 641d6b9acc0SPaul Jacksonphrase" should not be a filename. Do not use the same "summary 64266effdc6SRandy Dunlapphrase" for every patch in a whole patch series (where a "patch 64366effdc6SRandy Dunlapseries" is an ordered sequence of multiple, related patches). 644d6b9acc0SPaul Jackson 6452ae19acaSTheodore Ts'oBear in mind that the "summary phrase" of your email becomes a 6462ae19acaSTheodore Ts'oglobally-unique identifier for that patch. It propagates all the way 6472ae19acaSTheodore Ts'ointo the git changelog. The "summary phrase" may later be used in 6482ae19acaSTheodore Ts'odeveloper discussions which refer to the patch. People will want to 6492ae19acaSTheodore Ts'ogoogle for the "summary phrase" to read discussion regarding that 6502ae19acaSTheodore Ts'opatch. It will also be the only thing that people may quickly see 6512ae19acaSTheodore Ts'owhen, two or three months later, they are going through perhaps 6522ae19acaSTheodore Ts'othousands of patches using tools such as "gitk" or "git log 6532ae19acaSTheodore Ts'o--oneline". 6542ae19acaSTheodore Ts'o 6552ae19acaSTheodore Ts'oFor these reasons, the "summary" must be no more than 70-75 6562ae19acaSTheodore Ts'ocharacters, and it must describe both what the patch changes, as well 6572ae19acaSTheodore Ts'oas why the patch might be necessary. It is challenging to be both 6582ae19acaSTheodore Ts'osuccinct and descriptive, but that is what a well-written summary 6592ae19acaSTheodore Ts'oshould do. 6602ae19acaSTheodore Ts'o 6612ae19acaSTheodore Ts'oThe "summary phrase" may be prefixed by tags enclosed in square 662e12d7462SAlex Henriebrackets: "Subject: [PATCH <tag>...] <summary phrase>". The tags are 663e12d7462SAlex Henrienot considered part of the summary phrase, but describe how the patch 6642ae19acaSTheodore Ts'oshould be treated. Common tags might include a version descriptor if 6652ae19acaSTheodore Ts'othe multiple versions of the patch have been sent out in response to 6662ae19acaSTheodore Ts'ocomments (i.e., "v1, v2, v3"), or "RFC" to indicate a request for 6672ae19acaSTheodore Ts'ocomments. If there are four patches in a patch series the individual 6682ae19acaSTheodore Ts'opatches may be numbered like this: 1/4, 2/4, 3/4, 4/4. This assures 6692ae19acaSTheodore Ts'othat developers understand the order in which the patches should be 6702ae19acaSTheodore Ts'oapplied and that they have reviewed or applied all of the patches in 6712ae19acaSTheodore Ts'othe patch series. 672d6b9acc0SPaul Jackson 673d6b9acc0SPaul JacksonA couple of example Subjects: 674d6b9acc0SPaul Jackson 675e12d7462SAlex Henrie Subject: [PATCH 2/5] ext2: improve scalability of bitmap searching 676e12d7462SAlex Henrie Subject: [PATCH v2 01/27] x86: fix eflags tracking 67775f8426cSPaul Jackson 67875f8426cSPaul JacksonThe "from" line must be the very first line in the message body, 67975f8426cSPaul Jacksonand has the form: 68075f8426cSPaul Jackson 68175f8426cSPaul Jackson From: Original Author <author@example.com> 68275f8426cSPaul Jackson 68375f8426cSPaul JacksonThe "from" line specifies who will be credited as the author of the 68475f8426cSPaul Jacksonpatch in the permanent changelog. If the "from" line is missing, 68575f8426cSPaul Jacksonthen the "From:" line from the email header will be used to determine 68675f8426cSPaul Jacksonthe patch author in the changelog. 68775f8426cSPaul Jackson 68875f8426cSPaul JacksonThe explanation body will be committed to the permanent source 68975f8426cSPaul Jacksonchangelog, so should make sense to a competent reader who has long 69075f8426cSPaul Jacksonsince forgotten the immediate details of the discussion that might 6912ae19acaSTheodore Ts'ohave led to this patch. Including symptoms of the failure which the 6922ae19acaSTheodore Ts'opatch addresses (kernel log messages, oops messages, etc.) is 6932ae19acaSTheodore Ts'oespecially useful for people who might be searching the commit logs 6942ae19acaSTheodore Ts'olooking for the applicable patch. If a patch fixes a compile failure, 6952ae19acaSTheodore Ts'oit may not be necessary to include _all_ of the compile failures; just 6962ae19acaSTheodore Ts'oenough that it is likely that someone searching for the patch can find 6972ae19acaSTheodore Ts'oit. As in the "summary phrase", it is important to be both succinct as 6982ae19acaSTheodore Ts'owell as descriptive. 69975f8426cSPaul Jackson 70075f8426cSPaul JacksonThe "---" marker line serves the essential purpose of marking for patch 70175f8426cSPaul Jacksonhandling tools where the changelog message ends. 70275f8426cSPaul Jackson 70375f8426cSPaul JacksonOne good use for the additional comments after the "---" marker is for 7042ae19acaSTheodore Ts'oa diffstat, to show what files have changed, and the number of 7052ae19acaSTheodore Ts'oinserted and deleted lines per file. A diffstat is especially useful 7062ae19acaSTheodore Ts'oon bigger patches. Other comments relevant only to the moment or the 7072ae19acaSTheodore Ts'omaintainer, not suitable for the permanent changelog, should also go 7082ae19acaSTheodore Ts'ohere. A good example of such comments might be "patch changelogs" 7092ae19acaSTheodore Ts'owhich describe what has changed between the v1 and v2 version of the 7102ae19acaSTheodore Ts'opatch. 7112ae19acaSTheodore Ts'o 7122ae19acaSTheodore Ts'oIf you are going to include a diffstat after the "---" marker, please 7132ae19acaSTheodore Ts'ouse diffstat options "-p 1 -w 70" so that filenames are listed from 7142ae19acaSTheodore Ts'othe top of the kernel source tree and don't use too much horizontal 7158e3072a2SJosh Triplettspace (easily fit in 80 columns, maybe with some indentation). (git 7168e3072a2SJosh Triplettgenerates appropriate diffstats by default.) 71775f8426cSPaul Jackson 71875f8426cSPaul JacksonSee more details on the proper patch format in the following 71975f8426cSPaul Jacksonreferences. 72075f8426cSPaul Jackson 721*d7ac8d85SChris Metcalf15) Explicit In-Reply-To headers 722*d7ac8d85SChris Metcalf-------------------------------- 72375f8426cSPaul Jackson 724*d7ac8d85SChris MetcalfIt can be helpful to manually add In-Reply-To: headers to a patch 725*d7ac8d85SChris Metcalf(e.g., when using "git send email") to associate the patch with 726*d7ac8d85SChris Metcalfprevious relevant discussion, e.g. to link a bug fix to the email with 727*d7ac8d85SChris Metcalfthe bug report. However, for a multi-patch series, it is generally 728*d7ac8d85SChris Metcalfbest to avoid using In-Reply-To: to link to older versions of the 729*d7ac8d85SChris Metcalfseries. This way multiple versions of the patch don't become an 730*d7ac8d85SChris Metcalfunmanageable forest of references in email clients. If a link is 731*d7ac8d85SChris Metcalfhelpful, you can use the https://lkml.kernel.org/ redirector (e.g., in 732*d7ac8d85SChris Metcalfthe cover email text) to link to an earlier version of the patch series. 733*d7ac8d85SChris Metcalf 734*d7ac8d85SChris Metcalf 735*d7ac8d85SChris Metcalf16) Sending "git pull" requests 7367994cc15SJonathan Corbet------------------------------- 73784da7c08SRandy Dunlap 7387994cc15SJonathan CorbetIf you have a series of patches, it may be most convenient to have the 7397994cc15SJonathan Corbetmaintainer pull them directly into the subsystem repository with a 7407994cc15SJonathan Corbet"git pull" operation. Note, however, that pulling patches from a developer 7417994cc15SJonathan Corbetrequires a higher degree of trust than taking patches from a mailing list. 7427994cc15SJonathan CorbetAs a result, many subsystem maintainers are reluctant to take pull 743b792ffe4SJonathan Corbetrequests, especially from new, unknown developers. If in doubt you can use 744b792ffe4SJonathan Corbetthe pull request as the cover letter for a normal posting of the patch 745b792ffe4SJonathan Corbetseries, giving the maintainer the option of using either. 74614863617SRandy Dunlap 7477994cc15SJonathan CorbetA pull request should have [GIT] or [PULL] in the subject line. The 7487994cc15SJonathan Corbetrequest itself should include the repository name and the branch of 7497994cc15SJonathan Corbetinterest on a single line; it should look something like: 75014863617SRandy Dunlap 7517994cc15SJonathan Corbet Please pull from 75214863617SRandy Dunlap 75314863617SRandy Dunlap git://jdelvare.pck.nerim.net/jdelvare-2.6 i2c-for-linus 75414863617SRandy Dunlap 75564e32895SJakub Wilk to get these changes: 75614863617SRandy Dunlap 7577994cc15SJonathan CorbetA pull request should also include an overall message saying what will be 7587994cc15SJonathan Corbetincluded in the request, a "git shortlog" listing of the patches 7597994cc15SJonathan Corbetthemselves, and a diffstat showing the overall effect of the patch series. 7607994cc15SJonathan CorbetThe easiest way to get all this information together is, of course, to let 7617994cc15SJonathan Corbetgit do it for you with the "git request-pull" command. 76214863617SRandy Dunlap 7637994cc15SJonathan CorbetSome maintainers (including Linus) want to see pull requests from signed 7647994cc15SJonathan Corbetcommits; that increases their confidence that the request actually came 7657994cc15SJonathan Corbetfrom you. Linus, in particular, will not pull from public hosting sites 7667994cc15SJonathan Corbetlike GitHub in the absence of a signed tag. 76714863617SRandy Dunlap 7687994cc15SJonathan CorbetThe first step toward creating such tags is to make a GNUPG key and get it 7697994cc15SJonathan Corbetsigned by one or more core kernel developers. This step can be hard for 7707994cc15SJonathan Corbetnew developers, but there is no way around it. Attending conferences can 7717994cc15SJonathan Corbetbe a good way to find developers who can sign your key. 77214863617SRandy Dunlap 7737994cc15SJonathan CorbetOnce you have prepared a patch series in git that you wish to have somebody 7747994cc15SJonathan Corbetpull, create a signed tag with "git tag -s". This will create a new tag 7757994cc15SJonathan Corbetidentifying the last commit in the series and containing a signature 7767994cc15SJonathan Corbetcreated with your private key. You will also have the opportunity to add a 7777994cc15SJonathan Corbetchangelog-style message to the tag; this is an ideal place to describe the 7787994cc15SJonathan Corbeteffects of the pull request as a whole. 77984da7c08SRandy Dunlap 7807994cc15SJonathan CorbetIf the tree the maintainer will be pulling from is not the repository you 7817994cc15SJonathan Corbetare working from, don't forget to push the signed tag explicitly to the 7827994cc15SJonathan Corbetpublic tree. 7831da177e4SLinus Torvalds 7847994cc15SJonathan CorbetWhen generating your pull request, use the signed tag as the target. A 7857994cc15SJonathan Corbetcommand like this will do the trick: 7861da177e4SLinus Torvalds 7877994cc15SJonathan Corbet git request-pull master git://my.public.tree/linux.git my-signed-tag 7885b0ed2c6SXose Vazquez Perez 7895b0ed2c6SXose Vazquez Perez 7905b0ed2c6SXose Vazquez Perez---------------------- 7916de16ebaSJonathan CorbetSECTION 2 - REFERENCES 7925b0ed2c6SXose Vazquez Perez---------------------- 7935b0ed2c6SXose Vazquez Perez 7945b0ed2c6SXose Vazquez PerezAndrew Morton, "The perfect patch" (tpp). 79537c703f4SMitchel Humpherys <http://www.ozlabs.org/~akpm/stuff/tpp.txt> 7965b0ed2c6SXose Vazquez Perez 7978e9cb8fdSPavel MachekJeff Garzik, "Linux kernel patch submission format". 7985b0ed2c6SXose Vazquez Perez <http://linux.yyz.us/patch-format.html> 7995b0ed2c6SXose Vazquez Perez 8008e9cb8fdSPavel MachekGreg Kroah-Hartman, "How to piss off a kernel subsystem maintainer". 801f5039935SVikram Narayanan <http://www.kroah.com/log/linux/maintainer.html> 802f5039935SVikram Narayanan <http://www.kroah.com/log/linux/maintainer-02.html> 803f5039935SVikram Narayanan <http://www.kroah.com/log/linux/maintainer-03.html> 804f5039935SVikram Narayanan <http://www.kroah.com/log/linux/maintainer-04.html> 805f5039935SVikram Narayanan <http://www.kroah.com/log/linux/maintainer-05.html> 8067e0dae61SSudip Mukherjee <http://www.kroah.com/log/linux/maintainer-06.html> 8075b0ed2c6SXose Vazquez Perez 808bc7455faSRandy DunlapNO!!!! No more huge patch bombs to linux-kernel@vger.kernel.org people! 80937c703f4SMitchel Humpherys <https://lkml.org/lkml/2005/7/11/336> 8105b0ed2c6SXose Vazquez Perez 8118e9cb8fdSPavel MachekKernel Documentation/CodingStyle: 81260498bb5SLuis de Bethencourt <Documentation/CodingStyle> 8135b0ed2c6SXose Vazquez Perez 8148e9cb8fdSPavel MachekLinus Torvalds's mail on the canonical patch format: 8155b0ed2c6SXose Vazquez Perez <http://lkml.org/lkml/2005/4/7/183> 8169536727eSAndi Kleen 8179536727eSAndi KleenAndi Kleen, "On submitting kernel patches" 81825985edcSLucas De Marchi Some strategies to get difficult or controversial changes in. 8199536727eSAndi Kleen http://halobates.de/on-submitting-patches.pdf 8209536727eSAndi Kleen 8215b0ed2c6SXose Vazquez Perez-- 822