submit-checklist.rst 5.0 KB

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