1*31c9d7c8SThomas Gleixner.. SPDX-License-Identifier: GPL-2.0
2*31c9d7c8SThomas Gleixner
3*31c9d7c8SThomas GleixnerThe tip tree handbook
4*31c9d7c8SThomas Gleixner=====================
5*31c9d7c8SThomas Gleixner
6*31c9d7c8SThomas GleixnerWhat is the tip tree?
7*31c9d7c8SThomas Gleixner---------------------
8*31c9d7c8SThomas Gleixner
9*31c9d7c8SThomas GleixnerThe tip tree is a collection of several subsystems and areas of
10*31c9d7c8SThomas Gleixnerdevelopment. The tip tree is both a direct development tree and a
11*31c9d7c8SThomas Gleixneraggregation tree for several sub-maintainer trees. The tip tree gitweb URL
12*31c9d7c8SThomas Gleixneris: https://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git
13*31c9d7c8SThomas Gleixner
14*31c9d7c8SThomas GleixnerThe tip tree contains the following subsystems:
15*31c9d7c8SThomas Gleixner
16*31c9d7c8SThomas Gleixner   - **x86 architecture**
17*31c9d7c8SThomas Gleixner
18*31c9d7c8SThomas Gleixner     The x86 architecture development takes place in the tip tree except
19*31c9d7c8SThomas Gleixner     for the x86 KVM and XEN specific parts which are maintained in the
20*31c9d7c8SThomas Gleixner     corresponding subsystems and routed directly to mainline from
21*31c9d7c8SThomas Gleixner     there. It's still good practice to Cc the x86 maintainers on
22*31c9d7c8SThomas Gleixner     x86-specific KVM and XEN patches.
23*31c9d7c8SThomas Gleixner
24*31c9d7c8SThomas Gleixner     Some x86 subsystems have their own maintainers in addition to the
25*31c9d7c8SThomas Gleixner     overall x86 maintainers.  Please Cc the overall x86 maintainers on
26*31c9d7c8SThomas Gleixner     patches touching files in arch/x86 even when they are not called out
27*31c9d7c8SThomas Gleixner     by the MAINTAINER file.
28*31c9d7c8SThomas Gleixner
29*31c9d7c8SThomas Gleixner     Note, that ``x86@kernel.org`` is not a mailing list. It is merely a
30*31c9d7c8SThomas Gleixner     mail alias which distributes mails to the x86 top-level maintainer
31*31c9d7c8SThomas Gleixner     team. Please always Cc the Linux Kernel mailing list (LKML)
32*31c9d7c8SThomas Gleixner     ``linux-kernel@vger.kernel.org``, otherwise your mail ends up only in
33*31c9d7c8SThomas Gleixner     the private inboxes of the maintainers.
34*31c9d7c8SThomas Gleixner
35*31c9d7c8SThomas Gleixner   - **Scheduler**
36*31c9d7c8SThomas Gleixner
37*31c9d7c8SThomas Gleixner     Scheduler development takes place in the -tip tree, in the
38*31c9d7c8SThomas Gleixner     sched/core branch - with occasional sub-topic trees for
39*31c9d7c8SThomas Gleixner     work-in-progress patch-sets.
40*31c9d7c8SThomas Gleixner
41*31c9d7c8SThomas Gleixner   - **Locking and atomics**
42*31c9d7c8SThomas Gleixner
43*31c9d7c8SThomas Gleixner     Locking development (including atomics and other synchronization
44*31c9d7c8SThomas Gleixner     primitives that are connected to locking) takes place in the -tip
45*31c9d7c8SThomas Gleixner     tree, in the locking/core branch - with occasional sub-topic trees
46*31c9d7c8SThomas Gleixner     for work-in-progress patch-sets.
47*31c9d7c8SThomas Gleixner
48*31c9d7c8SThomas Gleixner   - **Generic interrupt subsystem and interrupt chip drivers**:
49*31c9d7c8SThomas Gleixner
50*31c9d7c8SThomas Gleixner     - interrupt core development happens in the irq/core branch
51*31c9d7c8SThomas Gleixner
52*31c9d7c8SThomas Gleixner     - interrupt chip driver development also happens in the irq/core
53*31c9d7c8SThomas Gleixner       branch, but the patches are usually applied in a separate maintainer
54*31c9d7c8SThomas Gleixner       tree and then aggregated into irq/core
55*31c9d7c8SThomas Gleixner
56*31c9d7c8SThomas Gleixner   - **Time, timers, timekeeping, NOHZ and related chip drivers**:
57*31c9d7c8SThomas Gleixner
58*31c9d7c8SThomas Gleixner     - timekeeping, clocksource core, NTP and alarmtimer development
59*31c9d7c8SThomas Gleixner       happens in the timers/core branch, but patches are usually applied in
60*31c9d7c8SThomas Gleixner       a separate maintainer tree and then aggregated into timers/core
61*31c9d7c8SThomas Gleixner
62*31c9d7c8SThomas Gleixner     - clocksource/event driver development happens in the timers/core
63*31c9d7c8SThomas Gleixner       branch, but patches are mostly applied in a separate maintainer tree
64*31c9d7c8SThomas Gleixner       and then aggregated into timers/core
65*31c9d7c8SThomas Gleixner
66*31c9d7c8SThomas Gleixner   - **Performance counters core, architecture support and tooling**:
67*31c9d7c8SThomas Gleixner
68*31c9d7c8SThomas Gleixner     - perf core and architecture support development happens in the
69*31c9d7c8SThomas Gleixner       perf/core branch
70*31c9d7c8SThomas Gleixner
71*31c9d7c8SThomas Gleixner     - perf tooling development happens in the perf tools maintainer
72*31c9d7c8SThomas Gleixner       tree and is aggregated into the tip tree.
73*31c9d7c8SThomas Gleixner
74*31c9d7c8SThomas Gleixner   - **CPU hotplug core**
75*31c9d7c8SThomas Gleixner
76*31c9d7c8SThomas Gleixner   - **RAS core**
77*31c9d7c8SThomas Gleixner
78*31c9d7c8SThomas Gleixner     Mostly x86-specific RAS patches are collected in the tip ras/core
79*31c9d7c8SThomas Gleixner     branch.
80*31c9d7c8SThomas Gleixner
81*31c9d7c8SThomas Gleixner   - **EFI core**
82*31c9d7c8SThomas Gleixner
83*31c9d7c8SThomas Gleixner     EFI development in the efi git tree. The collected patches are
84*31c9d7c8SThomas Gleixner     aggregated in the tip efi/core branch.
85*31c9d7c8SThomas Gleixner
86*31c9d7c8SThomas Gleixner   - **RCU**
87*31c9d7c8SThomas Gleixner
88*31c9d7c8SThomas Gleixner     RCU development happens in the linux-rcu tree. The resulting changes
89*31c9d7c8SThomas Gleixner     are aggregated into the tip core/rcu branch.
90*31c9d7c8SThomas Gleixner
91*31c9d7c8SThomas Gleixner   - **Various core code components**:
92*31c9d7c8SThomas Gleixner
93*31c9d7c8SThomas Gleixner       - debugobjects
94*31c9d7c8SThomas Gleixner
95*31c9d7c8SThomas Gleixner       - objtool
96*31c9d7c8SThomas Gleixner
97*31c9d7c8SThomas Gleixner       - random bits and pieces
98*31c9d7c8SThomas Gleixner
99*31c9d7c8SThomas Gleixner
100*31c9d7c8SThomas GleixnerPatch submission notes
101*31c9d7c8SThomas Gleixner----------------------
102*31c9d7c8SThomas Gleixner
103*31c9d7c8SThomas GleixnerSelecting the tree/branch
104*31c9d7c8SThomas Gleixner^^^^^^^^^^^^^^^^^^^^^^^^^
105*31c9d7c8SThomas Gleixner
106*31c9d7c8SThomas GleixnerIn general, development against the head of the tip tree master branch is
107*31c9d7c8SThomas Gleixnerfine, but for the subsystems which are maintained separately, have their
108*31c9d7c8SThomas Gleixnerown git tree and are only aggregated into the tip tree, development should
109*31c9d7c8SThomas Gleixnertake place against the relevant subsystem tree or branch.
110*31c9d7c8SThomas Gleixner
111*31c9d7c8SThomas GleixnerBug fixes which target mainline should always be applicable against the
112*31c9d7c8SThomas Gleixnermainline kernel tree. Potential conflicts against changes which are already
113*31c9d7c8SThomas Gleixnerqueued in the tip tree are handled by the maintainers.
114*31c9d7c8SThomas Gleixner
115*31c9d7c8SThomas GleixnerPatch subject
116*31c9d7c8SThomas Gleixner^^^^^^^^^^^^^
117*31c9d7c8SThomas Gleixner
118*31c9d7c8SThomas GleixnerThe tip tree preferred format for patch subject prefixes is
119*31c9d7c8SThomas Gleixner'subsys/component:', e.g. 'x86/apic:', 'x86/mm/fault:', 'sched/fair:',
120*31c9d7c8SThomas Gleixner'genirq/core:'. Please do not use file names or complete file paths as
121*31c9d7c8SThomas Gleixnerprefix. 'git log path/to/file' should give you a reasonable hint in most
122*31c9d7c8SThomas Gleixnercases.
123*31c9d7c8SThomas Gleixner
124*31c9d7c8SThomas GleixnerThe condensed patch description in the subject line should start with a
125*31c9d7c8SThomas Gleixneruppercase letter and should be written in imperative tone.
126*31c9d7c8SThomas Gleixner
127*31c9d7c8SThomas Gleixner
128*31c9d7c8SThomas GleixnerChangelog
129*31c9d7c8SThomas Gleixner^^^^^^^^^
130*31c9d7c8SThomas Gleixner
131*31c9d7c8SThomas GleixnerThe general rules about changelogs in the process documentation, see
132*31c9d7c8SThomas Gleixner:ref:`Documentation/process/ <submittingpatches>`, apply.
133*31c9d7c8SThomas Gleixner
134*31c9d7c8SThomas GleixnerThe tip tree maintainers set value on following these rules, especially on
135*31c9d7c8SThomas Gleixnerthe request to write changelogs in imperative mood and not impersonating
136*31c9d7c8SThomas Gleixnercode or the execution of it. This is not just a whim of the
137*31c9d7c8SThomas Gleixnermaintainers. Changelogs written in abstract words are more precise and
138*31c9d7c8SThomas Gleixnertend to be less confusing than those written in the form of novels.
139*31c9d7c8SThomas Gleixner
140*31c9d7c8SThomas GleixnerIt's also useful to structure the changelog into several paragraphs and not
141*31c9d7c8SThomas Gleixnerlump everything together into a single one. A good structure is to explain
142*31c9d7c8SThomas Gleixnerthe context, the problem and the solution in separate paragraphs and this
143*31c9d7c8SThomas Gleixnerorder.
144*31c9d7c8SThomas Gleixner
145*31c9d7c8SThomas GleixnerExamples for illustration:
146*31c9d7c8SThomas Gleixner
147*31c9d7c8SThomas Gleixner  Example 1::
148*31c9d7c8SThomas Gleixner
149*31c9d7c8SThomas Gleixner    x86/intel_rdt/mbm: Fix MBM overflow handler during hot cpu
150*31c9d7c8SThomas Gleixner
151*31c9d7c8SThomas Gleixner    When a CPU is dying, we cancel the worker and schedule a new worker on a
152*31c9d7c8SThomas Gleixner    different CPU on the same domain. But if the timer is already about to
153*31c9d7c8SThomas Gleixner    expire (say 0.99s) then we essentially double the interval.
154*31c9d7c8SThomas Gleixner
155*31c9d7c8SThomas Gleixner    We modify the hot cpu handling to cancel the delayed work on the dying
156*31c9d7c8SThomas Gleixner    cpu and run the worker immediately on a different cpu in same domain. We
157*31c9d7c8SThomas Gleixner    donot flush the worker because the MBM overflow worker reschedules the
158*31c9d7c8SThomas Gleixner    worker on same CPU and scans the domain->cpu_mask to get the domain
159*31c9d7c8SThomas Gleixner    pointer.
160*31c9d7c8SThomas Gleixner
161*31c9d7c8SThomas Gleixner  Improved version::
162*31c9d7c8SThomas Gleixner
163*31c9d7c8SThomas Gleixner    x86/intel_rdt/mbm: Fix MBM overflow handler during CPU hotplug
164*31c9d7c8SThomas Gleixner
165*31c9d7c8SThomas Gleixner    When a CPU is dying, the overflow worker is canceled and rescheduled on a
166*31c9d7c8SThomas Gleixner    different CPU in the same domain. But if the timer is already about to
167*31c9d7c8SThomas Gleixner    expire this essentially doubles the interval which might result in a non
168*31c9d7c8SThomas Gleixner    detected overflow.
169*31c9d7c8SThomas Gleixner
170*31c9d7c8SThomas Gleixner    Cancel the overflow worker and reschedule it immediately on a different CPU
171*31c9d7c8SThomas Gleixner    in the same domain. The work could be flushed as well, but that would
172*31c9d7c8SThomas Gleixner    reschedule it on the same CPU.
173*31c9d7c8SThomas Gleixner
174*31c9d7c8SThomas Gleixner  Example 2::
175*31c9d7c8SThomas Gleixner
176*31c9d7c8SThomas Gleixner    time: POSIX CPU timers: Ensure that variable is initialized
177*31c9d7c8SThomas Gleixner
178*31c9d7c8SThomas Gleixner    If cpu_timer_sample_group returns -EINVAL, it will not have written into
179*31c9d7c8SThomas Gleixner    *sample. Checking for cpu_timer_sample_group's return value precludes the
180*31c9d7c8SThomas Gleixner    potential use of an uninitialized value of now in the following block.
181*31c9d7c8SThomas Gleixner    Given an invalid clock_idx, the previous code could otherwise overwrite
182*31c9d7c8SThomas Gleixner    *oldval in an undefined manner. This is now prevented. We also exploit
183*31c9d7c8SThomas Gleixner    short-circuiting of && to sample the timer only if the result will
184*31c9d7c8SThomas Gleixner    actually be used to update *oldval.
185*31c9d7c8SThomas Gleixner
186*31c9d7c8SThomas Gleixner  Improved version::
187*31c9d7c8SThomas Gleixner
188*31c9d7c8SThomas Gleixner    posix-cpu-timers: Make set_process_cpu_timer() more robust
189*31c9d7c8SThomas Gleixner
190*31c9d7c8SThomas Gleixner    Because the return value of cpu_timer_sample_group() is not checked,
191*31c9d7c8SThomas Gleixner    compilers and static checkers can legitimately warn about a potential use
192*31c9d7c8SThomas Gleixner    of the uninitialized variable 'now'. This is not a runtime issue as all
193*31c9d7c8SThomas Gleixner    call sites hand in valid clock ids.
194*31c9d7c8SThomas Gleixner
195*31c9d7c8SThomas Gleixner    Also cpu_timer_sample_group() is invoked unconditionally even when the
196*31c9d7c8SThomas Gleixner    result is not used because *oldval is NULL.
197*31c9d7c8SThomas Gleixner
198*31c9d7c8SThomas Gleixner    Make the invocation conditional and check the return value.
199*31c9d7c8SThomas Gleixner
200*31c9d7c8SThomas Gleixner  Example 3::
201*31c9d7c8SThomas Gleixner
202*31c9d7c8SThomas Gleixner    The entity can also be used for other purposes.
203*31c9d7c8SThomas Gleixner
204*31c9d7c8SThomas Gleixner    Let's rename it to be more generic.
205*31c9d7c8SThomas Gleixner
206*31c9d7c8SThomas Gleixner  Improved version::
207*31c9d7c8SThomas Gleixner
208*31c9d7c8SThomas Gleixner    The entity can also be used for other purposes.
209*31c9d7c8SThomas Gleixner
210*31c9d7c8SThomas Gleixner    Rename it to be more generic.
211*31c9d7c8SThomas Gleixner
212*31c9d7c8SThomas Gleixner
213*31c9d7c8SThomas GleixnerFor complex scenarios, especially race conditions and memory ordering
214*31c9d7c8SThomas Gleixnerissues, it is valuable to depict the scenario with a table which shows
215*31c9d7c8SThomas Gleixnerthe parallelism and the temporal order of events. Here is an example::
216*31c9d7c8SThomas Gleixner
217*31c9d7c8SThomas Gleixner    CPU0                            CPU1
218*31c9d7c8SThomas Gleixner    free_irq(X)                     interrupt X
219*31c9d7c8SThomas Gleixner                                    spin_lock(desc->lock)
220*31c9d7c8SThomas Gleixner                                    wake irq thread()
221*31c9d7c8SThomas Gleixner                                    spin_unlock(desc->lock)
222*31c9d7c8SThomas Gleixner    spin_lock(desc->lock)
223*31c9d7c8SThomas Gleixner    remove action()
224*31c9d7c8SThomas Gleixner    shutdown_irq()
225*31c9d7c8SThomas Gleixner    release_resources()             thread_handler()
226*31c9d7c8SThomas Gleixner    spin_unlock(desc->lock)           access released resources.
227*31c9d7c8SThomas Gleixner                                      ^^^^^^^^^^^^^^^^^^^^^^^^^
228*31c9d7c8SThomas Gleixner    synchronize_irq()
229*31c9d7c8SThomas Gleixner
230*31c9d7c8SThomas GleixnerLockdep provides similar useful output to depict a possible deadlock
231*31c9d7c8SThomas Gleixnerscenario::
232*31c9d7c8SThomas Gleixner
233*31c9d7c8SThomas Gleixner    CPU0                                    CPU1
234*31c9d7c8SThomas Gleixner    rtmutex_lock(&rcu->rt_mutex)
235*31c9d7c8SThomas Gleixner      spin_lock(&rcu->rt_mutex.wait_lock)
236*31c9d7c8SThomas Gleixner                                            local_irq_disable()
237*31c9d7c8SThomas Gleixner                                            spin_lock(&timer->it_lock)
238*31c9d7c8SThomas Gleixner                                            spin_lock(&rcu->mutex.wait_lock)
239*31c9d7c8SThomas Gleixner    --> Interrupt
240*31c9d7c8SThomas Gleixner        spin_lock(&timer->it_lock)
241*31c9d7c8SThomas Gleixner
242*31c9d7c8SThomas Gleixner
243*31c9d7c8SThomas GleixnerFunction references in changelogs
244*31c9d7c8SThomas Gleixner^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
245*31c9d7c8SThomas Gleixner
246*31c9d7c8SThomas GleixnerWhen a function is mentioned in the changelog, either the text body or the
247*31c9d7c8SThomas Gleixnersubject line, please use the format 'function_name()'. Omitting the
248*31c9d7c8SThomas Gleixnerbrackets after the function name can be ambiguous::
249*31c9d7c8SThomas Gleixner
250*31c9d7c8SThomas Gleixner  Subject: subsys/component: Make reservation_count static
251*31c9d7c8SThomas Gleixner
252*31c9d7c8SThomas Gleixner  reservation_count is only used in reservation_stats. Make it static.
253*31c9d7c8SThomas Gleixner
254*31c9d7c8SThomas GleixnerThe variant with brackets is more precise::
255*31c9d7c8SThomas Gleixner
256*31c9d7c8SThomas Gleixner  Subject: subsys/component: Make reservation_count() static
257*31c9d7c8SThomas Gleixner
258*31c9d7c8SThomas Gleixner  reservation_count() is only called from reservation_stats(). Make it
259*31c9d7c8SThomas Gleixner  static.
260*31c9d7c8SThomas Gleixner
261*31c9d7c8SThomas Gleixner
262*31c9d7c8SThomas GleixnerBacktraces in changelogs
263*31c9d7c8SThomas Gleixner^^^^^^^^^^^^^^^^^^^^^^^^
264*31c9d7c8SThomas Gleixner
265*31c9d7c8SThomas GleixnerSee :ref:`backtraces`.
266*31c9d7c8SThomas Gleixner
267*31c9d7c8SThomas GleixnerOrdering of commit tags
268*31c9d7c8SThomas Gleixner^^^^^^^^^^^^^^^^^^^^^^^
269*31c9d7c8SThomas Gleixner
270*31c9d7c8SThomas GleixnerTo have a uniform view of the commit tags, the tip maintainers use the
271*31c9d7c8SThomas Gleixnerfollowing tag ordering scheme:
272*31c9d7c8SThomas Gleixner
273*31c9d7c8SThomas Gleixner - Fixes: 12char-SHA1 ("sub/sys: Original subject line")
274*31c9d7c8SThomas Gleixner
275*31c9d7c8SThomas Gleixner   A Fixes tag should be added even for changes which do not need to be
276*31c9d7c8SThomas Gleixner   backported to stable kernels, i.e. when addressing a recently introduced
277*31c9d7c8SThomas Gleixner   issue which only affects tip or the current head of mainline. These tags
278*31c9d7c8SThomas Gleixner   are helpful to identify the original commit and are much more valuable
279*31c9d7c8SThomas Gleixner   than prominently mentioning the commit which introduced a problem in the
280*31c9d7c8SThomas Gleixner   text of the changelog itself because they can be automatically
281*31c9d7c8SThomas Gleixner   extracted.
282*31c9d7c8SThomas Gleixner
283*31c9d7c8SThomas Gleixner   The following example illustrates the difference::
284*31c9d7c8SThomas Gleixner
285*31c9d7c8SThomas Gleixner     Commit
286*31c9d7c8SThomas Gleixner
287*31c9d7c8SThomas Gleixner       abcdef012345678 ("x86/xxx: Replace foo with bar")
288*31c9d7c8SThomas Gleixner
289*31c9d7c8SThomas Gleixner     left an unused instance of variable foo around. Remove it.
290*31c9d7c8SThomas Gleixner
291*31c9d7c8SThomas Gleixner     Signed-off-by: J.Dev <j.dev@mail>
292*31c9d7c8SThomas Gleixner
293*31c9d7c8SThomas Gleixner   Please say instead::
294*31c9d7c8SThomas Gleixner
295*31c9d7c8SThomas Gleixner     The recent replacement of foo with bar left an unused instance of
296*31c9d7c8SThomas Gleixner     variable foo around. Remove it.
297*31c9d7c8SThomas Gleixner
298*31c9d7c8SThomas Gleixner     Fixes: abcdef012345678 ("x86/xxx: Replace foo with bar")
299*31c9d7c8SThomas Gleixner     Signed-off-by: J.Dev <j.dev@mail>
300*31c9d7c8SThomas Gleixner
301*31c9d7c8SThomas Gleixner   The latter puts the information about the patch into the focus and
302*31c9d7c8SThomas Gleixner   amends it with the reference to the commit which introduced the issue
303*31c9d7c8SThomas Gleixner   rather than putting the focus on the original commit in the first place.
304*31c9d7c8SThomas Gleixner
305*31c9d7c8SThomas Gleixner - Reported-by: ``Reporter <reporter@mail>``
306*31c9d7c8SThomas Gleixner
307*31c9d7c8SThomas Gleixner - Originally-by: ``Original author <original-author@mail>``
308*31c9d7c8SThomas Gleixner
309*31c9d7c8SThomas Gleixner - Suggested-by: ``Suggester <suggester@mail>``
310*31c9d7c8SThomas Gleixner
311*31c9d7c8SThomas Gleixner - Co-developed-by: ``Co-author <co-author@mail>``
312*31c9d7c8SThomas Gleixner
313*31c9d7c8SThomas Gleixner   Signed-off: ``Co-author <co-author@mail>``
314*31c9d7c8SThomas Gleixner
315*31c9d7c8SThomas Gleixner   Note, that Co-developed-by and Signed-off-by of the co-author(s) must
316*31c9d7c8SThomas Gleixner   come in pairs.
317*31c9d7c8SThomas Gleixner
318*31c9d7c8SThomas Gleixner - Signed-off-by: ``Author <author@mail>``
319*31c9d7c8SThomas Gleixner
320*31c9d7c8SThomas Gleixner   The first Signed-off-by (SOB) after the last Co-developed-by/SOB pair is the
321*31c9d7c8SThomas Gleixner   author SOB, i.e. the person flagged as author by git.
322*31c9d7c8SThomas Gleixner
323*31c9d7c8SThomas Gleixner - Signed-off-by: ``Patch handler <handler@mail>``
324*31c9d7c8SThomas Gleixner
325*31c9d7c8SThomas Gleixner   SOBs after the author SOB are from people handling and transporting
326*31c9d7c8SThomas Gleixner   the patch, but were not involved in development. SOB chains should
327*31c9d7c8SThomas Gleixner   reflect the **real** route a patch took as it was propagated to us,
328*31c9d7c8SThomas Gleixner   with the first SOB entry signalling primary authorship of a single
329*31c9d7c8SThomas Gleixner   author. Acks should be given as Acked-by lines and review approvals
330*31c9d7c8SThomas Gleixner   as Reviewed-by lines.
331*31c9d7c8SThomas Gleixner
332*31c9d7c8SThomas Gleixner   If the handler made modifications to the patch or the changelog, then
333*31c9d7c8SThomas Gleixner   this should be mentioned **after** the changelog text and **above**
334*31c9d7c8SThomas Gleixner   all commit tags in the following format::
335*31c9d7c8SThomas Gleixner
336*31c9d7c8SThomas Gleixner     ... changelog text ends.
337*31c9d7c8SThomas Gleixner
338*31c9d7c8SThomas Gleixner     [ handler: Replaced foo by bar and updated changelog ]
339*31c9d7c8SThomas Gleixner
340*31c9d7c8SThomas Gleixner     First-tag: .....
341*31c9d7c8SThomas Gleixner
342*31c9d7c8SThomas Gleixner   Note the two empty new lines which separate the changelog text and the
343*31c9d7c8SThomas Gleixner   commit tags from that notice.
344*31c9d7c8SThomas Gleixner
345*31c9d7c8SThomas Gleixner   If a patch is sent to the mailing list by a handler then the author has
346*31c9d7c8SThomas Gleixner   to be noted in the first line of the changelog with::
347*31c9d7c8SThomas Gleixner
348*31c9d7c8SThomas Gleixner     From: Author <author@mail>
349*31c9d7c8SThomas Gleixner
350*31c9d7c8SThomas Gleixner     Changelog text starts here....
351*31c9d7c8SThomas Gleixner
352*31c9d7c8SThomas Gleixner   so the authorship is preserved. The 'From:' line has to be followed
353*31c9d7c8SThomas Gleixner   by a empty newline. If that 'From:' line is missing, then the patch
354*31c9d7c8SThomas Gleixner   would be attributed to the person who sent (transported, handled) it.
355*31c9d7c8SThomas Gleixner   The 'From:' line is automatically removed when the patch is applied
356*31c9d7c8SThomas Gleixner   and does not show up in the final git changelog. It merely affects
357*31c9d7c8SThomas Gleixner   the authorship information of the resulting Git commit.
358*31c9d7c8SThomas Gleixner
359*31c9d7c8SThomas Gleixner - Tested-by: ``Tester <tester@mail>``
360*31c9d7c8SThomas Gleixner
361*31c9d7c8SThomas Gleixner - Reviewed-by: ``Reviewer <reviewer@mail>``
362*31c9d7c8SThomas Gleixner
363*31c9d7c8SThomas Gleixner - Acked-by: ``Acker <acker@mail>``
364*31c9d7c8SThomas Gleixner
365*31c9d7c8SThomas Gleixner - Cc: ``cc-ed-person <person@mail>``
366*31c9d7c8SThomas Gleixner
367*31c9d7c8SThomas Gleixner   If the patch should be backported to stable, then please add a '``Cc:
368*31c9d7c8SThomas Gleixner   stable@vger.kernel.org``' tag, but do not Cc stable when sending your
369*31c9d7c8SThomas Gleixner   mail.
370*31c9d7c8SThomas Gleixner
371*31c9d7c8SThomas Gleixner - Link: ``https://link/to/information``
372*31c9d7c8SThomas Gleixner
373*31c9d7c8SThomas Gleixner   For referring to an email on LKML or other kernel mailing lists,
374*31c9d7c8SThomas Gleixner   please use the lkml.kernel.org redirector URL::
375*31c9d7c8SThomas Gleixner
376*31c9d7c8SThomas Gleixner     https://lkml.kernel.org/r/email-message@id
377*31c9d7c8SThomas Gleixner
378*31c9d7c8SThomas Gleixner   The kernel.org redirector is considered a stable URL, unlike other email
379*31c9d7c8SThomas Gleixner   archives.
380*31c9d7c8SThomas Gleixner
381*31c9d7c8SThomas Gleixner   Maintainers will add a Link tag referencing the email of the patch
382*31c9d7c8SThomas Gleixner   submission when they apply a patch to the tip tree. This tag is useful
383*31c9d7c8SThomas Gleixner   for later reference and is also used for commit notifications.
384*31c9d7c8SThomas Gleixner
385*31c9d7c8SThomas GleixnerPlease do not use combined tags, e.g. ``Reported-and-tested-by``, as
386*31c9d7c8SThomas Gleixnerthey just complicate automated extraction of tags.
387*31c9d7c8SThomas Gleixner
388*31c9d7c8SThomas Gleixner
389*31c9d7c8SThomas GleixnerLinks to documentation
390*31c9d7c8SThomas Gleixner^^^^^^^^^^^^^^^^^^^^^^
391*31c9d7c8SThomas Gleixner
392*31c9d7c8SThomas GleixnerProviding links to documentation in the changelog is a great help to later
393*31c9d7c8SThomas Gleixnerdebugging and analysis.  Unfortunately, URLs often break very quickly
394*31c9d7c8SThomas Gleixnerbecause companies restructure their websites frequently.  Non-'volatile'
395*31c9d7c8SThomas Gleixnerexceptions include the Intel SDM and the AMD APM.
396*31c9d7c8SThomas Gleixner
397*31c9d7c8SThomas GleixnerTherefore, for 'volatile' documents, please create an entry in the kernel
398*31c9d7c8SThomas Gleixnerbugzilla https://bugzilla.kernel.org and attach a copy of these documents
399*31c9d7c8SThomas Gleixnerto the bugzilla entry. Finally, provide the URL of the bugzilla entry in
400*31c9d7c8SThomas Gleixnerthe changelog.
401*31c9d7c8SThomas Gleixner
402*31c9d7c8SThomas GleixnerPatch resend or reminders
403*31c9d7c8SThomas Gleixner^^^^^^^^^^^^^^^^^^^^^^^^^
404*31c9d7c8SThomas Gleixner
405*31c9d7c8SThomas GleixnerSee :ref:`resend_reminders`.
406*31c9d7c8SThomas Gleixner
407*31c9d7c8SThomas GleixnerMerge window
408*31c9d7c8SThomas Gleixner^^^^^^^^^^^^
409*31c9d7c8SThomas Gleixner
410*31c9d7c8SThomas GleixnerPlease do not expect large patch series to be handled during the merge
411*31c9d7c8SThomas Gleixnerwindow or even during the week before.  Such patches should be submitted in
412*31c9d7c8SThomas Gleixnermergeable state *at* *least* a week before the merge window opens.
413*31c9d7c8SThomas GleixnerExceptions are made for bug fixes and *sometimes* for small standalone
414*31c9d7c8SThomas Gleixnerdrivers for new hardware or minimally invasive patches for hardware
415*31c9d7c8SThomas Gleixnerenablement.
416*31c9d7c8SThomas Gleixner
417*31c9d7c8SThomas GleixnerDuring the merge window, the maintainers instead focus on following the
418*31c9d7c8SThomas Gleixnerupstream changes, fixing merge window fallout, collecting bug fixes, and
419*31c9d7c8SThomas Gleixnerallowing themselves a breath. Please respect that.
420*31c9d7c8SThomas Gleixner
421*31c9d7c8SThomas GleixnerThe release candidate -rc1 is the starting point for new patches to be
422*31c9d7c8SThomas Gleixnerapplied which are targeted for the next merge window.
423*31c9d7c8SThomas Gleixner
424*31c9d7c8SThomas Gleixner
425*31c9d7c8SThomas GleixnerGit
426*31c9d7c8SThomas Gleixner^^^
427*31c9d7c8SThomas Gleixner
428*31c9d7c8SThomas GleixnerThe tip maintainers accept git pull requests from maintainers who provide
429*31c9d7c8SThomas Gleixnersubsystem changes for aggregation in the tip tree.
430*31c9d7c8SThomas Gleixner
431*31c9d7c8SThomas GleixnerPull requests for new patch submissions are usually not accepted and do not
432*31c9d7c8SThomas Gleixnerreplace proper patch submission to the mailing list. The main reason for
433*31c9d7c8SThomas Gleixnerthis is that the review workflow is email based.
434*31c9d7c8SThomas Gleixner
435*31c9d7c8SThomas GleixnerIf you submit a larger patch series it is helpful to provide a git branch
436*31c9d7c8SThomas Gleixnerin a private repository which allows interested people to easily pull the
437*31c9d7c8SThomas Gleixnerseries for testing. The usual way to offer this is a git URL in the cover
438*31c9d7c8SThomas Gleixnerletter of the patch series.
439*31c9d7c8SThomas Gleixner
440*31c9d7c8SThomas Gleixner
441*31c9d7c8SThomas GleixnerCoding style notes
442*31c9d7c8SThomas Gleixner------------------
443*31c9d7c8SThomas Gleixner
444*31c9d7c8SThomas GleixnerComment style
445*31c9d7c8SThomas Gleixner^^^^^^^^^^^^^
446*31c9d7c8SThomas Gleixner
447*31c9d7c8SThomas GleixnerSentences in comments start with an uppercase letter.
448*31c9d7c8SThomas Gleixner
449*31c9d7c8SThomas GleixnerSingle line comments::
450*31c9d7c8SThomas Gleixner
451*31c9d7c8SThomas Gleixner	/* This is a single line comment */
452*31c9d7c8SThomas Gleixner
453*31c9d7c8SThomas GleixnerMulti-line comments::
454*31c9d7c8SThomas Gleixner
455*31c9d7c8SThomas Gleixner	/*
456*31c9d7c8SThomas Gleixner	 * This is a properly formatted
457*31c9d7c8SThomas Gleixner	 * multi-line comment.
458*31c9d7c8SThomas Gleixner	 *
459*31c9d7c8SThomas Gleixner	 * Larger multi-line comments should be split into paragraphs.
460*31c9d7c8SThomas Gleixner	 */
461*31c9d7c8SThomas Gleixner
462*31c9d7c8SThomas GleixnerNo tail comments:
463*31c9d7c8SThomas Gleixner
464*31c9d7c8SThomas Gleixner  Please refrain from using tail comments. Tail comments disturb the
465*31c9d7c8SThomas Gleixner  reading flow in almost all contexts, but especially in code::
466*31c9d7c8SThomas Gleixner
467*31c9d7c8SThomas Gleixner	if (somecondition_is_true) /* Don't put a comment here */
468*31c9d7c8SThomas Gleixner		dostuff(); /* Neither here */
469*31c9d7c8SThomas Gleixner
470*31c9d7c8SThomas Gleixner	seed = MAGIC_CONSTANT; /* Nor here */
471*31c9d7c8SThomas Gleixner
472*31c9d7c8SThomas Gleixner  Use freestanding comments instead::
473*31c9d7c8SThomas Gleixner
474*31c9d7c8SThomas Gleixner	/* This condition is not obvious without a comment */
475*31c9d7c8SThomas Gleixner	if (somecondition_is_true) {
476*31c9d7c8SThomas Gleixner		/* This really needs to be documented */
477*31c9d7c8SThomas Gleixner		dostuff();
478*31c9d7c8SThomas Gleixner	}
479*31c9d7c8SThomas Gleixner
480*31c9d7c8SThomas Gleixner	/* This magic initialization needs a comment. Maybe not? */
481*31c9d7c8SThomas Gleixner	seed = MAGIC_CONSTANT;
482*31c9d7c8SThomas Gleixner
483*31c9d7c8SThomas GleixnerComment the important things:
484*31c9d7c8SThomas Gleixner
485*31c9d7c8SThomas Gleixner  Comments should be added where the operation is not obvious. Documenting
486*31c9d7c8SThomas Gleixner  the obvious is just a distraction::
487*31c9d7c8SThomas Gleixner
488*31c9d7c8SThomas Gleixner	/* Decrement refcount and check for zero */
489*31c9d7c8SThomas Gleixner	if (refcount_dec_and_test(&p->refcnt)) {
490*31c9d7c8SThomas Gleixner		do;
491*31c9d7c8SThomas Gleixner		lots;
492*31c9d7c8SThomas Gleixner		of;
493*31c9d7c8SThomas Gleixner		magic;
494*31c9d7c8SThomas Gleixner		things;
495*31c9d7c8SThomas Gleixner	}
496*31c9d7c8SThomas Gleixner
497*31c9d7c8SThomas Gleixner  Instead, comments should explain the non-obvious details and document
498*31c9d7c8SThomas Gleixner  constraints::
499*31c9d7c8SThomas Gleixner
500*31c9d7c8SThomas Gleixner	if (refcount_dec_and_test(&p->refcnt)) {
501*31c9d7c8SThomas Gleixner		/*
502*31c9d7c8SThomas Gleixner		 * Really good explanation why the magic things below
503*31c9d7c8SThomas Gleixner		 * need to be done, ordering and locking constraints,
504*31c9d7c8SThomas Gleixner		 * etc..
505*31c9d7c8SThomas Gleixner		 */
506*31c9d7c8SThomas Gleixner		do;
507*31c9d7c8SThomas Gleixner		lots;
508*31c9d7c8SThomas Gleixner		of;
509*31c9d7c8SThomas Gleixner		magic;
510*31c9d7c8SThomas Gleixner		/* Needs to be the last operation because ... */
511*31c9d7c8SThomas Gleixner		things;
512*31c9d7c8SThomas Gleixner	}
513*31c9d7c8SThomas Gleixner
514*31c9d7c8SThomas GleixnerFunction documentation comments:
515*31c9d7c8SThomas Gleixner
516*31c9d7c8SThomas Gleixner  To document functions and their arguments please use kernel-doc format
517*31c9d7c8SThomas Gleixner  and not free form comments::
518*31c9d7c8SThomas Gleixner
519*31c9d7c8SThomas Gleixner	/**
520*31c9d7c8SThomas Gleixner	 * magic_function - Do lots of magic stuff
521*31c9d7c8SThomas Gleixner	 * @magic:	Pointer to the magic data to operate on
522*31c9d7c8SThomas Gleixner	 * @offset:	Offset in the data array of @magic
523*31c9d7c8SThomas Gleixner	 *
524*31c9d7c8SThomas Gleixner	 * Deep explanation of mysterious things done with @magic along
525*31c9d7c8SThomas Gleixner         * with documentation of the return values.
526*31c9d7c8SThomas Gleixner	 *
527*31c9d7c8SThomas Gleixner	 * Note, that the argument descriptors above are arranged
528*31c9d7c8SThomas Gleixner	 * in a tabular fashion.
529*31c9d7c8SThomas Gleixner	 */
530*31c9d7c8SThomas Gleixner
531*31c9d7c8SThomas Gleixner  This applies especially to globally visible functions and inline
532*31c9d7c8SThomas Gleixner  functions in public header files. It might be overkill to use kernel-doc
533*31c9d7c8SThomas Gleixner  format for every (static) function which needs a tiny explanation. The
534*31c9d7c8SThomas Gleixner  usage of descriptive function names often replaces these tiny comments.
535*31c9d7c8SThomas Gleixner  Apply common sense as always.
536*31c9d7c8SThomas Gleixner
537*31c9d7c8SThomas Gleixner
538*31c9d7c8SThomas GleixnerDocumenting locking requirements
539*31c9d7c8SThomas Gleixner^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
540*31c9d7c8SThomas Gleixner  Documenting locking requirements is a good thing, but comments are not
541*31c9d7c8SThomas Gleixner  necessarily the best choice. Instead of writing::
542*31c9d7c8SThomas Gleixner
543*31c9d7c8SThomas Gleixner	/* Caller must hold foo->lock */
544*31c9d7c8SThomas Gleixner	void func(struct foo *foo)
545*31c9d7c8SThomas Gleixner	{
546*31c9d7c8SThomas Gleixner		...
547*31c9d7c8SThomas Gleixner	}
548*31c9d7c8SThomas Gleixner
549*31c9d7c8SThomas Gleixner  Please use::
550*31c9d7c8SThomas Gleixner
551*31c9d7c8SThomas Gleixner	void func(struct foo *foo)
552*31c9d7c8SThomas Gleixner	{
553*31c9d7c8SThomas Gleixner		lockdep_assert_held(&foo->lock);
554*31c9d7c8SThomas Gleixner		...
555*31c9d7c8SThomas Gleixner	}
556*31c9d7c8SThomas Gleixner
557*31c9d7c8SThomas Gleixner  In PROVE_LOCKING kernels, lockdep_assert_held() emits a warning
558*31c9d7c8SThomas Gleixner  if the caller doesn't hold the lock.  Comments can't do that.
559*31c9d7c8SThomas Gleixner
560*31c9d7c8SThomas GleixnerBracket rules
561*31c9d7c8SThomas Gleixner^^^^^^^^^^^^^
562*31c9d7c8SThomas Gleixner
563*31c9d7c8SThomas GleixnerBrackets should be omitted only if the statement which follows 'if', 'for',
564*31c9d7c8SThomas Gleixner'while' etc. is truly a single line::
565*31c9d7c8SThomas Gleixner
566*31c9d7c8SThomas Gleixner	if (foo)
567*31c9d7c8SThomas Gleixner		do_something();
568*31c9d7c8SThomas Gleixner
569*31c9d7c8SThomas GleixnerThe following is not considered to be a single line statement even
570*31c9d7c8SThomas Gleixnerthough C does not require brackets::
571*31c9d7c8SThomas Gleixner
572*31c9d7c8SThomas Gleixner	for (i = 0; i < end; i++)
573*31c9d7c8SThomas Gleixner		if (foo[i])
574*31c9d7c8SThomas Gleixner			do_something(foo[i]);
575*31c9d7c8SThomas Gleixner
576*31c9d7c8SThomas GleixnerAdding brackets around the outer loop enhances the reading flow::
577*31c9d7c8SThomas Gleixner
578*31c9d7c8SThomas Gleixner	for (i = 0; i < end; i++) {
579*31c9d7c8SThomas Gleixner		if (foo[i])
580*31c9d7c8SThomas Gleixner			do_something(foo[i]);
581*31c9d7c8SThomas Gleixner	}
582*31c9d7c8SThomas Gleixner
583*31c9d7c8SThomas Gleixner
584*31c9d7c8SThomas GleixnerVariable declarations
585*31c9d7c8SThomas Gleixner^^^^^^^^^^^^^^^^^^^^^
586*31c9d7c8SThomas Gleixner
587*31c9d7c8SThomas GleixnerThe preferred ordering of variable declarations at the beginning of a
588*31c9d7c8SThomas Gleixnerfunction is reverse fir tree order::
589*31c9d7c8SThomas Gleixner
590*31c9d7c8SThomas Gleixner	struct long_struct_name *descriptive_name;
591*31c9d7c8SThomas Gleixner	unsigned long foo, bar;
592*31c9d7c8SThomas Gleixner	unsigned int tmp;
593*31c9d7c8SThomas Gleixner	int ret;
594*31c9d7c8SThomas Gleixner
595*31c9d7c8SThomas GleixnerThe above is faster to parse than the reverse ordering::
596*31c9d7c8SThomas Gleixner
597*31c9d7c8SThomas Gleixner	int ret;
598*31c9d7c8SThomas Gleixner	unsigned int tmp;
599*31c9d7c8SThomas Gleixner	unsigned long foo, bar;
600*31c9d7c8SThomas Gleixner	struct long_struct_name *descriptive_name;
601*31c9d7c8SThomas Gleixner
602*31c9d7c8SThomas GleixnerAnd even more so than random ordering::
603*31c9d7c8SThomas Gleixner
604*31c9d7c8SThomas Gleixner	unsigned long foo, bar;
605*31c9d7c8SThomas Gleixner	int ret;
606*31c9d7c8SThomas Gleixner	struct long_struct_name *descriptive_name;
607*31c9d7c8SThomas Gleixner	unsigned int tmp;
608*31c9d7c8SThomas Gleixner
609*31c9d7c8SThomas GleixnerAlso please try to aggregate variables of the same type into a single
610*31c9d7c8SThomas Gleixnerline. There is no point in wasting screen space::
611*31c9d7c8SThomas Gleixner
612*31c9d7c8SThomas Gleixner	unsigned long a;
613*31c9d7c8SThomas Gleixner	unsigned long b;
614*31c9d7c8SThomas Gleixner	unsigned long c;
615*31c9d7c8SThomas Gleixner	unsigned long d;
616*31c9d7c8SThomas Gleixner
617*31c9d7c8SThomas GleixnerIt's really sufficient to do::
618*31c9d7c8SThomas Gleixner
619*31c9d7c8SThomas Gleixner	unsigned long a, b, c, d;
620*31c9d7c8SThomas Gleixner
621*31c9d7c8SThomas GleixnerPlease also refrain from introducing line splits in variable declarations::
622*31c9d7c8SThomas Gleixner
623*31c9d7c8SThomas Gleixner	struct long_struct_name *descriptive_name = container_of(bar,
624*31c9d7c8SThomas Gleixner						      struct long_struct_name,
625*31c9d7c8SThomas Gleixner	                                              member);
626*31c9d7c8SThomas Gleixner	struct foobar foo;
627*31c9d7c8SThomas Gleixner
628*31c9d7c8SThomas GleixnerIt's way better to move the initialization to a separate line after the
629*31c9d7c8SThomas Gleixnerdeclarations::
630*31c9d7c8SThomas Gleixner
631*31c9d7c8SThomas Gleixner	struct long_struct_name *descriptive_name;
632*31c9d7c8SThomas Gleixner	struct foobar foo;
633*31c9d7c8SThomas Gleixner
634*31c9d7c8SThomas Gleixner	descriptive_name = container_of(bar, struct long_struct_name, member);
635*31c9d7c8SThomas Gleixner
636*31c9d7c8SThomas Gleixner
637*31c9d7c8SThomas GleixnerVariable types
638*31c9d7c8SThomas Gleixner^^^^^^^^^^^^^^
639*31c9d7c8SThomas Gleixner
640*31c9d7c8SThomas GleixnerPlease use the proper u8, u16, u32, u64 types for variables which are meant
641*31c9d7c8SThomas Gleixnerto describe hardware or are used as arguments for functions which access
642*31c9d7c8SThomas Gleixnerhardware. These types are clearly defining the bit width and avoid
643*31c9d7c8SThomas Gleixnertruncation, expansion and 32/64-bit confusion.
644*31c9d7c8SThomas Gleixner
645*31c9d7c8SThomas Gleixneru64 is also recommended in code which would become ambiguous for 32-bit
646*31c9d7c8SThomas Gleixnerkernels when 'unsigned long' would be used instead. While in such
647*31c9d7c8SThomas Gleixnersituations 'unsigned long long' could be used as well, u64 is shorter
648*31c9d7c8SThomas Gleixnerand also clearly shows that the operation is required to be 64 bits wide
649*31c9d7c8SThomas Gleixnerindependent of the target CPU.
650*31c9d7c8SThomas Gleixner
651*31c9d7c8SThomas GleixnerPlease use 'unsigned int' instead of 'unsigned'.
652*31c9d7c8SThomas Gleixner
653*31c9d7c8SThomas Gleixner
654*31c9d7c8SThomas GleixnerConstants
655*31c9d7c8SThomas Gleixner^^^^^^^^^
656*31c9d7c8SThomas Gleixner
657*31c9d7c8SThomas GleixnerPlease do not use literal (hexa)decimal numbers in code or initializers.
658*31c9d7c8SThomas GleixnerEither use proper defines which have descriptive names or consider using
659*31c9d7c8SThomas Gleixneran enum.
660*31c9d7c8SThomas Gleixner
661*31c9d7c8SThomas Gleixner
662*31c9d7c8SThomas GleixnerStruct declarations and initializers
663*31c9d7c8SThomas Gleixner^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
664*31c9d7c8SThomas Gleixner
665*31c9d7c8SThomas GleixnerStruct declarations should align the struct member names in a tabular
666*31c9d7c8SThomas Gleixnerfashion::
667*31c9d7c8SThomas Gleixner
668*31c9d7c8SThomas Gleixner	struct bar_order {
669*31c9d7c8SThomas Gleixner		unsigned int	guest_id;
670*31c9d7c8SThomas Gleixner		int		ordered_item;
671*31c9d7c8SThomas Gleixner		struct menu	*menu;
672*31c9d7c8SThomas Gleixner	};
673*31c9d7c8SThomas Gleixner
674*31c9d7c8SThomas GleixnerPlease avoid documenting struct members within the declaration, because
675*31c9d7c8SThomas Gleixnerthis often results in strangely formatted comments and the struct members
676*31c9d7c8SThomas Gleixnerbecome obfuscated::
677*31c9d7c8SThomas Gleixner
678*31c9d7c8SThomas Gleixner	struct bar_order {
679*31c9d7c8SThomas Gleixner		unsigned int	guest_id; /* Unique guest id */
680*31c9d7c8SThomas Gleixner		int		ordered_item;
681*31c9d7c8SThomas Gleixner		/* Pointer to a menu instance which contains all the drinks */
682*31c9d7c8SThomas Gleixner		struct menu	*menu;
683*31c9d7c8SThomas Gleixner	};
684*31c9d7c8SThomas Gleixner
685*31c9d7c8SThomas GleixnerInstead, please consider using the kernel-doc format in a comment preceding
686*31c9d7c8SThomas Gleixnerthe struct declaration, which is easier to read and has the added advantage
687*31c9d7c8SThomas Gleixnerof including the information in the kernel documentation, for example, as
688*31c9d7c8SThomas Gleixnerfollows::
689*31c9d7c8SThomas Gleixner
690*31c9d7c8SThomas Gleixner
691*31c9d7c8SThomas Gleixner	/**
692*31c9d7c8SThomas Gleixner	 * struct bar_order - Description of a bar order
693*31c9d7c8SThomas Gleixner	 * @guest_id:		Unique guest id
694*31c9d7c8SThomas Gleixner	 * @ordered_item:	The item number from the menu
695*31c9d7c8SThomas Gleixner	 * @menu:		Pointer to the menu from which the item
696*31c9d7c8SThomas Gleixner	 *  			was ordered
697*31c9d7c8SThomas Gleixner	 *
698*31c9d7c8SThomas Gleixner	 * Supplementary information for using the struct.
699*31c9d7c8SThomas Gleixner	 *
700*31c9d7c8SThomas Gleixner	 * Note, that the struct member descriptors above are arranged
701*31c9d7c8SThomas Gleixner	 * in a tabular fashion.
702*31c9d7c8SThomas Gleixner	 */
703*31c9d7c8SThomas Gleixner	struct bar_order {
704*31c9d7c8SThomas Gleixner		unsigned int	guest_id;
705*31c9d7c8SThomas Gleixner		int		ordered_item;
706*31c9d7c8SThomas Gleixner		struct menu	*menu;
707*31c9d7c8SThomas Gleixner	};
708*31c9d7c8SThomas Gleixner
709*31c9d7c8SThomas GleixnerStatic struct initializers must use C99 initializers and should also be
710*31c9d7c8SThomas Gleixneraligned in a tabular fashion::
711*31c9d7c8SThomas Gleixner
712*31c9d7c8SThomas Gleixner	static struct foo statfoo = {
713*31c9d7c8SThomas Gleixner		.a		= 0,
714*31c9d7c8SThomas Gleixner		.plain_integer	= CONSTANT_DEFINE_OR_ENUM,
715*31c9d7c8SThomas Gleixner		.bar		= &statbar,
716*31c9d7c8SThomas Gleixner	};
717*31c9d7c8SThomas Gleixner
718*31c9d7c8SThomas GleixnerNote that while C99 syntax allows the omission of the final comma,
719*31c9d7c8SThomas Gleixnerwe recommend the use of a comma on the last line because it makes
720*31c9d7c8SThomas Gleixnerreordering and addition of new lines easier, and makes such future
721*31c9d7c8SThomas Gleixnerpatches slightly easier to read as well.
722*31c9d7c8SThomas Gleixner
723*31c9d7c8SThomas GleixnerLine breaks
724*31c9d7c8SThomas Gleixner^^^^^^^^^^^
725*31c9d7c8SThomas Gleixner
726*31c9d7c8SThomas GleixnerRestricting line length to 80 characters makes deeply indented code hard to
727*31c9d7c8SThomas Gleixnerread.  Consider breaking out code into helper functions to avoid excessive
728*31c9d7c8SThomas Gleixnerline breaking.
729*31c9d7c8SThomas Gleixner
730*31c9d7c8SThomas GleixnerThe 80 character rule is not a strict rule, so please use common sense when
731*31c9d7c8SThomas Gleixnerbreaking lines. Especially format strings should never be broken up.
732*31c9d7c8SThomas Gleixner
733*31c9d7c8SThomas GleixnerWhen splitting function declarations or function calls, then please align
734*31c9d7c8SThomas Gleixnerthe first argument in the second line with the first argument in the first
735*31c9d7c8SThomas Gleixnerline::
736*31c9d7c8SThomas Gleixner
737*31c9d7c8SThomas Gleixner  static int long_function_name(struct foobar *barfoo, unsigned int id,
738*31c9d7c8SThomas Gleixner				unsigned int offset)
739*31c9d7c8SThomas Gleixner  {
740*31c9d7c8SThomas Gleixner
741*31c9d7c8SThomas Gleixner	if (!id) {
742*31c9d7c8SThomas Gleixner		ret = longer_function_name(barfoo, DEFAULT_BARFOO_ID,
743*31c9d7c8SThomas Gleixner					   offset);
744*31c9d7c8SThomas Gleixner	...
745*31c9d7c8SThomas Gleixner
746*31c9d7c8SThomas GleixnerNamespaces
747*31c9d7c8SThomas Gleixner^^^^^^^^^^
748*31c9d7c8SThomas Gleixner
749*31c9d7c8SThomas GleixnerFunction/variable namespaces improve readability and allow easy
750*31c9d7c8SThomas Gleixnergrepping. These namespaces are string prefixes for globally visible
751*31c9d7c8SThomas Gleixnerfunction and variable names, including inlines. These prefixes should
752*31c9d7c8SThomas Gleixnercombine the subsystem and the component name such as 'x86_comp\_',
753*31c9d7c8SThomas Gleixner'sched\_', 'irq\_', and 'mutex\_'.
754*31c9d7c8SThomas Gleixner
755*31c9d7c8SThomas GleixnerThis also includes static file scope functions that are immediately put
756*31c9d7c8SThomas Gleixnerinto globally visible driver templates - it's useful for those symbols
757*31c9d7c8SThomas Gleixnerto carry a good prefix as well, for backtrace readability.
758*31c9d7c8SThomas Gleixner
759*31c9d7c8SThomas GleixnerNamespace prefixes may be omitted for local static functions and
760*31c9d7c8SThomas Gleixnervariables. Truly local functions, only called by other local functions,
761*31c9d7c8SThomas Gleixnercan have shorter descriptive names - our primary concern is greppability
762*31c9d7c8SThomas Gleixnerand backtrace readability.
763*31c9d7c8SThomas Gleixner
764*31c9d7c8SThomas GleixnerPlease note that 'xxx_vendor\_' and 'vendor_xxx_` prefixes are not
765*31c9d7c8SThomas Gleixnerhelpful for static functions in vendor-specific files. After all, it
766*31c9d7c8SThomas Gleixneris already clear that the code is vendor-specific. In addition, vendor
767*31c9d7c8SThomas Gleixnernames should only be for truly vendor-specific functionality.
768*31c9d7c8SThomas Gleixner
769*31c9d7c8SThomas GleixnerAs always apply common sense and aim for consistency and readability.
770*31c9d7c8SThomas Gleixner
771*31c9d7c8SThomas Gleixner
772*31c9d7c8SThomas GleixnerCommit notifications
773*31c9d7c8SThomas Gleixner--------------------
774*31c9d7c8SThomas Gleixner
775*31c9d7c8SThomas GleixnerThe tip tree is monitored by a bot for new commits. The bot sends an email
776*31c9d7c8SThomas Gleixnerfor each new commit to a dedicated mailing list
777*31c9d7c8SThomas Gleixner(``linux-tip-commits@vger.kernel.org``) and Cc's all people who are
778*31c9d7c8SThomas Gleixnermentioned in one of the commit tags. It uses the email message ID from the
779*31c9d7c8SThomas GleixnerLink tag at the end of the tag list to set the In-Reply-To email header so
780*31c9d7c8SThomas Gleixnerthe message is properly threaded with the patch submission email.
781*31c9d7c8SThomas Gleixner
782*31c9d7c8SThomas GleixnerThe tip maintainers and submaintainers try to reply to the submitter
783*31c9d7c8SThomas Gleixnerwhen merging a patch, but they sometimes forget or it does not fit the
784*31c9d7c8SThomas Gleixnerworkflow of the moment. While the bot message is purely mechanical, it
785*31c9d7c8SThomas Gleixneralso implies a 'Thank you! Applied.'.
786