xref: /openbmc/linux/Documentation/process/maintainer-tip.rst (revision 1ac731c529cd4d6adbce134754b51ff7d822b145)
131c9d7c8SThomas Gleixner.. SPDX-License-Identifier: GPL-2.0
231c9d7c8SThomas Gleixner
331c9d7c8SThomas GleixnerThe tip tree handbook
431c9d7c8SThomas Gleixner=====================
531c9d7c8SThomas Gleixner
631c9d7c8SThomas GleixnerWhat is the tip tree?
731c9d7c8SThomas Gleixner---------------------
831c9d7c8SThomas Gleixner
931c9d7c8SThomas GleixnerThe tip tree is a collection of several subsystems and areas of
1031c9d7c8SThomas Gleixnerdevelopment. The tip tree is both a direct development tree and a
1131c9d7c8SThomas Gleixneraggregation tree for several sub-maintainer trees. The tip tree gitweb URL
1231c9d7c8SThomas Gleixneris: https://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git
1331c9d7c8SThomas Gleixner
1431c9d7c8SThomas GleixnerThe tip tree contains the following subsystems:
1531c9d7c8SThomas Gleixner
1631c9d7c8SThomas Gleixner   - **x86 architecture**
1731c9d7c8SThomas Gleixner
1831c9d7c8SThomas Gleixner     The x86 architecture development takes place in the tip tree except
1931c9d7c8SThomas Gleixner     for the x86 KVM and XEN specific parts which are maintained in the
2031c9d7c8SThomas Gleixner     corresponding subsystems and routed directly to mainline from
2131c9d7c8SThomas Gleixner     there. It's still good practice to Cc the x86 maintainers on
2231c9d7c8SThomas Gleixner     x86-specific KVM and XEN patches.
2331c9d7c8SThomas Gleixner
2431c9d7c8SThomas Gleixner     Some x86 subsystems have their own maintainers in addition to the
2531c9d7c8SThomas Gleixner     overall x86 maintainers.  Please Cc the overall x86 maintainers on
2631c9d7c8SThomas Gleixner     patches touching files in arch/x86 even when they are not called out
2731c9d7c8SThomas Gleixner     by the MAINTAINER file.
2831c9d7c8SThomas Gleixner
2931c9d7c8SThomas Gleixner     Note, that ``x86@kernel.org`` is not a mailing list. It is merely a
3031c9d7c8SThomas Gleixner     mail alias which distributes mails to the x86 top-level maintainer
3131c9d7c8SThomas Gleixner     team. Please always Cc the Linux Kernel mailing list (LKML)
3231c9d7c8SThomas Gleixner     ``linux-kernel@vger.kernel.org``, otherwise your mail ends up only in
3331c9d7c8SThomas Gleixner     the private inboxes of the maintainers.
3431c9d7c8SThomas Gleixner
3531c9d7c8SThomas Gleixner   - **Scheduler**
3631c9d7c8SThomas Gleixner
3731c9d7c8SThomas Gleixner     Scheduler development takes place in the -tip tree, in the
3831c9d7c8SThomas Gleixner     sched/core branch - with occasional sub-topic trees for
3931c9d7c8SThomas Gleixner     work-in-progress patch-sets.
4031c9d7c8SThomas Gleixner
4131c9d7c8SThomas Gleixner   - **Locking and atomics**
4231c9d7c8SThomas Gleixner
4331c9d7c8SThomas Gleixner     Locking development (including atomics and other synchronization
4431c9d7c8SThomas Gleixner     primitives that are connected to locking) takes place in the -tip
4531c9d7c8SThomas Gleixner     tree, in the locking/core branch - with occasional sub-topic trees
4631c9d7c8SThomas Gleixner     for work-in-progress patch-sets.
4731c9d7c8SThomas Gleixner
4831c9d7c8SThomas Gleixner   - **Generic interrupt subsystem and interrupt chip drivers**:
4931c9d7c8SThomas Gleixner
5031c9d7c8SThomas Gleixner     - interrupt core development happens in the irq/core branch
5131c9d7c8SThomas Gleixner
5231c9d7c8SThomas Gleixner     - interrupt chip driver development also happens in the irq/core
5331c9d7c8SThomas Gleixner       branch, but the patches are usually applied in a separate maintainer
5431c9d7c8SThomas Gleixner       tree and then aggregated into irq/core
5531c9d7c8SThomas Gleixner
5631c9d7c8SThomas Gleixner   - **Time, timers, timekeeping, NOHZ and related chip drivers**:
5731c9d7c8SThomas Gleixner
5831c9d7c8SThomas Gleixner     - timekeeping, clocksource core, NTP and alarmtimer development
5931c9d7c8SThomas Gleixner       happens in the timers/core branch, but patches are usually applied in
6031c9d7c8SThomas Gleixner       a separate maintainer tree and then aggregated into timers/core
6131c9d7c8SThomas Gleixner
6231c9d7c8SThomas Gleixner     - clocksource/event driver development happens in the timers/core
6331c9d7c8SThomas Gleixner       branch, but patches are mostly applied in a separate maintainer tree
6431c9d7c8SThomas Gleixner       and then aggregated into timers/core
6531c9d7c8SThomas Gleixner
6631c9d7c8SThomas Gleixner   - **Performance counters core, architecture support and tooling**:
6731c9d7c8SThomas Gleixner
6831c9d7c8SThomas Gleixner     - perf core and architecture support development happens in the
6931c9d7c8SThomas Gleixner       perf/core branch
7031c9d7c8SThomas Gleixner
7131c9d7c8SThomas Gleixner     - perf tooling development happens in the perf tools maintainer
7231c9d7c8SThomas Gleixner       tree and is aggregated into the tip tree.
7331c9d7c8SThomas Gleixner
7431c9d7c8SThomas Gleixner   - **CPU hotplug core**
7531c9d7c8SThomas Gleixner
7631c9d7c8SThomas Gleixner   - **RAS core**
7731c9d7c8SThomas Gleixner
7831c9d7c8SThomas Gleixner     Mostly x86-specific RAS patches are collected in the tip ras/core
7931c9d7c8SThomas Gleixner     branch.
8031c9d7c8SThomas Gleixner
8131c9d7c8SThomas Gleixner   - **EFI core**
8231c9d7c8SThomas Gleixner
8331c9d7c8SThomas Gleixner     EFI development in the efi git tree. The collected patches are
8431c9d7c8SThomas Gleixner     aggregated in the tip efi/core branch.
8531c9d7c8SThomas Gleixner
8631c9d7c8SThomas Gleixner   - **RCU**
8731c9d7c8SThomas Gleixner
8831c9d7c8SThomas Gleixner     RCU development happens in the linux-rcu tree. The resulting changes
8931c9d7c8SThomas Gleixner     are aggregated into the tip core/rcu branch.
9031c9d7c8SThomas Gleixner
9131c9d7c8SThomas Gleixner   - **Various core code components**:
9231c9d7c8SThomas Gleixner
9331c9d7c8SThomas Gleixner       - debugobjects
9431c9d7c8SThomas Gleixner
9531c9d7c8SThomas Gleixner       - objtool
9631c9d7c8SThomas Gleixner
9731c9d7c8SThomas Gleixner       - random bits and pieces
9831c9d7c8SThomas Gleixner
9931c9d7c8SThomas Gleixner
10031c9d7c8SThomas GleixnerPatch submission notes
10131c9d7c8SThomas Gleixner----------------------
10231c9d7c8SThomas Gleixner
10331c9d7c8SThomas GleixnerSelecting the tree/branch
10431c9d7c8SThomas Gleixner^^^^^^^^^^^^^^^^^^^^^^^^^
10531c9d7c8SThomas Gleixner
10631c9d7c8SThomas GleixnerIn general, development against the head of the tip tree master branch is
10731c9d7c8SThomas Gleixnerfine, but for the subsystems which are maintained separately, have their
10831c9d7c8SThomas Gleixnerown git tree and are only aggregated into the tip tree, development should
10931c9d7c8SThomas Gleixnertake place against the relevant subsystem tree or branch.
11031c9d7c8SThomas Gleixner
11131c9d7c8SThomas GleixnerBug fixes which target mainline should always be applicable against the
11231c9d7c8SThomas Gleixnermainline kernel tree. Potential conflicts against changes which are already
11331c9d7c8SThomas Gleixnerqueued in the tip tree are handled by the maintainers.
11431c9d7c8SThomas Gleixner
11531c9d7c8SThomas GleixnerPatch subject
11631c9d7c8SThomas Gleixner^^^^^^^^^^^^^
11731c9d7c8SThomas Gleixner
11831c9d7c8SThomas GleixnerThe tip tree preferred format for patch subject prefixes is
11931c9d7c8SThomas Gleixner'subsys/component:', e.g. 'x86/apic:', 'x86/mm/fault:', 'sched/fair:',
12031c9d7c8SThomas Gleixner'genirq/core:'. Please do not use file names or complete file paths as
12131c9d7c8SThomas Gleixnerprefix. 'git log path/to/file' should give you a reasonable hint in most
12231c9d7c8SThomas Gleixnercases.
12331c9d7c8SThomas Gleixner
12431c9d7c8SThomas GleixnerThe condensed patch description in the subject line should start with a
12531c9d7c8SThomas Gleixneruppercase letter and should be written in imperative tone.
12631c9d7c8SThomas Gleixner
12731c9d7c8SThomas Gleixner
12831c9d7c8SThomas GleixnerChangelog
12931c9d7c8SThomas Gleixner^^^^^^^^^
13031c9d7c8SThomas Gleixner
131*0c4ff6f6SBagas SanjayaThe general rules about changelogs in the :ref:`Submitting patches guide
132*0c4ff6f6SBagas Sanjaya<describe_changes>`, apply.
13331c9d7c8SThomas Gleixner
13431c9d7c8SThomas GleixnerThe tip tree maintainers set value on following these rules, especially on
13531c9d7c8SThomas Gleixnerthe request to write changelogs in imperative mood and not impersonating
13631c9d7c8SThomas Gleixnercode or the execution of it. This is not just a whim of the
13731c9d7c8SThomas Gleixnermaintainers. Changelogs written in abstract words are more precise and
13831c9d7c8SThomas Gleixnertend to be less confusing than those written in the form of novels.
13931c9d7c8SThomas Gleixner
14031c9d7c8SThomas GleixnerIt's also useful to structure the changelog into several paragraphs and not
14131c9d7c8SThomas Gleixnerlump everything together into a single one. A good structure is to explain
14231c9d7c8SThomas Gleixnerthe context, the problem and the solution in separate paragraphs and this
14331c9d7c8SThomas Gleixnerorder.
14431c9d7c8SThomas Gleixner
14531c9d7c8SThomas GleixnerExamples for illustration:
14631c9d7c8SThomas Gleixner
14731c9d7c8SThomas Gleixner  Example 1::
14831c9d7c8SThomas Gleixner
14931c9d7c8SThomas Gleixner    x86/intel_rdt/mbm: Fix MBM overflow handler during hot cpu
15031c9d7c8SThomas Gleixner
15131c9d7c8SThomas Gleixner    When a CPU is dying, we cancel the worker and schedule a new worker on a
15231c9d7c8SThomas Gleixner    different CPU on the same domain. But if the timer is already about to
15331c9d7c8SThomas Gleixner    expire (say 0.99s) then we essentially double the interval.
15431c9d7c8SThomas Gleixner
15531c9d7c8SThomas Gleixner    We modify the hot cpu handling to cancel the delayed work on the dying
15631c9d7c8SThomas Gleixner    cpu and run the worker immediately on a different cpu in same domain. We
15731c9d7c8SThomas Gleixner    donot flush the worker because the MBM overflow worker reschedules the
15831c9d7c8SThomas Gleixner    worker on same CPU and scans the domain->cpu_mask to get the domain
15931c9d7c8SThomas Gleixner    pointer.
16031c9d7c8SThomas Gleixner
16131c9d7c8SThomas Gleixner  Improved version::
16231c9d7c8SThomas Gleixner
16331c9d7c8SThomas Gleixner    x86/intel_rdt/mbm: Fix MBM overflow handler during CPU hotplug
16431c9d7c8SThomas Gleixner
16531c9d7c8SThomas Gleixner    When a CPU is dying, the overflow worker is canceled and rescheduled on a
16631c9d7c8SThomas Gleixner    different CPU in the same domain. But if the timer is already about to
16731c9d7c8SThomas Gleixner    expire this essentially doubles the interval which might result in a non
16831c9d7c8SThomas Gleixner    detected overflow.
16931c9d7c8SThomas Gleixner
17031c9d7c8SThomas Gleixner    Cancel the overflow worker and reschedule it immediately on a different CPU
17131c9d7c8SThomas Gleixner    in the same domain. The work could be flushed as well, but that would
17231c9d7c8SThomas Gleixner    reschedule it on the same CPU.
17331c9d7c8SThomas Gleixner
17431c9d7c8SThomas Gleixner  Example 2::
17531c9d7c8SThomas Gleixner
17631c9d7c8SThomas Gleixner    time: POSIX CPU timers: Ensure that variable is initialized
17731c9d7c8SThomas Gleixner
17831c9d7c8SThomas Gleixner    If cpu_timer_sample_group returns -EINVAL, it will not have written into
17931c9d7c8SThomas Gleixner    *sample. Checking for cpu_timer_sample_group's return value precludes the
18031c9d7c8SThomas Gleixner    potential use of an uninitialized value of now in the following block.
18131c9d7c8SThomas Gleixner    Given an invalid clock_idx, the previous code could otherwise overwrite
18231c9d7c8SThomas Gleixner    *oldval in an undefined manner. This is now prevented. We also exploit
18331c9d7c8SThomas Gleixner    short-circuiting of && to sample the timer only if the result will
18431c9d7c8SThomas Gleixner    actually be used to update *oldval.
18531c9d7c8SThomas Gleixner
18631c9d7c8SThomas Gleixner  Improved version::
18731c9d7c8SThomas Gleixner
18831c9d7c8SThomas Gleixner    posix-cpu-timers: Make set_process_cpu_timer() more robust
18931c9d7c8SThomas Gleixner
19031c9d7c8SThomas Gleixner    Because the return value of cpu_timer_sample_group() is not checked,
19131c9d7c8SThomas Gleixner    compilers and static checkers can legitimately warn about a potential use
19231c9d7c8SThomas Gleixner    of the uninitialized variable 'now'. This is not a runtime issue as all
19331c9d7c8SThomas Gleixner    call sites hand in valid clock ids.
19431c9d7c8SThomas Gleixner
19531c9d7c8SThomas Gleixner    Also cpu_timer_sample_group() is invoked unconditionally even when the
19631c9d7c8SThomas Gleixner    result is not used because *oldval is NULL.
19731c9d7c8SThomas Gleixner
19831c9d7c8SThomas Gleixner    Make the invocation conditional and check the return value.
19931c9d7c8SThomas Gleixner
20031c9d7c8SThomas Gleixner  Example 3::
20131c9d7c8SThomas Gleixner
20231c9d7c8SThomas Gleixner    The entity can also be used for other purposes.
20331c9d7c8SThomas Gleixner
20431c9d7c8SThomas Gleixner    Let's rename it to be more generic.
20531c9d7c8SThomas Gleixner
20631c9d7c8SThomas Gleixner  Improved version::
20731c9d7c8SThomas Gleixner
20831c9d7c8SThomas Gleixner    The entity can also be used for other purposes.
20931c9d7c8SThomas Gleixner
21031c9d7c8SThomas Gleixner    Rename it to be more generic.
21131c9d7c8SThomas Gleixner
21231c9d7c8SThomas Gleixner
21331c9d7c8SThomas GleixnerFor complex scenarios, especially race conditions and memory ordering
21431c9d7c8SThomas Gleixnerissues, it is valuable to depict the scenario with a table which shows
21531c9d7c8SThomas Gleixnerthe parallelism and the temporal order of events. Here is an example::
21631c9d7c8SThomas Gleixner
21731c9d7c8SThomas Gleixner    CPU0                            CPU1
21831c9d7c8SThomas Gleixner    free_irq(X)                     interrupt X
21931c9d7c8SThomas Gleixner                                    spin_lock(desc->lock)
22031c9d7c8SThomas Gleixner                                    wake irq thread()
22131c9d7c8SThomas Gleixner                                    spin_unlock(desc->lock)
22231c9d7c8SThomas Gleixner    spin_lock(desc->lock)
22331c9d7c8SThomas Gleixner    remove action()
22431c9d7c8SThomas Gleixner    shutdown_irq()
22531c9d7c8SThomas Gleixner    release_resources()             thread_handler()
22631c9d7c8SThomas Gleixner    spin_unlock(desc->lock)           access released resources.
22731c9d7c8SThomas Gleixner                                      ^^^^^^^^^^^^^^^^^^^^^^^^^
22831c9d7c8SThomas Gleixner    synchronize_irq()
22931c9d7c8SThomas Gleixner
23031c9d7c8SThomas GleixnerLockdep provides similar useful output to depict a possible deadlock
23131c9d7c8SThomas Gleixnerscenario::
23231c9d7c8SThomas Gleixner
23331c9d7c8SThomas Gleixner    CPU0                                    CPU1
23431c9d7c8SThomas Gleixner    rtmutex_lock(&rcu->rt_mutex)
23531c9d7c8SThomas Gleixner      spin_lock(&rcu->rt_mutex.wait_lock)
23631c9d7c8SThomas Gleixner                                            local_irq_disable()
23731c9d7c8SThomas Gleixner                                            spin_lock(&timer->it_lock)
23831c9d7c8SThomas Gleixner                                            spin_lock(&rcu->mutex.wait_lock)
23931c9d7c8SThomas Gleixner    --> Interrupt
24031c9d7c8SThomas Gleixner        spin_lock(&timer->it_lock)
24131c9d7c8SThomas Gleixner
24231c9d7c8SThomas Gleixner
24331c9d7c8SThomas GleixnerFunction references in changelogs
24431c9d7c8SThomas Gleixner^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
24531c9d7c8SThomas Gleixner
24631c9d7c8SThomas GleixnerWhen a function is mentioned in the changelog, either the text body or the
24731c9d7c8SThomas Gleixnersubject line, please use the format 'function_name()'. Omitting the
24831c9d7c8SThomas Gleixnerbrackets after the function name can be ambiguous::
24931c9d7c8SThomas Gleixner
25031c9d7c8SThomas Gleixner  Subject: subsys/component: Make reservation_count static
25131c9d7c8SThomas Gleixner
25231c9d7c8SThomas Gleixner  reservation_count is only used in reservation_stats. Make it static.
25331c9d7c8SThomas Gleixner
25431c9d7c8SThomas GleixnerThe variant with brackets is more precise::
25531c9d7c8SThomas Gleixner
25631c9d7c8SThomas Gleixner  Subject: subsys/component: Make reservation_count() static
25731c9d7c8SThomas Gleixner
25831c9d7c8SThomas Gleixner  reservation_count() is only called from reservation_stats(). Make it
25931c9d7c8SThomas Gleixner  static.
26031c9d7c8SThomas Gleixner
26131c9d7c8SThomas Gleixner
26231c9d7c8SThomas GleixnerBacktraces in changelogs
26331c9d7c8SThomas Gleixner^^^^^^^^^^^^^^^^^^^^^^^^
26431c9d7c8SThomas Gleixner
26531c9d7c8SThomas GleixnerSee :ref:`backtraces`.
26631c9d7c8SThomas Gleixner
26731c9d7c8SThomas GleixnerOrdering of commit tags
26831c9d7c8SThomas Gleixner^^^^^^^^^^^^^^^^^^^^^^^
26931c9d7c8SThomas Gleixner
27031c9d7c8SThomas GleixnerTo have a uniform view of the commit tags, the tip maintainers use the
27131c9d7c8SThomas Gleixnerfollowing tag ordering scheme:
27231c9d7c8SThomas Gleixner
27331c9d7c8SThomas Gleixner - Fixes: 12char-SHA1 ("sub/sys: Original subject line")
27431c9d7c8SThomas Gleixner
27531c9d7c8SThomas Gleixner   A Fixes tag should be added even for changes which do not need to be
27631c9d7c8SThomas Gleixner   backported to stable kernels, i.e. when addressing a recently introduced
27731c9d7c8SThomas Gleixner   issue which only affects tip or the current head of mainline. These tags
27831c9d7c8SThomas Gleixner   are helpful to identify the original commit and are much more valuable
27931c9d7c8SThomas Gleixner   than prominently mentioning the commit which introduced a problem in the
28031c9d7c8SThomas Gleixner   text of the changelog itself because they can be automatically
28131c9d7c8SThomas Gleixner   extracted.
28231c9d7c8SThomas Gleixner
28331c9d7c8SThomas Gleixner   The following example illustrates the difference::
28431c9d7c8SThomas Gleixner
28531c9d7c8SThomas Gleixner     Commit
28631c9d7c8SThomas Gleixner
28731c9d7c8SThomas Gleixner       abcdef012345678 ("x86/xxx: Replace foo with bar")
28831c9d7c8SThomas Gleixner
28931c9d7c8SThomas Gleixner     left an unused instance of variable foo around. Remove it.
29031c9d7c8SThomas Gleixner
29131c9d7c8SThomas Gleixner     Signed-off-by: J.Dev <j.dev@mail>
29231c9d7c8SThomas Gleixner
29331c9d7c8SThomas Gleixner   Please say instead::
29431c9d7c8SThomas Gleixner
29531c9d7c8SThomas Gleixner     The recent replacement of foo with bar left an unused instance of
29631c9d7c8SThomas Gleixner     variable foo around. Remove it.
29731c9d7c8SThomas Gleixner
29831c9d7c8SThomas Gleixner     Fixes: abcdef012345678 ("x86/xxx: Replace foo with bar")
29931c9d7c8SThomas Gleixner     Signed-off-by: J.Dev <j.dev@mail>
30031c9d7c8SThomas Gleixner
30131c9d7c8SThomas Gleixner   The latter puts the information about the patch into the focus and
30231c9d7c8SThomas Gleixner   amends it with the reference to the commit which introduced the issue
30331c9d7c8SThomas Gleixner   rather than putting the focus on the original commit in the first place.
30431c9d7c8SThomas Gleixner
30531c9d7c8SThomas Gleixner - Reported-by: ``Reporter <reporter@mail>``
30631c9d7c8SThomas Gleixner
30731c9d7c8SThomas Gleixner - Originally-by: ``Original author <original-author@mail>``
30831c9d7c8SThomas Gleixner
30931c9d7c8SThomas Gleixner - Suggested-by: ``Suggester <suggester@mail>``
31031c9d7c8SThomas Gleixner
31131c9d7c8SThomas Gleixner - Co-developed-by: ``Co-author <co-author@mail>``
31231c9d7c8SThomas Gleixner
31331c9d7c8SThomas Gleixner   Signed-off: ``Co-author <co-author@mail>``
31431c9d7c8SThomas Gleixner
31531c9d7c8SThomas Gleixner   Note, that Co-developed-by and Signed-off-by of the co-author(s) must
31631c9d7c8SThomas Gleixner   come in pairs.
31731c9d7c8SThomas Gleixner
31831c9d7c8SThomas Gleixner - Signed-off-by: ``Author <author@mail>``
31931c9d7c8SThomas Gleixner
32031c9d7c8SThomas Gleixner   The first Signed-off-by (SOB) after the last Co-developed-by/SOB pair is the
32131c9d7c8SThomas Gleixner   author SOB, i.e. the person flagged as author by git.
32231c9d7c8SThomas Gleixner
32331c9d7c8SThomas Gleixner - Signed-off-by: ``Patch handler <handler@mail>``
32431c9d7c8SThomas Gleixner
32531c9d7c8SThomas Gleixner   SOBs after the author SOB are from people handling and transporting
32631c9d7c8SThomas Gleixner   the patch, but were not involved in development. SOB chains should
32731c9d7c8SThomas Gleixner   reflect the **real** route a patch took as it was propagated to us,
32831c9d7c8SThomas Gleixner   with the first SOB entry signalling primary authorship of a single
32931c9d7c8SThomas Gleixner   author. Acks should be given as Acked-by lines and review approvals
33031c9d7c8SThomas Gleixner   as Reviewed-by lines.
33131c9d7c8SThomas Gleixner
33231c9d7c8SThomas Gleixner   If the handler made modifications to the patch or the changelog, then
33331c9d7c8SThomas Gleixner   this should be mentioned **after** the changelog text and **above**
33431c9d7c8SThomas Gleixner   all commit tags in the following format::
33531c9d7c8SThomas Gleixner
33631c9d7c8SThomas Gleixner     ... changelog text ends.
33731c9d7c8SThomas Gleixner
33831c9d7c8SThomas Gleixner     [ handler: Replaced foo by bar and updated changelog ]
33931c9d7c8SThomas Gleixner
34031c9d7c8SThomas Gleixner     First-tag: .....
34131c9d7c8SThomas Gleixner
34231c9d7c8SThomas Gleixner   Note the two empty new lines which separate the changelog text and the
34331c9d7c8SThomas Gleixner   commit tags from that notice.
34431c9d7c8SThomas Gleixner
34531c9d7c8SThomas Gleixner   If a patch is sent to the mailing list by a handler then the author has
34631c9d7c8SThomas Gleixner   to be noted in the first line of the changelog with::
34731c9d7c8SThomas Gleixner
34831c9d7c8SThomas Gleixner     From: Author <author@mail>
34931c9d7c8SThomas Gleixner
35031c9d7c8SThomas Gleixner     Changelog text starts here....
35131c9d7c8SThomas Gleixner
35231c9d7c8SThomas Gleixner   so the authorship is preserved. The 'From:' line has to be followed
35331c9d7c8SThomas Gleixner   by a empty newline. If that 'From:' line is missing, then the patch
35431c9d7c8SThomas Gleixner   would be attributed to the person who sent (transported, handled) it.
35531c9d7c8SThomas Gleixner   The 'From:' line is automatically removed when the patch is applied
35631c9d7c8SThomas Gleixner   and does not show up in the final git changelog. It merely affects
35731c9d7c8SThomas Gleixner   the authorship information of the resulting Git commit.
35831c9d7c8SThomas Gleixner
35931c9d7c8SThomas Gleixner - Tested-by: ``Tester <tester@mail>``
36031c9d7c8SThomas Gleixner
36131c9d7c8SThomas Gleixner - Reviewed-by: ``Reviewer <reviewer@mail>``
36231c9d7c8SThomas Gleixner
36331c9d7c8SThomas Gleixner - Acked-by: ``Acker <acker@mail>``
36431c9d7c8SThomas Gleixner
36531c9d7c8SThomas Gleixner - Cc: ``cc-ed-person <person@mail>``
36631c9d7c8SThomas Gleixner
36731c9d7c8SThomas Gleixner   If the patch should be backported to stable, then please add a '``Cc:
36831c9d7c8SThomas Gleixner   stable@vger.kernel.org``' tag, but do not Cc stable when sending your
36931c9d7c8SThomas Gleixner   mail.
37031c9d7c8SThomas Gleixner
37131c9d7c8SThomas Gleixner - Link: ``https://link/to/information``
37231c9d7c8SThomas Gleixner
37331c9d7c8SThomas Gleixner   For referring to an email on LKML or other kernel mailing lists,
374a9d85efbSThorsten Leemhuis   please use the lore.kernel.org redirector URL::
37531c9d7c8SThomas Gleixner
376a9d85efbSThorsten Leemhuis     https://lore.kernel.org/r/email-message@id
37731c9d7c8SThomas Gleixner
37831c9d7c8SThomas Gleixner   The kernel.org redirector is considered a stable URL, unlike other email
37931c9d7c8SThomas Gleixner   archives.
38031c9d7c8SThomas Gleixner
38131c9d7c8SThomas Gleixner   Maintainers will add a Link tag referencing the email of the patch
38231c9d7c8SThomas Gleixner   submission when they apply a patch to the tip tree. This tag is useful
38331c9d7c8SThomas Gleixner   for later reference and is also used for commit notifications.
38431c9d7c8SThomas Gleixner
38531c9d7c8SThomas GleixnerPlease do not use combined tags, e.g. ``Reported-and-tested-by``, as
38631c9d7c8SThomas Gleixnerthey just complicate automated extraction of tags.
38731c9d7c8SThomas Gleixner
38831c9d7c8SThomas Gleixner
38931c9d7c8SThomas GleixnerLinks to documentation
39031c9d7c8SThomas Gleixner^^^^^^^^^^^^^^^^^^^^^^
39131c9d7c8SThomas Gleixner
39231c9d7c8SThomas GleixnerProviding links to documentation in the changelog is a great help to later
39331c9d7c8SThomas Gleixnerdebugging and analysis.  Unfortunately, URLs often break very quickly
39431c9d7c8SThomas Gleixnerbecause companies restructure their websites frequently.  Non-'volatile'
39531c9d7c8SThomas Gleixnerexceptions include the Intel SDM and the AMD APM.
39631c9d7c8SThomas Gleixner
39731c9d7c8SThomas GleixnerTherefore, for 'volatile' documents, please create an entry in the kernel
39831c9d7c8SThomas Gleixnerbugzilla https://bugzilla.kernel.org and attach a copy of these documents
39931c9d7c8SThomas Gleixnerto the bugzilla entry. Finally, provide the URL of the bugzilla entry in
40031c9d7c8SThomas Gleixnerthe changelog.
40131c9d7c8SThomas Gleixner
40231c9d7c8SThomas GleixnerPatch resend or reminders
40331c9d7c8SThomas Gleixner^^^^^^^^^^^^^^^^^^^^^^^^^
40431c9d7c8SThomas Gleixner
40531c9d7c8SThomas GleixnerSee :ref:`resend_reminders`.
40631c9d7c8SThomas Gleixner
40731c9d7c8SThomas GleixnerMerge window
40831c9d7c8SThomas Gleixner^^^^^^^^^^^^
40931c9d7c8SThomas Gleixner
41031c9d7c8SThomas GleixnerPlease do not expect large patch series to be handled during the merge
41131c9d7c8SThomas Gleixnerwindow or even during the week before.  Such patches should be submitted in
41231c9d7c8SThomas Gleixnermergeable state *at* *least* a week before the merge window opens.
41331c9d7c8SThomas GleixnerExceptions are made for bug fixes and *sometimes* for small standalone
41431c9d7c8SThomas Gleixnerdrivers for new hardware or minimally invasive patches for hardware
41531c9d7c8SThomas Gleixnerenablement.
41631c9d7c8SThomas Gleixner
41731c9d7c8SThomas GleixnerDuring the merge window, the maintainers instead focus on following the
41831c9d7c8SThomas Gleixnerupstream changes, fixing merge window fallout, collecting bug fixes, and
41931c9d7c8SThomas Gleixnerallowing themselves a breath. Please respect that.
42031c9d7c8SThomas Gleixner
42131c9d7c8SThomas GleixnerThe release candidate -rc1 is the starting point for new patches to be
42231c9d7c8SThomas Gleixnerapplied which are targeted for the next merge window.
42331c9d7c8SThomas Gleixner
42431c9d7c8SThomas GleixnerSo called _urgent_ branches will be merged into mainline during the
42531c9d7c8SThomas Gleixnerstabilization phase of each release.
42631c9d7c8SThomas Gleixner
42731c9d7c8SThomas Gleixner
42831c9d7c8SThomas GleixnerGit
42931c9d7c8SThomas Gleixner^^^
43031c9d7c8SThomas Gleixner
43131c9d7c8SThomas GleixnerThe tip maintainers accept git pull requests from maintainers who provide
43231c9d7c8SThomas Gleixnersubsystem changes for aggregation in the tip tree.
43331c9d7c8SThomas Gleixner
43431c9d7c8SThomas GleixnerPull requests for new patch submissions are usually not accepted and do not
43531c9d7c8SThomas Gleixnerreplace proper patch submission to the mailing list. The main reason for
43631c9d7c8SThomas Gleixnerthis is that the review workflow is email based.
43731c9d7c8SThomas Gleixner
43831c9d7c8SThomas GleixnerIf you submit a larger patch series it is helpful to provide a git branch
43931c9d7c8SThomas Gleixnerin a private repository which allows interested people to easily pull the
4409b5a7f4aSDave Hansenseries for testing. The usual way to offer this is a git URL in the cover
4419b5a7f4aSDave Hansenletter of the patch series.
4429b5a7f4aSDave Hansen
4439b5a7f4aSDave HansenTesting
4449b5a7f4aSDave Hansen^^^^^^^
4459b5a7f4aSDave Hansen
4469b5a7f4aSDave HansenCode should be tested before submitting to the tip maintainers.  Anything
4479b5a7f4aSDave Hansenother than minor changes should be built, booted and tested with
4489b5a7f4aSDave Hansencomprehensive (and heavyweight) kernel debugging options enabled.
4499b5a7f4aSDave Hansen
4509b5a7f4aSDave HansenThese debugging options can be found in kernel/configs/x86_debug.config
4519b5a7f4aSDave Hansenand can be added to an existing kernel config by running:
4529b5a7f4aSDave Hansen
4539b5a7f4aSDave Hansen	make x86_debug.config
45431c9d7c8SThomas Gleixner
45531c9d7c8SThomas GleixnerSome of these options are x86-specific and can be left out when testing
45631c9d7c8SThomas Gleixneron other architectures.
45731c9d7c8SThomas Gleixner
45831c9d7c8SThomas Gleixner.. _maintainer-tip-coding-style:
45931c9d7c8SThomas Gleixner
46031c9d7c8SThomas GleixnerCoding style notes
46131c9d7c8SThomas Gleixner------------------
46231c9d7c8SThomas Gleixner
46331c9d7c8SThomas GleixnerComment style
46431c9d7c8SThomas Gleixner^^^^^^^^^^^^^
46531c9d7c8SThomas Gleixner
46631c9d7c8SThomas GleixnerSentences in comments start with an uppercase letter.
46731c9d7c8SThomas Gleixner
46831c9d7c8SThomas GleixnerSingle line comments::
46931c9d7c8SThomas Gleixner
47031c9d7c8SThomas Gleixner	/* This is a single line comment */
47131c9d7c8SThomas Gleixner
47231c9d7c8SThomas GleixnerMulti-line comments::
47331c9d7c8SThomas Gleixner
47431c9d7c8SThomas Gleixner	/*
47531c9d7c8SThomas Gleixner	 * This is a properly formatted
47631c9d7c8SThomas Gleixner	 * multi-line comment.
47731c9d7c8SThomas Gleixner	 *
47831c9d7c8SThomas Gleixner	 * Larger multi-line comments should be split into paragraphs.
47931c9d7c8SThomas Gleixner	 */
48031c9d7c8SThomas Gleixner
48131c9d7c8SThomas GleixnerNo tail comments:
48231c9d7c8SThomas Gleixner
48331c9d7c8SThomas Gleixner  Please refrain from using tail comments. Tail comments disturb the
48431c9d7c8SThomas Gleixner  reading flow in almost all contexts, but especially in code::
48531c9d7c8SThomas Gleixner
48631c9d7c8SThomas Gleixner	if (somecondition_is_true) /* Don't put a comment here */
48731c9d7c8SThomas Gleixner		dostuff(); /* Neither here */
48831c9d7c8SThomas Gleixner
48931c9d7c8SThomas Gleixner	seed = MAGIC_CONSTANT; /* Nor here */
49031c9d7c8SThomas Gleixner
49131c9d7c8SThomas Gleixner  Use freestanding comments instead::
49231c9d7c8SThomas Gleixner
49331c9d7c8SThomas Gleixner	/* This condition is not obvious without a comment */
49431c9d7c8SThomas Gleixner	if (somecondition_is_true) {
49531c9d7c8SThomas Gleixner		/* This really needs to be documented */
49631c9d7c8SThomas Gleixner		dostuff();
49731c9d7c8SThomas Gleixner	}
49831c9d7c8SThomas Gleixner
49931c9d7c8SThomas Gleixner	/* This magic initialization needs a comment. Maybe not? */
50031c9d7c8SThomas Gleixner	seed = MAGIC_CONSTANT;
50131c9d7c8SThomas Gleixner
50231c9d7c8SThomas GleixnerComment the important things:
50331c9d7c8SThomas Gleixner
50431c9d7c8SThomas Gleixner  Comments should be added where the operation is not obvious. Documenting
50531c9d7c8SThomas Gleixner  the obvious is just a distraction::
50631c9d7c8SThomas Gleixner
50731c9d7c8SThomas Gleixner	/* Decrement refcount and check for zero */
50831c9d7c8SThomas Gleixner	if (refcount_dec_and_test(&p->refcnt)) {
50931c9d7c8SThomas Gleixner		do;
51031c9d7c8SThomas Gleixner		lots;
51131c9d7c8SThomas Gleixner		of;
51231c9d7c8SThomas Gleixner		magic;
51331c9d7c8SThomas Gleixner		things;
51431c9d7c8SThomas Gleixner	}
51531c9d7c8SThomas Gleixner
51631c9d7c8SThomas Gleixner  Instead, comments should explain the non-obvious details and document
51731c9d7c8SThomas Gleixner  constraints::
51831c9d7c8SThomas Gleixner
51931c9d7c8SThomas Gleixner	if (refcount_dec_and_test(&p->refcnt)) {
52031c9d7c8SThomas Gleixner		/*
52131c9d7c8SThomas Gleixner		 * Really good explanation why the magic things below
52231c9d7c8SThomas Gleixner		 * need to be done, ordering and locking constraints,
52331c9d7c8SThomas Gleixner		 * etc..
52431c9d7c8SThomas Gleixner		 */
52531c9d7c8SThomas Gleixner		do;
52631c9d7c8SThomas Gleixner		lots;
52731c9d7c8SThomas Gleixner		of;
52831c9d7c8SThomas Gleixner		magic;
52931c9d7c8SThomas Gleixner		/* Needs to be the last operation because ... */
53031c9d7c8SThomas Gleixner		things;
53131c9d7c8SThomas Gleixner	}
53231c9d7c8SThomas Gleixner
53331c9d7c8SThomas GleixnerFunction documentation comments:
53431c9d7c8SThomas Gleixner
53531c9d7c8SThomas Gleixner  To document functions and their arguments please use kernel-doc format
53631c9d7c8SThomas Gleixner  and not free form comments::
53731c9d7c8SThomas Gleixner
53831c9d7c8SThomas Gleixner	/**
53931c9d7c8SThomas Gleixner	 * magic_function - Do lots of magic stuff
54031c9d7c8SThomas Gleixner	 * @magic:	Pointer to the magic data to operate on
54131c9d7c8SThomas Gleixner	 * @offset:	Offset in the data array of @magic
54231c9d7c8SThomas Gleixner	 *
54331c9d7c8SThomas Gleixner	 * Deep explanation of mysterious things done with @magic along
54431c9d7c8SThomas Gleixner         * with documentation of the return values.
54531c9d7c8SThomas Gleixner	 *
54631c9d7c8SThomas Gleixner	 * Note, that the argument descriptors above are arranged
54731c9d7c8SThomas Gleixner	 * in a tabular fashion.
54831c9d7c8SThomas Gleixner	 */
54931c9d7c8SThomas Gleixner
55031c9d7c8SThomas Gleixner  This applies especially to globally visible functions and inline
55131c9d7c8SThomas Gleixner  functions in public header files. It might be overkill to use kernel-doc
55231c9d7c8SThomas Gleixner  format for every (static) function which needs a tiny explanation. The
55331c9d7c8SThomas Gleixner  usage of descriptive function names often replaces these tiny comments.
55431c9d7c8SThomas Gleixner  Apply common sense as always.
55531c9d7c8SThomas Gleixner
55631c9d7c8SThomas Gleixner
55731c9d7c8SThomas GleixnerDocumenting locking requirements
55831c9d7c8SThomas Gleixner^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
55931c9d7c8SThomas Gleixner  Documenting locking requirements is a good thing, but comments are not
56031c9d7c8SThomas Gleixner  necessarily the best choice. Instead of writing::
56131c9d7c8SThomas Gleixner
56231c9d7c8SThomas Gleixner	/* Caller must hold foo->lock */
56331c9d7c8SThomas Gleixner	void func(struct foo *foo)
56431c9d7c8SThomas Gleixner	{
56531c9d7c8SThomas Gleixner		...
56631c9d7c8SThomas Gleixner	}
56731c9d7c8SThomas Gleixner
56831c9d7c8SThomas Gleixner  Please use::
56931c9d7c8SThomas Gleixner
57031c9d7c8SThomas Gleixner	void func(struct foo *foo)
57131c9d7c8SThomas Gleixner	{
57231c9d7c8SThomas Gleixner		lockdep_assert_held(&foo->lock);
57331c9d7c8SThomas Gleixner		...
57431c9d7c8SThomas Gleixner	}
57531c9d7c8SThomas Gleixner
57631c9d7c8SThomas Gleixner  In PROVE_LOCKING kernels, lockdep_assert_held() emits a warning
57731c9d7c8SThomas Gleixner  if the caller doesn't hold the lock.  Comments can't do that.
57831c9d7c8SThomas Gleixner
57931c9d7c8SThomas GleixnerBracket rules
58031c9d7c8SThomas Gleixner^^^^^^^^^^^^^
58131c9d7c8SThomas Gleixner
58231c9d7c8SThomas GleixnerBrackets should be omitted only if the statement which follows 'if', 'for',
58331c9d7c8SThomas Gleixner'while' etc. is truly a single line::
58431c9d7c8SThomas Gleixner
58531c9d7c8SThomas Gleixner	if (foo)
58631c9d7c8SThomas Gleixner		do_something();
58731c9d7c8SThomas Gleixner
58831c9d7c8SThomas GleixnerThe following is not considered to be a single line statement even
58931c9d7c8SThomas Gleixnerthough C does not require brackets::
59031c9d7c8SThomas Gleixner
59131c9d7c8SThomas Gleixner	for (i = 0; i < end; i++)
59231c9d7c8SThomas Gleixner		if (foo[i])
59331c9d7c8SThomas Gleixner			do_something(foo[i]);
59431c9d7c8SThomas Gleixner
59531c9d7c8SThomas GleixnerAdding brackets around the outer loop enhances the reading flow::
59631c9d7c8SThomas Gleixner
59731c9d7c8SThomas Gleixner	for (i = 0; i < end; i++) {
59831c9d7c8SThomas Gleixner		if (foo[i])
59931c9d7c8SThomas Gleixner			do_something(foo[i]);
60031c9d7c8SThomas Gleixner	}
60131c9d7c8SThomas Gleixner
60231c9d7c8SThomas Gleixner
60331c9d7c8SThomas GleixnerVariable declarations
60431c9d7c8SThomas Gleixner^^^^^^^^^^^^^^^^^^^^^
60531c9d7c8SThomas Gleixner
60631c9d7c8SThomas GleixnerThe preferred ordering of variable declarations at the beginning of a
60731c9d7c8SThomas Gleixnerfunction is reverse fir tree order::
60831c9d7c8SThomas Gleixner
60931c9d7c8SThomas Gleixner	struct long_struct_name *descriptive_name;
61031c9d7c8SThomas Gleixner	unsigned long foo, bar;
61131c9d7c8SThomas Gleixner	unsigned int tmp;
61231c9d7c8SThomas Gleixner	int ret;
61331c9d7c8SThomas Gleixner
61431c9d7c8SThomas GleixnerThe above is faster to parse than the reverse ordering::
61531c9d7c8SThomas Gleixner
61631c9d7c8SThomas Gleixner	int ret;
61731c9d7c8SThomas Gleixner	unsigned int tmp;
61831c9d7c8SThomas Gleixner	unsigned long foo, bar;
61931c9d7c8SThomas Gleixner	struct long_struct_name *descriptive_name;
62031c9d7c8SThomas Gleixner
62131c9d7c8SThomas GleixnerAnd even more so than random ordering::
62231c9d7c8SThomas Gleixner
62331c9d7c8SThomas Gleixner	unsigned long foo, bar;
62431c9d7c8SThomas Gleixner	int ret;
62531c9d7c8SThomas Gleixner	struct long_struct_name *descriptive_name;
62631c9d7c8SThomas Gleixner	unsigned int tmp;
62731c9d7c8SThomas Gleixner
62831c9d7c8SThomas GleixnerAlso please try to aggregate variables of the same type into a single
62931c9d7c8SThomas Gleixnerline. There is no point in wasting screen space::
63031c9d7c8SThomas Gleixner
63131c9d7c8SThomas Gleixner	unsigned long a;
63231c9d7c8SThomas Gleixner	unsigned long b;
63331c9d7c8SThomas Gleixner	unsigned long c;
63431c9d7c8SThomas Gleixner	unsigned long d;
63531c9d7c8SThomas Gleixner
63631c9d7c8SThomas GleixnerIt's really sufficient to do::
63731c9d7c8SThomas Gleixner
63831c9d7c8SThomas Gleixner	unsigned long a, b, c, d;
63931c9d7c8SThomas Gleixner
64031c9d7c8SThomas GleixnerPlease also refrain from introducing line splits in variable declarations::
64131c9d7c8SThomas Gleixner
64231c9d7c8SThomas Gleixner	struct long_struct_name *descriptive_name = container_of(bar,
64331c9d7c8SThomas Gleixner						      struct long_struct_name,
64431c9d7c8SThomas Gleixner	                                              member);
64531c9d7c8SThomas Gleixner	struct foobar foo;
64631c9d7c8SThomas Gleixner
64731c9d7c8SThomas GleixnerIt's way better to move the initialization to a separate line after the
64831c9d7c8SThomas Gleixnerdeclarations::
64931c9d7c8SThomas Gleixner
65031c9d7c8SThomas Gleixner	struct long_struct_name *descriptive_name;
65131c9d7c8SThomas Gleixner	struct foobar foo;
65231c9d7c8SThomas Gleixner
65331c9d7c8SThomas Gleixner	descriptive_name = container_of(bar, struct long_struct_name, member);
65431c9d7c8SThomas Gleixner
65531c9d7c8SThomas Gleixner
65631c9d7c8SThomas GleixnerVariable types
65731c9d7c8SThomas Gleixner^^^^^^^^^^^^^^
65831c9d7c8SThomas Gleixner
65931c9d7c8SThomas GleixnerPlease use the proper u8, u16, u32, u64 types for variables which are meant
66031c9d7c8SThomas Gleixnerto describe hardware or are used as arguments for functions which access
66131c9d7c8SThomas Gleixnerhardware. These types are clearly defining the bit width and avoid
66231c9d7c8SThomas Gleixnertruncation, expansion and 32/64-bit confusion.
66331c9d7c8SThomas Gleixner
66431c9d7c8SThomas Gleixneru64 is also recommended in code which would become ambiguous for 32-bit
66531c9d7c8SThomas Gleixnerkernels when 'unsigned long' would be used instead. While in such
66631c9d7c8SThomas Gleixnersituations 'unsigned long long' could be used as well, u64 is shorter
66731c9d7c8SThomas Gleixnerand also clearly shows that the operation is required to be 64 bits wide
66831c9d7c8SThomas Gleixnerindependent of the target CPU.
66931c9d7c8SThomas Gleixner
67031c9d7c8SThomas GleixnerPlease use 'unsigned int' instead of 'unsigned'.
67131c9d7c8SThomas Gleixner
67231c9d7c8SThomas Gleixner
67331c9d7c8SThomas GleixnerConstants
67431c9d7c8SThomas Gleixner^^^^^^^^^
67531c9d7c8SThomas Gleixner
67631c9d7c8SThomas GleixnerPlease do not use literal (hexa)decimal numbers in code or initializers.
67731c9d7c8SThomas GleixnerEither use proper defines which have descriptive names or consider using
67831c9d7c8SThomas Gleixneran enum.
67931c9d7c8SThomas Gleixner
68031c9d7c8SThomas Gleixner
68131c9d7c8SThomas GleixnerStruct declarations and initializers
68231c9d7c8SThomas Gleixner^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
68331c9d7c8SThomas Gleixner
68431c9d7c8SThomas GleixnerStruct declarations should align the struct member names in a tabular
68531c9d7c8SThomas Gleixnerfashion::
68631c9d7c8SThomas Gleixner
68731c9d7c8SThomas Gleixner	struct bar_order {
68831c9d7c8SThomas Gleixner		unsigned int	guest_id;
68931c9d7c8SThomas Gleixner		int		ordered_item;
69031c9d7c8SThomas Gleixner		struct menu	*menu;
69131c9d7c8SThomas Gleixner	};
69231c9d7c8SThomas Gleixner
69331c9d7c8SThomas GleixnerPlease avoid documenting struct members within the declaration, because
69431c9d7c8SThomas Gleixnerthis often results in strangely formatted comments and the struct members
69531c9d7c8SThomas Gleixnerbecome obfuscated::
69631c9d7c8SThomas Gleixner
69731c9d7c8SThomas Gleixner	struct bar_order {
69831c9d7c8SThomas Gleixner		unsigned int	guest_id; /* Unique guest id */
69931c9d7c8SThomas Gleixner		int		ordered_item;
70031c9d7c8SThomas Gleixner		/* Pointer to a menu instance which contains all the drinks */
70131c9d7c8SThomas Gleixner		struct menu	*menu;
70231c9d7c8SThomas Gleixner	};
70331c9d7c8SThomas Gleixner
70431c9d7c8SThomas GleixnerInstead, please consider using the kernel-doc format in a comment preceding
70531c9d7c8SThomas Gleixnerthe struct declaration, which is easier to read and has the added advantage
70631c9d7c8SThomas Gleixnerof including the information in the kernel documentation, for example, as
70731c9d7c8SThomas Gleixnerfollows::
70831c9d7c8SThomas Gleixner
70931c9d7c8SThomas Gleixner
71031c9d7c8SThomas Gleixner	/**
71131c9d7c8SThomas Gleixner	 * struct bar_order - Description of a bar order
71231c9d7c8SThomas Gleixner	 * @guest_id:		Unique guest id
71331c9d7c8SThomas Gleixner	 * @ordered_item:	The item number from the menu
71431c9d7c8SThomas Gleixner	 * @menu:		Pointer to the menu from which the item
71531c9d7c8SThomas Gleixner	 *  			was ordered
71631c9d7c8SThomas Gleixner	 *
71731c9d7c8SThomas Gleixner	 * Supplementary information for using the struct.
71831c9d7c8SThomas Gleixner	 *
71931c9d7c8SThomas Gleixner	 * Note, that the struct member descriptors above are arranged
72031c9d7c8SThomas Gleixner	 * in a tabular fashion.
72131c9d7c8SThomas Gleixner	 */
72231c9d7c8SThomas Gleixner	struct bar_order {
72331c9d7c8SThomas Gleixner		unsigned int	guest_id;
72431c9d7c8SThomas Gleixner		int		ordered_item;
72531c9d7c8SThomas Gleixner		struct menu	*menu;
72631c9d7c8SThomas Gleixner	};
72731c9d7c8SThomas Gleixner
72831c9d7c8SThomas GleixnerStatic struct initializers must use C99 initializers and should also be
72931c9d7c8SThomas Gleixneraligned in a tabular fashion::
73031c9d7c8SThomas Gleixner
73131c9d7c8SThomas Gleixner	static struct foo statfoo = {
73231c9d7c8SThomas Gleixner		.a		= 0,
73331c9d7c8SThomas Gleixner		.plain_integer	= CONSTANT_DEFINE_OR_ENUM,
73431c9d7c8SThomas Gleixner		.bar		= &statbar,
73531c9d7c8SThomas Gleixner	};
73631c9d7c8SThomas Gleixner
73731c9d7c8SThomas GleixnerNote that while C99 syntax allows the omission of the final comma,
73831c9d7c8SThomas Gleixnerwe recommend the use of a comma on the last line because it makes
73931c9d7c8SThomas Gleixnerreordering and addition of new lines easier, and makes such future
74031c9d7c8SThomas Gleixnerpatches slightly easier to read as well.
74131c9d7c8SThomas Gleixner
74231c9d7c8SThomas GleixnerLine breaks
74331c9d7c8SThomas Gleixner^^^^^^^^^^^
74431c9d7c8SThomas Gleixner
74531c9d7c8SThomas GleixnerRestricting line length to 80 characters makes deeply indented code hard to
74631c9d7c8SThomas Gleixnerread.  Consider breaking out code into helper functions to avoid excessive
74731c9d7c8SThomas Gleixnerline breaking.
74831c9d7c8SThomas Gleixner
74931c9d7c8SThomas GleixnerThe 80 character rule is not a strict rule, so please use common sense when
75031c9d7c8SThomas Gleixnerbreaking lines. Especially format strings should never be broken up.
75131c9d7c8SThomas Gleixner
75231c9d7c8SThomas GleixnerWhen splitting function declarations or function calls, then please align
75331c9d7c8SThomas Gleixnerthe first argument in the second line with the first argument in the first
75431c9d7c8SThomas Gleixnerline::
75531c9d7c8SThomas Gleixner
75631c9d7c8SThomas Gleixner  static int long_function_name(struct foobar *barfoo, unsigned int id,
75731c9d7c8SThomas Gleixner				unsigned int offset)
75831c9d7c8SThomas Gleixner  {
75931c9d7c8SThomas Gleixner
76031c9d7c8SThomas Gleixner	if (!id) {
76131c9d7c8SThomas Gleixner		ret = longer_function_name(barfoo, DEFAULT_BARFOO_ID,
76231c9d7c8SThomas Gleixner					   offset);
76331c9d7c8SThomas Gleixner	...
76431c9d7c8SThomas Gleixner
76531c9d7c8SThomas GleixnerNamespaces
76631c9d7c8SThomas Gleixner^^^^^^^^^^
76731c9d7c8SThomas Gleixner
76831c9d7c8SThomas GleixnerFunction/variable namespaces improve readability and allow easy
76931c9d7c8SThomas Gleixnergrepping. These namespaces are string prefixes for globally visible
77031c9d7c8SThomas Gleixnerfunction and variable names, including inlines. These prefixes should
77131c9d7c8SThomas Gleixnercombine the subsystem and the component name such as 'x86_comp\_',
77231c9d7c8SThomas Gleixner'sched\_', 'irq\_', and 'mutex\_'.
77331c9d7c8SThomas Gleixner
77431c9d7c8SThomas GleixnerThis also includes static file scope functions that are immediately put
77531c9d7c8SThomas Gleixnerinto globally visible driver templates - it's useful for those symbols
77631c9d7c8SThomas Gleixnerto carry a good prefix as well, for backtrace readability.
77731c9d7c8SThomas Gleixner
77831c9d7c8SThomas GleixnerNamespace prefixes may be omitted for local static functions and
77931c9d7c8SThomas Gleixnervariables. Truly local functions, only called by other local functions,
78031c9d7c8SThomas Gleixnercan have shorter descriptive names - our primary concern is greppability
78131c9d7c8SThomas Gleixnerand backtrace readability.
78231c9d7c8SThomas Gleixner
78331c9d7c8SThomas GleixnerPlease note that 'xxx_vendor\_' and 'vendor_xxx_` prefixes are not
78431c9d7c8SThomas Gleixnerhelpful for static functions in vendor-specific files. After all, it
78531c9d7c8SThomas Gleixneris already clear that the code is vendor-specific. In addition, vendor
78631c9d7c8SThomas Gleixnernames should only be for truly vendor-specific functionality.
78731c9d7c8SThomas Gleixner
78831c9d7c8SThomas GleixnerAs always apply common sense and aim for consistency and readability.
78931c9d7c8SThomas Gleixner
79031c9d7c8SThomas Gleixner
79131c9d7c8SThomas GleixnerCommit notifications
79231c9d7c8SThomas Gleixner--------------------
79331c9d7c8SThomas Gleixner
79431c9d7c8SThomas GleixnerThe tip tree is monitored by a bot for new commits. The bot sends an email
79531c9d7c8SThomas Gleixnerfor each new commit to a dedicated mailing list
79631c9d7c8SThomas Gleixner(``linux-tip-commits@vger.kernel.org``) and Cc's all people who are
79731c9d7c8SThomas Gleixnermentioned in one of the commit tags. It uses the email message ID from the
79831c9d7c8SThomas GleixnerLink tag at the end of the tag list to set the In-Reply-To email header so
79931c9d7c8SThomas Gleixnerthe message is properly threaded with the patch submission email.
800
801The tip maintainers and submaintainers try to reply to the submitter
802when merging a patch, but they sometimes forget or it does not fit the
803workflow of the moment. While the bot message is purely mechanical, it
804also implies a 'Thank you! Applied.'.
805