1edba5eecSFederico Vaga.. _process_howto: 2edba5eecSFederico Vaga 3186128f7SMauro Carvalho ChehabHOWTO do Linux kernel development 4186128f7SMauro Carvalho Chehab================================= 5186128f7SMauro Carvalho Chehab 6186128f7SMauro Carvalho ChehabThis is the be-all, end-all document on this topic. It contains 7186128f7SMauro Carvalho Chehabinstructions on how to become a Linux kernel developer and how to learn 8186128f7SMauro Carvalho Chehabto work with the Linux kernel development community. It tries to not 9186128f7SMauro Carvalho Chehabcontain anything related to the technical aspects of kernel programming, 10186128f7SMauro Carvalho Chehabbut will help point you in the right direction for that. 11186128f7SMauro Carvalho Chehab 12186128f7SMauro Carvalho ChehabIf anything in this document becomes out of date, please send in patches 13186128f7SMauro Carvalho Chehabto the maintainer of this file, who is listed at the bottom of the 14186128f7SMauro Carvalho Chehabdocument. 15186128f7SMauro Carvalho Chehab 16186128f7SMauro Carvalho Chehab 17186128f7SMauro Carvalho ChehabIntroduction 18186128f7SMauro Carvalho Chehab------------ 19186128f7SMauro Carvalho Chehab 20186128f7SMauro Carvalho ChehabSo, you want to learn how to become a Linux kernel developer? Or you 21186128f7SMauro Carvalho Chehabhave been told by your manager, "Go write a Linux driver for this 22186128f7SMauro Carvalho Chehabdevice." This document's goal is to teach you everything you need to 23186128f7SMauro Carvalho Chehabknow to achieve this by describing the process you need to go through, 24186128f7SMauro Carvalho Chehaband hints on how to work with the community. It will also try to 25186128f7SMauro Carvalho Chehabexplain some of the reasons why the community works like it does. 26186128f7SMauro Carvalho Chehab 27186128f7SMauro Carvalho ChehabThe kernel is written mostly in C, with some architecture-dependent 28186128f7SMauro Carvalho Chehabparts written in assembly. A good understanding of C is required for 29186128f7SMauro Carvalho Chehabkernel development. Assembly (any architecture) is not required unless 30186128f7SMauro Carvalho Chehabyou plan to do low-level development for that architecture. Though they 31186128f7SMauro Carvalho Chehabare not a good substitute for a solid C education and/or years of 32186128f7SMauro Carvalho Chehabexperience, the following books are good for, if anything, reference: 33186128f7SMauro Carvalho Chehab 34186128f7SMauro Carvalho Chehab - "The C Programming Language" by Kernighan and Ritchie [Prentice Hall] 35186128f7SMauro Carvalho Chehab - "Practical C Programming" by Steve Oualline [O'Reilly] 36186128f7SMauro Carvalho Chehab - "C: A Reference Manual" by Harbison and Steele [Prentice Hall] 37186128f7SMauro Carvalho Chehab 38186128f7SMauro Carvalho ChehabThe kernel is written using GNU C and the GNU toolchain. While it 392f3f53d6SAkira Yokosawaadheres to the ISO C11 standard, it uses a number of extensions that are 40186128f7SMauro Carvalho Chehabnot featured in the standard. The kernel is a freestanding C 41186128f7SMauro Carvalho Chehabenvironment, with no reliance on the standard C library, so some 42186128f7SMauro Carvalho Chehabportions of the C standard are not supported. Arbitrary long long 43186128f7SMauro Carvalho Chehabdivisions and floating point are not allowed. It can sometimes be 44186128f7SMauro Carvalho Chehabdifficult to understand the assumptions the kernel has on the toolchain 45186128f7SMauro Carvalho Chehaband the extensions that it uses, and unfortunately there is no 46186128f7SMauro Carvalho Chehabdefinitive reference for them. Please check the gcc info pages (`info 47186128f7SMauro Carvalho Chehabgcc`) for some information on them. 48186128f7SMauro Carvalho Chehab 49186128f7SMauro Carvalho ChehabPlease remember that you are trying to learn how to work with the 50186128f7SMauro Carvalho Chehabexisting development community. It is a diverse group of people, with 51186128f7SMauro Carvalho Chehabhigh standards for coding, style and procedure. These standards have 52186128f7SMauro Carvalho Chehabbeen created over time based on what they have found to work best for 53186128f7SMauro Carvalho Chehabsuch a large and geographically dispersed team. Try to learn as much as 54186128f7SMauro Carvalho Chehabpossible about these standards ahead of time, as they are well 55186128f7SMauro Carvalho Chehabdocumented; do not expect people to adapt to you or your company's way 56186128f7SMauro Carvalho Chehabof doing things. 57186128f7SMauro Carvalho Chehab 58186128f7SMauro Carvalho Chehab 59186128f7SMauro Carvalho ChehabLegal Issues 60186128f7SMauro Carvalho Chehab------------ 61186128f7SMauro Carvalho Chehab 629799445aSMarkus HeiserThe Linux kernel source code is released under the GPL. Please see the file 639799445aSMarkus HeiserCOPYING in the main directory of the source tree. The Linux kernel licensing 649799445aSMarkus Heiserrules and how to use `SPDX <https://spdx.org/>`_ identifiers in source code are 6549afe7e9STobin C. Hardingdescribed in :ref:`Documentation/process/license-rules.rst <kernel_licensing>`. 669799445aSMarkus HeiserIf you have further questions about the license, please contact a lawyer, and do 679799445aSMarkus Heisernot ask on the Linux kernel mailing list. The people on the mailing lists are 689799445aSMarkus Heisernot lawyers, and you should not rely on their statements on legal matters. 69186128f7SMauro Carvalho Chehab 70186128f7SMauro Carvalho ChehabFor common questions and answers about the GPL, please see: 71186128f7SMauro Carvalho Chehab 72186128f7SMauro Carvalho Chehab https://www.gnu.org/licenses/gpl-faq.html 73186128f7SMauro Carvalho Chehab 74186128f7SMauro Carvalho Chehab 75186128f7SMauro Carvalho ChehabDocumentation 76186128f7SMauro Carvalho Chehab------------- 77186128f7SMauro Carvalho Chehab 78186128f7SMauro Carvalho ChehabThe Linux kernel source tree has a large range of documents that are 79186128f7SMauro Carvalho Chehabinvaluable for learning how to interact with the kernel community. When 80186128f7SMauro Carvalho Chehabnew features are added to the kernel, it is recommended that new 81186128f7SMauro Carvalho Chehabdocumentation files are also added which explain how to use the feature. 82186128f7SMauro Carvalho ChehabWhen a kernel change causes the interface that the kernel exposes to 83186128f7SMauro Carvalho Chehabuserspace to change, it is recommended that you send the information or 84186128f7SMauro Carvalho Chehaba patch to the manual pages explaining the change to the manual pages 85186128f7SMauro Carvalho Chehabmaintainer at mtk.manpages@gmail.com, and CC the list 86186128f7SMauro Carvalho Chehablinux-api@vger.kernel.org. 87186128f7SMauro Carvalho Chehab 88186128f7SMauro Carvalho ChehabHere is a list of files that are in the kernel source tree that are 89186128f7SMauro Carvalho Chehabrequired reading: 90186128f7SMauro Carvalho Chehab 91dad05139SMichael Rodin :ref:`Documentation/admin-guide/README.rst <readme>` 92186128f7SMauro Carvalho Chehab This file gives a short background on the Linux kernel and describes 93186128f7SMauro Carvalho Chehab what is necessary to do to configure and build the kernel. People 94186128f7SMauro Carvalho Chehab who are new to the kernel should start here. 95186128f7SMauro Carvalho Chehab 968c27ceffSMauro Carvalho Chehab :ref:`Documentation/process/changes.rst <changes>` 97186128f7SMauro Carvalho Chehab This file gives a list of the minimum levels of various software 98186128f7SMauro Carvalho Chehab packages that are necessary to build and run the kernel 99186128f7SMauro Carvalho Chehab successfully. 100186128f7SMauro Carvalho Chehab 1018c27ceffSMauro Carvalho Chehab :ref:`Documentation/process/coding-style.rst <codingstyle>` 102186128f7SMauro Carvalho Chehab This describes the Linux kernel coding style, and some of the 103186128f7SMauro Carvalho Chehab rationale behind it. All new code is expected to follow the 104186128f7SMauro Carvalho Chehab guidelines in this document. Most maintainers will only accept 105186128f7SMauro Carvalho Chehab patches if these rules are followed, and many people will only 106186128f7SMauro Carvalho Chehab review code if it is in the proper style. 107186128f7SMauro Carvalho Chehab 1089db370deSLukas Bulwahn :ref:`Documentation/process/submitting-patches.rst <submittingpatches>` 1099db370deSLukas Bulwahn This file describes in explicit detail how to successfully create 110186128f7SMauro Carvalho Chehab and send a patch, including (but not limited to): 111186128f7SMauro Carvalho Chehab 112186128f7SMauro Carvalho Chehab - Email contents 113186128f7SMauro Carvalho Chehab - Email format 114186128f7SMauro Carvalho Chehab - Who to send it to 115186128f7SMauro Carvalho Chehab 116186128f7SMauro Carvalho Chehab Following these rules will not guarantee success (as all patches are 117186128f7SMauro Carvalho Chehab subject to scrutiny for content and style), but not following them 118186128f7SMauro Carvalho Chehab will almost always prevent it. 119186128f7SMauro Carvalho Chehab 120186128f7SMauro Carvalho Chehab Other excellent descriptions of how to create patches properly are: 121186128f7SMauro Carvalho Chehab 122186128f7SMauro Carvalho Chehab "The Perfect Patch" 123186128f7SMauro Carvalho Chehab https://www.ozlabs.org/~akpm/stuff/tpp.txt 124186128f7SMauro Carvalho Chehab 125186128f7SMauro Carvalho Chehab "Linux kernel patch submission format" 1265aff7c46SJacob Huisman https://web.archive.org/web/20180829112450/http://linux.yyz.us/patch-format.html 127186128f7SMauro Carvalho Chehab 1288c27ceffSMauro Carvalho Chehab :ref:`Documentation/process/stable-api-nonsense.rst <stable_api_nonsense>` 129186128f7SMauro Carvalho Chehab This file describes the rationale behind the conscious decision to 130186128f7SMauro Carvalho Chehab not have a stable API within the kernel, including things like: 131186128f7SMauro Carvalho Chehab 132186128f7SMauro Carvalho Chehab - Subsystem shim-layers (for compatibility?) 133186128f7SMauro Carvalho Chehab - Driver portability between Operating Systems. 134186128f7SMauro Carvalho Chehab - Mitigating rapid change within the kernel source tree (or 135186128f7SMauro Carvalho Chehab preventing rapid change) 136186128f7SMauro Carvalho Chehab 137186128f7SMauro Carvalho Chehab This document is crucial for understanding the Linux development 138186128f7SMauro Carvalho Chehab philosophy and is very important for people moving to Linux from 139186128f7SMauro Carvalho Chehab development on other Operating Systems. 140186128f7SMauro Carvalho Chehab 141*44ac5abaSVegard Nossum :ref:`Documentation/process/security-bugs.rst <securitybugs>` 142186128f7SMauro Carvalho Chehab If you feel you have found a security problem in the Linux kernel, 143186128f7SMauro Carvalho Chehab please follow the steps in this document to help notify the kernel 144186128f7SMauro Carvalho Chehab developers, and help solve the issue. 145186128f7SMauro Carvalho Chehab 1468c27ceffSMauro Carvalho Chehab :ref:`Documentation/process/management-style.rst <managementstyle>` 147186128f7SMauro Carvalho Chehab This document describes how Linux kernel maintainers operate and the 148186128f7SMauro Carvalho Chehab shared ethos behind their methodologies. This is important reading 149186128f7SMauro Carvalho Chehab for anyone new to kernel development (or anyone simply curious about 150186128f7SMauro Carvalho Chehab it), as it resolves a lot of common misconceptions and confusion 151186128f7SMauro Carvalho Chehab about the unique behavior of kernel maintainers. 152186128f7SMauro Carvalho Chehab 1538c27ceffSMauro Carvalho Chehab :ref:`Documentation/process/stable-kernel-rules.rst <stable_kernel_rules>` 154186128f7SMauro Carvalho Chehab This file describes the rules on how the stable kernel releases 155186128f7SMauro Carvalho Chehab happen, and what to do if you want to get a change into one of these 156186128f7SMauro Carvalho Chehab releases. 157186128f7SMauro Carvalho Chehab 1588c27ceffSMauro Carvalho Chehab :ref:`Documentation/process/kernel-docs.rst <kernel_docs>` 159186128f7SMauro Carvalho Chehab A list of external documentation that pertains to kernel 160186128f7SMauro Carvalho Chehab development. Please consult this list if you do not find what you 161186128f7SMauro Carvalho Chehab are looking for within the in-kernel documentation. 162186128f7SMauro Carvalho Chehab 1638c27ceffSMauro Carvalho Chehab :ref:`Documentation/process/applying-patches.rst <applying_patches>` 164186128f7SMauro Carvalho Chehab A good introduction describing exactly what a patch is and how to 165186128f7SMauro Carvalho Chehab apply it to the different development branches of the kernel. 166186128f7SMauro Carvalho Chehab 167186128f7SMauro Carvalho ChehabThe kernel also has a large number of documents that can be 168186128f7SMauro Carvalho Chehabautomatically generated from the source code itself or from 169186128f7SMauro Carvalho ChehabReStructuredText markups (ReST), like this one. This includes a 170186128f7SMauro Carvalho Chehabfull description of the in-kernel API, and rules on how to handle 171186128f7SMauro Carvalho Chehablocking properly. 172186128f7SMauro Carvalho Chehab 173186128f7SMauro Carvalho ChehabAll such documents can be generated as PDF or HTML by running:: 174186128f7SMauro Carvalho Chehab 175186128f7SMauro Carvalho Chehab make pdfdocs 176186128f7SMauro Carvalho Chehab make htmldocs 177186128f7SMauro Carvalho Chehab 178186128f7SMauro Carvalho Chehabrespectively from the main kernel source directory. 179186128f7SMauro Carvalho Chehab 180186128f7SMauro Carvalho ChehabThe documents that uses ReST markup will be generated at Documentation/output. 181186128f7SMauro Carvalho ChehabThey can also be generated on LaTeX and ePub formats with:: 182186128f7SMauro Carvalho Chehab 183186128f7SMauro Carvalho Chehab make latexdocs 184186128f7SMauro Carvalho Chehab make epubdocs 185186128f7SMauro Carvalho Chehab 186186128f7SMauro Carvalho ChehabBecoming A Kernel Developer 187186128f7SMauro Carvalho Chehab--------------------------- 188186128f7SMauro Carvalho Chehab 189186128f7SMauro Carvalho ChehabIf you do not know anything about Linux kernel development, you should 190186128f7SMauro Carvalho Chehablook at the Linux KernelNewbies project: 191186128f7SMauro Carvalho Chehab 192186128f7SMauro Carvalho Chehab https://kernelnewbies.org 193186128f7SMauro Carvalho Chehab 194186128f7SMauro Carvalho ChehabIt consists of a helpful mailing list where you can ask almost any type 195186128f7SMauro Carvalho Chehabof basic kernel development question (make sure to search the archives 196186128f7SMauro Carvalho Chehabfirst, before asking something that has already been answered in the 197186128f7SMauro Carvalho Chehabpast.) It also has an IRC channel that you can use to ask questions in 198186128f7SMauro Carvalho Chehabreal-time, and a lot of helpful documentation that is useful for 199186128f7SMauro Carvalho Chehablearning about Linux kernel development. 200186128f7SMauro Carvalho Chehab 201186128f7SMauro Carvalho ChehabThe website has basic information about code organization, subsystems, 202186128f7SMauro Carvalho Chehaband current projects (both in-tree and out-of-tree). It also describes 203186128f7SMauro Carvalho Chehabsome basic logistical information, like how to compile a kernel and 204186128f7SMauro Carvalho Chehabapply a patch. 205186128f7SMauro Carvalho Chehab 206186128f7SMauro Carvalho ChehabIf you do not know where you want to start, but you want to look for 207186128f7SMauro Carvalho Chehabsome task to start doing to join into the kernel development community, 208186128f7SMauro Carvalho Chehabgo to the Linux Kernel Janitor's project: 209186128f7SMauro Carvalho Chehab 210186128f7SMauro Carvalho Chehab https://kernelnewbies.org/KernelJanitors 211186128f7SMauro Carvalho Chehab 212186128f7SMauro Carvalho ChehabIt is a great place to start. It describes a list of relatively simple 213186128f7SMauro Carvalho Chehabproblems that need to be cleaned up and fixed within the Linux kernel 214186128f7SMauro Carvalho Chehabsource tree. Working with the developers in charge of this project, you 215186128f7SMauro Carvalho Chehabwill learn the basics of getting your patch into the Linux kernel tree, 216186128f7SMauro Carvalho Chehaband possibly be pointed in the direction of what to go work on next, if 217186128f7SMauro Carvalho Chehabyou do not already have an idea. 218186128f7SMauro Carvalho Chehab 219186128f7SMauro Carvalho ChehabBefore making any actual modifications to the Linux kernel code, it is 220186128f7SMauro Carvalho Chehabimperative to understand how the code in question works. For this 221186128f7SMauro Carvalho Chehabpurpose, nothing is better than reading through it directly (most tricky 222186128f7SMauro Carvalho Chehabbits are commented well), perhaps even with the help of specialized 223186128f7SMauro Carvalho Chehabtools. One such tool that is particularly recommended is the Linux 224186128f7SMauro Carvalho ChehabCross-Reference project, which is able to present source code in a 225186128f7SMauro Carvalho Chehabself-referential, indexed webpage format. An excellent up-to-date 226186128f7SMauro Carvalho Chehabrepository of the kernel code may be found at: 227186128f7SMauro Carvalho Chehab 22819c1d46dSJonathan Neuschäfer https://elixir.bootlin.com/ 229186128f7SMauro Carvalho Chehab 230186128f7SMauro Carvalho Chehab 231186128f7SMauro Carvalho ChehabThe development process 232186128f7SMauro Carvalho Chehab----------------------- 233186128f7SMauro Carvalho Chehab 234186128f7SMauro Carvalho ChehabLinux kernel development process currently consists of a few different 235186128f7SMauro Carvalho Chehabmain kernel "branches" and lots of different subsystem-specific kernel 236186128f7SMauro Carvalho Chehabbranches. These different branches are: 237186128f7SMauro Carvalho Chehab 238d2b008f1SZenghui Yu - Linus's mainline tree 239d2b008f1SZenghui Yu - Various stable trees with multiple major numbers 240d2b008f1SZenghui Yu - Subsystem-specific trees 241d2b008f1SZenghui Yu - linux-next integration testing tree 242186128f7SMauro Carvalho Chehab 243d2b008f1SZenghui YuMainline tree 244d2b008f1SZenghui Yu~~~~~~~~~~~~~ 245d80b9d2aSSeongJae Park 246fb0e0ffeSTony FischettiThe mainline tree is maintained by Linus Torvalds, and can be found at 247d2b008f1SZenghui Yuhttps://kernel.org or in the repo. Its development process is as follows: 248186128f7SMauro Carvalho Chehab 249fb0e0ffeSTony Fischetti - As soon as a new kernel is released a two week window is open, 250186128f7SMauro Carvalho Chehab during this period of time maintainers can submit big diffs to 251186128f7SMauro Carvalho Chehab Linus, usually the patches that have already been included in the 252d2b008f1SZenghui Yu linux-next for a few weeks. The preferred way to submit big changes 253186128f7SMauro Carvalho Chehab is using git (the kernel's source management tool, more information 254186128f7SMauro Carvalho Chehab can be found at https://git-scm.com/) but plain patches are also just 255186128f7SMauro Carvalho Chehab fine. 256388f9b20SDan Carpenter - After two weeks a -rc1 kernel is released and the focus is on making the 257388f9b20SDan Carpenter new kernel as rock solid as possible. Most of the patches at this point 258388f9b20SDan Carpenter should fix a regression. Bugs that have always existed are not 259388f9b20SDan Carpenter regressions, so only push these kinds of fixes if they are important. 260388f9b20SDan Carpenter Please note that a whole new driver (or filesystem) might be accepted 261388f9b20SDan Carpenter after -rc1 because there is no risk of causing regressions with such a 262388f9b20SDan Carpenter change as long as the change is self-contained and does not affect areas 263388f9b20SDan Carpenter outside of the code that is being added. git can be used to send 264388f9b20SDan Carpenter patches to Linus after -rc1 is released, but the patches need to also be 265388f9b20SDan Carpenter sent to a public mailing list for review. 266186128f7SMauro Carvalho Chehab - A new -rc is released whenever Linus deems the current git tree to 267186128f7SMauro Carvalho Chehab be in a reasonably sane state adequate for testing. The goal is to 268186128f7SMauro Carvalho Chehab release a new -rc kernel every week. 269186128f7SMauro Carvalho Chehab - Process continues until the kernel is considered "ready", the 270186128f7SMauro Carvalho Chehab process should last around 6 weeks. 271186128f7SMauro Carvalho Chehab 272186128f7SMauro Carvalho ChehabIt is worth mentioning what Andrew Morton wrote on the linux-kernel 273186128f7SMauro Carvalho Chehabmailing list about kernel releases: 274186128f7SMauro Carvalho Chehab 275186128f7SMauro Carvalho Chehab *"Nobody knows when a kernel will be released, because it's 276186128f7SMauro Carvalho Chehab released according to perceived bug status, not according to a 277186128f7SMauro Carvalho Chehab preconceived timeline."* 278186128f7SMauro Carvalho Chehab 279d2b008f1SZenghui YuVarious stable trees with multiple major numbers 280d2b008f1SZenghui Yu~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 281d80b9d2aSSeongJae Park 282186128f7SMauro Carvalho ChehabKernels with 3-part versions are -stable kernels. They contain 283186128f7SMauro Carvalho Chehabrelatively small and critical fixes for security problems or significant 284fb0e0ffeSTony Fischettiregressions discovered in a given major mainline release. Each release 285fb0e0ffeSTony Fischettiin a major stable series increments the third part of the version 286fb0e0ffeSTony Fischettinumber, keeping the first two parts the same. 287186128f7SMauro Carvalho Chehab 288186128f7SMauro Carvalho ChehabThis is the recommended branch for users who want the most recent stable 289186128f7SMauro Carvalho Chehabkernel and are not interested in helping test development/experimental 290186128f7SMauro Carvalho Chehabversions. 291186128f7SMauro Carvalho Chehab 292d2b008f1SZenghui YuStable trees are maintained by the "stable" team <stable@vger.kernel.org>, and 293186128f7SMauro Carvalho Chehabare released as needs dictate. The normal release period is approximately 294186128f7SMauro Carvalho Chehabtwo weeks, but it can be longer if there are no pressing problems. A 295186128f7SMauro Carvalho Chehabsecurity-related problem, instead, can cause a release to happen almost 296186128f7SMauro Carvalho Chehabinstantly. 297186128f7SMauro Carvalho Chehab 298f77af637SFederico VagaThe file :ref:`Documentation/process/stable-kernel-rules.rst <stable_kernel_rules>` 299f77af637SFederico Vagain the kernel tree documents what kinds of changes are acceptable for 300f77af637SFederico Vagathe -stable tree, and how the release process works. 301186128f7SMauro Carvalho Chehab 302d2b008f1SZenghui YuSubsystem-specific trees 303d2b008f1SZenghui Yu~~~~~~~~~~~~~~~~~~~~~~~~ 304d80b9d2aSSeongJae Park 305186128f7SMauro Carvalho ChehabThe maintainers of the various kernel subsystems --- and also many 306186128f7SMauro Carvalho Chehabkernel subsystem developers --- expose their current state of 307186128f7SMauro Carvalho Chehabdevelopment in source repositories. That way, others can see what is 308186128f7SMauro Carvalho Chehabhappening in the different areas of the kernel. In areas where 309186128f7SMauro Carvalho Chehabdevelopment is rapid, a developer may be asked to base his submissions 310186128f7SMauro Carvalho Chehabonto such a subsystem kernel tree so that conflicts between the 311186128f7SMauro Carvalho Chehabsubmission and other already ongoing work are avoided. 312186128f7SMauro Carvalho Chehab 313186128f7SMauro Carvalho ChehabMost of these repositories are git trees, but there are also other SCMs 314186128f7SMauro Carvalho Chehabin use, or patch queues being published as quilt series. Addresses of 315186128f7SMauro Carvalho Chehabthese subsystem repositories are listed in the MAINTAINERS file. Many 316186128f7SMauro Carvalho Chehabof them can be browsed at https://git.kernel.org/. 317186128f7SMauro Carvalho Chehab 318186128f7SMauro Carvalho ChehabBefore a proposed patch is committed to such a subsystem tree, it is 319186128f7SMauro Carvalho Chehabsubject to review which primarily happens on mailing lists (see the 320186128f7SMauro Carvalho Chehabrespective section below). For several kernel subsystems, this review 321186128f7SMauro Carvalho Chehabprocess is tracked with the tool patchwork. Patchwork offers a web 322186128f7SMauro Carvalho Chehabinterface which shows patch postings, any comments on a patch or 323186128f7SMauro Carvalho Chehabrevisions to it, and maintainers can mark patches as under review, 324186128f7SMauro Carvalho Chehabaccepted, or rejected. Most of these patchwork sites are listed at 325186128f7SMauro Carvalho Chehabhttps://patchwork.kernel.org/. 326186128f7SMauro Carvalho Chehab 327d2b008f1SZenghui Yulinux-next integration testing tree 328d2b008f1SZenghui Yu~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 329d80b9d2aSSeongJae Park 330d2b008f1SZenghui YuBefore updates from subsystem trees are merged into the mainline tree, 331d2b008f1SZenghui Yuthey need to be integration-tested. For this purpose, a special 332186128f7SMauro Carvalho Chehabtesting repository exists into which virtually all subsystem trees are 333186128f7SMauro Carvalho Chehabpulled on an almost daily basis: 334186128f7SMauro Carvalho Chehab 335186128f7SMauro Carvalho Chehab https://git.kernel.org/?p=linux/kernel/git/next/linux-next.git 336186128f7SMauro Carvalho Chehab 337d2b008f1SZenghui YuThis way, the linux-next gives a summary outlook onto what will be 338186128f7SMauro Carvalho Chehabexpected to go into the mainline kernel at the next merge period. 339d2b008f1SZenghui YuAdventurous testers are very welcome to runtime-test the linux-next. 340186128f7SMauro Carvalho Chehab 341186128f7SMauro Carvalho Chehab 342186128f7SMauro Carvalho ChehabBug Reporting 343186128f7SMauro Carvalho Chehab------------- 344186128f7SMauro Carvalho Chehab 345da514157SThorsten LeemhuisThe file 'Documentation/admin-guide/reporting-issues.rst' in the main kernel 346cf6d6fc2SThorsten Leemhuissource directory describes how to report a possible kernel bug, and details 347cf6d6fc2SThorsten Leemhuiswhat kind of information is needed by the kernel developers to help track 348cf6d6fc2SThorsten Leemhuisdown the problem. 349186128f7SMauro Carvalho Chehab 350186128f7SMauro Carvalho Chehab 351186128f7SMauro Carvalho ChehabManaging bug reports 352186128f7SMauro Carvalho Chehab-------------------- 353186128f7SMauro Carvalho Chehab 354186128f7SMauro Carvalho ChehabOne of the best ways to put into practice your hacking skills is by fixing 355186128f7SMauro Carvalho Chehabbugs reported by other people. Not only you will help to make the kernel 356fb0e0ffeSTony Fischettimore stable, but you'll also learn to fix real world problems and you will 357fb0e0ffeSTony Fischettiimprove your skills, and other developers will be aware of your presence. 358fb0e0ffeSTony FischettiFixing bugs is one of the best ways to get merits among other developers, 359fb0e0ffeSTony Fischettibecause not many people like wasting time fixing other people's bugs. 360186128f7SMauro Carvalho Chehab 361cf6d6fc2SThorsten LeemhuisTo work on already reported bug reports, find a subsystem you are interested in. 362cf6d6fc2SThorsten LeemhuisCheck the MAINTAINERS file where bugs for that subsystem get reported to; often 363cf6d6fc2SThorsten Leemhuisit will be a mailing list, rarely a bugtracker. Search the archives of said 364cf6d6fc2SThorsten Leemhuisplace for recent reports and help where you see fit. You may also want to check 365cf6d6fc2SThorsten Leemhuishttps://bugzilla.kernel.org for bug reports; only a handful of kernel subsystems 366cf6d6fc2SThorsten Leemhuisuse it actively for reporting or tracking, nevertheless bugs for the whole 367cf6d6fc2SThorsten Leemhuiskernel get filed there. 368186128f7SMauro Carvalho Chehab 369186128f7SMauro Carvalho Chehab 370186128f7SMauro Carvalho ChehabMailing lists 371186128f7SMauro Carvalho Chehab------------- 372186128f7SMauro Carvalho Chehab 373186128f7SMauro Carvalho ChehabAs some of the above documents describe, the majority of the core kernel 374186128f7SMauro Carvalho Chehabdevelopers participate on the Linux Kernel Mailing list. Details on how 375186128f7SMauro Carvalho Chehabto subscribe and unsubscribe from the list can be found at: 376186128f7SMauro Carvalho Chehab 377186128f7SMauro Carvalho Chehab http://vger.kernel.org/vger-lists.html#linux-kernel 378186128f7SMauro Carvalho Chehab 379186128f7SMauro Carvalho ChehabThere are archives of the mailing list on the web in many different 380186128f7SMauro Carvalho Chehabplaces. Use a search engine to find these archives. For example: 381186128f7SMauro Carvalho Chehab 3827cc39531SAkira Yokosawa https://lore.kernel.org/lkml/ 383186128f7SMauro Carvalho Chehab 384186128f7SMauro Carvalho ChehabIt is highly recommended that you search the archives about the topic 385186128f7SMauro Carvalho Chehabyou want to bring up, before you post it to the list. A lot of things 386186128f7SMauro Carvalho Chehabalready discussed in detail are only recorded at the mailing list 387186128f7SMauro Carvalho Chehabarchives. 388186128f7SMauro Carvalho Chehab 389186128f7SMauro Carvalho ChehabMost of the individual kernel subsystems also have their own separate 390186128f7SMauro Carvalho Chehabmailing list where they do their development efforts. See the 391186128f7SMauro Carvalho ChehabMAINTAINERS file for a list of what these lists are for the different 392186128f7SMauro Carvalho Chehabgroups. 393186128f7SMauro Carvalho Chehab 394186128f7SMauro Carvalho ChehabMany of the lists are hosted on kernel.org. Information on them can be 395186128f7SMauro Carvalho Chehabfound at: 396186128f7SMauro Carvalho Chehab 397186128f7SMauro Carvalho Chehab http://vger.kernel.org/vger-lists.html 398186128f7SMauro Carvalho Chehab 399186128f7SMauro Carvalho ChehabPlease remember to follow good behavioral habits when using the lists. 400186128f7SMauro Carvalho ChehabThough a bit cheesy, the following URL has some simple guidelines for 401186128f7SMauro Carvalho Chehabinteracting with the list (or any list): 402186128f7SMauro Carvalho Chehab 403186128f7SMauro Carvalho Chehab http://www.albion.com/netiquette/ 404186128f7SMauro Carvalho Chehab 405186128f7SMauro Carvalho ChehabIf multiple people respond to your mail, the CC: list of recipients may 406186128f7SMauro Carvalho Chehabget pretty large. Don't remove anybody from the CC: list without a good 407186128f7SMauro Carvalho Chehabreason, or don't reply only to the list address. Get used to receiving the 408186128f7SMauro Carvalho Chehabmail twice, one from the sender and the one from the list, and don't try 409186128f7SMauro Carvalho Chehabto tune that by adding fancy mail-headers, people will not like it. 410186128f7SMauro Carvalho Chehab 411186128f7SMauro Carvalho ChehabRemember to keep the context and the attribution of your replies intact, 412186128f7SMauro Carvalho Chehabkeep the "John Kernelhacker wrote ...:" lines at the top of your reply, and 413186128f7SMauro Carvalho Chehabadd your statements between the individual quoted sections instead of 414186128f7SMauro Carvalho Chehabwriting at the top of the mail. 415186128f7SMauro Carvalho Chehab 416186128f7SMauro Carvalho ChehabIf you add patches to your mail, make sure they are plain readable text 417f77af637SFederico Vagaas stated in :ref:`Documentation/process/submitting-patches.rst <submittingpatches>`. 418186128f7SMauro Carvalho ChehabKernel developers don't want to deal with 419186128f7SMauro Carvalho Chehabattachments or compressed patches; they may want to comment on 420186128f7SMauro Carvalho Chehabindividual lines of your patch, which works only that way. Make sure you 421186128f7SMauro Carvalho Chehabuse a mail program that does not mangle spaces and tab characters. A 422186128f7SMauro Carvalho Chehabgood first test is to send the mail to yourself and try to apply your 423186128f7SMauro Carvalho Chehabown patch by yourself. If that doesn't work, get your mail program fixed 424186128f7SMauro Carvalho Chehabor change it until it works. 425186128f7SMauro Carvalho Chehab 426186128f7SMauro Carvalho ChehabAbove all, please remember to show respect to other subscribers. 427186128f7SMauro Carvalho Chehab 428186128f7SMauro Carvalho Chehab 429186128f7SMauro Carvalho ChehabWorking with the community 430186128f7SMauro Carvalho Chehab-------------------------- 431186128f7SMauro Carvalho Chehab 432186128f7SMauro Carvalho ChehabThe goal of the kernel community is to provide the best possible kernel 433186128f7SMauro Carvalho Chehabthere is. When you submit a patch for acceptance, it will be reviewed 434186128f7SMauro Carvalho Chehabon its technical merits and those alone. So, what should you be 435186128f7SMauro Carvalho Chehabexpecting? 436186128f7SMauro Carvalho Chehab 437186128f7SMauro Carvalho Chehab - criticism 438186128f7SMauro Carvalho Chehab - comments 439186128f7SMauro Carvalho Chehab - requests for change 440186128f7SMauro Carvalho Chehab - requests for justification 441186128f7SMauro Carvalho Chehab - silence 442186128f7SMauro Carvalho Chehab 443186128f7SMauro Carvalho ChehabRemember, this is part of getting your patch into the kernel. You have 444186128f7SMauro Carvalho Chehabto be able to take criticism and comments about your patches, evaluate 445186128f7SMauro Carvalho Chehabthem at a technical level and either rework your patches or provide 446186128f7SMauro Carvalho Chehabclear and concise reasoning as to why those changes should not be made. 447186128f7SMauro Carvalho ChehabIf there are no responses to your posting, wait a few days and try 448186128f7SMauro Carvalho Chehabagain, sometimes things get lost in the huge volume. 449186128f7SMauro Carvalho Chehab 450186128f7SMauro Carvalho ChehabWhat should you not do? 451186128f7SMauro Carvalho Chehab 452186128f7SMauro Carvalho Chehab - expect your patch to be accepted without question 453186128f7SMauro Carvalho Chehab - become defensive 454186128f7SMauro Carvalho Chehab - ignore comments 455186128f7SMauro Carvalho Chehab - resubmit the patch without making any of the requested changes 456186128f7SMauro Carvalho Chehab 457186128f7SMauro Carvalho ChehabIn a community that is looking for the best technical solution possible, 458186128f7SMauro Carvalho Chehabthere will always be differing opinions on how beneficial a patch is. 459186128f7SMauro Carvalho ChehabYou have to be cooperative, and willing to adapt your idea to fit within 460186128f7SMauro Carvalho Chehabthe kernel. Or at least be willing to prove your idea is worth it. 461186128f7SMauro Carvalho ChehabRemember, being wrong is acceptable as long as you are willing to work 462186128f7SMauro Carvalho Chehabtoward a solution that is right. 463186128f7SMauro Carvalho Chehab 464186128f7SMauro Carvalho ChehabIt is normal that the answers to your first patch might simply be a list 465186128f7SMauro Carvalho Chehabof a dozen things you should correct. This does **not** imply that your 466186128f7SMauro Carvalho Chehabpatch will not be accepted, and it is **not** meant against you 467186128f7SMauro Carvalho Chehabpersonally. Simply correct all issues raised against your patch and 468186128f7SMauro Carvalho Chehabresend it. 469186128f7SMauro Carvalho Chehab 470186128f7SMauro Carvalho Chehab 471186128f7SMauro Carvalho ChehabDifferences between the kernel community and corporate structures 472186128f7SMauro Carvalho Chehab----------------------------------------------------------------- 473186128f7SMauro Carvalho Chehab 474186128f7SMauro Carvalho ChehabThe kernel community works differently than most traditional corporate 475186128f7SMauro Carvalho Chehabdevelopment environments. Here are a list of things that you can try to 476186128f7SMauro Carvalho Chehabdo to avoid problems: 477186128f7SMauro Carvalho Chehab 478186128f7SMauro Carvalho Chehab Good things to say regarding your proposed changes: 479186128f7SMauro Carvalho Chehab 480186128f7SMauro Carvalho Chehab - "This solves multiple problems." 481186128f7SMauro Carvalho Chehab - "This deletes 2000 lines of code." 482186128f7SMauro Carvalho Chehab - "Here is a patch that explains what I am trying to describe." 483186128f7SMauro Carvalho Chehab - "I tested it on 5 different architectures..." 484186128f7SMauro Carvalho Chehab - "Here is a series of small patches that..." 485186128f7SMauro Carvalho Chehab - "This increases performance on typical machines..." 486186128f7SMauro Carvalho Chehab 487186128f7SMauro Carvalho Chehab Bad things you should avoid saying: 488186128f7SMauro Carvalho Chehab 489186128f7SMauro Carvalho Chehab - "We did it this way in AIX/ptx/Solaris, so therefore it must be 490186128f7SMauro Carvalho Chehab good..." 491186128f7SMauro Carvalho Chehab - "I've being doing this for 20 years, so..." 492186128f7SMauro Carvalho Chehab - "This is required for my company to make money" 493186128f7SMauro Carvalho Chehab - "This is for our Enterprise product line." 494186128f7SMauro Carvalho Chehab - "Here is my 1000 page design document that describes my idea" 495186128f7SMauro Carvalho Chehab - "I've been working on this for 6 months..." 496186128f7SMauro Carvalho Chehab - "Here's a 5000 line patch that..." 497186128f7SMauro Carvalho Chehab - "I rewrote all of the current mess, and here it is..." 498186128f7SMauro Carvalho Chehab - "I have a deadline, and this patch needs to be applied now." 499186128f7SMauro Carvalho Chehab 500186128f7SMauro Carvalho ChehabAnother way the kernel community is different than most traditional 501186128f7SMauro Carvalho Chehabsoftware engineering work environments is the faceless nature of 502186128f7SMauro Carvalho Chehabinteraction. One benefit of using email and irc as the primary forms of 503186128f7SMauro Carvalho Chehabcommunication is the lack of discrimination based on gender or race. 504186128f7SMauro Carvalho ChehabThe Linux kernel work environment is accepting of women and minorities 505186128f7SMauro Carvalho Chehabbecause all you are is an email address. The international aspect also 506186128f7SMauro Carvalho Chehabhelps to level the playing field because you can't guess gender based on 507186128f7SMauro Carvalho Chehaba person's name. A man may be named Andrea and a woman may be named Pat. 508186128f7SMauro Carvalho ChehabMost women who have worked in the Linux kernel and have expressed an 509186128f7SMauro Carvalho Chehabopinion have had positive experiences. 510186128f7SMauro Carvalho Chehab 511186128f7SMauro Carvalho ChehabThe language barrier can cause problems for some people who are not 512186128f7SMauro Carvalho Chehabcomfortable with English. A good grasp of the language can be needed in 513186128f7SMauro Carvalho Chehaborder to get ideas across properly on mailing lists, so it is 514186128f7SMauro Carvalho Chehabrecommended that you check your emails to make sure they make sense in 515186128f7SMauro Carvalho ChehabEnglish before sending them. 516186128f7SMauro Carvalho Chehab 517186128f7SMauro Carvalho Chehab 518186128f7SMauro Carvalho ChehabBreak up your changes 519186128f7SMauro Carvalho Chehab--------------------- 520186128f7SMauro Carvalho Chehab 521186128f7SMauro Carvalho ChehabThe Linux kernel community does not gladly accept large chunks of code 522186128f7SMauro Carvalho Chehabdropped on it all at once. The changes need to be properly introduced, 523186128f7SMauro Carvalho Chehabdiscussed, and broken up into tiny, individual portions. This is almost 524186128f7SMauro Carvalho Chehabthe exact opposite of what companies are used to doing. Your proposal 525186128f7SMauro Carvalho Chehabshould also be introduced very early in the development process, so that 526186128f7SMauro Carvalho Chehabyou can receive feedback on what you are doing. It also lets the 527186128f7SMauro Carvalho Chehabcommunity feel that you are working with them, and not simply using them 528186128f7SMauro Carvalho Chehabas a dumping ground for your feature. However, don't send 50 emails at 529186128f7SMauro Carvalho Chehabone time to a mailing list, your patch series should be smaller than 530186128f7SMauro Carvalho Chehabthat almost all of the time. 531186128f7SMauro Carvalho Chehab 532186128f7SMauro Carvalho ChehabThe reasons for breaking things up are the following: 533186128f7SMauro Carvalho Chehab 534186128f7SMauro Carvalho Chehab1) Small patches increase the likelihood that your patches will be 535186128f7SMauro Carvalho Chehab applied, since they don't take much time or effort to verify for 536186128f7SMauro Carvalho Chehab correctness. A 5 line patch can be applied by a maintainer with 537186128f7SMauro Carvalho Chehab barely a second glance. However, a 500 line patch may take hours to 538186128f7SMauro Carvalho Chehab review for correctness (the time it takes is exponentially 539186128f7SMauro Carvalho Chehab proportional to the size of the patch, or something). 540186128f7SMauro Carvalho Chehab 541186128f7SMauro Carvalho Chehab Small patches also make it very easy to debug when something goes 542186128f7SMauro Carvalho Chehab wrong. It's much easier to back out patches one by one than it is 543186128f7SMauro Carvalho Chehab to dissect a very large patch after it's been applied (and broken 544186128f7SMauro Carvalho Chehab something). 545186128f7SMauro Carvalho Chehab 546186128f7SMauro Carvalho Chehab2) It's important not only to send small patches, but also to rewrite 547186128f7SMauro Carvalho Chehab and simplify (or simply re-order) patches before submitting them. 548186128f7SMauro Carvalho Chehab 549186128f7SMauro Carvalho ChehabHere is an analogy from kernel developer Al Viro: 550186128f7SMauro Carvalho Chehab 551186128f7SMauro Carvalho Chehab *"Think of a teacher grading homework from a math student. The 552186128f7SMauro Carvalho Chehab teacher does not want to see the student's trials and errors 553186128f7SMauro Carvalho Chehab before they came up with the solution. They want to see the 554186128f7SMauro Carvalho Chehab cleanest, most elegant answer. A good student knows this, and 555186128f7SMauro Carvalho Chehab would never submit her intermediate work before the final 556186128f7SMauro Carvalho Chehab solution.* 557186128f7SMauro Carvalho Chehab 558186128f7SMauro Carvalho Chehab *The same is true of kernel development. The maintainers and 559186128f7SMauro Carvalho Chehab reviewers do not want to see the thought process behind the 560186128f7SMauro Carvalho Chehab solution to the problem one is solving. They want to see a 561186128f7SMauro Carvalho Chehab simple and elegant solution."* 562186128f7SMauro Carvalho Chehab 563186128f7SMauro Carvalho ChehabIt may be challenging to keep the balance between presenting an elegant 564186128f7SMauro Carvalho Chehabsolution and working together with the community and discussing your 565186128f7SMauro Carvalho Chehabunfinished work. Therefore it is good to get early in the process to 566186128f7SMauro Carvalho Chehabget feedback to improve your work, but also keep your changes in small 567186128f7SMauro Carvalho Chehabchunks that they may get already accepted, even when your whole task is 568186128f7SMauro Carvalho Chehabnot ready for inclusion now. 569186128f7SMauro Carvalho Chehab 570186128f7SMauro Carvalho ChehabAlso realize that it is not acceptable to send patches for inclusion 571186128f7SMauro Carvalho Chehabthat are unfinished and will be "fixed up later." 572186128f7SMauro Carvalho Chehab 573186128f7SMauro Carvalho Chehab 574186128f7SMauro Carvalho ChehabJustify your change 575186128f7SMauro Carvalho Chehab------------------- 576186128f7SMauro Carvalho Chehab 577186128f7SMauro Carvalho ChehabAlong with breaking up your patches, it is very important for you to let 578186128f7SMauro Carvalho Chehabthe Linux community know why they should add this change. New features 579186128f7SMauro Carvalho Chehabmust be justified as being needed and useful. 580186128f7SMauro Carvalho Chehab 581186128f7SMauro Carvalho Chehab 582186128f7SMauro Carvalho ChehabDocument your change 583186128f7SMauro Carvalho Chehab-------------------- 584186128f7SMauro Carvalho Chehab 585186128f7SMauro Carvalho ChehabWhen sending in your patches, pay special attention to what you say in 586186128f7SMauro Carvalho Chehabthe text in your email. This information will become the ChangeLog 587186128f7SMauro Carvalho Chehabinformation for the patch, and will be preserved for everyone to see for 588186128f7SMauro Carvalho Chehaball time. It should describe the patch completely, containing: 589186128f7SMauro Carvalho Chehab 590186128f7SMauro Carvalho Chehab - why the change is necessary 591186128f7SMauro Carvalho Chehab - the overall design approach in the patch 592186128f7SMauro Carvalho Chehab - implementation details 593186128f7SMauro Carvalho Chehab - testing results 594186128f7SMauro Carvalho Chehab 595186128f7SMauro Carvalho ChehabFor more details on what this should all look like, please see the 596186128f7SMauro Carvalho ChehabChangeLog section of the document: 597186128f7SMauro Carvalho Chehab 598186128f7SMauro Carvalho Chehab "The Perfect Patch" 599e7b4311eSAlexander A. Klimov https://www.ozlabs.org/~akpm/stuff/tpp.txt 600186128f7SMauro Carvalho Chehab 601186128f7SMauro Carvalho Chehab 602186128f7SMauro Carvalho ChehabAll of these things are sometimes very hard to do. It can take years to 603186128f7SMauro Carvalho Chehabperfect these practices (if at all). It's a continuous process of 604186128f7SMauro Carvalho Chehabimprovement that requires a lot of patience and determination. But 605186128f7SMauro Carvalho Chehabdon't give up, it's possible. Many have done it before, and each had to 606186128f7SMauro Carvalho Chehabstart exactly where you are now. 607186128f7SMauro Carvalho Chehab 608186128f7SMauro Carvalho Chehab 609186128f7SMauro Carvalho Chehab 610186128f7SMauro Carvalho Chehab 611186128f7SMauro Carvalho Chehab---------- 612186128f7SMauro Carvalho Chehab 613186128f7SMauro Carvalho ChehabThanks to Paolo Ciarrocchi who allowed the "Development Process" 614186128f7SMauro Carvalho Chehab(https://lwn.net/Articles/94386/) section 615186128f7SMauro Carvalho Chehabto be based on text he had written, and to Randy Dunlap and Gerrit 616186128f7SMauro Carvalho ChehabHuizenga for some of the list of things you should and should not say. 617186128f7SMauro Carvalho ChehabAlso thanks to Pat Mochel, Hanna Linder, Randy Dunlap, Kay Sievers, 618186128f7SMauro Carvalho ChehabVojtech Pavlik, Jan Kara, Josh Boyer, Kees Cook, Andrew Morton, Andi 619186128f7SMauro Carvalho ChehabKleen, Vadim Lobanov, Jesper Juhl, Adrian Bunk, Keri Harris, Frans Pop, 620186128f7SMauro Carvalho ChehabDavid A. Wheeler, Junio Hamano, Michael Kerrisk, and Alex Shepard for 621186128f7SMauro Carvalho Chehabtheir review, comments, and contributions. Without their help, this 622186128f7SMauro Carvalho Chehabdocument would not have been possible. 623186128f7SMauro Carvalho Chehab 624186128f7SMauro Carvalho Chehab 625186128f7SMauro Carvalho Chehab 626186128f7SMauro Carvalho ChehabMaintainer: Greg Kroah-Hartman <greg@kroah.com> 627