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