submit-checklist.rst 5.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137
  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/admin-guide/abi.rst (or ``Documentation/ABI/README``)
  39. for more information.
  40. Patches that change userspace interfaces should be CCed to
  41. linux-api@vger.kernel.org.
  42. 6) If any ioctl's are added by the patch, then also update
  43. ``Documentation/userspace-api/ioctl/ioctl-number.rst``.
  44. Check your code with tools
  45. ==========================
  46. 1) Check for trivial violations with the patch style checker prior to
  47. submission (``scripts/checkpatch.pl``).
  48. You should be able to justify all violations that remain in
  49. your patch.
  50. 2) Check cleanly with sparse.
  51. 3) Use ``make checkstack`` and fix any problems that it finds.
  52. Note that ``checkstack`` does not point out problems explicitly,
  53. but any one function that uses more than 512 bytes on the stack is a
  54. candidate for change.
  55. Build your code
  56. ===============
  57. 1) Builds cleanly:
  58. a) with applicable or modified ``CONFIG`` options ``=y``, ``=m``, and
  59. ``=n``. No ``gcc`` warnings/errors, no linker warnings/errors.
  60. b) Passes ``allnoconfig``, ``allmodconfig``
  61. c) Builds successfully when using ``O=builddir``
  62. d) Any Documentation/ changes build successfully without new warnings/errors.
  63. Use ``make htmldocs`` or ``make pdfdocs`` to check the build and
  64. fix any issues.
  65. 2) Builds on multiple CPU architectures by using local cross-compile tools
  66. or some other build farm.
  67. Note that testing against architectures of different word sizes
  68. (32- and 64-bit) and different endianness (big- and little-) is effective
  69. in catching various portability issues due to false assumptions on
  70. representable quantity range, data alignment, or endianness, among
  71. others.
  72. 3) Newly-added code has been compiled with ``gcc -W`` (use
  73. ``make KCFLAGS=-W``). This will generate lots of noise, but is good
  74. for finding bugs like "warning: comparison between signed and unsigned".
  75. 4) If your modified source code depends on or uses any of the kernel
  76. APIs or features that are related to the following ``Kconfig`` symbols,
  77. then test multiple builds with the related ``Kconfig`` symbols disabled
  78. and/or ``=m`` (if that option is available) [not all of these at the
  79. same time, just various/random combinations of them]:
  80. ``CONFIG_SMP``, ``CONFIG_SYSFS``, ``CONFIG_PROC_FS``, ``CONFIG_INPUT``,
  81. ``CONFIG_PCI``, ``CONFIG_BLOCK``, ``CONFIG_PM``, ``CONFIG_MAGIC_SYSRQ``,
  82. ``CONFIG_NET``, ``CONFIG_INET=n`` (but latter with ``CONFIG_NET=y``).
  83. Test your code
  84. ==============
  85. 1) Has been tested with ``CONFIG_PREEMPT``, ``CONFIG_DEBUG_PREEMPT``,
  86. ``CONFIG_SLUB_DEBUG``, ``CONFIG_DEBUG_PAGEALLOC``, ``CONFIG_DEBUG_MUTEXES``,
  87. ``CONFIG_DEBUG_SPINLOCK``, ``CONFIG_DEBUG_ATOMIC_SLEEP``,
  88. ``CONFIG_PROVE_RCU`` and ``CONFIG_DEBUG_OBJECTS_RCU_HEAD`` all
  89. simultaneously enabled.
  90. 2) Has been build- and runtime tested with and without ``CONFIG_SMP`` and
  91. ``CONFIG_PREEMPT.``
  92. 3) All codepaths have been exercised with all lockdep features enabled.
  93. 4) Has been checked with injection of at least slab and page-allocation
  94. failures. See ``Documentation/fault-injection/``.
  95. If the new code is substantial, addition of subsystem-specific fault
  96. injection might be appropriate.
  97. 5) Tested with the most recent tag of linux-next to make sure that it still
  98. works with all of the other queued patches and various changes in the VM,
  99. VFS, and other subsystems.