blob: 3f8e9d5d95c22f5e4517cc18c8b03a387f845863 [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
273) Builds on multiple CPU architectures by using local cross-compile tools
Randy Dunlap7de33692009-12-15 16:46:59 -080028 or some other build farm.
Randy Dunlap915a56d2006-06-23 02:05:49 -070029
Mauro Carvalho Chehab7a71a802016-09-19 08:08:01 -0300304) ppc64 is a good architecture for cross-compilation checking because it
31 tends to use ``unsigned long`` for 64-bit quantities.
Randy Dunlap915a56d2006-06-23 02:05:49 -070032
Mauro Carvalho Chehabdca22a62016-09-21 08:51:05 -0300335) Check your patch for general style as detailed in
Mauro Carvalho Chehab8c27ceff32016-10-18 10:12:27 -020034 :ref:`Documentation/process/coding-style.rst <codingstyle>`.
Mauro Carvalho Chehab7a71a802016-09-19 08:08:01 -030035 Check for trivial violations with the patch style checker prior to
36 submission (``scripts/checkpatch.pl``).
J. Bruce Fieldsdf24d9a2008-02-13 15:03:20 -080037 You should be able to justify all violations that remain in
38 your patch.
Randy Dunlap915a56d2006-06-23 02:05:49 -070039
Darren Hart (VMware)241f67c2017-11-20 14:39:34 -0800406) Any new or modified ``CONFIG`` options do not muck up the config menu and
Markus Heiser012e93c2017-12-12 11:46:51 +010041 default to off unless they meet the exception criteria documented in
Mauro Carvalho Chehabcd238ef2019-06-12 14:52:48 -030042 ``Documentation/kbuild/kconfig-language.rst`` Menu attributes: default value.
Randy Dunlap915a56d2006-06-23 02:05:49 -070043
Mauro Carvalho Chehab7a71a802016-09-19 08:08:01 -0300447) All new ``Kconfig`` options have help text.
Randy Dunlap915a56d2006-06-23 02:05:49 -070045
Mauro Carvalho Chehab7a71a802016-09-19 08:08:01 -0300468) Has been carefully reviewed with respect to relevant ``Kconfig``
Andrew Mortone54695a2006-07-10 04:45:42 -070047 combinations. This is very hard to get right with testing -- brainpower
48 pays off here.
Randy Dunlap915a56d2006-06-23 02:05:49 -070049
Mauro Carvalho Chehab7a71a802016-09-19 08:08:01 -0300509) Check cleanly with sparse.
Randy Dunlap915a56d2006-06-23 02:05:49 -070051
Mauro Carvalho Chehab7a71a802016-09-19 08:08:01 -03005210) Use ``make checkstack`` and ``make namespacecheck`` and fix any problems
53 that they find.
54
55 .. note::
56
57 ``checkstack`` does not point out problems explicitly,
58 but any one function that uses more than 512 bytes on the stack is a
59 candidate for change.
Randy Dunlap915a56d2006-06-23 02:05:49 -070060
Mauro Carvalho Chehabdca22a62016-09-21 08:51:05 -03006111) Include :ref:`kernel-doc <kernel_doc>` to document global kernel APIs.
Mauro Carvalho Chehab0cef67a2016-09-19 08:08:00 -030062 (Not required for static functions, but OK there also.) Use
63 ``make htmldocs`` or ``make pdfdocs`` to check the
64 :ref:`kernel-doc <kernel_doc>` and fix any issues.
Randy Dunlap915a56d2006-06-23 02:05:49 -070065
Mauro Carvalho Chehab7a71a802016-09-19 08:08:01 -03006612) Has been tested with ``CONFIG_PREEMPT``, ``CONFIG_DEBUG_PREEMPT``,
67 ``CONFIG_DEBUG_SLAB``, ``CONFIG_DEBUG_PAGEALLOC``, ``CONFIG_DEBUG_MUTEXES``,
68 ``CONFIG_DEBUG_SPINLOCK``, ``CONFIG_DEBUG_ATOMIC_SLEEP``,
69 ``CONFIG_PROVE_RCU`` and ``CONFIG_DEBUG_OBJECTS_RCU_HEAD`` all
70 simultaneously enabled.
Randy Dunlap915a56d2006-06-23 02:05:49 -070071
Mauro Carvalho Chehab7a71a802016-09-19 08:08:01 -03007213) Has been build- and runtime tested with and without ``CONFIG_SMP`` and
73 ``CONFIG_PREEMPT.``
Randy Dunlap915a56d2006-06-23 02:05:49 -070074
Christoph Hellwig72deb452019-04-05 18:08:59 +02007516) All codepaths have been exercised with all lockdep features enabled.
Randy Dunlap915a56d2006-06-23 02:05:49 -070076
Christoph Hellwig72deb452019-04-05 18:08:59 +02007717) All new ``/proc`` entries are documented under ``Documentation/``
Randy Dunlap915a56d2006-06-23 02:05:49 -070078
Christoph Hellwig72deb452019-04-05 18:08:59 +02007918) All new kernel boot parameters are documented in
Mauro Carvalho Chehab8c27ceff32016-10-18 10:12:27 -020080 ``Documentation/admin-guide/kernel-parameters.rst``.
Andrew Mortone54695a2006-07-10 04:45:42 -070081
Christoph Hellwig72deb452019-04-05 18:08:59 +02008219) All new module parameters are documented with ``MODULE_PARM_DESC()``
Randy Dunlap1a036cdd2006-09-29 02:01:26 -070083
Christoph Hellwig72deb452019-04-05 18:08:59 +02008420) All new userspace interfaces are documented in ``Documentation/ABI/``.
Mauro Carvalho Chehab7a71a802016-09-19 08:08:01 -030085 See ``Documentation/ABI/README`` for more information.
Michael Kerrisk1d992ce2008-10-03 15:23:44 -070086 Patches that change userspace interfaces should be CCed to
87 linux-api@vger.kernel.org.
Andrew Mortonce584f92006-09-30 23:27:39 -070088
Christoph Hellwig72deb452019-04-05 18:08:59 +02008921) Check that it all passes ``make headers_check``.
Andrew Morton0dd4e5b2006-12-10 02:18:56 -080090
Christoph Hellwig72deb452019-04-05 18:08:59 +02009122) Has been checked with injection of at least slab and page-allocation
Mauro Carvalho Chehab7a71a802016-09-19 08:08:01 -030092 failures. See ``Documentation/fault-injection/``.
Andrew Morton0dd4e5b2006-12-10 02:18:56 -080093
94 If the new code is substantial, addition of subsystem-specific fault
95 injection might be appropriate.
Andrew Mortona517b9f2007-01-22 20:40:36 -080096
Christoph Hellwig72deb452019-04-05 18:08:59 +02009723) Newly-added code has been compiled with ``gcc -W`` (use
Mauro Carvalho Chehab7a71a802016-09-19 08:08:01 -030098 ``make EXTRA_CFLAGS=-W``). This will generate lots of noise, but is good
99 for finding bugs like "warning: comparison between signed and unsigned".
Randy Dunlap244474b2007-02-28 20:12:35 -0800100
Christoph Hellwig72deb452019-04-05 18:08:59 +020010124) Tested after it has been merged into the -mm patchset to make sure
Randy Dunlap244474b2007-02-28 20:12:35 -0800102 that it still works with all of the other queued patches and various
103 changes in the VM, VFS, and other subsystems.
Randy Dunlap8033fe62008-10-15 22:01:59 -0700104
Christoph Hellwig72deb452019-04-05 18:08:59 +020010525) All memory barriers {e.g., ``barrier()``, ``rmb()``, ``wmb()``} need a
Mauro Carvalho Chehab7a71a802016-09-19 08:08:01 -0300106 comment in the source code that explains the logic of what they are doing
107 and why.
Randy Dunlap7de33692009-12-15 16:46:59 -0800108
Christoph Hellwig72deb452019-04-05 18:08:59 +020010926) If any ioctl's are added by the patch, then also update
Mauro Carvalho Chehab72ef5e52020-04-14 18:48:35 +0200110 ``Documentation/userspace-api/ioctl/ioctl-number.rst``.
Randy Dunlap85f96422010-05-23 17:02:30 -0700111
Christoph Hellwig72deb452019-04-05 18:08:59 +020011227) If your modified source code depends on or uses any of the kernel
Mauro Carvalho Chehab7a71a802016-09-19 08:08:01 -0300113 APIs or features that are related to the following ``Kconfig`` symbols,
114 then test multiple builds with the related ``Kconfig`` symbols disabled
115 and/or ``=m`` (if that option is available) [not all of these at the
Randy Dunlap85f96422010-05-23 17:02:30 -0700116 same time, just various/random combinations of them]:
117
Mauro Carvalho Chehab7a71a802016-09-19 08:08:01 -0300118 ``CONFIG_SMP``, ``CONFIG_SYSFS``, ``CONFIG_PROC_FS``, ``CONFIG_INPUT``, ``CONFIG_PCI``, ``CONFIG_BLOCK``, ``CONFIG_PM``, ``CONFIG_MAGIC_SYSRQ``,
119 ``CONFIG_NET``, ``CONFIG_INET=n`` (but latter with ``CONFIG_NET=y``).