xref: /OK3568_Linux_fs/kernel/Documentation/process/2.Process.rst (revision 4882a59341e53eb6f0b4789bf948001014eff981)
1*4882a593Smuzhiyun.. _development_process:
2*4882a593Smuzhiyun
3*4882a593SmuzhiyunHow the development process works
4*4882a593Smuzhiyun=================================
5*4882a593Smuzhiyun
6*4882a593SmuzhiyunLinux kernel development in the early 1990's was a pretty loose affair,
7*4882a593Smuzhiyunwith relatively small numbers of users and developers involved.  With a
8*4882a593Smuzhiyunuser base in the millions and with some 2,000 developers involved over the
9*4882a593Smuzhiyuncourse of one year, the kernel has since had to evolve a number of
10*4882a593Smuzhiyunprocesses to keep development happening smoothly.  A solid understanding of
11*4882a593Smuzhiyunhow the process works is required in order to be an effective part of it.
12*4882a593Smuzhiyun
13*4882a593SmuzhiyunThe big picture
14*4882a593Smuzhiyun---------------
15*4882a593Smuzhiyun
16*4882a593SmuzhiyunThe kernel developers use a loosely time-based release process, with a new
17*4882a593Smuzhiyunmajor kernel release happening every two or three months.  The recent
18*4882a593Smuzhiyunrelease history looks like this:
19*4882a593Smuzhiyun
20*4882a593Smuzhiyun	======  =================
21*4882a593Smuzhiyun	5.0	March 3, 2019
22*4882a593Smuzhiyun	5.1	May 5, 2019
23*4882a593Smuzhiyun	5.2	July 7, 2019
24*4882a593Smuzhiyun	5.3	September 15, 2019
25*4882a593Smuzhiyun	5.4	November 24, 2019
26*4882a593Smuzhiyun	5.5	January 6, 2020
27*4882a593Smuzhiyun	======  =================
28*4882a593Smuzhiyun
29*4882a593SmuzhiyunEvery 5.x release is a major kernel release with new features, internal
30*4882a593SmuzhiyunAPI changes, and more.  A typical release can contain about 13,000
31*4882a593Smuzhiyunchangesets with changes to several hundred thousand lines of code.  5.x is
32*4882a593Smuzhiyunthe leading edge of Linux kernel development; the kernel uses a
33*4882a593Smuzhiyunrolling development model which is continually integrating major changes.
34*4882a593Smuzhiyun
35*4882a593SmuzhiyunA relatively straightforward discipline is followed with regard to the
36*4882a593Smuzhiyunmerging of patches for each release.  At the beginning of each development
37*4882a593Smuzhiyuncycle, the "merge window" is said to be open.  At that time, code which is
38*4882a593Smuzhiyundeemed to be sufficiently stable (and which is accepted by the development
39*4882a593Smuzhiyuncommunity) is merged into the mainline kernel.  The bulk of changes for a
40*4882a593Smuzhiyunnew development cycle (and all of the major changes) will be merged during
41*4882a593Smuzhiyunthis time, at a rate approaching 1,000 changes ("patches," or "changesets")
42*4882a593Smuzhiyunper day.
43*4882a593Smuzhiyun
44*4882a593Smuzhiyun(As an aside, it is worth noting that the changes integrated during the
45*4882a593Smuzhiyunmerge window do not come out of thin air; they have been collected, tested,
46*4882a593Smuzhiyunand staged ahead of time.  How that process works will be described in
47*4882a593Smuzhiyundetail later on).
48*4882a593Smuzhiyun
49*4882a593SmuzhiyunThe merge window lasts for approximately two weeks.  At the end of this
50*4882a593Smuzhiyuntime, Linus Torvalds will declare that the window is closed and release the
51*4882a593Smuzhiyunfirst of the "rc" kernels.  For the kernel which is destined to be 5.6,
52*4882a593Smuzhiyunfor example, the release which happens at the end of the merge window will
53*4882a593Smuzhiyunbe called 5.6-rc1.  The -rc1 release is the signal that the time to
54*4882a593Smuzhiyunmerge new features has passed, and that the time to stabilize the next
55*4882a593Smuzhiyunkernel has begun.
56*4882a593Smuzhiyun
57*4882a593SmuzhiyunOver the next six to ten weeks, only patches which fix problems should be
58*4882a593Smuzhiyunsubmitted to the mainline.  On occasion a more significant change will be
59*4882a593Smuzhiyunallowed, but such occasions are rare; developers who try to merge new
60*4882a593Smuzhiyunfeatures outside of the merge window tend to get an unfriendly reception.
61*4882a593SmuzhiyunAs a general rule, if you miss the merge window for a given feature, the
62*4882a593Smuzhiyunbest thing to do is to wait for the next development cycle.  (An occasional
63*4882a593Smuzhiyunexception is made for drivers for previously-unsupported hardware; if they
64*4882a593Smuzhiyuntouch no in-tree code, they cannot cause regressions and should be safe to
65*4882a593Smuzhiyunadd at any time).
66*4882a593Smuzhiyun
67*4882a593SmuzhiyunAs fixes make their way into the mainline, the patch rate will slow over
68*4882a593Smuzhiyuntime.  Linus releases new -rc kernels about once a week; a normal series
69*4882a593Smuzhiyunwill get up to somewhere between -rc6 and -rc9 before the kernel is
70*4882a593Smuzhiyunconsidered to be sufficiently stable and the final release is made.
71*4882a593SmuzhiyunAt that point the whole process starts over again.
72*4882a593Smuzhiyun
73*4882a593SmuzhiyunAs an example, here is how the 5.4 development cycle went (all dates in
74*4882a593Smuzhiyun2019):
75*4882a593Smuzhiyun
76*4882a593Smuzhiyun	==============  ===============================
77*4882a593Smuzhiyun	September 15	5.3 stable release
78*4882a593Smuzhiyun	September 30	5.4-rc1, merge window closes
79*4882a593Smuzhiyun	October 6	5.4-rc2
80*4882a593Smuzhiyun	October 13	5.4-rc3
81*4882a593Smuzhiyun	October 20	5.4-rc4
82*4882a593Smuzhiyun	October 27	5.4-rc5
83*4882a593Smuzhiyun	November 3	5.4-rc6
84*4882a593Smuzhiyun	November 10	5.4-rc7
85*4882a593Smuzhiyun	November 17	5.4-rc8
86*4882a593Smuzhiyun	November 24	5.4 stable release
87*4882a593Smuzhiyun	==============  ===============================
88*4882a593Smuzhiyun
89*4882a593SmuzhiyunHow do the developers decide when to close the development cycle and create
90*4882a593Smuzhiyunthe stable release?  The most significant metric used is the list of
91*4882a593Smuzhiyunregressions from previous releases.  No bugs are welcome, but those which
92*4882a593Smuzhiyunbreak systems which worked in the past are considered to be especially
93*4882a593Smuzhiyunserious.  For this reason, patches which cause regressions are looked upon
94*4882a593Smuzhiyununfavorably and are quite likely to be reverted during the stabilization
95*4882a593Smuzhiyunperiod.
96*4882a593Smuzhiyun
97*4882a593SmuzhiyunThe developers' goal is to fix all known regressions before the stable
98*4882a593Smuzhiyunrelease is made.  In the real world, this kind of perfection is hard to
99*4882a593Smuzhiyunachieve; there are just too many variables in a project of this size.
100*4882a593SmuzhiyunThere comes a point where delaying the final release just makes the problem
101*4882a593Smuzhiyunworse; the pile of changes waiting for the next merge window will grow
102*4882a593Smuzhiyunlarger, creating even more regressions the next time around.  So most 5.x
103*4882a593Smuzhiyunkernels go out with a handful of known regressions though, hopefully, none
104*4882a593Smuzhiyunof them are serious.
105*4882a593Smuzhiyun
106*4882a593SmuzhiyunOnce a stable release is made, its ongoing maintenance is passed off to the
107*4882a593Smuzhiyun"stable team," currently Greg Kroah-Hartman. The stable team will release
108*4882a593Smuzhiyunoccasional updates to the stable release using the 5.x.y numbering scheme.
109*4882a593SmuzhiyunTo be considered for an update release, a patch must (1) fix a significant
110*4882a593Smuzhiyunbug, and (2) already be merged into the mainline for the next development
111*4882a593Smuzhiyunkernel. Kernels will typically receive stable updates for a little more
112*4882a593Smuzhiyunthan one development cycle past their initial release. So, for example, the
113*4882a593Smuzhiyun5.2 kernel's history looked like this (all dates in 2019):
114*4882a593Smuzhiyun
115*4882a593Smuzhiyun	==============  ===============================
116*4882a593Smuzhiyun	July 7		5.2 stable release
117*4882a593Smuzhiyun	July 14		5.2.1
118*4882a593Smuzhiyun	July 21		5.2.2
119*4882a593Smuzhiyun	July 26		5.2.3
120*4882a593Smuzhiyun	July 28		5.2.4
121*4882a593Smuzhiyun	July 31  	5.2.5
122*4882a593Smuzhiyun	...		...
123*4882a593Smuzhiyun	October 11	5.2.21
124*4882a593Smuzhiyun	==============  ===============================
125*4882a593Smuzhiyun
126*4882a593Smuzhiyun5.2.21 was the final stable update of the 5.2 release.
127*4882a593Smuzhiyun
128*4882a593SmuzhiyunSome kernels are designated "long term" kernels; they will receive support
129*4882a593Smuzhiyunfor a longer period.  As of this writing, the current long term kernels
130*4882a593Smuzhiyunand their maintainers are:
131*4882a593Smuzhiyun
132*4882a593Smuzhiyun	======  ================================	=======================
133*4882a593Smuzhiyun	3.16	Ben Hutchings				(very long-term kernel)
134*4882a593Smuzhiyun	4.4	Greg Kroah-Hartman & Sasha Levin	(very long-term kernel)
135*4882a593Smuzhiyun	4.9	Greg Kroah-Hartman & Sasha Levin
136*4882a593Smuzhiyun	4.14	Greg Kroah-Hartman & Sasha Levin
137*4882a593Smuzhiyun	4.19	Greg Kroah-Hartman & Sasha Levin
138*4882a593Smuzhiyun	5.4	Greg Kroah-Hartman & Sasha Levin
139*4882a593Smuzhiyun	======  ================================	=======================
140*4882a593Smuzhiyun
141*4882a593SmuzhiyunThe selection of a kernel for long-term support is purely a matter of a
142*4882a593Smuzhiyunmaintainer having the need and the time to maintain that release.  There
143*4882a593Smuzhiyunare no known plans for long-term support for any specific upcoming
144*4882a593Smuzhiyunrelease.
145*4882a593Smuzhiyun
146*4882a593Smuzhiyun
147*4882a593SmuzhiyunThe lifecycle of a patch
148*4882a593Smuzhiyun------------------------
149*4882a593Smuzhiyun
150*4882a593SmuzhiyunPatches do not go directly from the developer's keyboard into the mainline
151*4882a593Smuzhiyunkernel.  There is, instead, a somewhat involved (if somewhat informal)
152*4882a593Smuzhiyunprocess designed to ensure that each patch is reviewed for quality and that
153*4882a593Smuzhiyuneach patch implements a change which is desirable to have in the mainline.
154*4882a593SmuzhiyunThis process can happen quickly for minor fixes, or, in the case of large
155*4882a593Smuzhiyunand controversial changes, go on for years.  Much developer frustration
156*4882a593Smuzhiyuncomes from a lack of understanding of this process or from attempts to
157*4882a593Smuzhiyuncircumvent it.
158*4882a593Smuzhiyun
159*4882a593SmuzhiyunIn the hopes of reducing that frustration, this document will describe how
160*4882a593Smuzhiyuna patch gets into the kernel.  What follows below is an introduction which
161*4882a593Smuzhiyundescribes the process in a somewhat idealized way.  A much more detailed
162*4882a593Smuzhiyuntreatment will come in later sections.
163*4882a593Smuzhiyun
164*4882a593SmuzhiyunThe stages that a patch goes through are, generally:
165*4882a593Smuzhiyun
166*4882a593Smuzhiyun - Design.  This is where the real requirements for the patch - and the way
167*4882a593Smuzhiyun   those requirements will be met - are laid out.  Design work is often
168*4882a593Smuzhiyun   done without involving the community, but it is better to do this work
169*4882a593Smuzhiyun   in the open if at all possible; it can save a lot of time redesigning
170*4882a593Smuzhiyun   things later.
171*4882a593Smuzhiyun
172*4882a593Smuzhiyun - Early review.  Patches are posted to the relevant mailing list, and
173*4882a593Smuzhiyun   developers on that list reply with any comments they may have.  This
174*4882a593Smuzhiyun   process should turn up any major problems with a patch if all goes
175*4882a593Smuzhiyun   well.
176*4882a593Smuzhiyun
177*4882a593Smuzhiyun - Wider review.  When the patch is getting close to ready for mainline
178*4882a593Smuzhiyun   inclusion, it should be accepted by a relevant subsystem maintainer -
179*4882a593Smuzhiyun   though this acceptance is not a guarantee that the patch will make it
180*4882a593Smuzhiyun   all the way to the mainline.  The patch will show up in the maintainer's
181*4882a593Smuzhiyun   subsystem tree and into the -next trees (described below).  When the
182*4882a593Smuzhiyun   process works, this step leads to more extensive review of the patch and
183*4882a593Smuzhiyun   the discovery of any problems resulting from the integration of this
184*4882a593Smuzhiyun   patch with work being done by others.
185*4882a593Smuzhiyun
186*4882a593Smuzhiyun-  Please note that most maintainers also have day jobs, so merging
187*4882a593Smuzhiyun   your patch may not be their highest priority.  If your patch is
188*4882a593Smuzhiyun   getting feedback about changes that are needed, you should either
189*4882a593Smuzhiyun   make those changes or justify why they should not be made.  If your
190*4882a593Smuzhiyun   patch has no review complaints but is not being merged by its
191*4882a593Smuzhiyun   appropriate subsystem or driver maintainer, you should be persistent
192*4882a593Smuzhiyun   in updating the patch to the current kernel so that it applies cleanly
193*4882a593Smuzhiyun   and keep sending it for review and merging.
194*4882a593Smuzhiyun
195*4882a593Smuzhiyun - Merging into the mainline.  Eventually, a successful patch will be
196*4882a593Smuzhiyun   merged into the mainline repository managed by Linus Torvalds.  More
197*4882a593Smuzhiyun   comments and/or problems may surface at this time; it is important that
198*4882a593Smuzhiyun   the developer be responsive to these and fix any issues which arise.
199*4882a593Smuzhiyun
200*4882a593Smuzhiyun - Stable release.  The number of users potentially affected by the patch
201*4882a593Smuzhiyun   is now large, so, once again, new problems may arise.
202*4882a593Smuzhiyun
203*4882a593Smuzhiyun - Long-term maintenance.  While it is certainly possible for a developer
204*4882a593Smuzhiyun   to forget about code after merging it, that sort of behavior tends to
205*4882a593Smuzhiyun   leave a poor impression in the development community.  Merging code
206*4882a593Smuzhiyun   eliminates some of the maintenance burden, in that others will fix
207*4882a593Smuzhiyun   problems caused by API changes.  But the original developer should
208*4882a593Smuzhiyun   continue to take responsibility for the code if it is to remain useful
209*4882a593Smuzhiyun   in the longer term.
210*4882a593Smuzhiyun
211*4882a593SmuzhiyunOne of the largest mistakes made by kernel developers (or their employers)
212*4882a593Smuzhiyunis to try to cut the process down to a single "merging into the mainline"
213*4882a593Smuzhiyunstep.  This approach invariably leads to frustration for everybody
214*4882a593Smuzhiyuninvolved.
215*4882a593Smuzhiyun
216*4882a593SmuzhiyunHow patches get into the Kernel
217*4882a593Smuzhiyun-------------------------------
218*4882a593Smuzhiyun
219*4882a593SmuzhiyunThere is exactly one person who can merge patches into the mainline kernel
220*4882a593Smuzhiyunrepository: Linus Torvalds. But, for example, of the over 9,500 patches
221*4882a593Smuzhiyunwhich went into the 2.6.38 kernel, only 112 (around 1.3%) were directly
222*4882a593Smuzhiyunchosen by Linus himself. The kernel project has long since grown to a size
223*4882a593Smuzhiyunwhere no single developer could possibly inspect and select every patch
224*4882a593Smuzhiyununassisted. The way the kernel developers have addressed this growth is
225*4882a593Smuzhiyunthrough the use of a lieutenant system built around a chain of trust.
226*4882a593Smuzhiyun
227*4882a593SmuzhiyunThe kernel code base is logically broken down into a set of subsystems:
228*4882a593Smuzhiyunnetworking, specific architecture support, memory management, video
229*4882a593Smuzhiyundevices, etc.  Most subsystems have a designated maintainer, a developer
230*4882a593Smuzhiyunwho has overall responsibility for the code within that subsystem.  These
231*4882a593Smuzhiyunsubsystem maintainers are the gatekeepers (in a loose way) for the portion
232*4882a593Smuzhiyunof the kernel they manage; they are the ones who will (usually) accept a
233*4882a593Smuzhiyunpatch for inclusion into the mainline kernel.
234*4882a593Smuzhiyun
235*4882a593SmuzhiyunSubsystem maintainers each manage their own version of the kernel source
236*4882a593Smuzhiyuntree, usually (but certainly not always) using the git source management
237*4882a593Smuzhiyuntool.  Tools like git (and related tools like quilt or mercurial) allow
238*4882a593Smuzhiyunmaintainers to track a list of patches, including authorship information
239*4882a593Smuzhiyunand other metadata.  At any given time, the maintainer can identify which
240*4882a593Smuzhiyunpatches in his or her repository are not found in the mainline.
241*4882a593Smuzhiyun
242*4882a593SmuzhiyunWhen the merge window opens, top-level maintainers will ask Linus to "pull"
243*4882a593Smuzhiyunthe patches they have selected for merging from their repositories.  If
244*4882a593SmuzhiyunLinus agrees, the stream of patches will flow up into his repository,
245*4882a593Smuzhiyunbecoming part of the mainline kernel.  The amount of attention that Linus
246*4882a593Smuzhiyunpays to specific patches received in a pull operation varies.  It is clear
247*4882a593Smuzhiyunthat, sometimes, he looks quite closely.  But, as a general rule, Linus
248*4882a593Smuzhiyuntrusts the subsystem maintainers to not send bad patches upstream.
249*4882a593Smuzhiyun
250*4882a593SmuzhiyunSubsystem maintainers, in turn, can pull patches from other maintainers.
251*4882a593SmuzhiyunFor example, the networking tree is built from patches which accumulated
252*4882a593Smuzhiyunfirst in trees dedicated to network device drivers, wireless networking,
253*4882a593Smuzhiyunetc.  This chain of repositories can be arbitrarily long, though it rarely
254*4882a593Smuzhiyunexceeds two or three links.  Since each maintainer in the chain trusts
255*4882a593Smuzhiyunthose managing lower-level trees, this process is known as the "chain of
256*4882a593Smuzhiyuntrust."
257*4882a593Smuzhiyun
258*4882a593SmuzhiyunClearly, in a system like this, getting patches into the kernel depends on
259*4882a593Smuzhiyunfinding the right maintainer.  Sending patches directly to Linus is not
260*4882a593Smuzhiyunnormally the right way to go.
261*4882a593Smuzhiyun
262*4882a593Smuzhiyun
263*4882a593SmuzhiyunNext trees
264*4882a593Smuzhiyun----------
265*4882a593Smuzhiyun
266*4882a593SmuzhiyunThe chain of subsystem trees guides the flow of patches into the kernel,
267*4882a593Smuzhiyunbut it also raises an interesting question: what if somebody wants to look
268*4882a593Smuzhiyunat all of the patches which are being prepared for the next merge window?
269*4882a593SmuzhiyunDevelopers will be interested in what other changes are pending to see
270*4882a593Smuzhiyunwhether there are any conflicts to worry about; a patch which changes a
271*4882a593Smuzhiyuncore kernel function prototype, for example, will conflict with any other
272*4882a593Smuzhiyunpatches which use the older form of that function.  Reviewers and testers
273*4882a593Smuzhiyunwant access to the changes in their integrated form before all of those
274*4882a593Smuzhiyunchanges land in the mainline kernel.  One could pull changes from all of
275*4882a593Smuzhiyunthe interesting subsystem trees, but that would be a big and error-prone
276*4882a593Smuzhiyunjob.
277*4882a593Smuzhiyun
278*4882a593SmuzhiyunThe answer comes in the form of -next trees, where subsystem trees are
279*4882a593Smuzhiyuncollected for testing and review.  The older of these trees, maintained by
280*4882a593SmuzhiyunAndrew Morton, is called "-mm" (for memory management, which is how it got
281*4882a593Smuzhiyunstarted).  The -mm tree integrates patches from a long list of subsystem
282*4882a593Smuzhiyuntrees; it also has some patches aimed at helping with debugging.
283*4882a593Smuzhiyun
284*4882a593SmuzhiyunBeyond that, -mm contains a significant collection of patches which have
285*4882a593Smuzhiyunbeen selected by Andrew directly.  These patches may have been posted on a
286*4882a593Smuzhiyunmailing list, or they may apply to a part of the kernel for which there is
287*4882a593Smuzhiyunno designated subsystem tree.  As a result, -mm operates as a sort of
288*4882a593Smuzhiyunsubsystem tree of last resort; if there is no other obvious path for a
289*4882a593Smuzhiyunpatch into the mainline, it is likely to end up in -mm.  Miscellaneous
290*4882a593Smuzhiyunpatches which accumulate in -mm will eventually either be forwarded on to
291*4882a593Smuzhiyunan appropriate subsystem tree or be sent directly to Linus.  In a typical
292*4882a593Smuzhiyundevelopment cycle, approximately 5-10% of the patches going into the
293*4882a593Smuzhiyunmainline get there via -mm.
294*4882a593Smuzhiyun
295*4882a593SmuzhiyunThe current -mm patch is available in the "mmotm" (-mm of the moment)
296*4882a593Smuzhiyundirectory at:
297*4882a593Smuzhiyun
298*4882a593Smuzhiyun	https://www.ozlabs.org/~akpm/mmotm/
299*4882a593Smuzhiyun
300*4882a593SmuzhiyunUse of the MMOTM tree is likely to be a frustrating experience, though;
301*4882a593Smuzhiyunthere is a definite chance that it will not even compile.
302*4882a593Smuzhiyun
303*4882a593SmuzhiyunThe primary tree for next-cycle patch merging is linux-next, maintained by
304*4882a593SmuzhiyunStephen Rothwell.  The linux-next tree is, by design, a snapshot of what
305*4882a593Smuzhiyunthe mainline is expected to look like after the next merge window closes.
306*4882a593SmuzhiyunLinux-next trees are announced on the linux-kernel and linux-next mailing
307*4882a593Smuzhiyunlists when they are assembled; they can be downloaded from:
308*4882a593Smuzhiyun
309*4882a593Smuzhiyun	https://www.kernel.org/pub/linux/kernel/next/
310*4882a593Smuzhiyun
311*4882a593SmuzhiyunLinux-next has become an integral part of the kernel development process;
312*4882a593Smuzhiyunall patches merged during a given merge window should really have found
313*4882a593Smuzhiyuntheir way into linux-next some time before the merge window opens.
314*4882a593Smuzhiyun
315*4882a593Smuzhiyun
316*4882a593SmuzhiyunStaging trees
317*4882a593Smuzhiyun-------------
318*4882a593Smuzhiyun
319*4882a593SmuzhiyunThe kernel source tree contains the drivers/staging/ directory, where
320*4882a593Smuzhiyunmany sub-directories for drivers or filesystems that are on their way to
321*4882a593Smuzhiyunbeing added to the kernel tree live.  They remain in drivers/staging while
322*4882a593Smuzhiyunthey still need more work; once complete, they can be moved into the
323*4882a593Smuzhiyunkernel proper.  This is a way to keep track of drivers that aren't
324*4882a593Smuzhiyunup to Linux kernel coding or quality standards, but people may want to use
325*4882a593Smuzhiyunthem and track development.
326*4882a593Smuzhiyun
327*4882a593SmuzhiyunGreg Kroah-Hartman currently maintains the staging tree.  Drivers that
328*4882a593Smuzhiyunstill need work are sent to him, with each driver having its own
329*4882a593Smuzhiyunsubdirectory in drivers/staging/.  Along with the driver source files, a
330*4882a593SmuzhiyunTODO file should be present in the directory as well.  The TODO file lists
331*4882a593Smuzhiyunthe pending work that the driver needs for acceptance into the kernel
332*4882a593Smuzhiyunproper, as well as a list of people that should be Cc'd for any patches to
333*4882a593Smuzhiyunthe driver.  Current rules require that drivers contributed to staging
334*4882a593Smuzhiyunmust, at a minimum, compile properly.
335*4882a593Smuzhiyun
336*4882a593SmuzhiyunStaging can be a relatively easy way to get new drivers into the mainline
337*4882a593Smuzhiyunwhere, with luck, they will come to the attention of other developers and
338*4882a593Smuzhiyunimprove quickly.  Entry into staging is not the end of the story, though;
339*4882a593Smuzhiyuncode in staging which is not seeing regular progress will eventually be
340*4882a593Smuzhiyunremoved.  Distributors also tend to be relatively reluctant to enable
341*4882a593Smuzhiyunstaging drivers.  So staging is, at best, a stop on the way toward becoming
342*4882a593Smuzhiyuna proper mainline driver.
343*4882a593Smuzhiyun
344*4882a593Smuzhiyun
345*4882a593SmuzhiyunTools
346*4882a593Smuzhiyun-----
347*4882a593Smuzhiyun
348*4882a593SmuzhiyunAs can be seen from the above text, the kernel development process depends
349*4882a593Smuzhiyunheavily on the ability to herd collections of patches in various
350*4882a593Smuzhiyundirections.  The whole thing would not work anywhere near as well as it
351*4882a593Smuzhiyundoes without suitably powerful tools.  Tutorials on how to use these tools
352*4882a593Smuzhiyunare well beyond the scope of this document, but there is space for a few
353*4882a593Smuzhiyunpointers.
354*4882a593Smuzhiyun
355*4882a593SmuzhiyunBy far the dominant source code management system used by the kernel
356*4882a593Smuzhiyuncommunity is git.  Git is one of a number of distributed version control
357*4882a593Smuzhiyunsystems being developed in the free software community.  It is well tuned
358*4882a593Smuzhiyunfor kernel development, in that it performs quite well when dealing with
359*4882a593Smuzhiyunlarge repositories and large numbers of patches.  It also has a reputation
360*4882a593Smuzhiyunfor being difficult to learn and use, though it has gotten better over
361*4882a593Smuzhiyuntime.  Some sort of familiarity with git is almost a requirement for kernel
362*4882a593Smuzhiyundevelopers; even if they do not use it for their own work, they'll need git
363*4882a593Smuzhiyunto keep up with what other developers (and the mainline) are doing.
364*4882a593Smuzhiyun
365*4882a593SmuzhiyunGit is now packaged by almost all Linux distributions.  There is a home
366*4882a593Smuzhiyunpage at:
367*4882a593Smuzhiyun
368*4882a593Smuzhiyun	https://git-scm.com/
369*4882a593Smuzhiyun
370*4882a593SmuzhiyunThat page has pointers to documentation and tutorials.
371*4882a593Smuzhiyun
372*4882a593SmuzhiyunAmong the kernel developers who do not use git, the most popular choice is
373*4882a593Smuzhiyunalmost certainly Mercurial:
374*4882a593Smuzhiyun
375*4882a593Smuzhiyun	https://www.selenic.com/mercurial/
376*4882a593Smuzhiyun
377*4882a593SmuzhiyunMercurial shares many features with git, but it provides an interface which
378*4882a593Smuzhiyunmany find easier to use.
379*4882a593Smuzhiyun
380*4882a593SmuzhiyunThe other tool worth knowing about is Quilt:
381*4882a593Smuzhiyun
382*4882a593Smuzhiyun	https://savannah.nongnu.org/projects/quilt/
383*4882a593Smuzhiyun
384*4882a593SmuzhiyunQuilt is a patch management system, rather than a source code management
385*4882a593Smuzhiyunsystem.  It does not track history over time; it is, instead, oriented
386*4882a593Smuzhiyuntoward tracking a specific set of changes against an evolving code base.
387*4882a593SmuzhiyunSome major subsystem maintainers use quilt to manage patches intended to go
388*4882a593Smuzhiyunupstream.  For the management of certain kinds of trees (-mm, for example),
389*4882a593Smuzhiyunquilt is the best tool for the job.
390*4882a593Smuzhiyun
391*4882a593Smuzhiyun
392*4882a593SmuzhiyunMailing lists
393*4882a593Smuzhiyun-------------
394*4882a593Smuzhiyun
395*4882a593SmuzhiyunA great deal of Linux kernel development work is done by way of mailing
396*4882a593Smuzhiyunlists.  It is hard to be a fully-functioning member of the community
397*4882a593Smuzhiyunwithout joining at least one list somewhere.  But Linux mailing lists also
398*4882a593Smuzhiyunrepresent a potential hazard to developers, who risk getting buried under a
399*4882a593Smuzhiyunload of electronic mail, running afoul of the conventions used on the Linux
400*4882a593Smuzhiyunlists, or both.
401*4882a593Smuzhiyun
402*4882a593SmuzhiyunMost kernel mailing lists are run on vger.kernel.org; the master list can
403*4882a593Smuzhiyunbe found at:
404*4882a593Smuzhiyun
405*4882a593Smuzhiyun	http://vger.kernel.org/vger-lists.html
406*4882a593Smuzhiyun
407*4882a593SmuzhiyunThere are lists hosted elsewhere, though; a number of them are at
408*4882a593Smuzhiyunredhat.com/mailman/listinfo.
409*4882a593Smuzhiyun
410*4882a593SmuzhiyunThe core mailing list for kernel development is, of course, linux-kernel.
411*4882a593SmuzhiyunThis list is an intimidating place to be; volume can reach 500 messages per
412*4882a593Smuzhiyunday, the amount of noise is high, the conversation can be severely
413*4882a593Smuzhiyuntechnical, and participants are not always concerned with showing a high
414*4882a593Smuzhiyundegree of politeness.  But there is no other place where the kernel
415*4882a593Smuzhiyundevelopment community comes together as a whole; developers who avoid this
416*4882a593Smuzhiyunlist will miss important information.
417*4882a593Smuzhiyun
418*4882a593SmuzhiyunThere are a few hints which can help with linux-kernel survival:
419*4882a593Smuzhiyun
420*4882a593Smuzhiyun- Have the list delivered to a separate folder, rather than your main
421*4882a593Smuzhiyun  mailbox.  One must be able to ignore the stream for sustained periods of
422*4882a593Smuzhiyun  time.
423*4882a593Smuzhiyun
424*4882a593Smuzhiyun- Do not try to follow every conversation - nobody else does.  It is
425*4882a593Smuzhiyun  important to filter on both the topic of interest (though note that
426*4882a593Smuzhiyun  long-running conversations can drift away from the original subject
427*4882a593Smuzhiyun  without changing the email subject line) and the people who are
428*4882a593Smuzhiyun  participating.
429*4882a593Smuzhiyun
430*4882a593Smuzhiyun- Do not feed the trolls.  If somebody is trying to stir up an angry
431*4882a593Smuzhiyun  response, ignore them.
432*4882a593Smuzhiyun
433*4882a593Smuzhiyun- When responding to linux-kernel email (or that on other lists) preserve
434*4882a593Smuzhiyun  the Cc: header for all involved.  In the absence of a strong reason (such
435*4882a593Smuzhiyun  as an explicit request), you should never remove recipients.  Always make
436*4882a593Smuzhiyun  sure that the person you are responding to is in the Cc: list.  This
437*4882a593Smuzhiyun  convention also makes it unnecessary to explicitly ask to be copied on
438*4882a593Smuzhiyun  replies to your postings.
439*4882a593Smuzhiyun
440*4882a593Smuzhiyun- Search the list archives (and the net as a whole) before asking
441*4882a593Smuzhiyun  questions.  Some developers can get impatient with people who clearly
442*4882a593Smuzhiyun  have not done their homework.
443*4882a593Smuzhiyun
444*4882a593Smuzhiyun- Avoid top-posting (the practice of putting your answer above the quoted
445*4882a593Smuzhiyun  text you are responding to).  It makes your response harder to read and
446*4882a593Smuzhiyun  makes a poor impression.
447*4882a593Smuzhiyun
448*4882a593Smuzhiyun- Ask on the correct mailing list.  Linux-kernel may be the general meeting
449*4882a593Smuzhiyun  point, but it is not the best place to find developers from all
450*4882a593Smuzhiyun  subsystems.
451*4882a593Smuzhiyun
452*4882a593SmuzhiyunThe last point - finding the correct mailing list - is a common place for
453*4882a593Smuzhiyunbeginning developers to go wrong.  Somebody who asks a networking-related
454*4882a593Smuzhiyunquestion on linux-kernel will almost certainly receive a polite suggestion
455*4882a593Smuzhiyunto ask on the netdev list instead, as that is the list frequented by most
456*4882a593Smuzhiyunnetworking developers.  Other lists exist for the SCSI, video4linux, IDE,
457*4882a593Smuzhiyunfilesystem, etc. subsystems.  The best place to look for mailing lists is
458*4882a593Smuzhiyunin the MAINTAINERS file packaged with the kernel source.
459*4882a593Smuzhiyun
460*4882a593Smuzhiyun
461*4882a593SmuzhiyunGetting started with Kernel development
462*4882a593Smuzhiyun---------------------------------------
463*4882a593Smuzhiyun
464*4882a593SmuzhiyunQuestions about how to get started with the kernel development process are
465*4882a593Smuzhiyuncommon - from both individuals and companies.  Equally common are missteps
466*4882a593Smuzhiyunwhich make the beginning of the relationship harder than it has to be.
467*4882a593Smuzhiyun
468*4882a593SmuzhiyunCompanies often look to hire well-known developers to get a development
469*4882a593Smuzhiyungroup started.  This can, in fact, be an effective technique.  But it also
470*4882a593Smuzhiyuntends to be expensive and does not do much to grow the pool of experienced
471*4882a593Smuzhiyunkernel developers.  It is possible to bring in-house developers up to speed
472*4882a593Smuzhiyunon Linux kernel development, given the investment of a bit of time.  Taking
473*4882a593Smuzhiyunthis time can endow an employer with a group of developers who understand
474*4882a593Smuzhiyunthe kernel and the company both, and who can help to train others as well.
475*4882a593SmuzhiyunOver the medium term, this is often the more profitable approach.
476*4882a593Smuzhiyun
477*4882a593SmuzhiyunIndividual developers are often, understandably, at a loss for a place to
478*4882a593Smuzhiyunstart.  Beginning with a large project can be intimidating; one often wants
479*4882a593Smuzhiyunto test the waters with something smaller first.  This is the point where
480*4882a593Smuzhiyunsome developers jump into the creation of patches fixing spelling errors or
481*4882a593Smuzhiyunminor coding style issues.  Unfortunately, such patches create a level of
482*4882a593Smuzhiyunnoise which is distracting for the development community as a whole, so,
483*4882a593Smuzhiyunincreasingly, they are looked down upon.  New developers wishing to
484*4882a593Smuzhiyunintroduce themselves to the community will not get the sort of reception
485*4882a593Smuzhiyunthey wish for by these means.
486*4882a593Smuzhiyun
487*4882a593SmuzhiyunAndrew Morton gives this advice for aspiring kernel developers
488*4882a593Smuzhiyun
489*4882a593Smuzhiyun::
490*4882a593Smuzhiyun
491*4882a593Smuzhiyun	The #1 project for all kernel beginners should surely be "make sure
492*4882a593Smuzhiyun	that the kernel runs perfectly at all times on all machines which
493*4882a593Smuzhiyun	you can lay your hands on".  Usually the way to do this is to work
494*4882a593Smuzhiyun	with others on getting things fixed up (this can require
495*4882a593Smuzhiyun	persistence!) but that's fine - it's a part of kernel development.
496*4882a593Smuzhiyun
497*4882a593Smuzhiyun(https://lwn.net/Articles/283982/).
498*4882a593Smuzhiyun
499*4882a593SmuzhiyunIn the absence of obvious problems to fix, developers are advised to look
500*4882a593Smuzhiyunat the current lists of regressions and open bugs in general.  There is
501*4882a593Smuzhiyunnever any shortage of issues in need of fixing; by addressing these issues,
502*4882a593Smuzhiyundevelopers will gain experience with the process while, at the same time,
503*4882a593Smuzhiyunbuilding respect with the rest of the development community.
504