xref: /OK3568_Linux_fs/kernel/Documentation/process/6.Followthrough.rst (revision 4882a59341e53eb6f0b4789bf948001014eff981)
1*4882a593Smuzhiyun.. _development_followthrough:
2*4882a593Smuzhiyun
3*4882a593SmuzhiyunFollowthrough
4*4882a593Smuzhiyun=============
5*4882a593Smuzhiyun
6*4882a593SmuzhiyunAt this point, you have followed the guidelines given so far and, with the
7*4882a593Smuzhiyunaddition of your own engineering skills, have posted a perfect series of
8*4882a593Smuzhiyunpatches.  One of the biggest mistakes that even experienced kernel
9*4882a593Smuzhiyundevelopers can make is to conclude that their work is now done.  In truth,
10*4882a593Smuzhiyunposting patches indicates a transition into the next stage of the process,
11*4882a593Smuzhiyunwith, possibly, quite a bit of work yet to be done.
12*4882a593Smuzhiyun
13*4882a593SmuzhiyunIt is a rare patch which is so good at its first posting that there is no
14*4882a593Smuzhiyunroom for improvement.  The kernel development process recognizes this fact,
15*4882a593Smuzhiyunand, as a result, is heavily oriented toward the improvement of posted
16*4882a593Smuzhiyuncode.  You, as the author of that code, will be expected to work with the
17*4882a593Smuzhiyunkernel community to ensure that your code is up to the kernel's quality
18*4882a593Smuzhiyunstandards.  A failure to participate in this process is quite likely to
19*4882a593Smuzhiyunprevent the inclusion of your patches into the mainline.
20*4882a593Smuzhiyun
21*4882a593Smuzhiyun
22*4882a593SmuzhiyunWorking with reviewers
23*4882a593Smuzhiyun----------------------
24*4882a593Smuzhiyun
25*4882a593SmuzhiyunA patch of any significance will result in a number of comments from other
26*4882a593Smuzhiyundevelopers as they review the code.  Working with reviewers can be, for
27*4882a593Smuzhiyunmany developers, the most intimidating part of the kernel development
28*4882a593Smuzhiyunprocess.  Life can be made much easier, though, if you keep a few things in
29*4882a593Smuzhiyunmind:
30*4882a593Smuzhiyun
31*4882a593Smuzhiyun - If you have explained your patch well, reviewers will understand its
32*4882a593Smuzhiyun   value and why you went to the trouble of writing it.  But that value
33*4882a593Smuzhiyun   will not keep them from asking a fundamental question: what will it be
34*4882a593Smuzhiyun   like to maintain a kernel with this code in it five or ten years later?
35*4882a593Smuzhiyun   Many of the changes you may be asked to make - from coding style tweaks
36*4882a593Smuzhiyun   to substantial rewrites - come from the understanding that Linux will
37*4882a593Smuzhiyun   still be around and under development a decade from now.
38*4882a593Smuzhiyun
39*4882a593Smuzhiyun - Code review is hard work, and it is a relatively thankless occupation;
40*4882a593Smuzhiyun   people remember who wrote kernel code, but there is little lasting fame
41*4882a593Smuzhiyun   for those who reviewed it.  So reviewers can get grumpy, especially when
42*4882a593Smuzhiyun   they see the same mistakes being made over and over again.  If you get a
43*4882a593Smuzhiyun   review which seems angry, insulting, or outright offensive, resist the
44*4882a593Smuzhiyun   impulse to respond in kind.  Code review is about the code, not about
45*4882a593Smuzhiyun   the people, and code reviewers are not attacking you personally.
46*4882a593Smuzhiyun
47*4882a593Smuzhiyun - Similarly, code reviewers are not trying to promote their employers'
48*4882a593Smuzhiyun   agendas at the expense of your own.  Kernel developers often expect to
49*4882a593Smuzhiyun   be working on the kernel years from now, but they understand that their
50*4882a593Smuzhiyun   employer could change.  They truly are, almost without exception,
51*4882a593Smuzhiyun   working toward the creation of the best kernel they can; they are not
52*4882a593Smuzhiyun   trying to create discomfort for their employers' competitors.
53*4882a593Smuzhiyun
54*4882a593SmuzhiyunWhat all of this comes down to is that, when reviewers send you comments,
55*4882a593Smuzhiyunyou need to pay attention to the technical observations that they are
56*4882a593Smuzhiyunmaking.  Do not let their form of expression or your own pride keep that
57*4882a593Smuzhiyunfrom happening.  When you get review comments on a patch, take the time to
58*4882a593Smuzhiyununderstand what the reviewer is trying to say.  If possible, fix the things
59*4882a593Smuzhiyunthat the reviewer is asking you to fix.  And respond back to the reviewer:
60*4882a593Smuzhiyunthank them, and describe how you will answer their questions.
61*4882a593Smuzhiyun
62*4882a593SmuzhiyunNote that you do not have to agree with every change suggested by
63*4882a593Smuzhiyunreviewers.  If you believe that the reviewer has misunderstood your code,
64*4882a593Smuzhiyunexplain what is really going on.  If you have a technical objection to a
65*4882a593Smuzhiyunsuggested change, describe it and justify your solution to the problem.  If
66*4882a593Smuzhiyunyour explanations make sense, the reviewer will accept them.  Should your
67*4882a593Smuzhiyunexplanation not prove persuasive, though, especially if others start to
68*4882a593Smuzhiyunagree with the reviewer, take some time to think things over again.  It can
69*4882a593Smuzhiyunbe easy to become blinded by your own solution to a problem to the point
70*4882a593Smuzhiyunthat you don't realize that something is fundamentally wrong or, perhaps,
71*4882a593Smuzhiyunyou're not even solving the right problem.
72*4882a593Smuzhiyun
73*4882a593SmuzhiyunAndrew Morton has suggested that every review comment which does not result
74*4882a593Smuzhiyunin a code change should result in an additional code comment instead; that
75*4882a593Smuzhiyuncan help future reviewers avoid the questions which came up the first time
76*4882a593Smuzhiyunaround.
77*4882a593Smuzhiyun
78*4882a593SmuzhiyunOne fatal mistake is to ignore review comments in the hope that they will
79*4882a593Smuzhiyungo away.  They will not go away.  If you repost code without having
80*4882a593Smuzhiyunresponded to the comments you got the time before, you're likely to find
81*4882a593Smuzhiyunthat your patches go nowhere.
82*4882a593Smuzhiyun
83*4882a593SmuzhiyunSpeaking of reposting code: please bear in mind that reviewers are not
84*4882a593Smuzhiyungoing to remember all the details of the code you posted the last time
85*4882a593Smuzhiyunaround.  So it is always a good idea to remind reviewers of previously
86*4882a593Smuzhiyunraised issues and how you dealt with them; the patch changelog is a good
87*4882a593Smuzhiyunplace for this kind of information.  Reviewers should not have to search
88*4882a593Smuzhiyunthrough list archives to familiarize themselves with what was said last
89*4882a593Smuzhiyuntime; if you help them get a running start, they will be in a better mood
90*4882a593Smuzhiyunwhen they revisit your code.
91*4882a593Smuzhiyun
92*4882a593SmuzhiyunWhat if you've tried to do everything right and things still aren't going
93*4882a593Smuzhiyunanywhere?  Most technical disagreements can be resolved through discussion,
94*4882a593Smuzhiyunbut there are times when somebody simply has to make a decision.  If you
95*4882a593Smuzhiyunhonestly believe that this decision is going against you wrongly, you can
96*4882a593Smuzhiyunalways try appealing to a higher power.  As of this writing, that higher
97*4882a593Smuzhiyunpower tends to be Andrew Morton.  Andrew has a great deal of respect in the
98*4882a593Smuzhiyunkernel development community; he can often unjam a situation which seems to
99*4882a593Smuzhiyunbe hopelessly blocked.  Appealing to Andrew should not be done lightly,
100*4882a593Smuzhiyunthough, and not before all other alternatives have been explored.  And bear
101*4882a593Smuzhiyunin mind, of course, that he may not agree with you either.
102*4882a593Smuzhiyun
103*4882a593Smuzhiyun
104*4882a593SmuzhiyunWhat happens next
105*4882a593Smuzhiyun-----------------
106*4882a593Smuzhiyun
107*4882a593SmuzhiyunIf a patch is considered to be a good thing to add to the kernel, and once
108*4882a593Smuzhiyunmost of the review issues have been resolved, the next step is usually
109*4882a593Smuzhiyunentry into a subsystem maintainer's tree.  How that works varies from one
110*4882a593Smuzhiyunsubsystem to the next; each maintainer has his or her own way of doing
111*4882a593Smuzhiyunthings.  In particular, there may be more than one tree - one, perhaps,
112*4882a593Smuzhiyundedicated to patches planned for the next merge window, and another for
113*4882a593Smuzhiyunlonger-term work.
114*4882a593Smuzhiyun
115*4882a593SmuzhiyunFor patches applying to areas for which there is no obvious subsystem tree
116*4882a593Smuzhiyun(memory management patches, for example), the default tree often ends up
117*4882a593Smuzhiyunbeing -mm.  Patches which affect multiple subsystems can also end up going
118*4882a593Smuzhiyunthrough the -mm tree.
119*4882a593Smuzhiyun
120*4882a593SmuzhiyunInclusion into a subsystem tree can bring a higher level of visibility to a
121*4882a593Smuzhiyunpatch.  Now other developers working with that tree will get the patch by
122*4882a593Smuzhiyundefault.  Subsystem trees typically feed linux-next as well, making their
123*4882a593Smuzhiyuncontents visible to the development community as a whole.  At this point,
124*4882a593Smuzhiyunthere's a good chance that you will get more comments from a new set of
125*4882a593Smuzhiyunreviewers; these comments need to be answered as in the previous round.
126*4882a593Smuzhiyun
127*4882a593SmuzhiyunWhat may also happen at this point, depending on the nature of your patch,
128*4882a593Smuzhiyunis that conflicts with work being done by others turn up.  In the worst
129*4882a593Smuzhiyuncase, heavy patch conflicts can result in some work being put on the back
130*4882a593Smuzhiyunburner so that the remaining patches can be worked into shape and merged.
131*4882a593SmuzhiyunOther times, conflict resolution will involve working with the other
132*4882a593Smuzhiyundevelopers and, possibly, moving some patches between trees to ensure that
133*4882a593Smuzhiyuneverything applies cleanly.  This work can be a pain, but count your
134*4882a593Smuzhiyunblessings: before the advent of the linux-next tree, these conflicts often
135*4882a593Smuzhiyunonly turned up during the merge window and had to be addressed in a hurry.
136*4882a593SmuzhiyunNow they can be resolved at leisure, before the merge window opens.
137*4882a593Smuzhiyun
138*4882a593SmuzhiyunSome day, if all goes well, you'll log on and see that your patch has been
139*4882a593Smuzhiyunmerged into the mainline kernel.  Congratulations!  Once the celebration is
140*4882a593Smuzhiyuncomplete (and you have added yourself to the MAINTAINERS file), though, it
141*4882a593Smuzhiyunis worth remembering an important little fact: the job still is not done.
142*4882a593SmuzhiyunMerging into the mainline brings its own challenges.
143*4882a593Smuzhiyun
144*4882a593SmuzhiyunTo begin with, the visibility of your patch has increased yet again.  There
145*4882a593Smuzhiyunmay be a new round of comments from developers who had not been aware of
146*4882a593Smuzhiyunthe patch before.  It may be tempting to ignore them, since there is no
147*4882a593Smuzhiyunlonger any question of your code being merged.  Resist that temptation,
148*4882a593Smuzhiyunthough; you still need to be responsive to developers who have questions or
149*4882a593Smuzhiyunsuggestions.
150*4882a593Smuzhiyun
151*4882a593SmuzhiyunMore importantly, though: inclusion into the mainline puts your code into
152*4882a593Smuzhiyunthe hands of a much larger group of testers.  Even if you have contributed
153*4882a593Smuzhiyuna driver for hardware which is not yet available, you will be surprised by
154*4882a593Smuzhiyunhow many people will build your code into their kernels.  And, of course,
155*4882a593Smuzhiyunwhere there are testers, there will be bug reports.
156*4882a593Smuzhiyun
157*4882a593SmuzhiyunThe worst sort of bug reports are regressions.  If your patch causes a
158*4882a593Smuzhiyunregression, you'll find an uncomfortable number of eyes upon you;
159*4882a593Smuzhiyunregressions need to be fixed as soon as possible.  If you are unwilling or
160*4882a593Smuzhiyununable to fix the regression (and nobody else does it for you), your patch
161*4882a593Smuzhiyunwill almost certainly be removed during the stabilization period.  Beyond
162*4882a593Smuzhiyunnegating all of the work you have done to get your patch into the mainline,
163*4882a593Smuzhiyunhaving a patch pulled as the result of a failure to fix a regression could
164*4882a593Smuzhiyunwell make it harder for you to get work merged in the future.
165*4882a593Smuzhiyun
166*4882a593SmuzhiyunAfter any regressions have been dealt with, there may be other, ordinary
167*4882a593Smuzhiyunbugs to deal with.  The stabilization period is your best opportunity to
168*4882a593Smuzhiyunfix these bugs and ensure that your code's debut in a mainline kernel
169*4882a593Smuzhiyunrelease is as solid as possible.  So, please, answer bug reports, and fix
170*4882a593Smuzhiyunthe problems if at all possible.  That's what the stabilization period is
171*4882a593Smuzhiyunfor; you can start creating cool new patches once any problems with the old
172*4882a593Smuzhiyunones have been taken care of.
173*4882a593Smuzhiyun
174*4882a593SmuzhiyunAnd don't forget that there are other milestones which may also create bug
175*4882a593Smuzhiyunreports: the next mainline stable release, when prominent distributors pick
176*4882a593Smuzhiyunup a version of the kernel containing your patch, etc.  Continuing to
177*4882a593Smuzhiyunrespond to these reports is a matter of basic pride in your work.  If that
178*4882a593Smuzhiyunis insufficient motivation, though, it's also worth considering that the
179*4882a593Smuzhiyundevelopment community remembers developers who lose interest in their code
180*4882a593Smuzhiyunafter it's merged.  The next time you post a patch, they will be evaluating
181*4882a593Smuzhiyunit with the assumption that you will not be around to maintain it
182*4882a593Smuzhiyunafterward.
183*4882a593Smuzhiyun
184*4882a593Smuzhiyun
185*4882a593SmuzhiyunOther things that can happen
186*4882a593Smuzhiyun-----------------------------
187*4882a593Smuzhiyun
188*4882a593SmuzhiyunOne day, you may open your mail client and see that somebody has mailed you
189*4882a593Smuzhiyuna patch to your code.  That is one of the advantages of having your code
190*4882a593Smuzhiyunout there in the open, after all.  If you agree with the patch, you can
191*4882a593Smuzhiyuneither forward it on to the subsystem maintainer (be sure to include a
192*4882a593Smuzhiyunproper From: line so that the attribution is correct, and add a signoff of
193*4882a593Smuzhiyunyour own), or send an Acked-by: response back and let the original poster
194*4882a593Smuzhiyunsend it upward.
195*4882a593Smuzhiyun
196*4882a593SmuzhiyunIf you disagree with the patch, send a polite response explaining why.  If
197*4882a593Smuzhiyunpossible, tell the author what changes need to be made to make the patch
198*4882a593Smuzhiyunacceptable to you.  There is a certain resistance to merging patches which
199*4882a593Smuzhiyunare opposed by the author and maintainer of the code, but it only goes so
200*4882a593Smuzhiyunfar.  If you are seen as needlessly blocking good work, those patches will
201*4882a593Smuzhiyuneventually flow around you and get into the mainline anyway.  In the Linux
202*4882a593Smuzhiyunkernel, nobody has absolute veto power over any code.  Except maybe Linus.
203*4882a593Smuzhiyun
204*4882a593SmuzhiyunOn very rare occasion, you may see something completely different: another
205*4882a593Smuzhiyundeveloper posts a different solution to your problem.  At that point,
206*4882a593Smuzhiyunchances are that one of the two patches will not be merged, and "mine was
207*4882a593Smuzhiyunhere first" is not considered to be a compelling technical argument.  If
208*4882a593Smuzhiyunsomebody else's patch displaces yours and gets into the mainline, there is
209*4882a593Smuzhiyunreally only one way to respond: be pleased that your problem got solved and
210*4882a593Smuzhiyunget on with your work.  Having one's work shoved aside in this manner can
211*4882a593Smuzhiyunbe hurtful and discouraging, but the community will remember your reaction
212*4882a593Smuzhiyunlong after they have forgotten whose patch actually got merged.
213