1 .. SPDX-License-Identifier: GPL-2.0
9 The tip tree is a collection of several subsystems and areas of
10 development. The tip tree is both a direct development tree and a
11 aggregation tree for several sub-maintainer trees. The tip tree gitweb URL
12 is: https://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git
14 The tip tree contains the following subsystems:
16 - **x86 architecture**
18 The x86 architecture development takes place in the tip tree except
19 for the x86 KVM and XEN specific parts which are maintained in the
20 corresponding subsystems and routed directly to mainline from
21 there. It's still good practice to Cc the x86 maintainers on
22 x86-specific KVM and XEN patches.
24 Some x86 subsystems have their own maintainers in addition to the
25 overall x86 maintainers. Please Cc the overall x86 maintainers on
26 patches touching files in arch/x86 even when they are not called out
27 by the MAINTAINER file.
29 Note, that ``x86@kernel.org`` is not a mailing list. It is merely a
30 mail alias which distributes mails to the x86 top-level maintainer
31 team. Please always Cc the Linux Kernel mailing list (LKML)
32 ``linux-kernel@vger.kernel.org``, otherwise your mail ends up only in
33 the private inboxes of the maintainers.
37 Scheduler development takes place in the -tip tree, in the
38 sched/core branch - with occasional sub-topic trees for
39 work-in-progress patch-sets.
41 - **Locking and atomics**
43 Locking development (including atomics and other synchronization
44 primitives that are connected to locking) takes place in the -tip
45 tree, in the locking/core branch - with occasional sub-topic trees
46 for work-in-progress patch-sets.
48 - **Generic interrupt subsystem and interrupt chip drivers**:
50 - interrupt core development happens in the irq/core branch
52 - interrupt chip driver development also happens in the irq/core
53 branch, but the patches are usually applied in a separate maintainer
54 tree and then aggregated into irq/core
56 - **Time, timers, timekeeping, NOHZ and related chip drivers**:
58 - timekeeping, clocksource core, NTP and alarmtimer development
59 happens in the timers/core branch, but patches are usually applied in
60 a separate maintainer tree and then aggregated into timers/core
62 - clocksource/event driver development happens in the timers/core
63 branch, but patches are mostly applied in a separate maintainer tree
64 and then aggregated into timers/core
66 - **Performance counters core, architecture support and tooling**:
68 - perf core and architecture support development happens in the
71 - perf tooling development happens in the perf tools maintainer
72 tree and is aggregated into the tip tree.
74 - **CPU hotplug core**
78 Mostly x86-specific RAS patches are collected in the tip ras/core
83 EFI development in the efi git tree. The collected patches are
84 aggregated in the tip efi/core branch.
88 RCU development happens in the linux-rcu tree. The resulting changes
89 are aggregated into the tip core/rcu branch.
91 - **Various core code components**:
97 - random bits and pieces
100 Patch submission notes
101 ----------------------
103 Selecting the tree/branch
104 ^^^^^^^^^^^^^^^^^^^^^^^^^
106 In general, development against the head of the tip tree master branch is
107 fine, but for the subsystems which are maintained separately, have their
108 own git tree and are only aggregated into the tip tree, development should
109 take place against the relevant subsystem tree or branch.
111 Bug fixes which target mainline should always be applicable against the
112 mainline kernel tree. Potential conflicts against changes which are already
113 queued in the tip tree are handled by the maintainers.
118 The tip tree preferred format for patch subject prefixes is
119 'subsys/component:', e.g. 'x86/apic:', 'x86/mm/fault:', 'sched/fair:',
120 'genirq/core:'. Please do not use file names or complete file paths as
121 prefix. 'git log path/to/file' should give you a reasonable hint in most
124 The condensed patch description in the subject line should start with a
125 uppercase letter and should be written in imperative tone.
131 The general rules about changelogs in the :ref:`Submitting patches guide
132 <describe_changes>`, apply.
134 The tip tree maintainers set value on following these rules, especially on
135 the request to write changelogs in imperative mood and not impersonating
136 code or the execution of it. This is not just a whim of the
137 maintainers. Changelogs written in abstract words are more precise and
138 tend to be less confusing than those written in the form of novels.
140 It's also useful to structure the changelog into several paragraphs and not
141 lump everything together into a single one. A good structure is to explain
142 the context, the problem and the solution in separate paragraphs and this
145 Examples for illustration:
149 x86/intel_rdt/mbm: Fix MBM overflow handler during hot cpu
151 When a CPU is dying, we cancel the worker and schedule a new worker on a
152 different CPU on the same domain. But if the timer is already about to
153 expire (say 0.99s) then we essentially double the interval.
155 We modify the hot cpu handling to cancel the delayed work on the dying
156 cpu and run the worker immediately on a different cpu in same domain. We
157 donot flush the worker because the MBM overflow worker reschedules the
158 worker on same CPU and scans the domain->cpu_mask to get the domain
163 x86/intel_rdt/mbm: Fix MBM overflow handler during CPU hotplug
165 When a CPU is dying, the overflow worker is canceled and rescheduled on a
166 different CPU in the same domain. But if the timer is already about to
167 expire this essentially doubles the interval which might result in a non
170 Cancel the overflow worker and reschedule it immediately on a different CPU
171 in the same domain. The work could be flushed as well, but that would
172 reschedule it on the same CPU.
176 time: POSIX CPU timers: Ensure that variable is initialized
178 If cpu_timer_sample_group returns -EINVAL, it will not have written into
179 *sample. Checking for cpu_timer_sample_group's return value precludes the
180 potential use of an uninitialized value of now in the following block.
181 Given an invalid clock_idx, the previous code could otherwise overwrite
182 *oldval in an undefined manner. This is now prevented. We also exploit
183 short-circuiting of && to sample the timer only if the result will
184 actually be used to update *oldval.
188 posix-cpu-timers: Make set_process_cpu_timer() more robust
190 Because the return value of cpu_timer_sample_group() is not checked,
191 compilers and static checkers can legitimately warn about a potential use
192 of the uninitialized variable 'now'. This is not a runtime issue as all
193 call sites hand in valid clock ids.
195 Also cpu_timer_sample_group() is invoked unconditionally even when the
196 result is not used because *oldval is NULL.
198 Make the invocation conditional and check the return value.
202 The entity can also be used for other purposes.
204 Let's rename it to be more generic.
208 The entity can also be used for other purposes.
210 Rename it to be more generic.
213 For complex scenarios, especially race conditions and memory ordering
214 issues, it is valuable to depict the scenario with a table which shows
215 the parallelism and the temporal order of events. Here is an example::
218 free_irq(X) interrupt X
219 spin_lock(desc->lock)
221 spin_unlock(desc->lock)
222 spin_lock(desc->lock)
225 release_resources() thread_handler()
226 spin_unlock(desc->lock) access released resources.
227 ^^^^^^^^^^^^^^^^^^^^^^^^^
230 Lockdep provides similar useful output to depict a possible deadlock
234 rtmutex_lock(&rcu->rt_mutex)
235 spin_lock(&rcu->rt_mutex.wait_lock)
237 spin_lock(&timer->it_lock)
238 spin_lock(&rcu->mutex.wait_lock)
240 spin_lock(&timer->it_lock)
243 Function references in changelogs
244 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
246 When a function is mentioned in the changelog, either the text body or the
247 subject line, please use the format 'function_name()'. Omitting the
248 brackets after the function name can be ambiguous::
250 Subject: subsys/component: Make reservation_count static
252 reservation_count is only used in reservation_stats. Make it static.
254 The variant with brackets is more precise::
256 Subject: subsys/component: Make reservation_count() static
258 reservation_count() is only called from reservation_stats(). Make it
262 Backtraces in changelogs
263 ^^^^^^^^^^^^^^^^^^^^^^^^
265 See :ref:`backtraces`.
267 Ordering of commit tags
268 ^^^^^^^^^^^^^^^^^^^^^^^
270 To have a uniform view of the commit tags, the tip maintainers use the
271 following tag ordering scheme:
273 - Fixes: 12char-SHA1 ("sub/sys: Original subject line")
275 A Fixes tag should be added even for changes which do not need to be
276 backported to stable kernels, i.e. when addressing a recently introduced
277 issue which only affects tip or the current head of mainline. These tags
278 are helpful to identify the original commit and are much more valuable
279 than prominently mentioning the commit which introduced a problem in the
280 text of the changelog itself because they can be automatically
283 The following example illustrates the difference::
287 abcdef012345678 ("x86/xxx: Replace foo with bar")
289 left an unused instance of variable foo around. Remove it.
291 Signed-off-by: J.Dev <j.dev@mail>
295 The recent replacement of foo with bar left an unused instance of
296 variable foo around. Remove it.
298 Fixes: abcdef012345678 ("x86/xxx: Replace foo with bar")
299 Signed-off-by: J.Dev <j.dev@mail>
301 The latter puts the information about the patch into the focus and
302 amends it with the reference to the commit which introduced the issue
303 rather than putting the focus on the original commit in the first place.
305 - Reported-by: ``Reporter <reporter@mail>``
307 - Closes: ``URL or Message-ID of the bug report this is fixing``
309 - Originally-by: ``Original author <original-author@mail>``
311 - Suggested-by: ``Suggester <suggester@mail>``
313 - Co-developed-by: ``Co-author <co-author@mail>``
315 Signed-off-by: ``Co-author <co-author@mail>``
317 Note, that Co-developed-by and Signed-off-by of the co-author(s) must
320 - Signed-off-by: ``Author <author@mail>``
322 The first Signed-off-by (SOB) after the last Co-developed-by/SOB pair is the
323 author SOB, i.e. the person flagged as author by git.
325 - Signed-off-by: ``Patch handler <handler@mail>``
327 SOBs after the author SOB are from people handling and transporting
328 the patch, but were not involved in development. SOB chains should
329 reflect the **real** route a patch took as it was propagated to us,
330 with the first SOB entry signalling primary authorship of a single
331 author. Acks should be given as Acked-by lines and review approvals
332 as Reviewed-by lines.
334 If the handler made modifications to the patch or the changelog, then
335 this should be mentioned **after** the changelog text and **above**
336 all commit tags in the following format::
338 ... changelog text ends.
340 [ handler: Replaced foo by bar and updated changelog ]
344 Note the two empty new lines which separate the changelog text and the
345 commit tags from that notice.
347 If a patch is sent to the mailing list by a handler then the author has
348 to be noted in the first line of the changelog with::
350 From: Author <author@mail>
352 Changelog text starts here....
354 so the authorship is preserved. The 'From:' line has to be followed
355 by a empty newline. If that 'From:' line is missing, then the patch
356 would be attributed to the person who sent (transported, handled) it.
357 The 'From:' line is automatically removed when the patch is applied
358 and does not show up in the final git changelog. It merely affects
359 the authorship information of the resulting Git commit.
361 - Tested-by: ``Tester <tester@mail>``
363 - Reviewed-by: ``Reviewer <reviewer@mail>``
365 - Acked-by: ``Acker <acker@mail>``
367 - Cc: ``cc-ed-person <person@mail>``
369 If the patch should be backported to stable, then please add a '``Cc:
370 stable@vger.kernel.org``' tag, but do not Cc stable when sending your
373 - Link: ``https://link/to/information``
375 For referring to an email on LKML or other kernel mailing lists,
376 please use the lore.kernel.org redirector URL::
378 https://lore.kernel.org/r/email-message@id
380 The kernel.org redirector is considered a stable URL, unlike other email
383 Maintainers will add a Link tag referencing the email of the patch
384 submission when they apply a patch to the tip tree. This tag is useful
385 for later reference and is also used for commit notifications.
387 Please do not use combined tags, e.g. ``Reported-and-tested-by``, as
388 they just complicate automated extraction of tags.
391 Links to documentation
392 ^^^^^^^^^^^^^^^^^^^^^^
394 Providing links to documentation in the changelog is a great help to later
395 debugging and analysis. Unfortunately, URLs often break very quickly
396 because companies restructure their websites frequently. Non-'volatile'
397 exceptions include the Intel SDM and the AMD APM.
399 Therefore, for 'volatile' documents, please create an entry in the kernel
400 bugzilla https://bugzilla.kernel.org and attach a copy of these documents
401 to the bugzilla entry. Finally, provide the URL of the bugzilla entry in
404 Patch resend or reminders
405 ^^^^^^^^^^^^^^^^^^^^^^^^^
407 See :ref:`resend_reminders`.
412 Please do not expect large patch series to be handled during the merge
413 window or even during the week before. Such patches should be submitted in
414 mergeable state *at* *least* a week before the merge window opens.
415 Exceptions are made for bug fixes and *sometimes* for small standalone
416 drivers for new hardware or minimally invasive patches for hardware
419 During the merge window, the maintainers instead focus on following the
420 upstream changes, fixing merge window fallout, collecting bug fixes, and
421 allowing themselves a breath. Please respect that.
423 The release candidate -rc1 is the starting point for new patches to be
424 applied which are targeted for the next merge window.
426 So called _urgent_ branches will be merged into mainline during the
427 stabilization phase of each release.
433 The tip maintainers accept git pull requests from maintainers who provide
434 subsystem changes for aggregation in the tip tree.
436 Pull requests for new patch submissions are usually not accepted and do not
437 replace proper patch submission to the mailing list. The main reason for
438 this is that the review workflow is email based.
440 If you submit a larger patch series it is helpful to provide a git branch
441 in a private repository which allows interested people to easily pull the
442 series for testing. The usual way to offer this is a git URL in the cover
443 letter of the patch series.
448 Code should be tested before submitting to the tip maintainers. Anything
449 other than minor changes should be built, booted and tested with
450 comprehensive (and heavyweight) kernel debugging options enabled.
452 These debugging options can be found in kernel/configs/x86_debug.config
453 and can be added to an existing kernel config by running:
455 make x86_debug.config
457 Some of these options are x86-specific and can be left out when testing
458 on other architectures.
460 .. _maintainer-tip-coding-style:
468 Sentences in comments start with an uppercase letter.
470 Single line comments::
472 /* This is a single line comment */
474 Multi-line comments::
477 * This is a properly formatted
478 * multi-line comment.
480 * Larger multi-line comments should be split into paragraphs.
483 No tail comments (see below):
485 Please refrain from using tail comments. Tail comments disturb the
486 reading flow in almost all contexts, but especially in code::
488 if (somecondition_is_true) /* Don't put a comment here */
489 dostuff(); /* Neither here */
491 seed = MAGIC_CONSTANT; /* Nor here */
493 Use freestanding comments instead::
495 /* This condition is not obvious without a comment */
496 if (somecondition_is_true) {
497 /* This really needs to be documented */
501 /* This magic initialization needs a comment. Maybe not? */
502 seed = MAGIC_CONSTANT;
504 Use C++ style, tail comments when documenting structs in headers to
505 achieve a more compact layout and better readability::
508 u32 x2apic_shift : 5, // Number of bits to shift APIC ID right
509 // for the topology ID at the next level
512 u32 num_processors : 16, // Number of processors at current level
519 * Number of bits to shift APIC ID right for the topology ID
522 u32 x2apic_shift : 5,
527 /* Number of processors at current level */
528 u32 num_processors : 16,
532 Comment the important things:
534 Comments should be added where the operation is not obvious. Documenting
535 the obvious is just a distraction::
537 /* Decrement refcount and check for zero */
538 if (refcount_dec_and_test(&p->refcnt)) {
546 Instead, comments should explain the non-obvious details and document
549 if (refcount_dec_and_test(&p->refcnt)) {
551 * Really good explanation why the magic things below
552 * need to be done, ordering and locking constraints,
559 /* Needs to be the last operation because ... */
563 Function documentation comments:
565 To document functions and their arguments please use kernel-doc format
566 and not free form comments::
569 * magic_function - Do lots of magic stuff
570 * @magic: Pointer to the magic data to operate on
571 * @offset: Offset in the data array of @magic
573 * Deep explanation of mysterious things done with @magic along
574 * with documentation of the return values.
576 * Note, that the argument descriptors above are arranged
577 * in a tabular fashion.
580 This applies especially to globally visible functions and inline
581 functions in public header files. It might be overkill to use kernel-doc
582 format for every (static) function which needs a tiny explanation. The
583 usage of descriptive function names often replaces these tiny comments.
584 Apply common sense as always.
587 Documenting locking requirements
588 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
589 Documenting locking requirements is a good thing, but comments are not
590 necessarily the best choice. Instead of writing::
592 /* Caller must hold foo->lock */
593 void func(struct foo *foo)
600 void func(struct foo *foo)
602 lockdep_assert_held(&foo->lock);
606 In PROVE_LOCKING kernels, lockdep_assert_held() emits a warning
607 if the caller doesn't hold the lock. Comments can't do that.
612 Brackets should be omitted only if the statement which follows 'if', 'for',
613 'while' etc. is truly a single line::
618 The following is not considered to be a single line statement even
619 though C does not require brackets::
621 for (i = 0; i < end; i++)
623 do_something(foo[i]);
625 Adding brackets around the outer loop enhances the reading flow::
627 for (i = 0; i < end; i++) {
629 do_something(foo[i]);
633 Variable declarations
634 ^^^^^^^^^^^^^^^^^^^^^
636 The preferred ordering of variable declarations at the beginning of a
637 function is reverse fir tree order::
639 struct long_struct_name *descriptive_name;
640 unsigned long foo, bar;
644 The above is faster to parse than the reverse ordering::
648 unsigned long foo, bar;
649 struct long_struct_name *descriptive_name;
651 And even more so than random ordering::
653 unsigned long foo, bar;
655 struct long_struct_name *descriptive_name;
658 Also please try to aggregate variables of the same type into a single
659 line. There is no point in wasting screen space::
666 It's really sufficient to do::
668 unsigned long a, b, c, d;
670 Please also refrain from introducing line splits in variable declarations::
672 struct long_struct_name *descriptive_name = container_of(bar,
673 struct long_struct_name,
677 It's way better to move the initialization to a separate line after the
680 struct long_struct_name *descriptive_name;
683 descriptive_name = container_of(bar, struct long_struct_name, member);
689 Please use the proper u8, u16, u32, u64 types for variables which are meant
690 to describe hardware or are used as arguments for functions which access
691 hardware. These types are clearly defining the bit width and avoid
692 truncation, expansion and 32/64-bit confusion.
694 u64 is also recommended in code which would become ambiguous for 32-bit
695 kernels when 'unsigned long' would be used instead. While in such
696 situations 'unsigned long long' could be used as well, u64 is shorter
697 and also clearly shows that the operation is required to be 64 bits wide
698 independent of the target CPU.
700 Please use 'unsigned int' instead of 'unsigned'.
706 Please do not use literal (hexa)decimal numbers in code or initializers.
707 Either use proper defines which have descriptive names or consider using
711 Struct declarations and initializers
712 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
714 Struct declarations should align the struct member names in a tabular
718 unsigned int guest_id;
723 Please avoid documenting struct members within the declaration, because
724 this often results in strangely formatted comments and the struct members
728 unsigned int guest_id; /* Unique guest id */
730 /* Pointer to a menu instance which contains all the drinks */
734 Instead, please consider using the kernel-doc format in a comment preceding
735 the struct declaration, which is easier to read and has the added advantage
736 of including the information in the kernel documentation, for example, as
741 * struct bar_order - Description of a bar order
742 * @guest_id: Unique guest id
743 * @ordered_item: The item number from the menu
744 * @menu: Pointer to the menu from which the item
747 * Supplementary information for using the struct.
749 * Note, that the struct member descriptors above are arranged
750 * in a tabular fashion.
753 unsigned int guest_id;
758 Static struct initializers must use C99 initializers and should also be
759 aligned in a tabular fashion::
761 static struct foo statfoo = {
763 .plain_integer = CONSTANT_DEFINE_OR_ENUM,
767 Note that while C99 syntax allows the omission of the final comma,
768 we recommend the use of a comma on the last line because it makes
769 reordering and addition of new lines easier, and makes such future
770 patches slightly easier to read as well.
775 Restricting line length to 80 characters makes deeply indented code hard to
776 read. Consider breaking out code into helper functions to avoid excessive
779 The 80 character rule is not a strict rule, so please use common sense when
780 breaking lines. Especially format strings should never be broken up.
782 When splitting function declarations or function calls, then please align
783 the first argument in the second line with the first argument in the first
786 static int long_function_name(struct foobar *barfoo, unsigned int id,
791 ret = longer_function_name(barfoo, DEFAULT_BARFOO_ID,
798 Function/variable namespaces improve readability and allow easy
799 grepping. These namespaces are string prefixes for globally visible
800 function and variable names, including inlines. These prefixes should
801 combine the subsystem and the component name such as 'x86_comp\_',
802 'sched\_', 'irq\_', and 'mutex\_'.
804 This also includes static file scope functions that are immediately put
805 into globally visible driver templates - it's useful for those symbols
806 to carry a good prefix as well, for backtrace readability.
808 Namespace prefixes may be omitted for local static functions and
809 variables. Truly local functions, only called by other local functions,
810 can have shorter descriptive names - our primary concern is greppability
811 and backtrace readability.
813 Please note that 'xxx_vendor\_' and 'vendor_xxx_` prefixes are not
814 helpful for static functions in vendor-specific files. After all, it
815 is already clear that the code is vendor-specific. In addition, vendor
816 names should only be for truly vendor-specific functionality.
818 As always apply common sense and aim for consistency and readability.
824 The tip tree is monitored by a bot for new commits. The bot sends an email
825 for each new commit to a dedicated mailing list
826 (``linux-tip-commits@vger.kernel.org``) and Cc's all people who are
827 mentioned in one of the commit tags. It uses the email message ID from the
828 Link tag at the end of the tag list to set the In-Reply-To email header so
829 the message is properly threaded with the patch submission email.
831 The tip maintainers and submaintainers try to reply to the submitter
832 when merging a patch, but they sometimes forget or it does not fit the
833 workflow of the moment. While the bot message is purely mechanical, it
834 also implies a 'Thank you! Applied.'.