Linux Kernel patch submission checklist¶
Here are some basic things that developers should do if they want to see theirkernel patch submissions accepted more quickly.
These are all above and beyond the documentation that is provided inDocumentation/process/submitting-patches.rstand elsewhere regarding submitting Linux kernel patches.
Review your code¶
If you use a facility then #include the file that defines/declaresthat facility. Don’t depend on other header files pulling in onesthat you use.
Check your patch for general style as detailed inDocumentation/process/coding-style.rst.
All memory barriers {e.g.,
barrier(),rmb(),wmb()} need acomment in the source code that explains the logic of what they are doingand why.
Review Kconfig changes¶
Any new or modified
CONFIGoptions do not muck up the config menu anddefault to off unless they meet the exception criteria documented inDocumentation/kbuild/kconfig-language.rstMenu attributes: default value.All new
Kconfigoptions have help text.Has been carefully reviewed with respect to relevant
Kconfigcombinations. This is very hard to get right with testing---brainpowerpays off here.
Provide documentation¶
Includekernel-doc to document global kernel APIs.(Not required for static functions, but OK there also.)
All new
/procentries are documented underDocumentation/All new kernel boot parameters are documented in
Documentation/admin-guide/kernel-parameters.rst.All new module parameters are documented with
MODULE_PARM_DESC()All new userspace interfaces are documented in
Documentation/ABI/.SeeLinux ABI description (orDocumentation/ABI/README)for more information.Patches that change userspace interfaces should be CCed tolinux-api@vger.kernel.org.If any ioctl’s are added by the patch, then also update
Documentation/userspace-api/ioctl/ioctl-number.rst.
Check your code with tools¶
Check for trivial violations with the patch style checker prior tosubmission (
scripts/checkpatch.pl).You should be able to justify all violations that remain inyour patch.Check cleanly with sparse.
Use
makecheckstackand fix any problems that it finds.Note thatcheckstackdoes not point out problems explicitly,but any one function that uses more than 512 bytes on the stack is acandidate for change.
Build your code¶
Builds cleanly:
with applicable or modified
CONFIGoptions=y,=m, and=n. Nogccwarnings/errors, no linker warnings/errors.Passes
allnoconfig,allmodconfigBuilds successfully when using
O=builddirAny Documentation/ changes build successfully without new warnings/errors.Use
makehtmldocsormakepdfdocsto check the build andfix any issues.
Builds on multiple CPU architectures by using local cross-compile toolsor some other build farm.Note that testing against architectures of different word sizes(32- and 64-bit) and different endianness (big- and little-) is effectivein catching various portability issues due to false assumptions onrepresentable quantity range, data alignment, or endianness, amongothers.
Newly-added code has been compiled with
gcc-W(usemakeKCFLAGS=-W). This will generate lots of noise, but is goodfor finding bugs like “warning: comparison between signed and unsigned”.If your modified source code depends on or uses any of the kernelAPIs or features that are related to the following
Kconfigsymbols,then test multiple builds with the relatedKconfigsymbols disabledand/or=m(if that option is available) [not all of these at thesame time, just various/random combinations of them]:CONFIG_SMP,CONFIG_SYSFS,CONFIG_PROC_FS,CONFIG_INPUT,CONFIG_PCI,CONFIG_BLOCK,CONFIG_PM,CONFIG_MAGIC_SYSRQ,CONFIG_NET,CONFIG_INET=n(but latter withCONFIG_NET=y).
Test your code¶
Has been tested with
CONFIG_PREEMPT,CONFIG_DEBUG_PREEMPT,CONFIG_SLUB_DEBUG,CONFIG_DEBUG_PAGEALLOC,CONFIG_DEBUG_MUTEXES,CONFIG_DEBUG_SPINLOCK,CONFIG_DEBUG_ATOMIC_SLEEP,CONFIG_PROVE_RCUandCONFIG_DEBUG_OBJECTS_RCU_HEADallsimultaneously enabled.Has been build- and runtime tested with and without
CONFIG_SMPandCONFIG_PREEMPT.All codepaths have been exercised with all lockdep features enabled.
Has been checked with injection of at least slab and page-allocationfailures. See
Documentation/fault-injection/.If the new code is substantial, addition of subsystem-specific faultinjection might be appropriate.Tested with the most recent tag of linux-next to make sure that it stillworks with all of the other queued patches and various changes in the VM,VFS, and other subsystems.