blob: b1bc2d37bd0a1d46df5e3f2c6be973ec3daa5469 [file] [log] [blame]
Mauro Carvalho Chehabdca22a62016-09-21 08:51:05 -03001.. _submitchecklist:
2
Jesper Juhl8b7ecb12007-07-15 23:40:51 -07003Linux Kernel patch submission checklist
Mauro Carvalho Chehab7a71a802016-09-19 08:08:01 -03004~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Randy Dunlap915a56d2006-06-23 02:05:49 -07005
Andrew Mortone54695a2006-07-10 04:45:42 -07006Here are some basic things that developers should do if they want to see their
7kernel patch submissions accepted more quickly.
Randy Dunlap915a56d2006-06-23 02:05:49 -07008
Andrew Mortone54695a2006-07-10 04:45:42 -07009These are all above and beyond the documentation that is provided in
Mauro Carvalho Chehab8c27ceff32016-10-18 10:12:27 -020010:ref:`Documentation/process/submitting-patches.rst <submittingpatches>`
Mauro Carvalho Chehab7a71a802016-09-19 08:08:01 -030011and elsewhere regarding submitting Linux kernel patches.
Randy Dunlap915a56d2006-06-23 02:05:49 -070012
13
Mauro Carvalho Chehab7a71a802016-09-19 08:08:01 -0300141) If you use a facility then #include the file that defines/declares
Randy Dunlapb5247c82010-03-10 15:21:59 -080015 that facility. Don't depend on other header files pulling in ones
16 that you use.
17
Mauro Carvalho Chehab7a71a802016-09-19 08:08:01 -0300182) Builds cleanly:
Randy Dunlap915a56d2006-06-23 02:05:49 -070019
Mauro Carvalho Chehab7a71a802016-09-19 08:08:01 -030020 a) with applicable or modified ``CONFIG`` options ``=y``, ``=m``, and
21 ``=n``. No ``gcc`` warnings/errors, no linker warnings/errors.
Randy Dunlap915a56d2006-06-23 02:05:49 -070022
Mauro Carvalho Chehab7a71a802016-09-19 08:08:01 -030023 b) Passes ``allnoconfig``, ``allmodconfig``
Randy Dunlap85f96422010-05-23 17:02:30 -070024
Mauro Carvalho Chehab7a71a802016-09-19 08:08:01 -030025 c) Builds successfully when using ``O=builddir``
26
Randy Dunlap9334e342020-08-30 17:43:54 -070027 d) Any Documentation/ changes build successfully without new warnings/errors.
28 Use ``make htmldocs`` or ``make pdfdocs`` to check the build and
29 fix any issues.
30
Mauro Carvalho Chehab7a71a802016-09-19 08:08:01 -0300313) Builds on multiple CPU architectures by using local cross-compile tools
Randy Dunlap7de33692009-12-15 16:46:59 -080032 or some other build farm.
Randy Dunlap915a56d2006-06-23 02:05:49 -070033
Mauro Carvalho Chehab7a71a802016-09-19 08:08:01 -0300344) ppc64 is a good architecture for cross-compilation checking because it
35 tends to use ``unsigned long`` for 64-bit quantities.
Randy Dunlap915a56d2006-06-23 02:05:49 -070036
Mauro Carvalho Chehabdca22a62016-09-21 08:51:05 -0300375) Check your patch for general style as detailed in
Mauro Carvalho Chehab8c27ceff32016-10-18 10:12:27 -020038 :ref:`Documentation/process/coding-style.rst <codingstyle>`.
Mauro Carvalho Chehab7a71a802016-09-19 08:08:01 -030039 Check for trivial violations with the patch style checker prior to
40 submission (``scripts/checkpatch.pl``).
J. Bruce Fieldsdf24d9a2008-02-13 15:03:20 -080041 You should be able to justify all violations that remain in
42 your patch.
Randy Dunlap915a56d2006-06-23 02:05:49 -070043
Darren Hart (VMware)241f67c2017-11-20 14:39:34 -0800446) Any new or modified ``CONFIG`` options do not muck up the config menu and
Markus Heiser012e93c2017-12-12 11:46:51 +010045 default to off unless they meet the exception criteria documented in
Mauro Carvalho Chehabcd238ef2019-06-12 14:52:48 -030046 ``Documentation/kbuild/kconfig-language.rst`` Menu attributes: default value.
Randy Dunlap915a56d2006-06-23 02:05:49 -070047
Mauro Carvalho Chehab7a71a802016-09-19 08:08:01 -0300487) All new ``Kconfig`` options have help text.
Randy Dunlap915a56d2006-06-23 02:05:49 -070049
Mauro Carvalho Chehab7a71a802016-09-19 08:08:01 -0300508) Has been carefully reviewed with respect to relevant ``Kconfig``
Andrew Mortone54695a2006-07-10 04:45:42 -070051 combinations. This is very hard to get right with testing -- brainpower
52 pays off here.
Randy Dunlap915a56d2006-06-23 02:05:49 -070053
Mauro Carvalho Chehab7a71a802016-09-19 08:08:01 -0300549) Check cleanly with sparse.
Randy Dunlap915a56d2006-06-23 02:05:49 -070055
Jacob Keller7dfbea42020-10-09 17:18:44 -07005610) Use ``make checkstack`` and fix any problems that it finds.
Mauro Carvalho Chehab7a71a802016-09-19 08:08:01 -030057
58 .. note::
59
60 ``checkstack`` does not point out problems explicitly,
61 but any one function that uses more than 512 bytes on the stack is a
62 candidate for change.
Randy Dunlap915a56d2006-06-23 02:05:49 -070063
Mauro Carvalho Chehabdca22a62016-09-21 08:51:05 -03006411) Include :ref:`kernel-doc <kernel_doc>` to document global kernel APIs.
Mauro Carvalho Chehab0cef67a2016-09-19 08:08:00 -030065 (Not required for static functions, but OK there also.) Use
66 ``make htmldocs`` or ``make pdfdocs`` to check the
67 :ref:`kernel-doc <kernel_doc>` and fix any issues.
Randy Dunlap915a56d2006-06-23 02:05:49 -070068
Mauro Carvalho Chehab7a71a802016-09-19 08:08:01 -03006912) Has been tested with ``CONFIG_PREEMPT``, ``CONFIG_DEBUG_PREEMPT``,
70 ``CONFIG_DEBUG_SLAB``, ``CONFIG_DEBUG_PAGEALLOC``, ``CONFIG_DEBUG_MUTEXES``,
71 ``CONFIG_DEBUG_SPINLOCK``, ``CONFIG_DEBUG_ATOMIC_SLEEP``,
72 ``CONFIG_PROVE_RCU`` and ``CONFIG_DEBUG_OBJECTS_RCU_HEAD`` all
73 simultaneously enabled.
Randy Dunlap915a56d2006-06-23 02:05:49 -070074
Mauro Carvalho Chehab7a71a802016-09-19 08:08:01 -03007513) Has been build- and runtime tested with and without ``CONFIG_SMP`` and
76 ``CONFIG_PREEMPT.``
Randy Dunlap915a56d2006-06-23 02:05:49 -070077
Milan Lakhani27ab8732020-12-15 20:42:36 +00007814) All codepaths have been exercised with all lockdep features enabled.
Randy Dunlap915a56d2006-06-23 02:05:49 -070079
Milan Lakhani27ab8732020-12-15 20:42:36 +00008015) All new ``/proc`` entries are documented under ``Documentation/``
Randy Dunlap915a56d2006-06-23 02:05:49 -070081
Milan Lakhani27ab8732020-12-15 20:42:36 +00008216) All new kernel boot parameters are documented in
Mauro Carvalho Chehab8c27ceff32016-10-18 10:12:27 -020083 ``Documentation/admin-guide/kernel-parameters.rst``.
Andrew Mortone54695a2006-07-10 04:45:42 -070084
Milan Lakhani27ab8732020-12-15 20:42:36 +00008517) All new module parameters are documented with ``MODULE_PARM_DESC()``
Randy Dunlap1a036cdd2006-09-29 02:01:26 -070086
Milan Lakhani27ab8732020-12-15 20:42:36 +00008718) All new userspace interfaces are documented in ``Documentation/ABI/``.
Mauro Carvalho Chehab7a71a802016-09-19 08:08:01 -030088 See ``Documentation/ABI/README`` for more information.
Michael Kerrisk1d992ce2008-10-03 15:23:44 -070089 Patches that change userspace interfaces should be CCed to
90 linux-api@vger.kernel.org.
Andrew Mortonce584f92006-09-30 23:27:39 -070091
Milan Lakhani1a63f9c2021-01-12 13:41:01 +00009219) Has been checked with injection of at least slab and page-allocation
Mauro Carvalho Chehab7a71a802016-09-19 08:08:01 -030093 failures. See ``Documentation/fault-injection/``.
Andrew Morton0dd4e5b2006-12-10 02:18:56 -080094
95 If the new code is substantial, addition of subsystem-specific fault
96 injection might be appropriate.
Andrew Mortona517b9f2007-01-22 20:40:36 -080097
Milan Lakhani1a63f9c2021-01-12 13:41:01 +00009820) Newly-added code has been compiled with ``gcc -W`` (use
Masahiro Yamada163ba352021-02-22 00:25:24 +090099 ``make KCFLAGS=-W``). This will generate lots of noise, but is good
Mauro Carvalho Chehab7a71a802016-09-19 08:08:01 -0300100 for finding bugs like "warning: comparison between signed and unsigned".
Randy Dunlap244474b2007-02-28 20:12:35 -0800101
Milan Lakhani1a63f9c2021-01-12 13:41:01 +000010221) Tested after it has been merged into the -mm patchset to make sure
Randy Dunlap244474b2007-02-28 20:12:35 -0800103 that it still works with all of the other queued patches and various
104 changes in the VM, VFS, and other subsystems.
Randy Dunlap8033fe62008-10-15 22:01:59 -0700105
Milan Lakhani1a63f9c2021-01-12 13:41:01 +000010622) All memory barriers {e.g., ``barrier()``, ``rmb()``, ``wmb()``} need a
Mauro Carvalho Chehab7a71a802016-09-19 08:08:01 -0300107 comment in the source code that explains the logic of what they are doing
108 and why.
Randy Dunlap7de33692009-12-15 16:46:59 -0800109
Milan Lakhani1a63f9c2021-01-12 13:41:01 +000011023) If any ioctl's are added by the patch, then also update
Mauro Carvalho Chehab72ef5e52020-04-14 18:48:35 +0200111 ``Documentation/userspace-api/ioctl/ioctl-number.rst``.
Randy Dunlap85f96422010-05-23 17:02:30 -0700112
Milan Lakhani1a63f9c2021-01-12 13:41:01 +000011324) If your modified source code depends on or uses any of the kernel
Mauro Carvalho Chehab7a71a802016-09-19 08:08:01 -0300114 APIs or features that are related to the following ``Kconfig`` symbols,
115 then test multiple builds with the related ``Kconfig`` symbols disabled
116 and/or ``=m`` (if that option is available) [not all of these at the
Randy Dunlap85f96422010-05-23 17:02:30 -0700117 same time, just various/random combinations of them]:
118
Mauro Carvalho Chehab7a71a802016-09-19 08:08:01 -0300119 ``CONFIG_SMP``, ``CONFIG_SYSFS``, ``CONFIG_PROC_FS``, ``CONFIG_INPUT``, ``CONFIG_PCI``, ``CONFIG_BLOCK``, ``CONFIG_PM``, ``CONFIG_MAGIC_SYSRQ``,
120 ``CONFIG_NET``, ``CONFIG_INET=n`` (but latter with ``CONFIG_NET=y``).