Skip to content

Commit a66437c

Browse files
hansendcJonathan Corbet
authored andcommitted
Documentation: Provide guidelines for tool-generated content
In the last few years, the capabilities of coding tools have exploded. As those capabilities have expanded, contributors and maintainers have more and more questions about how and when to apply those capabilities. Add new Documentation to guide contributors on how to best use kernel development tools, new and old. Note, though, there are fundamentally no new or unique rules in this new document. It clarifies expectations that the kernel community has had for many years. For example, researchers are already asked to disclose the tools they use to find issues by Documentation/process/researcher-guidelines.rst. This new document just reiterates existing best practices for development tooling. In short: Please show your work and make sure your contribution is easy to review. Signed-off-by: Dave Hansen <dave.hansen@linux.intel.com> Reviewed-by: Shuah Khan <shuah@kernel.org> Reviewed-by: Kees Cook <kees@kernel.org> Reviewed-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Reviewed-by: Miguel Ojeda <ojeda@kernel.org> Reviewed-by: Luis Chamberlain <mcgrof@kernel.org> Reviewed-by: SeongJae Park <sj@kernel.org> Reviewed-by: Dan Williams <dan.j.williams@intel.com> Reviewed-by: Steven Rostedt <rostedt@goodmis.org> Reviewed-by: Paul E. McKenney <paulmck@kernel.org> Reviewed-by: Simon Glass <simon.glass@canonical.com> Reviewed-by: Lee Jones <lee@kernel.org> Reviewed-by: Lorenzo Stoakes <lorenzo.stoakes@oracle.com> Cc: NeilBrown <neilb@ownmail.net> Cc: Lorenzo Stoakes <lorenzo.stoakes@oracle.com> Cc: Dan Williams <dan.j.williams@intel.com> Cc: Theodore Ts'o <tytso@mit.edu> Cc: Sasha Levin <sashal@kernel.org> Cc: Jonathan Corbet <corbet@lwn.net> Cc: Vlastimil Babka <vbabka@suse.cz> Cc: workflows@vger.kernel.org Cc: ksummit@lists.linux.dev Link: https://lore.kernel.org/all/cfb8bb96-e798-474d-bc6f-9cf610fe720f@lucifer.local/ -- Changes from v5: * Add more review tags * Add a blurb to the "special" asks bullet to mention that extra testing may be requested. * Reword the closing paragraph of "Out of Scope" section for clarity * Remove an "AI" and make small wording tweak (Jon) Changes from v4: * Modest tweaking and rewording to strengthen language * Add a section to help alleviate concerns that the document would not enable maintainers to act forcefully enough in the face of high-volume low-quality contributions (aka. AI slop). This is very close to some text that Lorenzo posted. I just made some very minor wording tweaks and spelling fixes. * Note: v4 mistakenly had "v3" in the subject Changes from v3: * Wording/formatting tweaks (Randy) Changes from v2: * Mention testing (Shuah) * Remove "very", rename LLM => coding assistant (Dan) * More formatting sprucing up and minor typos (Miguel) * Make changelog and text less flashy (Christian) * Tone down critical=>helpful (Neil) Changes from v1: * Rename to generated-content.rst and add to documentation index. (Jon) * Rework subject to align with the new filename * Replace commercial names with generic ones. (Jon) * Be consistent about punctuation at the end of bullets for whole sentences. (Miguel) * Formatting sprucing up and minor typos (Miguel) This document was a collaborative effort from all the members of the TAB. I just reformatted it into .rst and wrote the changelog. Signed-off-by: Jonathan Corbet <corbet@lwn.net> Message-ID: <20260119200418.89541-1-dave.hansen@linux.intel.com>
1 parent f2d4668 commit a66437c

2 files changed

Lines changed: 110 additions & 0 deletions

File tree

Lines changed: 109 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,109 @@
1+
============================================
2+
Kernel Guidelines for Tool-Generated Content
3+
============================================
4+
5+
Purpose
6+
=======
7+
8+
Kernel contributors have been using tooling to generate contributions
9+
for a long time. These tools can increase the volume of contributions.
10+
At the same time, reviewer and maintainer bandwidth is a scarce
11+
resource. Understanding which portions of a contribution come from
12+
humans versus tools is helpful to maintain those resources and keep
13+
kernel development healthy.
14+
15+
The goal here is to clarify community expectations around tools. This
16+
lets everyone become more productive while also maintaining high
17+
degrees of trust between submitters and reviewers.
18+
19+
Out of Scope
20+
============
21+
22+
These guidelines do not apply to tools that make trivial tweaks to
23+
preexisting content. Nor do they pertain to tooling that helps with
24+
menial tasks. Some examples:
25+
26+
- Spelling and grammar fix ups, like rephrasing to imperative voice
27+
- Typing aids like identifier completion, common boilerplate or
28+
trivial pattern completion
29+
- Purely mechanical transformations like variable renaming
30+
- Reformatting, like running Lindent, ``clang-format`` or
31+
``rust-fmt``
32+
33+
Even whenever your tool use is out of scope, you should still always
34+
consider if it would help reviewing your contribution if the reviewer
35+
knows about the tool that you used.
36+
37+
In Scope
38+
========
39+
40+
These guidelines apply when a meaningful amount of content in a kernel
41+
contribution was not written by a person in the Signed-off-by chain,
42+
but was instead created by a tool.
43+
44+
Detection of a problem and testing the fix for it is also part of the
45+
development process; if a tool was used to find a problem addressed by
46+
a change, that should be noted in the changelog. This not only gives
47+
credit where it is due, it also helps fellow developers find out about
48+
these tools.
49+
50+
Some examples:
51+
- Any tool-suggested fix such as ``checkpatch.pl --fix``
52+
- Coccinelle scripts
53+
- A chatbot generated a new function in your patch to sort list entries.
54+
- A .c file in the patch was originally generated by a coding
55+
assistant but cleaned up by hand.
56+
- The changelog was generated by handing the patch to a generative AI
57+
tool and asking it to write the changelog.
58+
- The changelog was translated from another language.
59+
60+
If in doubt, choose transparency and assume these guidelines apply to
61+
your contribution.
62+
63+
Guidelines
64+
==========
65+
66+
First, read the Developer's Certificate of Origin:
67+
Documentation/process/submitting-patches.rst. Its rules are simple
68+
and have been in place for a long time. They have covered many
69+
tool-generated contributions. Ensure that you understand your entire
70+
submission and are prepared to respond to review comments.
71+
72+
Second, when making a contribution, be transparent about the origin of
73+
content in cover letters and changelogs. You can be more transparent
74+
by adding information like this:
75+
76+
- What tools were used?
77+
- The input to the tools you used, like the Coccinelle source script.
78+
- If code was largely generated from a single or short set of
79+
prompts, include those prompts. For longer sessions, include a
80+
summary of the prompts and the nature of resulting assistance.
81+
- Which portions of the content were affected by that tool?
82+
- How is the submission tested and what tools were used to test the
83+
fix?
84+
85+
As with all contributions, individual maintainers have discretion to
86+
choose how they handle the contribution. For example, they might:
87+
88+
- Treat it just like any other contribution.
89+
- Reject it outright.
90+
- Treat the contribution specially, for example, asking for extra
91+
testing, reviewing with extra scrutiny, or reviewing at a lower
92+
priority than human-generated content.
93+
- Ask for some other special steps, like asking the contributor to
94+
elaborate on how the tool or model was trained.
95+
- Ask the submitter to explain in more detail about the contribution
96+
so that the maintainer can be assured that the submitter fully
97+
understands how the code works.
98+
- Suggest a better prompt instead of suggesting specific code changes.
99+
100+
If tools permit you to generate a contribution automatically, expect
101+
additional scrutiny in proportion to how much of it was generated.
102+
103+
As with the output of any tooling, the result may be incorrect or
104+
inappropriate. You are expected to understand and to be able to defend
105+
everything you submit. If you are unable to do so, then do not submit
106+
the resulting changes.
107+
108+
If you do so anyway, maintainers are entitled to reject your series
109+
without detailed review.

Documentation/process/index.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,7 @@ beyond).
6868
stable-kernel-rules
6969
management-style
7070
researcher-guidelines
71+
generated-content
7172
coding-assistants
7273

7374
Dealing with bugs

0 commit comments

Comments
 (0)