^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1) .. _submitchecklist:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 2)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 3) Linux Kernel patch submission checklist
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 4) ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 5)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 6) Here are some basic things that developers should do if they want to see their
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 7) kernel patch submissions accepted more quickly.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 8)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 9) These are all above and beyond the documentation that is provided in
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 10) :ref:`Documentation/process/submitting-patches.rst <submittingpatches>`
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 11) and elsewhere regarding submitting Linux kernel patches.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 12)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 13)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 14) 1) If you use a facility then #include the file that defines/declares
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 15) that facility. Don't depend on other header files pulling in ones
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 16) that you use.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 17)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 18) 2) Builds cleanly:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 19)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 20) a) with applicable or modified ``CONFIG`` options ``=y``, ``=m``, and
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 21) ``=n``. No ``gcc`` warnings/errors, no linker warnings/errors.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 22)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 23) b) Passes ``allnoconfig``, ``allmodconfig``
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 24)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 25) c) Builds successfully when using ``O=builddir``
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 26)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 27) d) Any Documentation/ changes build successfully without new warnings/errors.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 28) Use ``make htmldocs`` or ``make pdfdocs`` to check the build and
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 29) fix any issues.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 30)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 31) 3) Builds on multiple CPU architectures by using local cross-compile tools
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 32) or some other build farm.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 33)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 34) 4) ppc64 is a good architecture for cross-compilation checking because it
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 35) tends to use ``unsigned long`` for 64-bit quantities.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 36)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 37) 5) Check your patch for general style as detailed in
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 38) :ref:`Documentation/process/coding-style.rst <codingstyle>`.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 39) Check for trivial violations with the patch style checker prior to
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 40) submission (``scripts/checkpatch.pl``).
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 41) You should be able to justify all violations that remain in
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 42) your patch.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 43)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 44) 6) Any new or modified ``CONFIG`` options do not muck up the config menu and
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 45) default to off unless they meet the exception criteria documented in
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 46) ``Documentation/kbuild/kconfig-language.rst`` Menu attributes: default value.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 47)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 48) 7) All new ``Kconfig`` options have help text.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 49)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 50) 8) Has been carefully reviewed with respect to relevant ``Kconfig``
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 51) combinations. This is very hard to get right with testing -- brainpower
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 52) pays off here.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 53)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 54) 9) Check cleanly with sparse.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 55)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 56) 10) Use ``make checkstack`` and fix any problems that it finds.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 57)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 58) .. note::
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 59)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 60) ``checkstack`` does not point out problems explicitly,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 61) but any one function that uses more than 512 bytes on the stack is a
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 62) candidate for change.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 63)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 64) 11) Include :ref:`kernel-doc <kernel_doc>` to document global kernel APIs.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 65) (Not required for static functions, but OK there also.) Use
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 66) ``make htmldocs`` or ``make pdfdocs`` to check the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 67) :ref:`kernel-doc <kernel_doc>` and fix any issues.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 68)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 69) 12) Has been tested with ``CONFIG_PREEMPT``, ``CONFIG_DEBUG_PREEMPT``,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 70) ``CONFIG_DEBUG_SLAB``, ``CONFIG_DEBUG_PAGEALLOC``, ``CONFIG_DEBUG_MUTEXES``,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 71) ``CONFIG_DEBUG_SPINLOCK``, ``CONFIG_DEBUG_ATOMIC_SLEEP``,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 72) ``CONFIG_PROVE_RCU`` and ``CONFIG_DEBUG_OBJECTS_RCU_HEAD`` all
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 73) simultaneously enabled.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 74)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 75) 13) Has been build- and runtime tested with and without ``CONFIG_SMP`` and
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 76) ``CONFIG_PREEMPT.``
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 77)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 78) 16) All codepaths have been exercised with all lockdep features enabled.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 79)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 80) 17) All new ``/proc`` entries are documented under ``Documentation/``
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 81)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 82) 18) All new kernel boot parameters are documented in
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 83) ``Documentation/admin-guide/kernel-parameters.rst``.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 84)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 85) 19) All new module parameters are documented with ``MODULE_PARM_DESC()``
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 86)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 87) 20) All new userspace interfaces are documented in ``Documentation/ABI/``.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 88) See ``Documentation/ABI/README`` for more information.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 89) Patches that change userspace interfaces should be CCed to
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 90) linux-api@vger.kernel.org.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 91)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 92) 21) Check that it all passes ``make headers_check``.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 93)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 94) 22) Has been checked with injection of at least slab and page-allocation
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 95) failures. See ``Documentation/fault-injection/``.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 96)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 97) If the new code is substantial, addition of subsystem-specific fault
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 98) injection might be appropriate.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 99)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 100) 23) Newly-added code has been compiled with ``gcc -W`` (use
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 101) ``make EXTRA_CFLAGS=-W``). This will generate lots of noise, but is good
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 102) for finding bugs like "warning: comparison between signed and unsigned".
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 103)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 104) 24) Tested after it has been merged into the -mm patchset to make sure
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 105) that it still works with all of the other queued patches and various
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 106) changes in the VM, VFS, and other subsystems.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 107)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 108) 25) All memory barriers {e.g., ``barrier()``, ``rmb()``, ``wmb()``} need a
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 109) comment in the source code that explains the logic of what they are doing
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 110) and why.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 111)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 112) 26) If any ioctl's are added by the patch, then also update
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 113) ``Documentation/userspace-api/ioctl/ioctl-number.rst``.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 114)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 115) 27) If your modified source code depends on or uses any of the kernel
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 116) APIs or features that are related to the following ``Kconfig`` symbols,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 117) then test multiple builds with the related ``Kconfig`` symbols disabled
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 118) and/or ``=m`` (if that option is available) [not all of these at the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 119) same time, just various/random combinations of them]:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 120)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 121) ``CONFIG_SMP``, ``CONFIG_SYSFS``, ``CONFIG_PROC_FS``, ``CONFIG_INPUT``, ``CONFIG_PCI``, ``CONFIG_BLOCK``, ``CONFIG_PM``, ``CONFIG_MAGIC_SYSRQ``,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 122) ``CONFIG_NET``, ``CONFIG_INET=n`` (but latter with ``CONFIG_NET=y``).