Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

Merge tag 'docs-5.18-2' of git://git.lwn.net/linux

Pull more documentation updates from Jonathan Corbet:
"Some late-arriving documentation improvements.

This is mostly build-system fixes from Mauro and Akira; I also took
the liberty of dropping in my 'messy diffstat' document"

* tag 'docs-5.18-2' of git://git.lwn.net/linux:
docs: Add a document on how to fix a messy diffstat
docs: sphinx/requirements: Limit jinja2<3.1
Documentation: kunit: Fix cross-referencing warnings
scripts/kernel-doc: change the line number meta info
scripts/get_abi: change the file/line number meta info
docs: kernel_include.py: add sphinx build dependencies
docs: kernel_abi.py: add sphinx build dependencies
docs: kernel_feat.py: add build dependencies
scripts/get_feat.pl: allow output the parsed file names
docs: kfigure.py: Don't warn of missing PDF converter in 'make htmldocs'
Documentation: Fix duplicate statement about raw_spinlock_t type

+148 -25
+2 -11
Documentation/dev-tools/kunit/architecture.rst
··· 26 26 grouped into KUnit suites. A KUnit test case is a function with type 27 27 signature ``void (*)(struct kunit *test)``. 28 28 These test case functions are wrapped in a struct called 29 - ``struct kunit_case``. For code, see: 30 - 31 - .. kernel-doc:: include/kunit/test.h 32 - :identifiers: kunit_case 29 + struct kunit_case. 33 30 34 31 .. note: 35 32 ``generate_params`` is optional for non-parameterized tests. ··· 149 152 Each KUnit parameterized test is associated with a collection of 150 153 parameters. The test is invoked multiple times, once for each parameter 151 154 value and the parameter is stored in the ``param_value`` field. 152 - The test case includes a ``KUNIT_CASE_PARAM()`` macro that accepts a 155 + The test case includes a KUNIT_CASE_PARAM() macro that accepts a 153 156 generator function. 154 157 The generator function is passed the previous parameter and returns the next 155 158 parameter. It also provides a macro to generate common-case generators based on 156 159 arrays. 157 - 158 - For code, see: 159 - 160 - .. kernel-doc:: include/kunit/test.h 161 - :identifiers: KUNIT_ARRAY_PARAM 162 - 163 160 164 161 kunit_tool (Command Line Test Harness) 165 162 ======================================
-3
Documentation/locking/locktypes.rst
··· 211 211 raw_spinlock_t 212 212 -------------- 213 213 214 - raw_spinlock_t is a strict spinning lock implementation regardless of the 215 - kernel configuration including PREEMPT_RT enabled kernels. 216 - 217 214 raw_spinlock_t is a strict spinning lock implementation in all kernels, 218 215 including PREEMPT_RT kernels. Use raw_spinlock_t only in real critical 219 216 core code, low-level interrupt handling and places where disabling
+1
Documentation/maintainer/index.rst
··· 12 12 configure-git 13 13 rebasing-and-merging 14 14 pull-requests 15 + messy-diffstat 15 16 maintainer-entry-profile 16 17 modifying-patches 17 18
+96
Documentation/maintainer/messy-diffstat.rst
··· 1 + .. SPDX-License-Identifier: GPL-2.0 2 + 3 + ===================================== 4 + Handling messy pull-request diffstats 5 + ===================================== 6 + 7 + Subsystem maintainers routinely use ``git request-pull`` as part of the 8 + process of sending work upstream. Normally, the result includes a nice 9 + diffstat that shows which files will be touched and how much of each will 10 + be changed. Occasionally, though, a repository with a relatively 11 + complicated development history will yield a massive diffstat containing a 12 + great deal of unrelated work. The result looks ugly and obscures what the 13 + pull request is actually doing. This document describes what is happening 14 + and how to fix things up; it is derived from The Wisdom of Linus Torvalds, 15 + found in Linus1_ and Linus2_. 16 + 17 + .. _Linus1: https://lore.kernel.org/lkml/CAHk-=wg3wXH2JNxkQi+eLZkpuxqV+wPiHhw_Jf7ViH33Sw7PHA@mail.gmail.com/ 18 + .. _Linus2: https://lore.kernel.org/lkml/CAHk-=wgXbSa8yq8Dht8at+gxb_idnJ7X5qWZQWRBN4_CUPr=eQ@mail.gmail.com/ 19 + 20 + A Git development history proceeds as a series of commits. In a simplified 21 + manner, mainline kernel development looks like this:: 22 + 23 + ... vM --- vN-rc1 --- vN-rc2 --- vN-rc3 --- ... --- vN-rc7 --- vN 24 + 25 + If one wants to see what has changed between two points, a command like 26 + this will do the job:: 27 + 28 + $ git diff --stat --summary vN-rc2..vN-rc3 29 + 30 + Here, there are two clear points in the history; Git will essentially 31 + "subtract" the beginning point from the end point and display the resulting 32 + differences. The requested operation is unambiguous and easy enough to 33 + understand. 34 + 35 + When a subsystem maintainer creates a branch and commits changes to it, the 36 + result in the simplest case is a history that looks like:: 37 + 38 + ... vM --- vN-rc1 --- vN-rc2 --- vN-rc3 --- ... --- vN-rc7 --- vN 39 + | 40 + +-- c1 --- c2 --- ... --- cN 41 + 42 + If that maintainer now uses ``git diff`` to see what has changed between 43 + the mainline branch (let's call it "linus") and cN, there are still two 44 + clear endpoints, and the result is as expected. So a pull request 45 + generated with ``git request-pull`` will also be as expected. But now 46 + consider a slightly more complex development history:: 47 + 48 + ... vM --- vN-rc1 --- vN-rc2 --- vN-rc3 --- ... --- vN-rc7 --- vN 49 + | | 50 + | +-- c1 --- c2 --- ... --- cN 51 + | / 52 + +-- x1 --- x2 --- x3 53 + 54 + Our maintainer has created one branch at vN-rc1 and another at vN-rc2; the 55 + two were then subsequently merged into c2. Now a pull request generated 56 + for cN may end up being messy indeed, and developers often end up wondering 57 + why. 58 + 59 + What is happening here is that there are no longer two clear end points for 60 + the ``git diff`` operation to use. The development culminating in cN 61 + started in two different places; to generate the diffstat, ``git diff`` 62 + ends up having pick one of them and hoping for the best. If the diffstat 63 + starts at vN-rc1, it may end up including all of the changes between there 64 + and the second origin end point (vN-rc2), which is certainly not what our 65 + maintainer had in mind. With all of that extra junk in the diffstat, it 66 + may be impossible to tell what actually happened in the changes leading up 67 + to cN. 68 + 69 + Maintainers often try to resolve this problem by, for example, rebasing the 70 + branch or performing another merge with the linus branch, then recreating 71 + the pull request. This approach tends not to lead to joy at the receiving 72 + end of that pull request; rebasing and/or merging just before pushing 73 + upstream is a well-known way to get a grumpy response. 74 + 75 + So what is to be done? The best response when confronted with this 76 + situation is to indeed to do a merge with the branch you intend your work 77 + to be pulled into, but to do it privately, as if it were the source of 78 + shame. Create a new, throwaway branch and do the merge there:: 79 + 80 + ... vM --- vN-rc1 --- vN-rc2 --- vN-rc3 --- ... --- vN-rc7 --- vN 81 + | | | 82 + | +-- c1 --- c2 --- ... --- cN | 83 + | / | | 84 + +-- x1 --- x2 --- x3 +------------+-- TEMP 85 + 86 + The merge operation resolves all of the complications resulting from the 87 + multiple beginning points, yielding a coherent result that contains only 88 + the differences from the mainline branch. Now it will be possible to 89 + generate a diffstat with the desired information:: 90 + 91 + $ git diff -C --stat --summary linus..TEMP 92 + 93 + Save the output from this command, then simply delete the TEMP branch; 94 + definitely do not expose it to the outside world. Take the saved diffstat 95 + output and edit it into the messy pull request, yielding a result that 96 + shows what is really going on. That request can then be sent upstream.
+5 -1
Documentation/sphinx/kernel_abi.py
··· 128 128 return out 129 129 130 130 def nestedParse(self, lines, fname): 131 + env = self.state.document.settings.env 131 132 content = ViewList() 132 133 node = nodes.section() 133 134 ··· 138 137 code_block += "\n " + l 139 138 lines = code_block + "\n\n" 140 139 141 - line_regex = re.compile("^#define LINENO (\S+)\#([0-9]+)$") 140 + line_regex = re.compile("^\.\. LINENO (\S+)\#([0-9]+)$") 142 141 ln = 0 143 142 n = 0 144 143 f = fname ··· 154 153 if new_f != f and content: 155 154 self.do_parse(content, node) 156 155 content = ViewList() 156 + 157 + # Add the file to Sphinx build dependencies 158 + env.note_dependency(os.path.abspath(f)) 157 159 158 160 f = new_f 159 161
+18 -2
Documentation/sphinx/kernel_feat.py
··· 33 33 34 34 import codecs 35 35 import os 36 + import re 36 37 import subprocess 37 38 import sys 38 39 ··· 83 82 84 83 env = doc.settings.env 85 84 cwd = path.dirname(doc.current_source) 86 - cmd = "get_feat.pl rest --dir " 85 + cmd = "get_feat.pl rest --enable-fname --dir " 87 86 cmd += self.arguments[0] 88 87 89 88 if len(self.arguments) > 1: ··· 103 102 shell_env["srctree"] = srctree 104 103 105 104 lines = self.runCmd(cmd, shell=True, cwd=cwd, env=shell_env) 106 - nodeList = self.nestedParse(lines, fname) 105 + 106 + line_regex = re.compile("^\.\. FILE (\S+)$") 107 + 108 + out_lines = "" 109 + 110 + for line in lines.split("\n"): 111 + match = line_regex.search(line) 112 + if match: 113 + fname = match.group(1) 114 + 115 + # Add the file to Sphinx build dependencies 116 + env.note_dependency(os.path.abspath(fname)) 117 + else: 118 + out_lines += line + "\n" 119 + 120 + nodeList = self.nestedParse(out_lines, fname) 107 121 return nodeList 108 122 109 123 def runCmd(self, cmd, **kwargs):
+3
Documentation/sphinx/kernel_include.py
··· 59 59 u"""KernelInclude (``kernel-include``) directive""" 60 60 61 61 def run(self): 62 + env = self.state.document.settings.env 62 63 path = os.path.realpath( 63 64 os.path.expandvars(self.arguments[0])) 64 65 ··· 70 69 % (self.name, path)) 71 70 72 71 self.arguments[0] = path 72 + 73 + env.note_dependency(os.path.abspath(path)) 73 74 74 75 #return super(KernelInclude, self).run() # won't work, see HINTs in _run() 75 76 return self._run()
+1 -1
Documentation/sphinx/kerneldoc.py
··· 130 130 result = ViewList() 131 131 132 132 lineoffset = 0; 133 - line_regex = re.compile("^#define LINENO ([0-9]+)$") 133 + line_regex = re.compile("^\.\. LINENO ([0-9]+)$") 134 134 for line in lines: 135 135 match = line_regex.search(line) 136 136 if match:
+5 -3
Documentation/sphinx/kfigure.py
··· 212 212 if convert_cmd: 213 213 kernellog.verbose(app, "use convert(1) from: " + convert_cmd) 214 214 else: 215 - kernellog.warn(app, 215 + kernellog.verbose(app, 216 216 "Neither inkscape(1) nor convert(1) found.\n" 217 217 "For SVG to PDF conversion, " 218 218 "install either Inkscape (https://inkscape.org/) (preferred) or\n" ··· 296 296 297 297 if translator.builder.format == 'latex': 298 298 if not inkscape_cmd and convert_cmd is None: 299 - kernellog.verbose(app, 300 - "no SVG to PDF conversion available / include SVG raw.") 299 + kernellog.warn(app, 300 + "no SVG to PDF conversion available / include SVG raw." 301 + "\nIncluding large raw SVGs can cause xelatex error." 302 + "\nInstall Inkscape (preferred) or ImageMagick.") 301 303 img_node.replace_self(file2literal(src_fname)) 302 304 else: 303 305 dst_fname = path.join(translator.builder.outdir, fname + '.pdf')
+2
Documentation/sphinx/requirements.txt
··· 1 + # jinja2>=3.1 is not compatible with Sphinx<4.0 2 + jinja2<3.1 1 3 sphinx_rtd_theme 2 4 Sphinx==2.4.4
+2 -2
scripts/get_abi.pl
··· 327 327 my @filepath = split / /, $data{$what}->{filepath}; 328 328 329 329 if ($enable_lineno) { 330 - printf "#define LINENO %s%s#%s\n\n", 330 + printf ".. LINENO %s%s#%s\n\n", 331 331 $prefix, $file[0], 332 332 $data{$what}->{line_no}; 333 333 } ··· 1023 1023 1024 1024 =item B<--enable-lineno> 1025 1025 1026 - Enable output of #define LINENO lines. 1026 + Enable output of .. LINENO lines. 1027 1027 1028 1028 =item B<--debug> I<debug level> 1029 1029
+11
scripts/get_feat.pl
··· 13 13 my $debug; 14 14 my $arch; 15 15 my $feat; 16 + my $enable_fname; 16 17 17 18 my $basename = abs_path($0); 18 19 $basename =~ s,/[^/]+$,/,; ··· 32 31 'arch=s' => \$arch, 33 32 'feat=s' => \$feat, 34 33 'feature=s' => \$feat, 34 + "enable-fname" => \$enable_fname, 35 35 man => \$man 36 36 ) or pod2usage(2); 37 37 ··· 96 94 return if ($mode & S_IFDIR); 97 95 return if ($file =~ m,($prefix)/arch-support.txt,); 98 96 return if (!($file =~ m,arch-support.txt$,)); 97 + 98 + if ($enable_fname) { 99 + printf ".. FILE %s\n", abs_path($file); 100 + } 99 101 100 102 my $subsys = ""; 101 103 $subsys = $2 if ( m,.*($prefix)/([^/]+).*,); ··· 585 579 586 580 Changes the location of the Feature files. By default, it uses 587 581 the Documentation/features directory. 582 + 583 + =item B<--enable-fname> 584 + 585 + Prints the file name of the feature files. This can be used in order to 586 + track dependencies during documentation build. 588 587 589 588 =item B<--debug> 590 589
+2 -2
scripts/kernel-doc
··· 424 424 sub print_lineno { 425 425 my $lineno = shift; 426 426 if ($enable_lineno && defined($lineno)) { 427 - print "#define LINENO " . $lineno . "\n"; 427 + print ".. LINENO " . $lineno . "\n"; 428 428 } 429 429 } 430 430 ## ··· 2478 2478 2479 2479 =item -enable-lineno 2480 2480 2481 - Enable output of #define LINENO lines. 2481 + Enable output of .. LINENO lines. 2482 2482 2483 2483 =back 2484 2484