aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--.mailmap6
-rw-r--r--Documentation/ABI/testing/sysfs-kernel-livepatch2
-rw-r--r--Documentation/DMA-API-HOWTO.txt2
-rw-r--r--Documentation/Makefile9
-rw-r--r--Documentation/atomic_bitops.txt6
-rw-r--r--Documentation/clearing-warn-once.txt2
-rw-r--r--Documentation/core-api/index.rst1
-rw-r--r--Documentation/dev-tools/kselftest.rst42
-rw-r--r--Documentation/doc-guide/index.rst6
-rw-r--r--Documentation/dontdiff8
-rw-r--r--Documentation/driver-api/soundwire/stream.rst16
-rw-r--r--Documentation/livepatch/callbacks.rst (renamed from Documentation/livepatch/callbacks.txt)45
-rw-r--r--Documentation/livepatch/cumulative-patches.rst (renamed from Documentation/livepatch/cumulative-patches.txt)14
-rw-r--r--Documentation/livepatch/index.rst21
-rw-r--r--Documentation/livepatch/livepatch.rst (renamed from Documentation/livepatch/livepatch.txt)62
-rw-r--r--Documentation/livepatch/module-elf-format.rst (renamed from Documentation/livepatch/module-elf-format.txt)353
-rw-r--r--Documentation/livepatch/shadow-vars.rst (renamed from Documentation/livepatch/shadow-vars.txt)65
-rw-r--r--Documentation/ntb.txt14
-rw-r--r--Documentation/process/5.Posting.rst10
-rw-r--r--Documentation/process/coding-style.rst6
-rw-r--r--Documentation/process/deprecated.rst2
-rw-r--r--Documentation/process/howto.rst2
-rw-r--r--Documentation/process/kernel-docs.rst12
-rw-r--r--Documentation/process/license-rules.rst61
-rw-r--r--Documentation/process/maintainer-pgp-guide.rst2
-rw-r--r--Documentation/process/submitting-patches.rst46
-rw-r--r--Documentation/rtc.txt2
-rw-r--r--Documentation/speculation.txt8
-rw-r--r--Documentation/sysctl/kernel.txt2
-rw-r--r--Documentation/trace/ftrace.rst1
-rw-r--r--Documentation/trace/histogram.rst94
-rw-r--r--Documentation/translations/index.rst40
-rw-r--r--Documentation/translations/it_IT/core-api/memory-allocation.rst13
-rw-r--r--Documentation/translations/it_IT/disclaimer-ita.rst13
-rw-r--r--Documentation/translations/it_IT/doc-guide/index.rst6
-rw-r--r--Documentation/translations/it_IT/index.rst65
-rw-r--r--Documentation/translations/it_IT/networking/netdev-FAQ.rst13
-rw-r--r--Documentation/translations/it_IT/process/5.Posting.rst10
-rw-r--r--Documentation/translations/it_IT/process/coding-style.rst8
-rw-r--r--Documentation/translations/it_IT/process/deprecated.rst129
-rw-r--r--Documentation/translations/it_IT/process/kernel-enforcement-statement.rst168
-rw-r--r--Documentation/translations/it_IT/process/license-rules.rst452
-rw-r--r--Documentation/translations/it_IT/process/maintainer-pgp-guide.rst939
-rw-r--r--Documentation/translations/it_IT/process/stable-kernel-rules.rst194
-rw-r--r--Documentation/translations/it_IT/process/submitting-patches.rst47
-rw-r--r--Documentation/translations/ja_JP/SubmittingPatches6
-rw-r--r--Documentation/translations/zh_CN/SubmittingPatches412
-rw-r--r--Documentation/translations/zh_CN/disclaimer-zh_CN.rst9
-rw-r--r--Documentation/translations/zh_CN/index.rst17
-rw-r--r--Documentation/translations/zh_CN/magic-number.txt153
-rw-r--r--Documentation/translations/zh_CN/oops-tracing.txt2
-rw-r--r--Documentation/translations/zh_CN/process/1.Intro.rst186
-rw-r--r--Documentation/translations/zh_CN/process/2.Process.rst360
-rw-r--r--Documentation/translations/zh_CN/process/3.Early-stage.rst161
-rw-r--r--Documentation/translations/zh_CN/process/4.Coding.rst290
-rw-r--r--Documentation/translations/zh_CN/process/5.Posting.rst240
-rw-r--r--Documentation/translations/zh_CN/process/6.Followthrough.rst145
-rw-r--r--Documentation/translations/zh_CN/process/7.AdvancedTopics.rst124
-rw-r--r--Documentation/translations/zh_CN/process/8.Conclusion.rst64
-rw-r--r--Documentation/translations/zh_CN/process/code-of-conduct-interpretation.rst108
-rw-r--r--Documentation/translations/zh_CN/process/code-of-conduct.rst72
-rw-r--r--Documentation/translations/zh_CN/process/coding-style.rst (renamed from Documentation/translations/zh_CN/coding-style.rst)21
-rw-r--r--Documentation/translations/zh_CN/process/development-process.rst26
-rw-r--r--Documentation/translations/zh_CN/process/email-clients.rst (renamed from Documentation/translations/zh_CN/email-clients.txt)104
-rw-r--r--Documentation/translations/zh_CN/process/howto.rst (renamed from Documentation/translations/zh_CN/HOWTO)265
-rw-r--r--Documentation/translations/zh_CN/process/index.rst60
-rw-r--r--Documentation/translations/zh_CN/process/license-rules.rst370
-rw-r--r--Documentation/translations/zh_CN/process/magic-number.rst151
-rw-r--r--Documentation/translations/zh_CN/process/management-style.rst207
-rw-r--r--Documentation/translations/zh_CN/process/programming-language.rst41
-rw-r--r--Documentation/translations/zh_CN/process/stable-api-nonsense.rst (renamed from Documentation/translations/zh_CN/stable_api_nonsense.txt)68
-rw-r--r--Documentation/translations/zh_CN/process/stable-kernel-rules.rst (renamed from Documentation/translations/zh_CN/stable_kernel_rules.txt)34
-rw-r--r--Documentation/translations/zh_CN/process/submit-checklist.rst107
-rw-r--r--Documentation/translations/zh_CN/process/submitting-drivers.rst (renamed from Documentation/translations/zh_CN/SubmittingDrivers)36
-rw-r--r--Documentation/translations/zh_CN/process/submitting-patches.rst682
-rw-r--r--Documentation/translations/zh_CN/process/volatile-considered-harmful.rst (renamed from Documentation/translations/zh_CN/volatile-considered-harmful.txt)35
-rw-r--r--Documentation/translations/zh_CN/sparse.txt6
-rw-r--r--Documentation/unaligned-memory-access.txt2
-rw-r--r--Documentation/userspace-api/seccomp_filter.rst8
-rw-r--r--Documentation/video-output.txt52
-rw-r--r--Documentation/vm/hugetlbfs_reserv.rst17
-rw-r--r--Documentation/vm/index.rst1
-rw-r--r--Documentation/vm/memory-model.rst183
-rw-r--r--Documentation/vm/numa.rst4
-rw-r--r--Documentation/vm/transhuge.rst81
-rw-r--r--Documentation/x86/boot.txt4
-rw-r--r--LICENSES/deprecated/GPL-1.0 (renamed from LICENSES/other/GPL-1.0)0
-rw-r--r--LICENSES/deprecated/ISC (renamed from LICENSES/other/ISC)0
-rw-r--r--LICENSES/deprecated/Linux-OpenIB (renamed from LICENSES/other/Linux-OpenIB)0
-rw-r--r--LICENSES/deprecated/X11 (renamed from LICENSES/other/X11)0
-rw-r--r--LICENSES/dual/Apache-2.0 (renamed from LICENSES/other/Apache-2.0)4
-rw-r--r--LICENSES/dual/CDDL-1.0 (renamed from LICENSES/other/CDDL-1.0)4
-rw-r--r--LICENSES/dual/MPL-1.1 (renamed from LICENSES/other/MPL-1.1)4
-rw-r--r--MAINTAINERS2
-rw-r--r--include/linux/wait.h2
-rwxr-xr-xscripts/checkpatch.pl18
-rwxr-xr-xscripts/documentation-file-ref-check32
-rwxr-xr-xscripts/sphinx-pre-install1
-rw-r--r--tools/objtool/Documentation/stack-validation.txt2
99 files changed, 6606 insertions, 1396 deletions
diff --git a/.mailmap b/.mailmap
index 0049c0b49056..07a777f9d687 100644
--- a/.mailmap
+++ b/.mailmap
@@ -16,6 +16,8 @@ Alan Cox <alan@lxorguk.ukuu.org.uk>
16Alan Cox <root@hraefn.swansea.linux.org.uk> 16Alan Cox <root@hraefn.swansea.linux.org.uk>
17Aleksey Gorelov <aleksey_gorelov@phoenix.com> 17Aleksey Gorelov <aleksey_gorelov@phoenix.com>
18Aleksandar Markovic <aleksandar.markovic@mips.com> <aleksandar.markovic@imgtec.com> 18Aleksandar Markovic <aleksandar.markovic@mips.com> <aleksandar.markovic@imgtec.com>
19Alex Shi <alex.shi@linux.alibaba.com> <alex.shi@intel.com>
20Alex Shi <alex.shi@linux.alibaba.com> <alex.shi@linaro.org>
19Alexei Starovoitov <ast@kernel.org> <ast@plumgrid.com> 21Alexei Starovoitov <ast@kernel.org> <ast@plumgrid.com>
20Alexei Starovoitov <ast@kernel.org> <alexei.starovoitov@gmail.com> 22Alexei Starovoitov <ast@kernel.org> <alexei.starovoitov@gmail.com>
21Alexei Starovoitov <ast@kernel.org> <ast@fb.com> 23Alexei Starovoitov <ast@kernel.org> <ast@fb.com>
@@ -126,6 +128,8 @@ Leonid I Ananiev <leonid.i.ananiev@intel.com>
126Linas Vepstas <linas@austin.ibm.com> 128Linas Vepstas <linas@austin.ibm.com>
127Linus Lüssing <linus.luessing@c0d3.blue> <linus.luessing@web.de> 129Linus Lüssing <linus.luessing@c0d3.blue> <linus.luessing@web.de>
128Linus Lüssing <linus.luessing@c0d3.blue> <linus.luessing@ascom.ch> 130Linus Lüssing <linus.luessing@c0d3.blue> <linus.luessing@ascom.ch>
131Li Yang <leoyang.li@nxp.com> <leo@zh-kernel.org>
132Li Yang <leoyang.li@nxp.com> <leoli@freescale.com>
129Maciej W. Rozycki <macro@mips.com> <macro@imgtec.com> 133Maciej W. Rozycki <macro@mips.com> <macro@imgtec.com>
130Marcin Nowakowski <marcin.nowakowski@mips.com> <marcin.nowakowski@imgtec.com> 134Marcin Nowakowski <marcin.nowakowski@mips.com> <marcin.nowakowski@imgtec.com>
131Mark Brown <broonie@sirena.org.uk> 135Mark Brown <broonie@sirena.org.uk>
@@ -217,6 +221,8 @@ Tejun Heo <htejun@gmail.com>
217Thomas Graf <tgraf@suug.ch> 221Thomas Graf <tgraf@suug.ch>
218Thomas Pedersen <twp@codeaurora.org> 222Thomas Pedersen <twp@codeaurora.org>
219Tony Luck <tony.luck@intel.com> 223Tony Luck <tony.luck@intel.com>
224TripleX Chung <xxx.phy@gmail.com> <zhongyu@18mail.cn>
225TripleX Chung <xxx.phy@gmail.com> <triplex@zh-kernel.org>
220Tsuneo Yoshioka <Tsuneo.Yoshioka@f-secure.com> 226Tsuneo Yoshioka <Tsuneo.Yoshioka@f-secure.com>
221Uwe Kleine-König <ukleinek@informatik.uni-freiburg.de> 227Uwe Kleine-König <ukleinek@informatik.uni-freiburg.de>
222Uwe Kleine-König <ukl@pengutronix.de> 228Uwe Kleine-König <ukl@pengutronix.de>
diff --git a/Documentation/ABI/testing/sysfs-kernel-livepatch b/Documentation/ABI/testing/sysfs-kernel-livepatch
index 85db352f68f9..bea7bd5a1d5f 100644
--- a/Documentation/ABI/testing/sysfs-kernel-livepatch
+++ b/Documentation/ABI/testing/sysfs-kernel-livepatch
@@ -45,7 +45,7 @@ Description:
45 use this feature without a clearance from a patch 45 use this feature without a clearance from a patch
46 distributor. Removal (rmmod) of patch modules is permanently 46 distributor. Removal (rmmod) of patch modules is permanently
47 disabled when the feature is used. See 47 disabled when the feature is used. See
48 Documentation/livepatch/livepatch.txt for more information. 48 Documentation/livepatch/livepatch.rst for more information.
49 49
50What: /sys/kernel/livepatch/<patch>/<object> 50What: /sys/kernel/livepatch/<patch>/<object>
51Date: Nov 2014 51Date: Nov 2014
diff --git a/Documentation/DMA-API-HOWTO.txt b/Documentation/DMA-API-HOWTO.txt
index 1a721d0f35c8..db48c6fd3162 100644
--- a/Documentation/DMA-API-HOWTO.txt
+++ b/Documentation/DMA-API-HOWTO.txt
@@ -147,7 +147,7 @@ networking subsystems make sure that the buffers they use are valid
147for you to DMA from/to. 147for you to DMA from/to.
148 148
149DMA addressing capabilities 149DMA addressing capabilities
150========================== 150===========================
151 151
152By default, the kernel assumes that your device can address 32-bits of DMA 152By default, the kernel assumes that your device can address 32-bits of DMA
153addressing. For a 64-bit capable device, this needs to be increased, and for 153addressing. For a 64-bit capable device, this needs to be increased, and for
diff --git a/Documentation/Makefile b/Documentation/Makefile
index 9786957c6a35..e889e7cb8511 100644
--- a/Documentation/Makefile
+++ b/Documentation/Makefile
@@ -28,8 +28,13 @@ ifeq ($(HAVE_SPHINX),0)
28 28
29else # HAVE_SPHINX 29else # HAVE_SPHINX
30 30
31# User-friendly check for pdflatex 31# User-friendly check for pdflatex and latexmk
32HAVE_PDFLATEX := $(shell if which $(PDFLATEX) >/dev/null 2>&1; then echo 1; else echo 0; fi) 32HAVE_PDFLATEX := $(shell if which $(PDFLATEX) >/dev/null 2>&1; then echo 1; else echo 0; fi)
33HAVE_LATEXMK := $(shell if which latexmk >/dev/null 2>&1; then echo 1; else echo 0; fi)
34
35ifeq ($(HAVE_LATEXMK),1)
36 PDFLATEX := latexmk -$(PDFLATEX)
37endif #HAVE_LATEXMK
33 38
34# Internal variables. 39# Internal variables.
35PAPEROPT_a4 = -D latex_paper_size=a4 40PAPEROPT_a4 = -D latex_paper_size=a4
@@ -82,7 +87,7 @@ pdfdocs:
82else # HAVE_PDFLATEX 87else # HAVE_PDFLATEX
83 88
84pdfdocs: latexdocs 89pdfdocs: latexdocs
85 $(foreach var,$(SPHINXDIRS), $(MAKE) PDFLATEX=$(PDFLATEX) LATEXOPTS="$(LATEXOPTS)" -C $(BUILDDIR)/$(var)/latex || exit;) 90 $(foreach var,$(SPHINXDIRS), $(MAKE) PDFLATEX="$(PDFLATEX)" LATEXOPTS="$(LATEXOPTS)" -C $(BUILDDIR)/$(var)/latex || exit;)
86 91
87endif # HAVE_PDFLATEX 92endif # HAVE_PDFLATEX
88 93
diff --git a/Documentation/atomic_bitops.txt b/Documentation/atomic_bitops.txt
index be70b32c95d9..093cdaefdb37 100644
--- a/Documentation/atomic_bitops.txt
+++ b/Documentation/atomic_bitops.txt
@@ -1,6 +1,6 @@
1 1=============
2On atomic bitops. 2Atomic bitops
3 3=============
4 4
5While our bitmap_{}() functions are non-atomic, we have a number of operations 5While our bitmap_{}() functions are non-atomic, we have a number of operations
6operating on single bits in a bitmap that are atomic. 6operating on single bits in a bitmap that are atomic.
diff --git a/Documentation/clearing-warn-once.txt b/Documentation/clearing-warn-once.txt
index c68598b31428..211fd926cf00 100644
--- a/Documentation/clearing-warn-once.txt
+++ b/Documentation/clearing-warn-once.txt
@@ -1,3 +1,5 @@
1Clearing WARN_ONCE
2------------------
1 3
2WARN_ONCE / WARN_ON_ONCE / printk_once only emit a message once. 4WARN_ONCE / WARN_ON_ONCE / printk_once only emit a message once.
3 5
diff --git a/Documentation/core-api/index.rst b/Documentation/core-api/index.rst
index 6870baffef82..ee1bb8983a88 100644
--- a/Documentation/core-api/index.rst
+++ b/Documentation/core-api/index.rst
@@ -22,7 +22,6 @@ Core utilities
22 workqueue 22 workqueue
23 genericirq 23 genericirq
24 xarray 24 xarray
25 flexible-arrays
26 librs 25 librs
27 genalloc 26 genalloc
28 errseq 27 errseq
diff --git a/Documentation/dev-tools/kselftest.rst b/Documentation/dev-tools/kselftest.rst
index c8c03388b9de..25604904fa6e 100644
--- a/Documentation/dev-tools/kselftest.rst
+++ b/Documentation/dev-tools/kselftest.rst
@@ -7,6 +7,11 @@ directory. These are intended to be small tests to exercise individual code
7paths in the kernel. Tests are intended to be run after building, installing 7paths in the kernel. Tests are intended to be run after building, installing
8and booting a kernel. 8and booting a kernel.
9 9
10You can find additional information on Kselftest framework, how to
11write new tests using the framework on Kselftest wiki:
12
13https://kselftest.wiki.kernel.org/
14
10On some systems, hot-plug tests could hang forever waiting for cpu and 15On some systems, hot-plug tests could hang forever waiting for cpu and
11memory to be ready to be offlined. A special hot-plug target is created 16memory to be ready to be offlined. A special hot-plug target is created
12to run the full range of hot-plug tests. In default mode, hot-plug tests run 17to run the full range of hot-plug tests. In default mode, hot-plug tests run
@@ -35,17 +40,32 @@ To build and run the tests with a single command, use::
35 40
36Note that some tests will require root privileges. 41Note that some tests will require root privileges.
37 42
38Build and run from user specific object directory (make O=dir):: 43Kselftest supports saving output files in a separate directory and then
44running tests. To locate output files in a separate directory two syntaxes
45are supported. In both cases the working directory must be the root of the
46kernel src. This is applicable to "Running a subset of selftests" section
47below.
48
49To build, save output files in a separate directory with O= ::
39 50
40 $ make O=/tmp/kselftest kselftest 51 $ make O=/tmp/kselftest kselftest
41 52
42Build and run KBUILD_OUTPUT directory (make KBUILD_OUTPUT=):: 53To build, save output files in a separate directory with KBUILD_OUTPUT ::
54
55 $ export KBUILD_OUTPUT=/tmp/kselftest; make kselftest
43 56
44 $ make KBUILD_OUTPUT=/tmp/kselftest kselftest 57The O= assignment takes precedence over the KBUILD_OUTPUT environment
58variable.
45 59
46The above commands run the tests and print pass/fail summary to make it 60The above commands by default run the tests and print full pass/fail report.
47easier to understand the test results. Please find the detailed individual 61Kselftest supports "summary" option to make it easier to understand the test
48test results for each test in /tmp/testname file(s). 62results. Please find the detailed individual test results for each test in
63/tmp/testname file(s) when summary option is specified. This is applicable
64to "Running a subset of selftests" section below.
65
66To run kselftest with summary option enabled ::
67
68 $ make summary=1 kselftest
49 69
50Running a subset of selftests 70Running a subset of selftests
51============================= 71=============================
@@ -61,17 +81,13 @@ You can specify multiple tests to build and run::
61 81
62 $ make TARGETS="size timers" kselftest 82 $ make TARGETS="size timers" kselftest
63 83
64Build and run from user specific object directory (make O=dir):: 84To build, save output files in a separate directory with O= ::
65 85
66 $ make O=/tmp/kselftest TARGETS="size timers" kselftest 86 $ make O=/tmp/kselftest TARGETS="size timers" kselftest
67 87
68Build and run KBUILD_OUTPUT directory (make KBUILD_OUTPUT=):: 88To build, save output files in a separate directory with KBUILD_OUTPUT ::
69
70 $ make KBUILD_OUTPUT=/tmp/kselftest TARGETS="size timers" kselftest
71 89
72The above commands run the tests and print pass/fail summary to make it 90 $ export KBUILD_OUTPUT=/tmp/kselftest; make TARGETS="size timers" kselftest
73easier to understand the test results. Please find the detailed individual
74test results for each test in /tmp/testname file(s).
75 91
76See the top-level tools/testing/selftests/Makefile for the list of all 92See the top-level tools/testing/selftests/Makefile for the list of all
77possible targets. 93possible targets.
diff --git a/Documentation/doc-guide/index.rst b/Documentation/doc-guide/index.rst
index a7f95d7d3a63..603f3ff55d5a 100644
--- a/Documentation/doc-guide/index.rst
+++ b/Documentation/doc-guide/index.rst
@@ -7,9 +7,9 @@ How to write kernel documentation
7.. toctree:: 7.. toctree::
8 :maxdepth: 1 8 :maxdepth: 1
9 9
10 sphinx.rst 10 sphinx
11 kernel-doc.rst 11 kernel-doc
12 parse-headers.rst 12 parse-headers
13 13
14.. only:: subproject and html 14.. only:: subproject and html
15 15
diff --git a/Documentation/dontdiff b/Documentation/dontdiff
index 48e1930fb4a4..5eba889ea84d 100644
--- a/Documentation/dontdiff
+++ b/Documentation/dontdiff
@@ -127,7 +127,7 @@ flask.h
127fore200e_mkfirm 127fore200e_mkfirm
128fore200e_pca_fw.c* 128fore200e_pca_fw.c*
129gconf 129gconf
130gconf.glade.h 130gconf-cfg
131gen-devlist 131gen-devlist
132gen_crc32table 132gen_crc32table
133gen_init_cpio 133gen_init_cpio
@@ -148,24 +148,22 @@ int32.c
148int4.c 148int4.c
149int8.c 149int8.c
150kallsyms 150kallsyms
151kconfig
152keywords.c 151keywords.c
153ksym.c* 152ksym.c*
154ksym.h* 153ksym.h*
155kxgettext
156*lex.c 154*lex.c
157*lex.*.c 155*lex.*.c
158linux 156linux
159logo_*.c 157logo_*.c
160logo_*_clut224.c 158logo_*_clut224.c
161logo_*_mono.c 159logo_*_mono.c
162lxdialog
163mach-types 160mach-types
164mach-types.h 161mach-types.h
165machtypes.h 162machtypes.h
166map 163map
167map_hugetlb 164map_hugetlb
168mconf 165mconf
166mconf-cfg
169miboot* 167miboot*
170mk_elfconfig 168mk_elfconfig
171mkboot 169mkboot
@@ -183,6 +181,7 @@ modules.builtin.modinfo
183modules.order 181modules.order
184modversions.h* 182modversions.h*
185nconf 183nconf
184nconf-cfg
186ncscope.* 185ncscope.*
187offset.h 186offset.h
188oui.c* 187oui.c*
@@ -202,6 +201,7 @@ pnmtologo
202ppc_defs.h* 201ppc_defs.h*
203pss_boot.h 202pss_boot.h
204qconf 203qconf
204qconf-cfg
205r100_reg_safe.h 205r100_reg_safe.h
206r200_reg_safe.h 206r200_reg_safe.h
207r300_reg_safe.h 207r300_reg_safe.h
diff --git a/Documentation/driver-api/soundwire/stream.rst b/Documentation/driver-api/soundwire/stream.rst
index 26a6064503fd..5351bd2f34a8 100644
--- a/Documentation/driver-api/soundwire/stream.rst
+++ b/Documentation/driver-api/soundwire/stream.rst
@@ -201,7 +201,7 @@ Bus implements below API for allocate a stream which needs to be called once
201per stream. From ASoC DPCM framework, this stream state maybe linked to 201per stream. From ASoC DPCM framework, this stream state maybe linked to
202.startup() operation. 202.startup() operation.
203 203
204 .. code-block:: c 204.. code-block:: c
205 205
206 int sdw_alloc_stream(char * stream_name); 206 int sdw_alloc_stream(char * stream_name);
207 207
@@ -228,7 +228,7 @@ the respective Master(s) and Slave(s) associated with stream. These APIs can
228only be invoked once by respective Master(s) and Slave(s). From ASoC DPCM 228only be invoked once by respective Master(s) and Slave(s). From ASoC DPCM
229framework, this stream state is linked to .hw_params() operation. 229framework, this stream state is linked to .hw_params() operation.
230 230
231 .. code-block:: c 231.. code-block:: c
232 232
233 int sdw_stream_add_master(struct sdw_bus * bus, 233 int sdw_stream_add_master(struct sdw_bus * bus,
234 struct sdw_stream_config * stream_config, 234 struct sdw_stream_config * stream_config,
@@ -274,7 +274,7 @@ Bus implements below API for PREPARE state which needs to be called once per
274stream. From ASoC DPCM framework, this stream state is linked to 274stream. From ASoC DPCM framework, this stream state is linked to
275.prepare() operation. 275.prepare() operation.
276 276
277 .. code-block:: c 277.. code-block:: c
278 278
279 int sdw_prepare_stream(struct sdw_stream_runtime * stream); 279 int sdw_prepare_stream(struct sdw_stream_runtime * stream);
280 280
@@ -304,7 +304,7 @@ Bus implements below API for ENABLE state which needs to be called once per
304stream. From ASoC DPCM framework, this stream state is linked to 304stream. From ASoC DPCM framework, this stream state is linked to
305.trigger() start operation. 305.trigger() start operation.
306 306
307 .. code-block:: c 307.. code-block:: c
308 308
309 int sdw_enable_stream(struct sdw_stream_runtime * stream); 309 int sdw_enable_stream(struct sdw_stream_runtime * stream);
310 310
@@ -332,7 +332,7 @@ Bus implements below API for DISABLED state which needs to be called once
332per stream. From ASoC DPCM framework, this stream state is linked to 332per stream. From ASoC DPCM framework, this stream state is linked to
333.trigger() stop operation. 333.trigger() stop operation.
334 334
335 .. code-block:: c 335.. code-block:: c
336 336
337 int sdw_disable_stream(struct sdw_stream_runtime * stream); 337 int sdw_disable_stream(struct sdw_stream_runtime * stream);
338 338
@@ -357,7 +357,7 @@ Bus implements below API for DEPREPARED state which needs to be called once
357per stream. From ASoC DPCM framework, this stream state is linked to 357per stream. From ASoC DPCM framework, this stream state is linked to
358.trigger() stop operation. 358.trigger() stop operation.
359 359
360 .. code-block:: c 360.. code-block:: c
361 361
362 int sdw_deprepare_stream(struct sdw_stream_runtime * stream); 362 int sdw_deprepare_stream(struct sdw_stream_runtime * stream);
363 363
@@ -382,7 +382,7 @@ Bus implements below APIs for RELEASE state which needs to be called by
382all the Master(s) and Slave(s) associated with stream. From ASoC DPCM 382all the Master(s) and Slave(s) associated with stream. From ASoC DPCM
383framework, this stream state is linked to .hw_free() operation. 383framework, this stream state is linked to .hw_free() operation.
384 384
385 .. code-block:: c 385.. code-block:: c
386 386
387 int sdw_stream_remove_master(struct sdw_bus * bus, 387 int sdw_stream_remove_master(struct sdw_bus * bus,
388 struct sdw_stream_runtime * stream); 388 struct sdw_stream_runtime * stream);
@@ -395,7 +395,7 @@ stream assigned as part of ALLOCATED state.
395 395
396In .shutdown() the data structure maintaining stream state are freed up. 396In .shutdown() the data structure maintaining stream state are freed up.
397 397
398 .. code-block:: c 398.. code-block:: c
399 399
400 void sdw_release_stream(struct sdw_stream_runtime * stream); 400 void sdw_release_stream(struct sdw_stream_runtime * stream);
401 401
diff --git a/Documentation/livepatch/callbacks.txt b/Documentation/livepatch/callbacks.rst
index 182e31d4abce..470944aa8658 100644
--- a/Documentation/livepatch/callbacks.txt
+++ b/Documentation/livepatch/callbacks.rst
@@ -4,7 +4,7 @@
4 4
5Livepatch (un)patch-callbacks provide a mechanism for livepatch modules 5Livepatch (un)patch-callbacks provide a mechanism for livepatch modules
6to execute callback functions when a kernel object is (un)patched. They 6to execute callback functions when a kernel object is (un)patched. They
7can be considered a "power feature" that extends livepatching abilities 7can be considered a **power feature** that **extends livepatching abilities**
8to include: 8to include:
9 9
10 - Safe updates to global data 10 - Safe updates to global data
@@ -17,6 +17,9 @@ In most cases, (un)patch callbacks will need to be used in conjunction
17with memory barriers and kernel synchronization primitives, like 17with memory barriers and kernel synchronization primitives, like
18mutexes/spinlocks, or even stop_machine(), to avoid concurrency issues. 18mutexes/spinlocks, or even stop_machine(), to avoid concurrency issues.
19 19
201. Motivation
21=============
22
20Callbacks differ from existing kernel facilities: 23Callbacks differ from existing kernel facilities:
21 24
22 - Module init/exit code doesn't run when disabling and re-enabling a 25 - Module init/exit code doesn't run when disabling and re-enabling a
@@ -28,21 +31,31 @@ Callbacks are part of the klp_object structure and their implementation
28is specific to that klp_object. Other livepatch objects may or may not 31is specific to that klp_object. Other livepatch objects may or may not
29be patched, irrespective of the target klp_object's current state. 32be patched, irrespective of the target klp_object's current state.
30 33
342. Callback types
35=================
36
31Callbacks can be registered for the following livepatch actions: 37Callbacks can be registered for the following livepatch actions:
32 38
33 * Pre-patch - before a klp_object is patched 39 * Pre-patch
40 - before a klp_object is patched
34 41
35 * Post-patch - after a klp_object has been patched and is active 42 * Post-patch
43 - after a klp_object has been patched and is active
36 across all tasks 44 across all tasks
37 45
38 * Pre-unpatch - before a klp_object is unpatched (ie, patched code is 46 * Pre-unpatch
47 - before a klp_object is unpatched (ie, patched code is
39 active), used to clean up post-patch callback 48 active), used to clean up post-patch callback
40 resources 49 resources
41 50
42 * Post-unpatch - after a klp_object has been patched, all code has 51 * Post-unpatch
52 - after a klp_object has been patched, all code has
43 been restored and no tasks are running patched code, 53 been restored and no tasks are running patched code,
44 used to cleanup pre-patch callback resources 54 used to cleanup pre-patch callback resources
45 55
563. How it works
57===============
58
46Each callback is optional, omitting one does not preclude specifying any 59Each callback is optional, omitting one does not preclude specifying any
47other. However, the livepatching core executes the handlers in 60other. However, the livepatching core executes the handlers in
48symmetry: pre-patch callbacks have a post-unpatch counterpart and 61symmetry: pre-patch callbacks have a post-unpatch counterpart and
@@ -86,11 +99,14 @@ If the object did successfully patch, but the patch transition never
86started for some reason (e.g., if another object failed to patch), 99started for some reason (e.g., if another object failed to patch),
87only the post-unpatch callback will be called. 100only the post-unpatch callback will be called.
88 101
1024. Use cases
103============
89 104
90Example Use-cases 105Sample livepatch modules demonstrating the callback API can be found in
91================= 106samples/livepatch/ directory. These samples were modified for use in
107kselftests and can be found in the lib/livepatch directory.
92 108
93Update global data 109Global data update
94------------------ 110------------------
95 111
96A pre-patch callback can be useful to update a global variable. For 112A pre-patch callback can be useful to update a global variable. For
@@ -103,24 +119,15 @@ patch the data *after* patching is complete with a post-patch callback,
103so that tcp_send_challenge_ack() could first be changed to read 119so that tcp_send_challenge_ack() could first be changed to read
104sysctl_tcp_challenge_ack_limit with READ_ONCE. 120sysctl_tcp_challenge_ack_limit with READ_ONCE.
105 121
106 122__init and probe function patches support
107Support __init and probe function patches
108----------------------------------------- 123-----------------------------------------
109 124
110Although __init and probe functions are not directly livepatch-able, it 125Although __init and probe functions are not directly livepatch-able, it
111may be possible to implement similar updates via pre/post-patch 126may be possible to implement similar updates via pre/post-patch
112callbacks. 127callbacks.
113 128
11448900cb6af42 ("virtio-net: drop NETIF_F_FRAGLIST") change the way that 129The commit ``48900cb6af42 ("virtio-net: drop NETIF_F_FRAGLIST")`` change the way that
115virtnet_probe() initialized its driver's net_device features. A 130virtnet_probe() initialized its driver's net_device features. A
116pre/post-patch callback could iterate over all such devices, making a 131pre/post-patch callback could iterate over all such devices, making a
117similar change to their hw_features value. (Client functions of the 132similar change to their hw_features value. (Client functions of the
118value may need to be updated accordingly.) 133value may need to be updated accordingly.)
119
120
121Other Examples
122==============
123
124Sample livepatch modules demonstrating the callback API can be found in
125samples/livepatch/ directory. These samples were modified for use in
126kselftests and can be found in the lib/livepatch directory.
diff --git a/Documentation/livepatch/cumulative-patches.txt b/Documentation/livepatch/cumulative-patches.rst
index 0012808e8d44..1931f318976a 100644
--- a/Documentation/livepatch/cumulative-patches.txt
+++ b/Documentation/livepatch/cumulative-patches.rst
@@ -18,7 +18,7 @@ Usage
18----- 18-----
19 19
20The atomic replace can be enabled by setting "replace" flag in struct klp_patch, 20The atomic replace can be enabled by setting "replace" flag in struct klp_patch,
21for example: 21for example::
22 22
23 static struct klp_patch patch = { 23 static struct klp_patch patch = {
24 .mod = THIS_MODULE, 24 .mod = THIS_MODULE,
@@ -49,19 +49,19 @@ Features
49 49
50The atomic replace allows: 50The atomic replace allows:
51 51
52 + Atomically revert some functions in a previous patch while 52 - Atomically revert some functions in a previous patch while
53 upgrading other functions. 53 upgrading other functions.
54 54
55 + Remove eventual performance impact caused by core redirection 55 - Remove eventual performance impact caused by core redirection
56 for functions that are no longer patched. 56 for functions that are no longer patched.
57 57
58 + Decrease user confusion about dependencies between livepatches. 58 - Decrease user confusion about dependencies between livepatches.
59 59
60 60
61Limitations: 61Limitations:
62------------ 62------------
63 63
64 + Once the operation finishes, there is no straightforward way 64 - Once the operation finishes, there is no straightforward way
65 to reverse it and restore the replaced patches atomically. 65 to reverse it and restore the replaced patches atomically.
66 66
67 A good practice is to set .replace flag in any released livepatch. 67 A good practice is to set .replace flag in any released livepatch.
@@ -74,7 +74,7 @@ Limitations:
74 only when the transition was not forced. 74 only when the transition was not forced.
75 75
76 76
77 + Only the (un)patching callbacks from the _new_ cumulative livepatch are 77 - Only the (un)patching callbacks from the _new_ cumulative livepatch are
78 executed. Any callbacks from the replaced patches are ignored. 78 executed. Any callbacks from the replaced patches are ignored.
79 79
80 In other words, the cumulative patch is responsible for doing any actions 80 In other words, the cumulative patch is responsible for doing any actions
@@ -93,7 +93,7 @@ Limitations:
93 enabled patches were called. 93 enabled patches were called.
94 94
95 95
96 + There is no special handling of shadow variables. Livepatch authors 96 - There is no special handling of shadow variables. Livepatch authors
97 must create their own rules how to pass them from one cumulative 97 must create their own rules how to pass them from one cumulative
98 patch to the other. Especially that they should not blindly remove 98 patch to the other. Especially that they should not blindly remove
99 them in module_exit() functions. 99 them in module_exit() functions.
diff --git a/Documentation/livepatch/index.rst b/Documentation/livepatch/index.rst
new file mode 100644
index 000000000000..edd291d51847
--- /dev/null
+++ b/Documentation/livepatch/index.rst
@@ -0,0 +1,21 @@
1:orphan:
2
3===================
4Kernel Livepatching
5===================
6
7.. toctree::
8 :maxdepth: 1
9
10 livepatch
11 callbacks
12 cumulative-patches
13 module-elf-format
14 shadow-vars
15
16.. only:: subproject and html
17
18 Indices
19 =======
20
21 * :ref:`genindex`
diff --git a/Documentation/livepatch/livepatch.txt b/Documentation/livepatch/livepatch.rst
index 4627b41ff02e..c2c598c4ead8 100644
--- a/Documentation/livepatch/livepatch.txt
+++ b/Documentation/livepatch/livepatch.rst
@@ -4,22 +4,22 @@ Livepatch
4 4
5This document outlines basic information about kernel livepatching. 5This document outlines basic information about kernel livepatching.
6 6
7Table of Contents: 7.. Table of Contents:
8 8
91. Motivation 9 1. Motivation
102. Kprobes, Ftrace, Livepatching 10 2. Kprobes, Ftrace, Livepatching
113. Consistency model 11 3. Consistency model
124. Livepatch module 12 4. Livepatch module
13 4.1. New functions 13 4.1. New functions
14 4.2. Metadata 14 4.2. Metadata
155. Livepatch life-cycle 15 5. Livepatch life-cycle
16 5.1. Loading 16 5.1. Loading
17 5.2. Enabling 17 5.2. Enabling
18 5.3. Replacing 18 5.3. Replacing
19 5.4. Disabling 19 5.4. Disabling
20 5.5. Removing 20 5.5. Removing
216. Sysfs 21 6. Sysfs
227. Limitations 22 7. Limitations
23 23
24 24
251. Motivation 251. Motivation
@@ -40,14 +40,14 @@ There are multiple mechanisms in the Linux kernel that are directly related
40to redirection of code execution; namely: kernel probes, function tracing, 40to redirection of code execution; namely: kernel probes, function tracing,
41and livepatching: 41and livepatching:
42 42
43 + The kernel probes are the most generic. The code can be redirected by 43 - The kernel probes are the most generic. The code can be redirected by
44 putting a breakpoint instruction instead of any instruction. 44 putting a breakpoint instruction instead of any instruction.
45 45
46 + The function tracer calls the code from a predefined location that is 46 - The function tracer calls the code from a predefined location that is
47 close to the function entry point. This location is generated by the 47 close to the function entry point. This location is generated by the
48 compiler using the '-pg' gcc option. 48 compiler using the '-pg' gcc option.
49 49
50 + Livepatching typically needs to redirect the code at the very beginning 50 - Livepatching typically needs to redirect the code at the very beginning
51 of the function entry before the function parameters or the stack 51 of the function entry before the function parameters or the stack
52 are in any way modified. 52 are in any way modified.
53 53
@@ -249,7 +249,7 @@ The patch contains only functions that are really modified. But they
249might want to access functions or data from the original source file 249might want to access functions or data from the original source file
250that may only be locally accessible. This can be solved by a special 250that may only be locally accessible. This can be solved by a special
251relocation section in the generated livepatch module, see 251relocation section in the generated livepatch module, see
252Documentation/livepatch/module-elf-format.txt for more details. 252Documentation/livepatch/module-elf-format.rst for more details.
253 253
254 254
2554.2. Metadata 2554.2. Metadata
@@ -258,7 +258,7 @@ Documentation/livepatch/module-elf-format.txt for more details.
258The patch is described by several structures that split the information 258The patch is described by several structures that split the information
259into three levels: 259into three levels:
260 260
261 + struct klp_func is defined for each patched function. It describes 261 - struct klp_func is defined for each patched function. It describes
262 the relation between the original and the new implementation of a 262 the relation between the original and the new implementation of a
263 particular function. 263 particular function.
264 264
@@ -275,7 +275,7 @@ into three levels:
275 only for a particular object ( vmlinux or a kernel module ). Note that 275 only for a particular object ( vmlinux or a kernel module ). Note that
276 kallsyms allows for searching symbols according to the object name. 276 kallsyms allows for searching symbols according to the object name.
277 277
278 + struct klp_object defines an array of patched functions (struct 278 - struct klp_object defines an array of patched functions (struct
279 klp_func) in the same object. Where the object is either vmlinux 279 klp_func) in the same object. Where the object is either vmlinux
280 (NULL) or a module name. 280 (NULL) or a module name.
281 281
@@ -285,7 +285,7 @@ into three levels:
285 only when they are available. 285 only when they are available.
286 286
287 287
288 + struct klp_patch defines an array of patched objects (struct 288 - struct klp_patch defines an array of patched objects (struct
289 klp_object). 289 klp_object).
290 290
291 This structure handles all patched functions consistently and eventually, 291 This structure handles all patched functions consistently and eventually,
@@ -337,14 +337,16 @@ operation fails.
337Second, livepatch enters into a transition state where tasks are converging 337Second, livepatch enters into a transition state where tasks are converging
338to the patched state. If an original function is patched for the first 338to the patched state. If an original function is patched for the first
339time, a function specific struct klp_ops is created and an universal 339time, a function specific struct klp_ops is created and an universal
340ftrace handler is registered[*]. This stage is indicated by a value of '1' 340ftrace handler is registered\ [#]_. This stage is indicated by a value of '1'
341in /sys/kernel/livepatch/<name>/transition. For more information about 341in /sys/kernel/livepatch/<name>/transition. For more information about
342this process, see the "Consistency model" section. 342this process, see the "Consistency model" section.
343 343
344Finally, once all tasks have been patched, the 'transition' value changes 344Finally, once all tasks have been patched, the 'transition' value changes
345to '0'. 345to '0'.
346 346
347[*] Note that functions might be patched multiple times. The ftrace handler 347.. [#]
348
349 Note that functions might be patched multiple times. The ftrace handler
348 is registered only once for a given function. Further patches just add 350 is registered only once for a given function. Further patches just add
349 an entry to the list (see field `func_stack`) of the struct klp_ops. 351 an entry to the list (see field `func_stack`) of the struct klp_ops.
350 The right implementation is selected by the ftrace handler, see 352 The right implementation is selected by the ftrace handler, see
@@ -368,7 +370,7 @@ the ftrace handler is unregistered and the struct klp_ops is
368freed when the related function is not modified by the new patch 370freed when the related function is not modified by the new patch
369and func_stack list becomes empty. 371and func_stack list becomes empty.
370 372
371See Documentation/livepatch/cumulative-patches.txt for more details. 373See Documentation/livepatch/cumulative-patches.rst for more details.
372 374
373 375
3745.4. Disabling 3765.4. Disabling
@@ -421,7 +423,7 @@ See Documentation/ABI/testing/sysfs-kernel-livepatch for more details.
421 423
422The current Livepatch implementation has several limitations: 424The current Livepatch implementation has several limitations:
423 425
424 + Only functions that can be traced could be patched. 426 - Only functions that can be traced could be patched.
425 427
426 Livepatch is based on the dynamic ftrace. In particular, functions 428 Livepatch is based on the dynamic ftrace. In particular, functions
427 implementing ftrace or the livepatch ftrace handler could not be 429 implementing ftrace or the livepatch ftrace handler could not be
@@ -431,7 +433,7 @@ The current Livepatch implementation has several limitations:
431 433
432 434
433 435
434 + Livepatch works reliably only when the dynamic ftrace is located at 436 - Livepatch works reliably only when the dynamic ftrace is located at
435 the very beginning of the function. 437 the very beginning of the function.
436 438
437 The function need to be redirected before the stack or the function 439 The function need to be redirected before the stack or the function
@@ -445,7 +447,7 @@ The current Livepatch implementation has several limitations:
445 this is handled on the ftrace level. 447 this is handled on the ftrace level.
446 448
447 449
448 + Kretprobes using the ftrace framework conflict with the patched 450 - Kretprobes using the ftrace framework conflict with the patched
449 functions. 451 functions.
450 452
451 Both kretprobes and livepatches use a ftrace handler that modifies 453 Both kretprobes and livepatches use a ftrace handler that modifies
@@ -453,7 +455,7 @@ The current Livepatch implementation has several limitations:
453 is rejected when the handler is already in use by the other. 455 is rejected when the handler is already in use by the other.
454 456
455 457
456 + Kprobes in the original function are ignored when the code is 458 - Kprobes in the original function are ignored when the code is
457 redirected to the new implementation. 459 redirected to the new implementation.
458 460
459 There is a work in progress to add warnings about this situation. 461 There is a work in progress to add warnings about this situation.
diff --git a/Documentation/livepatch/module-elf-format.txt b/Documentation/livepatch/module-elf-format.rst
index f21a5289a09c..2a591e6f8e6c 100644
--- a/Documentation/livepatch/module-elf-format.txt
+++ b/Documentation/livepatch/module-elf-format.rst
@@ -4,33 +4,21 @@ Livepatch module Elf format
4 4
5This document outlines the Elf format requirements that livepatch modules must follow. 5This document outlines the Elf format requirements that livepatch modules must follow.
6 6
7----------------- 7
8Table of Contents 8.. Table of Contents
9----------------- 9
100. Background and motivation 10 1. Background and motivation
111. Livepatch modinfo field 11 2. Livepatch modinfo field
122. Livepatch relocation sections 12 3. Livepatch relocation sections
13 2.1 What are livepatch relocation sections? 13 3.1 Livepatch relocation section format
14 2.2 Livepatch relocation section format 14 4. Livepatch symbols
15 2.2.1 Required flags 15 4.1 A livepatch module's symbol table
16 2.2.2 Required name format 16 4.2 Livepatch symbol format
17 2.2.3 Example livepatch relocation section names 17 5. Architecture-specific sections
18 2.2.4 Example `readelf --sections` output 18 6. Symbol table and Elf section access
19 2.2.5 Example `readelf --relocs` output 19
203. Livepatch symbols 201. Background and motivation
21 3.1 What are livepatch symbols? 21============================
22 3.2 A livepatch module's symbol table
23 3.3 Livepatch symbol format
24 3.3.1 Required flags
25 3.3.2 Required name format
26 3.3.3 Example livepatch symbol names
27 3.3.4 Example `readelf --symbols` output
284. Architecture-specific sections
295. Symbol table and Elf section access
30
31----------------------------
320. Background and motivation
33----------------------------
34 22
35Formerly, livepatch required separate architecture-specific code to write 23Formerly, livepatch required separate architecture-specific code to write
36relocations. However, arch-specific code to write relocations already 24relocations. However, arch-specific code to write relocations already
@@ -52,8 +40,8 @@ relocation sections and symbols, which are described in this document. The
52Elf constants used to mark livepatch symbols and relocation sections were 40Elf constants used to mark livepatch symbols and relocation sections were
53selected from OS-specific ranges according to the definitions from glibc. 41selected from OS-specific ranges according to the definitions from glibc.
54 42
550.1 Why does livepatch need to write its own relocations? 43Why does livepatch need to write its own relocations?
56--------------------------------------------------------- 44-----------------------------------------------------
57A typical livepatch module contains patched versions of functions that can 45A typical livepatch module contains patched versions of functions that can
58reference non-exported global symbols and non-included local symbols. 46reference non-exported global symbols and non-included local symbols.
59Relocations referencing these types of symbols cannot be left in as-is 47Relocations referencing these types of symbols cannot be left in as-is
@@ -72,13 +60,8 @@ relas reference are special livepatch symbols (see section 2 and 3). The
72arch-specific livepatch relocation code is replaced by a call to 60arch-specific livepatch relocation code is replaced by a call to
73apply_relocate_add(). 61apply_relocate_add().
74 62
75================================ 632. Livepatch modinfo field
76PATCH MODULE FORMAT REQUIREMENTS 64==========================
77================================
78
79--------------------------
801. Livepatch modinfo field
81--------------------------
82 65
83Livepatch modules are required to have the "livepatch" modinfo attribute. 66Livepatch modules are required to have the "livepatch" modinfo attribute.
84See the sample livepatch module in samples/livepatch/ for how this is done. 67See the sample livepatch module in samples/livepatch/ for how this is done.
@@ -87,22 +70,23 @@ Livepatch modules can be identified by users by using the 'modinfo' command
87and looking for the presence of the "livepatch" field. This field is also 70and looking for the presence of the "livepatch" field. This field is also
88used by the kernel module loader to identify livepatch modules. 71used by the kernel module loader to identify livepatch modules.
89 72
90Example modinfo output: 73Example:
91----------------------- 74--------
92% modinfo livepatch-meminfo.ko 75
93filename: livepatch-meminfo.ko 76**Modinfo output:**
94livepatch: Y 77
95license: GPL 78::
96depends: 79
97vermagic: 4.3.0+ SMP mod_unload 80 % modinfo livepatch-meminfo.ko
98 81 filename: livepatch-meminfo.ko
99-------------------------------- 82 livepatch: Y
1002. Livepatch relocation sections 83 license: GPL
101-------------------------------- 84 depends:
102 85 vermagic: 4.3.0+ SMP mod_unload
103------------------------------------------- 86
1042.1 What are livepatch relocation sections? 873. Livepatch relocation sections
105------------------------------------------- 88================================
89
106A livepatch module manages its own Elf relocation sections to apply 90A livepatch module manages its own Elf relocation sections to apply
107relocations to modules as well as to the kernel (vmlinux) at the 91relocations to modules as well as to the kernel (vmlinux) at the
108appropriate time. For example, if a patch module patches a driver that is 92appropriate time. For example, if a patch module patches a driver that is
@@ -127,12 +111,9 @@ Every symbol referenced by a rela in a livepatch relocation section is a
127livepatch symbol. These must be resolved before livepatch can call 111livepatch symbol. These must be resolved before livepatch can call
128apply_relocate_add(). See Section 3 for more information. 112apply_relocate_add(). See Section 3 for more information.
129 113
130--------------------------------------- 1143.1 Livepatch relocation section format
1312.2 Livepatch relocation section format 115=======================================
132---------------------------------------
133 116
1342.2.1 Required flags
135--------------------
136Livepatch relocation sections must be marked with the SHF_RELA_LIVEPATCH 117Livepatch relocation sections must be marked with the SHF_RELA_LIVEPATCH
137section flag. See include/uapi/linux/elf.h for the definition. The module 118section flag. See include/uapi/linux/elf.h for the definition. The module
138loader recognizes this flag and will avoid applying those relocation sections 119loader recognizes this flag and will avoid applying those relocation sections
@@ -140,28 +121,39 @@ at patch module load time. These sections must also be marked with SHF_ALLOC,
140so that the module loader doesn't discard them on module load (i.e. they will 121so that the module loader doesn't discard them on module load (i.e. they will
141be copied into memory along with the other SHF_ALLOC sections). 122be copied into memory along with the other SHF_ALLOC sections).
142 123
1432.2.2 Required name format 124The name of a livepatch relocation section must conform to the following
144-------------------------- 125format::
145The name of a livepatch relocation section must conform to the following format:
146 126
147.klp.rela.objname.section_name 127 .klp.rela.objname.section_name
148^ ^^ ^ ^ ^ 128 ^ ^^ ^ ^ ^
149|________||_____| |__________| 129 |________||_____| |__________|
150 [A] [B] [C] 130 [A] [B] [C]
151 131
152[A] The relocation section name is prefixed with the string ".klp.rela." 132[A]
153[B] The name of the object (i.e. "vmlinux" or name of module) to 133 The relocation section name is prefixed with the string ".klp.rela."
154 which the relocation section belongs follows immediately after the prefix.
155[C] The actual name of the section to which this relocation section applies.
156 134
1572.2.3 Example livepatch relocation section names: 135[B]
158------------------------------------------------- 136 The name of the object (i.e. "vmlinux" or name of module) to
159.klp.rela.ext4.text.ext4_attr_store 137 which the relocation section belongs follows immediately after the prefix.
160.klp.rela.vmlinux.text.cmdline_proc_show 138
139[C]
140 The actual name of the section to which this relocation section applies.
141
142Examples:
143---------
144
145**Livepatch relocation section names:**
146
147::
148
149 .klp.rela.ext4.text.ext4_attr_store
150 .klp.rela.vmlinux.text.cmdline_proc_show
151
152**`readelf --sections` output for a patch
153module that patches vmlinux and modules 9p, btrfs, ext4:**
154
155::
161 156
1622.2.4 Example `readelf --sections` output for a patch
163module that patches vmlinux and modules 9p, btrfs, ext4:
164--------------------------------------------------------
165 Section Headers: 157 Section Headers:
166 [Nr] Name Type Address Off Size ES Flg Lk Inf Al 158 [Nr] Name Type Address Off Size ES Flg Lk Inf Al
167 [ snip ] 159 [ snip ]
@@ -175,31 +167,33 @@ module that patches vmlinux and modules 9p, btrfs, ext4:
175 [ snip ] ^ ^ 167 [ snip ] ^ ^
176 | | 168 | |
177 [*] [*] 169 [*] [*]
178[*] Livepatch relocation sections are SHT_RELA sections but with a few special 170
179characteristics. Notice that they are marked SHF_ALLOC ("A") so that they will 171[*]
180not be discarded when the module is loaded into memory, as well as with the 172 Livepatch relocation sections are SHT_RELA sections but with a few special
181SHF_RELA_LIVEPATCH flag ("o" - for OS-specific). 173 characteristics. Notice that they are marked SHF_ALLOC ("A") so that they will
182 174 not be discarded when the module is loaded into memory, as well as with the
1832.2.5 Example `readelf --relocs` output for a patch module: 175 SHF_RELA_LIVEPATCH flag ("o" - for OS-specific).
184----------------------------------------------------------- 176
185Relocation section '.klp.rela.btrfs.text.btrfs_feature_attr_show' at offset 0x2ba0 contains 4 entries: 177**`readelf --relocs` output for a patch module:**
186 Offset Info Type Symbol's Value Symbol's Name + Addend 178
187000000000000001f 0000005e00000002 R_X86_64_PC32 0000000000000000 .klp.sym.vmlinux.printk,0 - 4 179::
1880000000000000028 0000003d0000000b R_X86_64_32S 0000000000000000 .klp.sym.btrfs.btrfs_ktype,0 + 0 180
1890000000000000036 0000003b00000002 R_X86_64_PC32 0000000000000000 .klp.sym.btrfs.can_modify_feature.isra.3,0 - 4 181 Relocation section '.klp.rela.btrfs.text.btrfs_feature_attr_show' at offset 0x2ba0 contains 4 entries:
190000000000000004c 0000004900000002 R_X86_64_PC32 0000000000000000 .klp.sym.vmlinux.snprintf,0 - 4 182 Offset Info Type Symbol's Value Symbol's Name + Addend
191[ snip ] ^ 183 000000000000001f 0000005e00000002 R_X86_64_PC32 0000000000000000 .klp.sym.vmlinux.printk,0 - 4
192 | 184 0000000000000028 0000003d0000000b R_X86_64_32S 0000000000000000 .klp.sym.btrfs.btrfs_ktype,0 + 0
193 [*] 185 0000000000000036 0000003b00000002 R_X86_64_PC32 0000000000000000 .klp.sym.btrfs.can_modify_feature.isra.3,0 - 4
194[*] Every symbol referenced by a relocation is a livepatch symbol. 186 000000000000004c 0000004900000002 R_X86_64_PC32 0000000000000000 .klp.sym.vmlinux.snprintf,0 - 4
195 187 [ snip ] ^
196-------------------- 188 |
1973. Livepatch symbols 189 [*]
198-------------------- 190
199 191[*]
200------------------------------- 192 Every symbol referenced by a relocation is a livepatch symbol.
2013.1 What are livepatch symbols? 193
202------------------------------- 1944. Livepatch symbols
195====================
196
203Livepatch symbols are symbols referred to by livepatch relocation sections. 197Livepatch symbols are symbols referred to by livepatch relocation sections.
204These are symbols accessed from new versions of functions for patched 198These are symbols accessed from new versions of functions for patched
205objects, whose addresses cannot be resolved by the module loader (because 199objects, whose addresses cannot be resolved by the module loader (because
@@ -219,9 +213,8 @@ loader can identify and ignore them. Livepatch modules keep these symbols
219in their symbol tables, and the symbol table is made accessible through 213in their symbol tables, and the symbol table is made accessible through
220module->symtab. 214module->symtab.
221 215
222------------------------------------- 2164.1 A livepatch module's symbol table
2233.2 A livepatch module's symbol table 217=====================================
224-------------------------------------
225Normally, a stripped down copy of a module's symbol table (containing only 218Normally, a stripped down copy of a module's symbol table (containing only
226"core" symbols) is made available through module->symtab (See layout_symtab() 219"core" symbols) is made available through module->symtab (See layout_symtab()
227in kernel/module.c). For livepatch modules, the symbol table copied into memory 220in kernel/module.c). For livepatch modules, the symbol table copied into memory
@@ -231,71 +224,82 @@ relocation section refer to their respective symbols with their symbol indices,
231and the original symbol indices (and thus the symtab ordering) must be 224and the original symbol indices (and thus the symtab ordering) must be
232preserved in order for apply_relocate_add() to find the right symbol. 225preserved in order for apply_relocate_add() to find the right symbol.
233 226
234For example, take this particular rela from a livepatch module: 227For example, take this particular rela from a livepatch module:::
235Relocation section '.klp.rela.btrfs.text.btrfs_feature_attr_show' at offset 0x2ba0 contains 4 entries: 228
236 Offset Info Type Symbol's Value Symbol's Name + Addend 229 Relocation section '.klp.rela.btrfs.text.btrfs_feature_attr_show' at offset 0x2ba0 contains 4 entries:
237000000000000001f 0000005e00000002 R_X86_64_PC32 0000000000000000 .klp.sym.vmlinux.printk,0 - 4 230 Offset Info Type Symbol's Value Symbol's Name + Addend
238 231 000000000000001f 0000005e00000002 R_X86_64_PC32 0000000000000000 .klp.sym.vmlinux.printk,0 - 4
239This rela refers to the symbol '.klp.sym.vmlinux.printk,0', and the symbol index is encoded 232
240in 'Info'. Here its symbol index is 0x5e, which is 94 in decimal, which refers to the 233 This rela refers to the symbol '.klp.sym.vmlinux.printk,0', and the symbol index is encoded
241symbol index 94. 234 in 'Info'. Here its symbol index is 0x5e, which is 94 in decimal, which refers to the
242And in this patch module's corresponding symbol table, symbol index 94 refers to that very symbol: 235 symbol index 94.
243[ snip ] 236 And in this patch module's corresponding symbol table, symbol index 94 refers to that very symbol:
24494: 0000000000000000 0 NOTYPE GLOBAL DEFAULT OS [0xff20] .klp.sym.vmlinux.printk,0 237 [ snip ]
245[ snip ] 238 94: 0000000000000000 0 NOTYPE GLOBAL DEFAULT OS [0xff20] .klp.sym.vmlinux.printk,0
246 239 [ snip ]
247--------------------------- 240
2483.3 Livepatch symbol format 2414.2 Livepatch symbol format
249--------------------------- 242===========================
250 243
2513.3.1 Required flags
252--------------------
253Livepatch symbols must have their section index marked as SHN_LIVEPATCH, so 244Livepatch symbols must have their section index marked as SHN_LIVEPATCH, so
254that the module loader can identify them and not attempt to resolve them. 245that the module loader can identify them and not attempt to resolve them.
255See include/uapi/linux/elf.h for the actual definitions. 246See include/uapi/linux/elf.h for the actual definitions.
256 247
2573.3.2 Required name format 248Livepatch symbol names must conform to the following format::
258-------------------------- 249
259Livepatch symbol names must conform to the following format: 250 .klp.sym.objname.symbol_name,sympos
260 251 ^ ^^ ^ ^ ^ ^
261.klp.sym.objname.symbol_name,sympos 252 |_______||_____| |_________| |
262^ ^^ ^ ^ ^ ^ 253 [A] [B] [C] [D]
263|_______||_____| |_________| | 254
264 [A] [B] [C] [D] 255[A]
265 256 The symbol name is prefixed with the string ".klp.sym."
266[A] The symbol name is prefixed with the string ".klp.sym." 257
267[B] The name of the object (i.e. "vmlinux" or name of module) to 258[B]
268 which the symbol belongs follows immediately after the prefix. 259 The name of the object (i.e. "vmlinux" or name of module) to
269[C] The actual name of the symbol. 260 which the symbol belongs follows immediately after the prefix.
270[D] The position of the symbol in the object (as according to kallsyms) 261
271 This is used to differentiate duplicate symbols within the same 262[C]
272 object. The symbol position is expressed numerically (0, 1, 2...). 263 The actual name of the symbol.
273 The symbol position of a unique symbol is 0. 264
274 265[D]
2753.3.3 Example livepatch symbol names: 266 The position of the symbol in the object (as according to kallsyms)
276------------------------------------- 267 This is used to differentiate duplicate symbols within the same
277.klp.sym.vmlinux.snprintf,0 268 object. The symbol position is expressed numerically (0, 1, 2...).
278.klp.sym.vmlinux.printk,0 269 The symbol position of a unique symbol is 0.
279.klp.sym.btrfs.btrfs_ktype,0 270
280 271Examples:
2813.3.4 Example `readelf --symbols` output for a patch module: 272---------
282------------------------------------------------------------ 273
283Symbol table '.symtab' contains 127 entries: 274**Livepatch symbol names:**
284 Num: Value Size Type Bind Vis Ndx Name 275
285 [ snip ] 276::
286 73: 0000000000000000 0 NOTYPE GLOBAL DEFAULT OS [0xff20] .klp.sym.vmlinux.snprintf,0 277
287 74: 0000000000000000 0 NOTYPE GLOBAL DEFAULT OS [0xff20] .klp.sym.vmlinux.capable,0 278 .klp.sym.vmlinux.snprintf,0
288 75: 0000000000000000 0 NOTYPE GLOBAL DEFAULT OS [0xff20] .klp.sym.vmlinux.find_next_bit,0 279 .klp.sym.vmlinux.printk,0
289 76: 0000000000000000 0 NOTYPE GLOBAL DEFAULT OS [0xff20] .klp.sym.vmlinux.si_swapinfo,0 280 .klp.sym.btrfs.btrfs_ktype,0
290 [ snip ] ^ 281
291 | 282**`readelf --symbols` output for a patch module:**
292 [*] 283
293[*] Note that the 'Ndx' (Section index) for these symbols is SHN_LIVEPATCH (0xff20). 284::
294 "OS" means OS-specific. 285
295 286 Symbol table '.symtab' contains 127 entries:
296--------------------------------- 287 Num: Value Size Type Bind Vis Ndx Name
2974. Architecture-specific sections 288 [ snip ]
298--------------------------------- 289 73: 0000000000000000 0 NOTYPE GLOBAL DEFAULT OS [0xff20] .klp.sym.vmlinux.snprintf,0
290 74: 0000000000000000 0 NOTYPE GLOBAL DEFAULT OS [0xff20] .klp.sym.vmlinux.capable,0
291 75: 0000000000000000 0 NOTYPE GLOBAL DEFAULT OS [0xff20] .klp.sym.vmlinux.find_next_bit,0
292 76: 0000000000000000 0 NOTYPE GLOBAL DEFAULT OS [0xff20] .klp.sym.vmlinux.si_swapinfo,0
293 [ snip ] ^
294 |
295 [*]
296
297[*]
298 Note that the 'Ndx' (Section index) for these symbols is SHN_LIVEPATCH (0xff20).
299 "OS" means OS-specific.
300
3015. Architecture-specific sections
302=================================
299Architectures may override arch_klp_init_object_loaded() to perform 303Architectures may override arch_klp_init_object_loaded() to perform
300additional arch-specific tasks when a target module loads, such as applying 304additional arch-specific tasks when a target module loads, such as applying
301arch-specific sections. On x86 for example, we must apply per-object 305arch-specific sections. On x86 for example, we must apply per-object
@@ -304,20 +308,19 @@ These sections must be prefixed with ".klp.arch.$objname." so that they can
304be easily identified when iterating through a patch module's Elf sections 308be easily identified when iterating through a patch module's Elf sections
305(See arch/x86/kernel/livepatch.c for a complete example). 309(See arch/x86/kernel/livepatch.c for a complete example).
306 310
307-------------------------------------- 3116. Symbol table and Elf section access
3085. Symbol table and Elf section access 312======================================
309--------------------------------------
310A livepatch module's symbol table is accessible through module->symtab. 313A livepatch module's symbol table is accessible through module->symtab.
311 314
312Since apply_relocate_add() requires access to a module's section headers, 315Since apply_relocate_add() requires access to a module's section headers,
313symbol table, and relocation section indices, Elf information is preserved for 316symbol table, and relocation section indices, Elf information is preserved for
314livepatch modules and is made accessible by the module loader through 317livepatch modules and is made accessible by the module loader through
315module->klp_info, which is a klp_modinfo struct. When a livepatch module loads, 318module->klp_info, which is a klp_modinfo struct. When a livepatch module loads,
316this struct is filled in by the module loader. Its fields are documented below: 319this struct is filled in by the module loader. Its fields are documented below::
317 320
318struct klp_modinfo { 321 struct klp_modinfo {
319 Elf_Ehdr hdr; /* Elf header */ 322 Elf_Ehdr hdr; /* Elf header */
320 Elf_Shdr *sechdrs; /* Section header table */ 323 Elf_Shdr *sechdrs; /* Section header table */
321 char *secstrings; /* String table for the section headers */ 324 char *secstrings; /* String table for the section headers */
322 unsigned int symndx; /* The symbol table section index */ 325 unsigned int symndx; /* The symbol table section index */
323}; 326 };
diff --git a/Documentation/livepatch/shadow-vars.txt b/Documentation/livepatch/shadow-vars.rst
index ecc09a7be5dd..c05715aeafa4 100644
--- a/Documentation/livepatch/shadow-vars.txt
+++ b/Documentation/livepatch/shadow-vars.rst
@@ -27,10 +27,13 @@ A hashtable references all shadow variables. These references are
27stored and retrieved through a <obj, id> pair. 27stored and retrieved through a <obj, id> pair.
28 28
29* The klp_shadow variable data structure encapsulates both tracking 29* The klp_shadow variable data structure encapsulates both tracking
30meta-data and shadow-data: 30 meta-data and shadow-data:
31
31 - meta-data 32 - meta-data
33
32 - obj - pointer to parent object 34 - obj - pointer to parent object
33 - id - data identifier 35 - id - data identifier
36
34 - data[] - storage for shadow data 37 - data[] - storage for shadow data
35 38
36It is important to note that the klp_shadow_alloc() and 39It is important to note that the klp_shadow_alloc() and
@@ -47,31 +50,43 @@ to do actions that can be done only once when a new variable is allocated.
47 50
48* klp_shadow_alloc() - allocate and add a new shadow variable 51* klp_shadow_alloc() - allocate and add a new shadow variable
49 - search hashtable for <obj, id> pair 52 - search hashtable for <obj, id> pair
53
50 - if exists 54 - if exists
55
51 - WARN and return NULL 56 - WARN and return NULL
57
52 - if <obj, id> doesn't already exist 58 - if <obj, id> doesn't already exist
59
53 - allocate a new shadow variable 60 - allocate a new shadow variable
54 - initialize the variable using a custom constructor and data when provided 61 - initialize the variable using a custom constructor and data when provided
55 - add <obj, id> to the global hashtable 62 - add <obj, id> to the global hashtable
56 63
57* klp_shadow_get_or_alloc() - get existing or alloc a new shadow variable 64* klp_shadow_get_or_alloc() - get existing or alloc a new shadow variable
58 - search hashtable for <obj, id> pair 65 - search hashtable for <obj, id> pair
66
59 - if exists 67 - if exists
68
60 - return existing shadow variable 69 - return existing shadow variable
70
61 - if <obj, id> doesn't already exist 71 - if <obj, id> doesn't already exist
72
62 - allocate a new shadow variable 73 - allocate a new shadow variable
63 - initialize the variable using a custom constructor and data when provided 74 - initialize the variable using a custom constructor and data when provided
64 - add <obj, id> pair to the global hashtable 75 - add <obj, id> pair to the global hashtable
65 76
66* klp_shadow_free() - detach and free a <obj, id> shadow variable 77* klp_shadow_free() - detach and free a <obj, id> shadow variable
67 - find and remove a <obj, id> reference from global hashtable 78 - find and remove a <obj, id> reference from global hashtable
79
68 - if found 80 - if found
81
69 - call destructor function if defined 82 - call destructor function if defined
70 - free shadow variable 83 - free shadow variable
71 84
72* klp_shadow_free_all() - detach and free all <*, id> shadow variables 85* klp_shadow_free_all() - detach and free all <*, id> shadow variables
73 - find and remove any <*, id> references from global hashtable 86 - find and remove any <*, id> references from global hashtable
87
74 - if found 88 - if found
89
75 - call destructor function if defined 90 - call destructor function if defined
76 - free shadow variable 91 - free shadow variable
77 92
@@ -102,12 +117,12 @@ parent "goes live" (ie, any shadow variable get-API requests are made
102for this <obj, id> pair.) 117for this <obj, id> pair.)
103 118
104For commit 1d147bfa6429, when a parent sta_info structure is allocated, 119For commit 1d147bfa6429, when a parent sta_info structure is allocated,
105allocate a shadow copy of the ps_lock pointer, then initialize it: 120allocate a shadow copy of the ps_lock pointer, then initialize it::
106 121
107#define PS_LOCK 1 122 #define PS_LOCK 1
108struct sta_info *sta_info_alloc(struct ieee80211_sub_if_data *sdata, 123 struct sta_info *sta_info_alloc(struct ieee80211_sub_if_data *sdata,
109 const u8 *addr, gfp_t gfp) 124 const u8 *addr, gfp_t gfp)
110{ 125 {
111 struct sta_info *sta; 126 struct sta_info *sta;
112 spinlock_t *ps_lock; 127 spinlock_t *ps_lock;
113 128
@@ -123,10 +138,10 @@ struct sta_info *sta_info_alloc(struct ieee80211_sub_if_data *sdata,
123 ... 138 ...
124 139
125When requiring a ps_lock, query the shadow variable API to retrieve one 140When requiring a ps_lock, query the shadow variable API to retrieve one
126for a specific struct sta_info: 141for a specific struct sta_info:::
127 142
128void ieee80211_sta_ps_deliver_wakeup(struct sta_info *sta) 143 void ieee80211_sta_ps_deliver_wakeup(struct sta_info *sta)
129{ 144 {
130 spinlock_t *ps_lock; 145 spinlock_t *ps_lock;
131 146
132 /* sync with ieee80211_tx_h_unicast_ps_buf */ 147 /* sync with ieee80211_tx_h_unicast_ps_buf */
@@ -136,10 +151,10 @@ void ieee80211_sta_ps_deliver_wakeup(struct sta_info *sta)
136 ... 151 ...
137 152
138When the parent sta_info structure is freed, first free the shadow 153When the parent sta_info structure is freed, first free the shadow
139variable: 154variable::
140 155
141void sta_info_free(struct ieee80211_local *local, struct sta_info *sta) 156 void sta_info_free(struct ieee80211_local *local, struct sta_info *sta)
142{ 157 {
143 klp_shadow_free(sta, PS_LOCK, NULL); 158 klp_shadow_free(sta, PS_LOCK, NULL);
144 kfree(sta); 159 kfree(sta);
145 ... 160 ...
@@ -155,19 +170,19 @@ these cases, the klp_shadow_get_or_alloc() call can be used to attach
155shadow variables to parents already in-flight. 170shadow variables to parents already in-flight.
156 171
157For commit 1d147bfa6429, a good spot to allocate a shadow spinlock is 172For commit 1d147bfa6429, a good spot to allocate a shadow spinlock is
158inside ieee80211_sta_ps_deliver_wakeup(): 173inside ieee80211_sta_ps_deliver_wakeup()::
159 174
160int ps_lock_shadow_ctor(void *obj, void *shadow_data, void *ctor_data) 175 int ps_lock_shadow_ctor(void *obj, void *shadow_data, void *ctor_data)
161{ 176 {
162 spinlock_t *lock = shadow_data; 177 spinlock_t *lock = shadow_data;
163 178
164 spin_lock_init(lock); 179 spin_lock_init(lock);
165 return 0; 180 return 0;
166} 181 }
167 182
168#define PS_LOCK 1 183 #define PS_LOCK 1
169void ieee80211_sta_ps_deliver_wakeup(struct sta_info *sta) 184 void ieee80211_sta_ps_deliver_wakeup(struct sta_info *sta)
170{ 185 {
171 spinlock_t *ps_lock; 186 spinlock_t *ps_lock;
172 187
173 /* sync with ieee80211_tx_h_unicast_ps_buf */ 188 /* sync with ieee80211_tx_h_unicast_ps_buf */
@@ -200,10 +215,12 @@ suggests how to handle the parent object.
200============= 215=============
201 216
202* https://github.com/dynup/kpatch 217* https://github.com/dynup/kpatch
203The livepatch implementation is based on the kpatch version of shadow 218
204variables. 219 The livepatch implementation is based on the kpatch version of shadow
220 variables.
205 221
206* http://files.mkgnu.net/files/dynamos/doc/papers/dynamos_eurosys_07.pdf 222* http://files.mkgnu.net/files/dynamos/doc/papers/dynamos_eurosys_07.pdf
207Dynamic and Adaptive Updates of Non-Quiescent Subsystems in Commodity 223
208Operating System Kernels (Kritis Makris, Kyung Dong Ryu 2007) presented 224 Dynamic and Adaptive Updates of Non-Quiescent Subsystems in Commodity
209a datatype update technique called "shadow data structures". 225 Operating System Kernels (Kritis Makris, Kyung Dong Ryu 2007) presented
226 a datatype update technique called "shadow data structures".
diff --git a/Documentation/ntb.txt b/Documentation/ntb.txt
index a043854d28df..074a423c853c 100644
--- a/Documentation/ntb.txt
+++ b/Documentation/ntb.txt
@@ -41,9 +41,10 @@ mainly used to perform the proper memory window initialization. Typically
41there are two types of memory window interfaces supported by the NTB API: 41there are two types of memory window interfaces supported by the NTB API:
42inbound translation configured on the local ntb port and outbound translation 42inbound translation configured on the local ntb port and outbound translation
43configured by the peer, on the peer ntb port. The first type is 43configured by the peer, on the peer ntb port. The first type is
44depicted on the next figure 44depicted on the next figure::
45
46 Inbound translation:
45 47
46Inbound translation:
47 Memory: Local NTB Port: Peer NTB Port: Peer MMIO: 48 Memory: Local NTB Port: Peer NTB Port: Peer MMIO:
48 ____________ 49 ____________
49 | dma-mapped |-ntb_mw_set_trans(addr) | 50 | dma-mapped |-ntb_mw_set_trans(addr) |
@@ -58,9 +59,10 @@ maps corresponding outbound memory window so to have access to the shared
58memory region. 59memory region.
59 60
60The second type of interface, that implies the shared windows being 61The second type of interface, that implies the shared windows being
61initialized by a peer device, is depicted on the figure: 62initialized by a peer device, is depicted on the figure::
63
64 Outbound translation:
62 65
63Outbound translation:
64 Memory: Local NTB Port: Peer NTB Port: Peer MMIO: 66 Memory: Local NTB Port: Peer NTB Port: Peer MMIO:
65 ____________ ______________ 67 ____________ ______________
66 | dma-mapped | | | MW base addr |<== memory-mapped IO 68 | dma-mapped | | | MW base addr |<== memory-mapped IO
@@ -75,11 +77,13 @@ outbound memory window so to have access to the shared memory region.
75 77
76As one can see the described scenarios can be combined in one portable 78As one can see the described scenarios can be combined in one portable
77algorithm. 79algorithm.
80
78 Local device: 81 Local device:
79 1) Allocate memory for a shared window 82 1) Allocate memory for a shared window
80 2) Initialize memory window by translated address of the allocated region 83 2) Initialize memory window by translated address of the allocated region
81 (it may fail if local memory window initialization is unsupported) 84 (it may fail if local memory window initialization is unsupported)
82 3) Send the translated address and memory window index to a peer device 85 3) Send the translated address and memory window index to a peer device
86
83 Peer device: 87 Peer device:
84 1) Initialize memory window with retrieved address of the allocated 88 1) Initialize memory window with retrieved address of the allocated
85 by another device memory region (it may fail if peer memory window 89 by another device memory region (it may fail if peer memory window
@@ -88,6 +92,7 @@ algorithm.
88 92
89In accordance with this scenario, the NTB Memory Window API can be used as 93In accordance with this scenario, the NTB Memory Window API can be used as
90follows: 94follows:
95
91 Local device: 96 Local device:
92 1) ntb_mw_count(pidx) - retrieve number of memory ranges, which can 97 1) ntb_mw_count(pidx) - retrieve number of memory ranges, which can
93 be allocated for memory windows between local device and peer device 98 be allocated for memory windows between local device and peer device
@@ -103,6 +108,7 @@ follows:
103 5) Send translated base address (usually together with memory window 108 5) Send translated base address (usually together with memory window
104 number) to the peer device using, for instance, scratchpad or message 109 number) to the peer device using, for instance, scratchpad or message
105 registers. 110 registers.
111
106 Peer device: 112 Peer device:
107 1) ntb_peer_mw_set_trans(pidx, midx) - try to set received from other 113 1) ntb_peer_mw_set_trans(pidx, midx) - try to set received from other
108 device (related to pidx) translated address for specified memory 114 device (related to pidx) translated address for specified memory
diff --git a/Documentation/process/5.Posting.rst b/Documentation/process/5.Posting.rst
index 4213e580f273..855a70b80269 100644
--- a/Documentation/process/5.Posting.rst
+++ b/Documentation/process/5.Posting.rst
@@ -216,10 +216,12 @@ The tags in common use are:
216 which can be found in :ref:`Documentation/process/submitting-patches.rst <submittingpatches>` 216 which can be found in :ref:`Documentation/process/submitting-patches.rst <submittingpatches>`
217 Code without a proper signoff cannot be merged into the mainline. 217 Code without a proper signoff cannot be merged into the mainline.
218 218
219 - Co-developed-by: states that the patch was also created by another developer 219 - Co-developed-by: states that the patch was co-created by several developers;
220 along with the original author. This is useful at times when multiple 220 it is a used to give attribution to co-authors (in addition to the author
221 people work on a single patch. Note, this person also needs to have a 221 attributed by the From: tag) when multiple people work on a single patch.
222 Signed-off-by: line in the patch as well. 222 Every Co-developed-by: must be immediately followed by a Signed-off-by: of
223 the associated co-author. Details and examples can be found in
224 :ref:`Documentation/process/submitting-patches.rst <submittingpatches>`.
223 225
224 - Acked-by: indicates an agreement by another developer (often a 226 - Acked-by: indicates an agreement by another developer (often a
225 maintainer of the relevant code) that the patch is appropriate for 227 maintainer of the relevant code) that the patch is appropriate for
diff --git a/Documentation/process/coding-style.rst b/Documentation/process/coding-style.rst
index 8ea913e99fa1..fa864a51e6ea 100644
--- a/Documentation/process/coding-style.rst
+++ b/Documentation/process/coding-style.rst
@@ -843,7 +843,8 @@ used.
843The kernel provides the following general purpose memory allocators: 843The kernel provides the following general purpose memory allocators:
844kmalloc(), kzalloc(), kmalloc_array(), kcalloc(), vmalloc(), and 844kmalloc(), kzalloc(), kmalloc_array(), kcalloc(), vmalloc(), and
845vzalloc(). Please refer to the API documentation for further information 845vzalloc(). Please refer to the API documentation for further information
846about them. 846about them. :ref:`Documentation/core-api/memory-allocation.rst
847<memory_allocation>`
847 848
848The preferred form for passing a size of a struct is the following: 849The preferred form for passing a size of a struct is the following:
849 850
@@ -874,6 +875,9 @@ The preferred form for allocating a zeroed array is the following:
874Both forms check for overflow on the allocation size n * sizeof(...), 875Both forms check for overflow on the allocation size n * sizeof(...),
875and return NULL if that occurred. 876and return NULL if that occurred.
876 877
878These generic allocation functions all emit a stack dump on failure when used
879without __GFP_NOWARN so there is no use in emitting an additional failure
880message when NULL is returned.
877 881
87815) The inline disease 88215) The inline disease
879---------------------- 883----------------------
diff --git a/Documentation/process/deprecated.rst b/Documentation/process/deprecated.rst
index 0ef5a63c06ba..49e0f64a3427 100644
--- a/Documentation/process/deprecated.rst
+++ b/Documentation/process/deprecated.rst
@@ -1,5 +1,7 @@
1.. SPDX-License-Identifier: GPL-2.0 1.. SPDX-License-Identifier: GPL-2.0
2 2
3.. _deprecated:
4
3===================================================================== 5=====================================================================
4Deprecated Interfaces, Language Features, Attributes, and Conventions 6Deprecated Interfaces, Language Features, Attributes, and Conventions
5===================================================================== 7=====================================================================
diff --git a/Documentation/process/howto.rst b/Documentation/process/howto.rst
index ad2b6c852b95..6ab75c11d2c3 100644
--- a/Documentation/process/howto.rst
+++ b/Documentation/process/howto.rst
@@ -62,7 +62,7 @@ Legal Issues
62The Linux kernel source code is released under the GPL. Please see the file 62The Linux kernel source code is released under the GPL. Please see the file
63COPYING in the main directory of the source tree. The Linux kernel licensing 63COPYING in the main directory of the source tree. The Linux kernel licensing
64rules and how to use `SPDX <https://spdx.org/>`_ identifiers in source code are 64rules and how to use `SPDX <https://spdx.org/>`_ identifiers in source code are
65descibed in :ref:`Documentation/process/license-rules.rst <kernel_licensing>`. 65described in :ref:`Documentation/process/license-rules.rst <kernel_licensing>`.
66If you have further questions about the license, please contact a lawyer, and do 66If you have further questions about the license, please contact a lawyer, and do
67not ask on the Linux kernel mailing list. The people on the mailing lists are 67not ask on the Linux kernel mailing list. The people on the mailing lists are
68not lawyers, and you should not rely on their statements on legal matters. 68not lawyers, and you should not rely on their statements on legal matters.
diff --git a/Documentation/process/kernel-docs.rst b/Documentation/process/kernel-docs.rst
index ab12dddc773e..7a45a8e36ea7 100644
--- a/Documentation/process/kernel-docs.rst
+++ b/Documentation/process/kernel-docs.rst
@@ -95,18 +95,6 @@ On-line docs
95 [...]. This paper examines some common problems for 95 [...]. This paper examines some common problems for
96 submitting larger changes and some strategies to avoid problems. 96 submitting larger changes and some strategies to avoid problems.
97 97
98 * Title: **Overview of the Virtual File System**
99
100 :Author: Richard Gooch.
101 :URL: http://www.mjmwired.net/kernel/Documentation/filesystems/vfs.txt
102 :Date: 2007
103 :Keywords: VFS, File System, mounting filesystems, opening files,
104 dentries, dcache.
105 :Description: Brief introduction to the Linux Virtual File System.
106 What is it, how it works, operations taken when opening a file or
107 mounting a file system and description of important data
108 structures explaining the purpose of each of their entries.
109
110 * Title: **Linux Device Drivers, Third Edition** 98 * Title: **Linux Device Drivers, Third Edition**
111 99
112 :Author: Jonathan Corbet, Alessandro Rubini, Greg Kroah-Hartman 100 :Author: Jonathan Corbet, Alessandro Rubini, Greg Kroah-Hartman
diff --git a/Documentation/process/license-rules.rst b/Documentation/process/license-rules.rst
index 6b09033a8e9e..2ef44ada3f11 100644
--- a/Documentation/process/license-rules.rst
+++ b/Documentation/process/license-rules.rst
@@ -234,13 +234,13 @@ kernel, can be broken down into:
234 234
235| 235|
236 236
2372. Not recommended licenses: 2372. Deprecated licenses:
238 238
239 These licenses should only be used for existing code or for importing 239 These licenses should only be used for existing code or for importing
240 code from a different project. These licenses are available from the 240 code from a different project. These licenses are available from the
241 directory:: 241 directory::
242 242
243 LICENSES/other/ 243 LICENSES/deprecated/
244 244
245 in the kernel source tree. 245 in the kernel source tree.
246 246
@@ -250,14 +250,14 @@ kernel, can be broken down into:
250 250
251 Examples:: 251 Examples::
252 252
253 LICENSES/other/ISC 253 LICENSES/deprecated/ISC
254 254
255 Contains the Internet Systems Consortium license text and the required 255 Contains the Internet Systems Consortium license text and the required
256 metatags:: 256 metatags::
257 257
258 LICENSES/other/ZLib 258 LICENSES/deprecated/GPL-1.0
259 259
260 Contains the ZLIB license text and the required metatags. 260 Contains the GPL version 1 license text and the required metatags.
261 261
262 Metatags: 262 Metatags:
263 263
@@ -281,7 +281,56 @@ kernel, can be broken down into:
281 281
282| 282|
283 283
2843. _`Exceptions`: 2843. Dual Licensing Only
285
286 These licenses should only be used to dual license code with another
287 license in addition to a preferred license. These licenses are available
288 from the directory::
289
290 LICENSES/dual/
291
292 in the kernel source tree.
293
294 The files in this directory contain the full license text and
295 `Metatags`_. The file names are identical to the SPDX license
296 identifier which shall be used for the license in source files.
297
298 Examples::
299
300 LICENSES/dual/MPL-1.1
301
302 Contains the Mozilla Public License version 1.1 license text and the
303 required metatags::
304
305 LICENSES/dual/Apache-2.0
306
307 Contains the Apache License version 2.0 license text and the required
308 metatags.
309
310 Metatags:
311
312 The metatag requirements for 'other' licenses are identical to the
313 requirements of the `Preferred licenses`_.
314
315 File format example::
316
317 Valid-License-Identifier: MPL-1.1
318 SPDX-URL: https://spdx.org/licenses/MPL-1.1.html
319 Usage-Guide:
320 Do NOT use. The MPL-1.1 is not GPL2 compatible. It may only be used for
321 dual-licensed files where the other license is GPL2 compatible.
322 If you end up using this it MUST be used together with a GPL2 compatible
323 license using "OR".
324 To use the Mozilla Public License version 1.1 put the following SPDX
325 tag/value pair into a comment according to the placement guidelines in
326 the licensing rules documentation:
327 SPDX-License-Identifier: MPL-1.1
328 License-Text:
329 Full license text
330
331|
332
3334. _`Exceptions`:
285 334
286 Some licenses can be amended with exceptions which grant certain rights 335 Some licenses can be amended with exceptions which grant certain rights
287 which the original license does not. These exceptions are available 336 which the original license does not. These exceptions are available
diff --git a/Documentation/process/maintainer-pgp-guide.rst b/Documentation/process/maintainer-pgp-guide.rst
index aff9b1a4d77b..4bab7464ff8c 100644
--- a/Documentation/process/maintainer-pgp-guide.rst
+++ b/Documentation/process/maintainer-pgp-guide.rst
@@ -943,7 +943,7 @@ have on your keyring::
943 943
944Next, open the `PGP pathfinder`_. In the "From" field, paste the key 944Next, open the `PGP pathfinder`_. In the "From" field, paste the key
945fingerprint of Linus Torvalds from the output above. In the "To" field, 945fingerprint of Linus Torvalds from the output above. In the "To" field,
946paste they key-id you found via ``gpg --search`` of the unknown key, and 946paste the key-id you found via ``gpg --search`` of the unknown key, and
947check the results: 947check the results:
948 948
949- `Finding paths to Linus`_ 949- `Finding paths to Linus`_
diff --git a/Documentation/process/submitting-patches.rst b/Documentation/process/submitting-patches.rst
index be7d1829c3af..9c4299293c72 100644
--- a/Documentation/process/submitting-patches.rst
+++ b/Documentation/process/submitting-patches.rst
@@ -60,8 +60,8 @@ not in any lower subdirectory.
60 60
61To create a patch for a single file, it is often sufficient to do:: 61To create a patch for a single file, it is often sufficient to do::
62 62
63 SRCTREE= linux 63 SRCTREE=linux
64 MYFILE= drivers/net/mydriver.c 64 MYFILE=drivers/net/mydriver.c
65 65
66 cd $SRCTREE 66 cd $SRCTREE
67 cp $MYFILE $MYFILE.orig 67 cp $MYFILE $MYFILE.orig
@@ -73,7 +73,7 @@ To create a patch for multiple files, you should unpack a "vanilla",
73or unmodified kernel source tree, and generate a ``diff`` against your 73or unmodified kernel source tree, and generate a ``diff`` against your
74own source tree. For example:: 74own source tree. For example::
75 75
76 MYSRC= /devel/linux 76 MYSRC=/devel/linux
77 77
78 tar xvfz linux-3.19.tar.gz 78 tar xvfz linux-3.19.tar.gz
79 mv linux-3.19 linux-3.19-vanilla 79 mv linux-3.19 linux-3.19-vanilla
@@ -545,10 +545,40 @@ person it names - but it should indicate that this person was copied on the
545patch. This tag documents that potentially interested parties 545patch. This tag documents that potentially interested parties
546have been included in the discussion. 546have been included in the discussion.
547 547
548A Co-developed-by: states that the patch was also created by another developer 548Co-developed-by: states that the patch was co-created by multiple developers;
549along with the original author. This is useful at times when multiple people 549it is a used to give attribution to co-authors (in addition to the author
550work on a single patch. Note, this person also needs to have a Signed-off-by: 550attributed by the From: tag) when several people work on a single patch. Since
551line in the patch as well. 551Co-developed-by: denotes authorship, every Co-developed-by: must be immediately
552followed by a Signed-off-by: of the associated co-author. Standard sign-off
553procedure applies, i.e. the ordering of Signed-off-by: tags should reflect the
554chronological history of the patch insofar as possible, regardless of whether
555the author is attributed via From: or Co-developed-by:. Notably, the last
556Signed-off-by: must always be that of the developer submitting the patch.
557
558Note, the From: tag is optional when the From: author is also the person (and
559email) listed in the From: line of the email header.
560
561Example of a patch submitted by the From: author::
562
563 <changelog>
564
565 Co-developed-by: First Co-Author <first@coauthor.example.org>
566 Signed-off-by: First Co-Author <first@coauthor.example.org>
567 Co-developed-by: Second Co-Author <second@coauthor.example.org>
568 Signed-off-by: Second Co-Author <second@coauthor.example.org>
569 Signed-off-by: From Author <from@author.example.org>
570
571Example of a patch submitted by a Co-developed-by: author::
572
573 From: From Author <from@author.example.org>
574
575 <changelog>
576
577 Co-developed-by: Random Co-Author <random@coauthor.example.org>
578 Signed-off-by: Random Co-Author <random@coauthor.example.org>
579 Signed-off-by: From Author <from@author.example.org>
580 Co-developed-by: Submitting Co-Author <sub@coauthor.example.org>
581 Signed-off-by: Submitting Co-Author <sub@coauthor.example.org>
552 582
553 583
55413) Using Reported-by:, Tested-by:, Reviewed-by:, Suggested-by: and Fixes: 58413) Using Reported-by:, Tested-by:, Reviewed-by:, Suggested-by: and Fixes:
@@ -696,7 +726,7 @@ A couple of example Subjects::
696The ``from`` line must be the very first line in the message body, 726The ``from`` line must be the very first line in the message body,
697and has the form: 727and has the form:
698 728
699 From: Original Author <author@example.com> 729 From: Patch Author <author@example.com>
700 730
701The ``from`` line specifies who will be credited as the author of the 731The ``from`` line specifies who will be credited as the author of the
702patch in the permanent changelog. If the ``from`` line is missing, 732patch in the permanent changelog. If the ``from`` line is missing,
diff --git a/Documentation/rtc.txt b/Documentation/rtc.txt
index a129acf38537..688c95b11919 100644
--- a/Documentation/rtc.txt
+++ b/Documentation/rtc.txt
@@ -136,5 +136,5 @@ a high functionality RTC is integrated into the SOC. That system might read
136the system clock from the discrete RTC, but use the integrated one for all 136the system clock from the discrete RTC, but use the integrated one for all
137other tasks, because of its greater functionality. 137other tasks, because of its greater functionality.
138 138
139Check out tools/testing/selftests/timers/rtctest.c for an example usage of the 139Check out tools/testing/selftests/rtc/rtctest.c for an example usage of the
140ioctl interface. 140ioctl interface.
diff --git a/Documentation/speculation.txt b/Documentation/speculation.txt
index e9e6cbae2841..50d7ea857cff 100644
--- a/Documentation/speculation.txt
+++ b/Documentation/speculation.txt
@@ -17,7 +17,7 @@ observed to extract secret information.
17 17
18For example, in the presence of branch prediction, it is possible for bounds 18For example, in the presence of branch prediction, it is possible for bounds
19checks to be ignored by code which is speculatively executed. Consider the 19checks to be ignored by code which is speculatively executed. Consider the
20following code: 20following code::
21 21
22 int load_array(int *array, unsigned int index) 22 int load_array(int *array, unsigned int index)
23 { 23 {
@@ -27,7 +27,7 @@ following code:
27 return array[index]; 27 return array[index];
28 } 28 }
29 29
30Which, on arm64, may be compiled to an assembly sequence such as: 30Which, on arm64, may be compiled to an assembly sequence such as::
31 31
32 CMP <index>, #MAX_ARRAY_ELEMS 32 CMP <index>, #MAX_ARRAY_ELEMS
33 B.LT less 33 B.LT less
@@ -44,7 +44,7 @@ microarchitectural state which can be subsequently measured.
44 44
45More complex sequences involving multiple dependent memory accesses may 45More complex sequences involving multiple dependent memory accesses may
46result in sensitive information being leaked. Consider the following 46result in sensitive information being leaked. Consider the following
47code, building on the prior example: 47code, building on the prior example::
48 48
49 int load_dependent_arrays(int *arr1, int *arr2, int index) 49 int load_dependent_arrays(int *arr1, int *arr2, int index)
50 { 50 {
@@ -77,7 +77,7 @@ A call to array_index_nospec(index, size) returns a sanitized index
77value that is bounded to [0, size) even under cpu speculation 77value that is bounded to [0, size) even under cpu speculation
78conditions. 78conditions.
79 79
80This can be used to protect the earlier load_array() example: 80This can be used to protect the earlier load_array() example::
81 81
82 int load_array(int *array, unsigned int index) 82 int load_array(int *array, unsigned int index)
83 { 83 {
diff --git a/Documentation/sysctl/kernel.txt b/Documentation/sysctl/kernel.txt
index aa058aa7bf28..f0c86fbb3b48 100644
--- a/Documentation/sysctl/kernel.txt
+++ b/Documentation/sysctl/kernel.txt
@@ -196,7 +196,7 @@ CAP_LAST_CAP from the kernel.
196core_pattern: 196core_pattern:
197 197
198core_pattern is used to specify a core dumpfile pattern name. 198core_pattern is used to specify a core dumpfile pattern name.
199. max length 128 characters; default value is "core" 199. max length 127 characters; default value is "core"
200. core_pattern is used as a pattern template for the output filename; 200. core_pattern is used as a pattern template for the output filename;
201 certain string patterns (beginning with '%') are substituted with 201 certain string patterns (beginning with '%') are substituted with
202 their actual values. 202 their actual values.
diff --git a/Documentation/trace/ftrace.rst b/Documentation/trace/ftrace.rst
index 7c5e6d6ab5d1..c3b9bd2fd512 100644
--- a/Documentation/trace/ftrace.rst
+++ b/Documentation/trace/ftrace.rst
@@ -1404,6 +1404,7 @@ trace has provided some very helpful debugging information.
1404 1404
1405If we prefer function graph output instead of function, we can set 1405If we prefer function graph output instead of function, we can set
1406display-graph option:: 1406display-graph option::
1407
1407 with echo 1 > options/display-graph 1408 with echo 1 > options/display-graph
1408 1409
1409 # tracer: irqsoff 1410 # tracer: irqsoff
diff --git a/Documentation/trace/histogram.rst b/Documentation/trace/histogram.rst
index 0ea59d45aef1..f95d94d19c22 100644
--- a/Documentation/trace/histogram.rst
+++ b/Documentation/trace/histogram.rst
@@ -2133,33 +2133,33 @@ The following commonly-used handler.action pairs are available:
2133 the end the event that triggered the snapshot (in this case you 2133 the end the event that triggered the snapshot (in this case you
2134 can verify the timestamps between the sched_waking and 2134 can verify the timestamps between the sched_waking and
2135 sched_switch events, which should match the time displayed in the 2135 sched_switch events, which should match the time displayed in the
2136 global maximum): 2136 global maximum)::
2137 2137
2138 # cat /sys/kernel/debug/tracing/snapshot 2138 # cat /sys/kernel/debug/tracing/snapshot
2139 2139
2140 <...>-2103 [005] d..3 309.873125: sched_switch: prev_comm=cyclictest prev_pid=2103 prev_prio=19 prev_state=D ==> next_comm=swapper/5 next_pid=0 next_prio=120 2140 <...>-2103 [005] d..3 309.873125: sched_switch: prev_comm=cyclictest prev_pid=2103 prev_prio=19 prev_state=D ==> next_comm=swapper/5 next_pid=0 next_prio=120
2141 <idle>-0 [005] d.h3 309.873611: sched_waking: comm=cyclictest pid=2102 prio=19 target_cpu=005 2141 <idle>-0 [005] d.h3 309.873611: sched_waking: comm=cyclictest pid=2102 prio=19 target_cpu=005
2142 <idle>-0 [005] dNh4 309.873613: sched_wakeup: comm=cyclictest pid=2102 prio=19 target_cpu=005 2142 <idle>-0 [005] dNh4 309.873613: sched_wakeup: comm=cyclictest pid=2102 prio=19 target_cpu=005
2143 <idle>-0 [005] d..3 309.873616: sched_switch: prev_comm=swapper/5 prev_pid=0 prev_prio=120 prev_state=S ==> next_comm=cyclictest next_pid=2102 next_prio=19 2143 <idle>-0 [005] d..3 309.873616: sched_switch: prev_comm=swapper/5 prev_pid=0 prev_prio=120 prev_state=S ==> next_comm=cyclictest next_pid=2102 next_prio=19
2144 <...>-2102 [005] d..3 309.873625: sched_switch: prev_comm=cyclictest prev_pid=2102 prev_prio=19 prev_state=D ==> next_comm=swapper/5 next_pid=0 next_prio=120 2144 <...>-2102 [005] d..3 309.873625: sched_switch: prev_comm=cyclictest prev_pid=2102 prev_prio=19 prev_state=D ==> next_comm=swapper/5 next_pid=0 next_prio=120
2145 <idle>-0 [005] d.h3 309.874624: sched_waking: comm=cyclictest pid=2102 prio=19 target_cpu=005 2145 <idle>-0 [005] d.h3 309.874624: sched_waking: comm=cyclictest pid=2102 prio=19 target_cpu=005
2146 <idle>-0 [005] dNh4 309.874626: sched_wakeup: comm=cyclictest pid=2102 prio=19 target_cpu=005 2146 <idle>-0 [005] dNh4 309.874626: sched_wakeup: comm=cyclictest pid=2102 prio=19 target_cpu=005
2147 <idle>-0 [005] dNh3 309.874628: sched_waking: comm=cyclictest pid=2103 prio=19 target_cpu=005 2147 <idle>-0 [005] dNh3 309.874628: sched_waking: comm=cyclictest pid=2103 prio=19 target_cpu=005
2148 <idle>-0 [005] dNh4 309.874630: sched_wakeup: comm=cyclictest pid=2103 prio=19 target_cpu=005 2148 <idle>-0 [005] dNh4 309.874630: sched_wakeup: comm=cyclictest pid=2103 prio=19 target_cpu=005
2149 <idle>-0 [005] d..3 309.874633: sched_switch: prev_comm=swapper/5 prev_pid=0 prev_prio=120 prev_state=S ==> next_comm=cyclictest next_pid=2102 next_prio=19 2149 <idle>-0 [005] d..3 309.874633: sched_switch: prev_comm=swapper/5 prev_pid=0 prev_prio=120 prev_state=S ==> next_comm=cyclictest next_pid=2102 next_prio=19
2150 <idle>-0 [004] d.h3 309.874757: sched_waking: comm=gnome-terminal- pid=1699 prio=120 target_cpu=004 2150 <idle>-0 [004] d.h3 309.874757: sched_waking: comm=gnome-terminal- pid=1699 prio=120 target_cpu=004
2151 <idle>-0 [004] dNh4 309.874762: sched_wakeup: comm=gnome-terminal- pid=1699 prio=120 target_cpu=004 2151 <idle>-0 [004] dNh4 309.874762: sched_wakeup: comm=gnome-terminal- pid=1699 prio=120 target_cpu=004
2152 <idle>-0 [004] d..3 309.874766: sched_switch: prev_comm=swapper/4 prev_pid=0 prev_prio=120 prev_state=S ==> next_comm=gnome-terminal- next_pid=1699 next_prio=120 2152 <idle>-0 [004] d..3 309.874766: sched_switch: prev_comm=swapper/4 prev_pid=0 prev_prio=120 prev_state=S ==> next_comm=gnome-terminal- next_pid=1699 next_prio=120
2153 gnome-terminal--1699 [004] d.h2 309.874941: sched_stat_runtime: comm=gnome-terminal- pid=1699 runtime=180706 [ns] vruntime=1126870572 [ns] 2153 gnome-terminal--1699 [004] d.h2 309.874941: sched_stat_runtime: comm=gnome-terminal- pid=1699 runtime=180706 [ns] vruntime=1126870572 [ns]
2154 <idle>-0 [003] d.s4 309.874956: sched_waking: comm=rcu_sched pid=9 prio=120 target_cpu=007 2154 <idle>-0 [003] d.s4 309.874956: sched_waking: comm=rcu_sched pid=9 prio=120 target_cpu=007
2155 <idle>-0 [003] d.s5 309.874960: sched_wake_idle_without_ipi: cpu=7 2155 <idle>-0 [003] d.s5 309.874960: sched_wake_idle_without_ipi: cpu=7
2156 <idle>-0 [003] d.s5 309.874961: sched_wakeup: comm=rcu_sched pid=9 prio=120 target_cpu=007 2156 <idle>-0 [003] d.s5 309.874961: sched_wakeup: comm=rcu_sched pid=9 prio=120 target_cpu=007
2157 <idle>-0 [007] d..3 309.874963: sched_switch: prev_comm=swapper/7 prev_pid=0 prev_prio=120 prev_state=S ==> next_comm=rcu_sched next_pid=9 next_prio=120 2157 <idle>-0 [007] d..3 309.874963: sched_switch: prev_comm=swapper/7 prev_pid=0 prev_prio=120 prev_state=S ==> next_comm=rcu_sched next_pid=9 next_prio=120
2158 rcu_sched-9 [007] d..3 309.874973: sched_stat_runtime: comm=rcu_sched pid=9 runtime=13646 [ns] vruntime=22531430286 [ns] 2158 rcu_sched-9 [007] d..3 309.874973: sched_stat_runtime: comm=rcu_sched pid=9 runtime=13646 [ns] vruntime=22531430286 [ns]
2159 rcu_sched-9 [007] d..3 309.874978: sched_switch: prev_comm=rcu_sched prev_pid=9 prev_prio=120 prev_state=R+ ==> next_comm=swapper/7 next_pid=0 next_prio=120 2159 rcu_sched-9 [007] d..3 309.874978: sched_switch: prev_comm=rcu_sched prev_pid=9 prev_prio=120 prev_state=R+ ==> next_comm=swapper/7 next_pid=0 next_prio=120
2160 <...>-2102 [005] d..4 309.874994: sched_migrate_task: comm=cyclictest pid=2103 prio=19 orig_cpu=5 dest_cpu=1 2160 <...>-2102 [005] d..4 309.874994: sched_migrate_task: comm=cyclictest pid=2103 prio=19 orig_cpu=5 dest_cpu=1
2161 <...>-2102 [005] d..4 309.875185: sched_wake_idle_without_ipi: cpu=1 2161 <...>-2102 [005] d..4 309.875185: sched_wake_idle_without_ipi: cpu=1
2162 <idle>-0 [001] d..3 309.875200: sched_switch: prev_comm=swapper/1 prev_pid=0 prev_prio=120 prev_state=S ==> next_comm=cyclictest next_pid=2103 next_prio=19 2162 <idle>-0 [001] d..3 309.875200: sched_switch: prev_comm=swapper/1 prev_pid=0 prev_prio=120 prev_state=S ==> next_comm=cyclictest next_pid=2103 next_prio=19
2163 2163
2164 - onchange(var).save(field,.. .) 2164 - onchange(var).save(field,.. .)
2165 2165
@@ -2213,9 +2213,10 @@ The following commonly-used handler.action pairs are available:
2213 following the rest of the fields. 2213 following the rest of the fields.
2214 2214
2215 If a snaphot was taken, there is also a message indicating that, 2215 If a snaphot was taken, there is also a message indicating that,
2216 along with the value and event that triggered the snapshot: 2216 along with the value and event that triggered the snapshot::
2217
2218 # cat /sys/kernel/debug/tracing/events/tcp/tcp_probe/hist
2217 2219
2218 # cat /sys/kernel/debug/tracing/events/tcp/tcp_probe/hist
2219 { dport: 1521 } hitcount: 8 2220 { dport: 1521 } hitcount: 8
2220 changed: 10 snd_wnd: 35456 srtt: 154262 rcv_wnd: 42112 2221 changed: 10 snd_wnd: 35456 srtt: 154262 rcv_wnd: 42112
2221 2222
@@ -2228,14 +2229,15 @@ The following commonly-used handler.action pairs are available:
2228 { dport: 443 } hitcount: 211 2229 { dport: 443 } hitcount: 211
2229 changed: 10 snd_wnd: 26960 srtt: 17379 rcv_wnd: 28800 2230 changed: 10 snd_wnd: 26960 srtt: 17379 rcv_wnd: 28800
2230 2231
2231 Snapshot taken (see tracing/snapshot). Details: 2232 Snapshot taken (see tracing/snapshot). Details::
2233
2232 triggering value { onchange($cwnd) }: 10 2234 triggering value { onchange($cwnd) }: 10
2233 triggered by event with key: { dport: 80 } 2235 triggered by event with key: { dport: 80 }
2234 2236
2235 Totals: 2237 Totals:
2236 Hits: 414 2238 Hits: 414
2237 Entries: 4 2239 Entries: 4
2238 Dropped: 0 2240 Dropped: 0
2239 2241
2240 In the above case, the event that triggered the snapshot has the 2242 In the above case, the event that triggered the snapshot has the
2241 key with dport == 80. If you look at the bucket that has 80 as 2243 key with dport == 80. If you look at the bucket that has 80 as
@@ -2245,18 +2247,18 @@ The following commonly-used handler.action pairs are available:
2245 the global snapshot). 2247 the global snapshot).
2246 2248
2247 And finally, looking at the snapshot data should show at or near 2249 And finally, looking at the snapshot data should show at or near
2248 the end the event that triggered the snapshot: 2250 the end the event that triggered the snapshot::
2249 2251
2250 # cat /sys/kernel/debug/tracing/snapshot 2252 # cat /sys/kernel/debug/tracing/snapshot
2251 2253
2252 gnome-shell-1261 [006] dN.3 49.823113: sched_stat_runtime: comm=gnome-shell pid=1261 runtime=49347 [ns] vruntime=1835730389 [ns] 2254 gnome-shell-1261 [006] dN.3 49.823113: sched_stat_runtime: comm=gnome-shell pid=1261 runtime=49347 [ns] vruntime=1835730389 [ns]
2253 kworker/u16:4-773 [003] d..3 49.823114: sched_switch: prev_comm=kworker/u16:4 prev_pid=773 prev_prio=120 prev_state=R+ ==> next_comm=kworker/3:2 next_pid=135 next_prio=120 2255 kworker/u16:4-773 [003] d..3 49.823114: sched_switch: prev_comm=kworker/u16:4 prev_pid=773 prev_prio=120 prev_state=R+ ==> next_comm=kworker/3:2 next_pid=135 next_prio=120
2254 gnome-shell-1261 [006] d..3 49.823114: sched_switch: prev_comm=gnome-shell prev_pid=1261 prev_prio=120 prev_state=R+ ==> next_comm=kworker/6:2 next_pid=387 next_prio=120 2256 gnome-shell-1261 [006] d..3 49.823114: sched_switch: prev_comm=gnome-shell prev_pid=1261 prev_prio=120 prev_state=R+ ==> next_comm=kworker/6:2 next_pid=387 next_prio=120
2255 kworker/3:2-135 [003] d..3 49.823118: sched_stat_runtime: comm=kworker/3:2 pid=135 runtime=5339 [ns] vruntime=17815800388 [ns] 2257 kworker/3:2-135 [003] d..3 49.823118: sched_stat_runtime: comm=kworker/3:2 pid=135 runtime=5339 [ns] vruntime=17815800388 [ns]
2256 kworker/6:2-387 [006] d..3 49.823120: sched_stat_runtime: comm=kworker/6:2 pid=387 runtime=9594 [ns] vruntime=14589605367 [ns] 2258 kworker/6:2-387 [006] d..3 49.823120: sched_stat_runtime: comm=kworker/6:2 pid=387 runtime=9594 [ns] vruntime=14589605367 [ns]
2257 kworker/6:2-387 [006] d..3 49.823122: sched_switch: prev_comm=kworker/6:2 prev_pid=387 prev_prio=120 prev_state=R+ ==> next_comm=gnome-shell next_pid=1261 next_prio=120 2259 kworker/6:2-387 [006] d..3 49.823122: sched_switch: prev_comm=kworker/6:2 prev_pid=387 prev_prio=120 prev_state=R+ ==> next_comm=gnome-shell next_pid=1261 next_prio=120
2258 kworker/3:2-135 [003] d..3 49.823123: sched_switch: prev_comm=kworker/3:2 prev_pid=135 prev_prio=120 prev_state=T ==> next_comm=swapper/3 next_pid=0 next_prio=120 2260 kworker/3:2-135 [003] d..3 49.823123: sched_switch: prev_comm=kworker/3:2 prev_pid=135 prev_prio=120 prev_state=T ==> next_comm=swapper/3 next_pid=0 next_prio=120
2259 <idle>-0 [004] ..s7 49.823798: tcp_probe: src=10.0.0.10:54326 dest=23.215.104.193:80 mark=0x0 length=32 snd_nxt=0xe3ae2ff5 snd_una=0xe3ae2ecd snd_cwnd=10 ssthresh=2147483647 snd_wnd=28960 srtt=19604 rcv_wnd=29312 2261 <idle>-0 [004] ..s7 49.823798: tcp_probe: src=10.0.0.10:54326 dest=23.215.104.193:80 mark=0x0 length=32 snd_nxt=0xe3ae2ff5 snd_una=0xe3ae2ecd snd_cwnd=10 ssthresh=2147483647 snd_wnd=28960 srtt=19604 rcv_wnd=29312
2260 2262
22613. User space creating a trigger 22633. User space creating a trigger
2262-------------------------------- 2264--------------------------------
diff --git a/Documentation/translations/index.rst b/Documentation/translations/index.rst
index 7f77c52d33aa..e446e5ed00a6 100644
--- a/Documentation/translations/index.rst
+++ b/Documentation/translations/index.rst
@@ -11,3 +11,43 @@ Translations
11 it_IT/index 11 it_IT/index
12 ko_KR/index 12 ko_KR/index
13 ja_JP/index 13 ja_JP/index
14
15
16.. _translations_disclaimer:
17
18Disclaimer
19----------
20
21Translation's purpose is to ease reading and understanding in languages other
22than English. Its aim is to help people who do not understand English or have
23doubts about its interpretation. Additionally, some people prefer to read
24documentation in their native language, but please bear in mind that the
25*only* official documentation is the English one: :ref:`linux_doc`.
26
27It is very unlikely that an update to :ref:`linux_doc` will be propagated
28immediately to all translations. Translations' maintainers - and
29contributors - follow the evolution of the official documentation and they
30maintain translations aligned as much as they can. For this reason there is
31no guarantee that a translation is up to date. If what you read in a
32translation does not sound right compared to what you read in the code, please
33inform the translation maintainer and - if you can - check also the English
34documentation.
35
36A translation is not a fork of the official documentation, therefore
37translations' users should not find information that differs from the official
38English documentation. Any content addition, removal or update, must be
39applied to the English documents first. Afterwards and when possible, the
40same change should be applied to translations. Translations' maintainers
41accept only contributions that are merely translation related (e.g. new
42translations, updates, fixes).
43
44Translations try to be as accurate as possible but it is not possible to map
45one language directly to all other languages. Each language has its own
46grammar and culture, so the translation of an English statement may need to be
47adapted to fit a different language. For this reason, when viewing
48translations, you may find slight differences that carry the same message but
49in a different form.
50
51If you need to communicate with the Linux community but you do not feel
52comfortable writing in English, you can ask the translation's maintainers
53for help.
diff --git a/Documentation/translations/it_IT/core-api/memory-allocation.rst b/Documentation/translations/it_IT/core-api/memory-allocation.rst
new file mode 100644
index 000000000000..11d5148f8d6b
--- /dev/null
+++ b/Documentation/translations/it_IT/core-api/memory-allocation.rst
@@ -0,0 +1,13 @@
1.. include:: ../disclaimer-ita.rst
2
3:Original: :ref:`Documentation/core-api/memory-allocation.rst <memory_allocation>`
4
5.. _it_memory_allocation:
6
7================================
8Guida all'allocazione di memoria
9================================
10
11.. warning::
12
13 TODO ancora da tradurre
diff --git a/Documentation/translations/it_IT/disclaimer-ita.rst b/Documentation/translations/it_IT/disclaimer-ita.rst
index d68e52de6a5d..bfe8a384baed 100644
--- a/Documentation/translations/it_IT/disclaimer-ita.rst
+++ b/Documentation/translations/it_IT/disclaimer-ita.rst
@@ -1,13 +1,6 @@
1:orphan: 1:orphan:
2 2
3.. note::
4 This document is maintained by Federico Vaga <federico.vaga@vaga.pv.it>.
5 If you find any difference between this document and the original file or a
6 problem with the translation, please contact the maintainer of this file.
7 Following people helped to translate or review:
8 Alessia Mantegazza <amantegazza@vaga.pv.it>
9
10.. warning:: 3.. warning::
11 The purpose of this file is to be easier to read and understand for Italian 4 In caso di dubbi sulla correttezza del contenuto di questa traduzione,
12 speakers and is not intended as a fork. So, if you have any comments or 5 l'unico riferimento valido è la documentazione ufficiale in inglese.
13 updates for this file please try to update the original English file first. 6 Per maggiori informazioni consultate le :ref:`avvertenze <it_disclaimer>`.
diff --git a/Documentation/translations/it_IT/doc-guide/index.rst b/Documentation/translations/it_IT/doc-guide/index.rst
index 7a6562b547ee..9fffff626711 100644
--- a/Documentation/translations/it_IT/doc-guide/index.rst
+++ b/Documentation/translations/it_IT/doc-guide/index.rst
@@ -12,9 +12,9 @@ Come scrivere la documentazione del kernel
12.. toctree:: 12.. toctree::
13 :maxdepth: 1 13 :maxdepth: 1
14 14
15 sphinx.rst 15 sphinx
16 kernel-doc.rst 16 kernel-doc
17 parse-headers.rst 17 parse-headers
18 18
19.. only:: subproject and html 19.. only:: subproject and html
20 20
diff --git a/Documentation/translations/it_IT/index.rst b/Documentation/translations/it_IT/index.rst
index ea9b2916b3e4..409eaac03e9f 100644
--- a/Documentation/translations/it_IT/index.rst
+++ b/Documentation/translations/it_IT/index.rst
@@ -4,26 +4,49 @@
4Traduzione italiana 4Traduzione italiana
5=================== 5===================
6 6
7L'obiettivo di questa traduzione è di rendere più facile la lettura e 7:manutentore: Federico Vaga <federico.vaga@vaga.pv.it>
8la comprensione per chi preferisce leggere in lingua italiana.
9Tenete presente che la documentazione di riferimento rimane comunque
10quella in lingua inglese: :ref:`linux_doc`
11
12Questa traduzione cerca di essere il più fedele possibile all'originale ma
13è ovvio che alcune frasi vadano trasformate: non aspettatevi una traduzione
14letterale. Quando possibile, si eviteranno gli inglesismi ed al loro posto
15verranno utilizzate le corrispettive parole italiane.
16 8
17Se notate che la traduzione non è più aggiornata potete contattare 9.. _it_disclaimer:
18direttamente il manutentore della traduzione italiana.
19 10
20Se notate che la documentazione contiene errori o dimenticanze, allora 11Avvertenze
21verificate la documentazione di riferimento in lingua inglese. Se il problema 12==========
22è presente anche nella documentazione di riferimento, contattate il suo
23manutentore. Se avete problemi a scrivere in inglese, potete comunque
24riportare il problema al manutentore della traduzione italiana.
25 13
26Manutentore della traduzione italiana: Federico Vaga <federico.vaga@vaga.pv.it> 14L'obiettivo di questa traduzione è di rendere più facile la lettura e
15la comprensione per chi non capisce l'inglese o ha dubbi sulla sua
16interpretazione, oppure semplicemente per chi preferisce leggere in lingua
17italiana. Tuttavia, tenete ben presente che l'*unica* documentazione
18ufficiale è quella in lingua inglese: :ref:`linux_doc`
19
20La propagazione simultanea a tutte le traduzioni di una modifica in
21:ref:`linux_doc` è altamente improbabile. I manutentori delle traduzioni -
22e i contributori - seguono l'evolversi della documentazione ufficiale e
23cercano di mantenere le rispettive traduzioni allineate nel limite del
24possibile. Per questo motivo non c'è garanzia che una traduzione sia
25aggiornata all'ultima modifica. Se quello che leggete in una traduzione
26non corrisponde a quello che leggete nel codice, informate il manutentore
27della traduzione e - se potete - verificate anche la documentazione in
28inglese.
29
30Una traduzione non è un *fork* della documentazione ufficiale, perciò gli
31utenti non vi troveranno alcuna informazione diversa rispetto alla versione
32ufficiale. Ogni aggiunta, rimozione o modifica dei contenuti deve essere
33fatta prima nei documenti in inglese. In seguito, e quando è possibile, la
34stessa modifica dovrebbe essere applicata anche alle traduzioni. I manutentori
35delle traduzioni accettano contributi che interessano prettamente l'attività
36di traduzione (per esempio, nuove traduzioni, aggiornamenti, correzioni).
37
38Le traduzioni cercano di essere il più possibile accurate ma non è possibile
39mappare direttamente una lingua in un'altra. Ogni lingua ha la sua grammatica
40e una sua cultura alle spalle, quindi la traduzione di una frase in inglese
41potrebbe essere modificata per adattarla all'italiano. Per questo motivo,
42quando leggete questa traduzione, potreste trovare alcune differenze di forma
43ma che trasmettono comunque il messaggio originale. Nonostante la grande
44diffusione di inglesismi nella lingua parlata, quando possibile, questi
45verranno sostituiti dalle corrispettive parole italiane
46
47Se avete bisogno d'aiuto per comunicare con la comunità Linux ma non vi sentite
48a vostro agio nello scrivere in inglese, potete chiedere aiuto al manutentore
49della traduzione.
27 50
28La documentazione del kernel Linux 51La documentazione del kernel Linux
29================================== 52==================================
@@ -47,9 +70,7 @@ I seguenti documenti descrivono la licenza usata nei sorgenti del kernel Linux
47(GPLv2), come licenziare i singoli file; inoltre troverete i riferimenti al 70(GPLv2), come licenziare i singoli file; inoltre troverete i riferimenti al
48testo integrale della licenza. 71testo integrale della licenza.
49 72
50.. warning:: 73* :ref:`it_kernel_licensing`
51
52 TODO ancora da tradurre
53 74
54Documentazione per gli utenti 75Documentazione per gli utenti
55----------------------------- 76-----------------------------
@@ -90,10 +111,6 @@ vostre modifiche molto più semplice
90 doc-guide/index 111 doc-guide/index
91 kernel-hacking/index 112 kernel-hacking/index
92 113
93.. warning::
94
95 TODO ancora da tradurre
96
97Documentazione della API del kernel 114Documentazione della API del kernel
98----------------------------------- 115-----------------------------------
99 116
diff --git a/Documentation/translations/it_IT/networking/netdev-FAQ.rst b/Documentation/translations/it_IT/networking/netdev-FAQ.rst
new file mode 100644
index 000000000000..8489ead7cff1
--- /dev/null
+++ b/Documentation/translations/it_IT/networking/netdev-FAQ.rst
@@ -0,0 +1,13 @@
1.. include:: ../disclaimer-ita.rst
2
3:Original: :ref:`Documentation/process/stable-kernel-rules.rst <stable_kernel_rules>`
4
5.. _it_netdev-FAQ:
6
7==========
8netdev FAQ
9==========
10
11.. warning::
12
13 TODO ancora da tradurre
diff --git a/Documentation/translations/it_IT/process/5.Posting.rst b/Documentation/translations/it_IT/process/5.Posting.rst
index b979266aa884..1476d51eb5e5 100644
--- a/Documentation/translations/it_IT/process/5.Posting.rst
+++ b/Documentation/translations/it_IT/process/5.Posting.rst
@@ -233,10 +233,12 @@ Le etichette in uso più comuni sono:
233 :ref:`Documentation/translations/it_IT/process/submitting-patches.rst <it_submittingpatches>`. 233 :ref:`Documentation/translations/it_IT/process/submitting-patches.rst <it_submittingpatches>`.
234 Codice che non presenta una firma appropriata non potrà essere integrato. 234 Codice che non presenta una firma appropriata non potrà essere integrato.
235 235
236 - Co-developed-by: indica che la patch è stata sviluppata anche da un altro 236 - Co-developed-by: indica che la patch è stata cosviluppata da diversi
237 sviluppatore assieme all'autore originale. Questo è utile quando più 237 sviluppatori; viene usato per assegnare più autori (in aggiunta a quello
238 persone lavorano sulla stessa patch. Da notare che questa persona deve 238 associato all'etichetta From:) quando più persone lavorano ad una patch.
239 avere anche una riga "Signed-off-by:" nella patch. 239 Ogni Co-developed-by: dev'essere seguito immediatamente da un Signed-off-by:
240 del corrispondente coautore. Maggiori dettagli ed esempi sono disponibili
241 in :ref:`Documentation/translations/it_IT/process/submitting-patches.rst <it_submittingpatches>`.
240 242
241 - Acked-by: indica il consenso di un altro sviluppatore (spesso il manutentore 243 - Acked-by: indica il consenso di un altro sviluppatore (spesso il manutentore
242 del codice in oggetto) all'integrazione della patch nel kernel. 244 del codice in oggetto) all'integrazione della patch nel kernel.
diff --git a/Documentation/translations/it_IT/process/coding-style.rst b/Documentation/translations/it_IT/process/coding-style.rst
index 2fd0e7f79d55..5ef534c95e69 100644
--- a/Documentation/translations/it_IT/process/coding-style.rst
+++ b/Documentation/translations/it_IT/process/coding-style.rst
@@ -859,7 +859,8 @@ racchiusa in #ifdef, potete usare printk(KERN_DEBUG ...).
859 859
860Il kernel fornisce i seguenti assegnatori ad uso generico: 860Il kernel fornisce i seguenti assegnatori ad uso generico:
861kmalloc(), kzalloc(), kmalloc_array(), kcalloc(), vmalloc(), e vzalloc(). 861kmalloc(), kzalloc(), kmalloc_array(), kcalloc(), vmalloc(), e vzalloc().
862Per maggiori informazioni, consultate la documentazione dell'API. 862Per maggiori informazioni, consultate la documentazione dell'API:
863:ref:`Documentation/translations/it_IT/core-api/memory-allocation.rst <it_memory_allocation>`
863 864
864Il modo preferito per passare la dimensione di una struttura è il seguente: 865Il modo preferito per passare la dimensione di una struttura è il seguente:
865 866
@@ -890,6 +891,11 @@ Il modo preferito per assegnare un vettore a zero è il seguente:
890Entrambe verificano la condizione di overflow per la dimensione 891Entrambe verificano la condizione di overflow per la dimensione
891d'assegnamento n * sizeof(...), se accade ritorneranno NULL. 892d'assegnamento n * sizeof(...), se accade ritorneranno NULL.
892 893
894Questi allocatori generici producono uno *stack dump* in caso di fallimento
895a meno che non venga esplicitamente specificato __GFP_NOWARN. Quindi, nella
896maggior parte dei casi, è inutile stampare messaggi aggiuntivi quando uno di
897questi allocatori ritornano un puntatore NULL.
898
89315) Il morbo inline 89915) Il morbo inline
894------------------- 900-------------------
895 901
diff --git a/Documentation/translations/it_IT/process/deprecated.rst b/Documentation/translations/it_IT/process/deprecated.rst
new file mode 100644
index 000000000000..776f26732a94
--- /dev/null
+++ b/Documentation/translations/it_IT/process/deprecated.rst
@@ -0,0 +1,129 @@
1.. SPDX-License-Identifier: GPL-2.0
2
3.. include:: ../disclaimer-ita.rst
4
5:Original: :ref:`Documentation/process/deprecated.rst <deprecated>`
6:Translator: Federico Vaga <federico.vaga@vaga.pv.it>
7
8.. _it_deprecated:
9
10==============================================================================
11Interfacce deprecate, caratteristiche del linguaggio, attributi, e convenzioni
12==============================================================================
13
14In un mondo perfetto, sarebbe possibile prendere tutti gli usi di
15un'interfaccia deprecata e convertirli in quella nuova, e così sarebbe
16possibile rimuovere la vecchia interfaccia in un singolo ciclo di sviluppo.
17Tuttavia, per via delle dimensioni del kernel, la gerarchia dei manutentori e
18le tempistiche, non è sempre possibile fare questo tipo di conversione tutta
19in una volta. Questo significa che nuove istanze di una vecchia interfaccia
20potrebbero aggiungersi al kernel proprio quando si sta cercando di rimuoverle,
21aumentando così il carico di lavoro. Al fine di istruire gli sviluppatori su
22cosa è considerato deprecato (e perché), è stata create la seguente lista a cui
23fare riferimento quando qualcuno propone modifiche che usano cose deprecate.
24
25__deprecated
26------------
27Nonostante questo attributo marchi visibilmente un interfaccia come deprecata,
28`non produce più alcun avviso durante la compilazione
29<https://git.kernel.org/linus/771c035372a036f83353eef46dbb829780330234>`_
30perché uno degli obiettivi del kernel è quello di compilare senza avvisi;
31inoltre, nessuno stava agendo per rimuovere queste interfacce. Nonostante l'uso
32di `__deprecated` in un file d'intestazione sia opportuno per segnare una
33interfaccia come 'vecchia', questa non è una soluzione completa. L'interfaccia
34deve essere rimossa dal kernel, o aggiunta a questo documento per scoraggiarne
35l'uso.
36
37Calcoli codificati negli argomenti di un allocatore
38----------------------------------------------------
39Il calcolo dinamico delle dimensioni (specialmente le moltiplicazioni) non
40dovrebbero essere fatto negli argomenti di funzioni di allocazione di memoria
41(o simili) per via del rischio di overflow. Questo può portare a valori più
42piccoli di quelli che il chiamante si aspettava. L'uso di questo modo di
43allocare può portare ad un overflow della memoria di heap e altri
44malfunzionamenti. (Si fa eccezione per valori numerici per i quali il
45compilatore può generare avvisi circa un potenziale overflow. Tuttavia usare
46i valori numerici come suggerito di seguito è innocuo).
47
48Per esempio, non usate ``count * size`` come argomento::
49
50 foo = kmalloc(count * size, GFP_KERNEL);
51
52Al suo posto, si dovrebbe usare l'allocatore a due argomenti::
53
54 foo = kmalloc_array(count, size, GFP_KERNEL);
55
56Se questo tipo di allocatore non è disponibile, allora dovrebbero essere usate
57le funzioni del tipo *saturate-on-overflow*::
58
59 bar = vmalloc(array_size(count, size));
60
61Un altro tipico caso da evitare è quello di calcolare la dimensione di una
62struttura seguita da un vettore di altre strutture, come nel seguente caso::
63
64 header = kzalloc(sizeof(*header) + count * sizeof(*header->item),
65 GFP_KERNEL);
66
67Invece, usate la seguente funzione::
68
69 header = kzalloc(struct_size(header, item, count), GFP_KERNEL);
70
71Per maggiori dettagli fate riferimento a :c:func:`array_size`,
72:c:func:`array3_size`, e :c:func:`struct_size`, così come la famiglia di
73funzioni :c:func:`check_add_overflow` e :c:func:`check_mul_overflow`.
74
75simple_strtol(), simple_strtoll(), simple_strtoul(), simple_strtoull()
76----------------------------------------------------------------------
77Le funzioni :c:func:`simple_strtol`, :c:func:`simple_strtoll`,
78:c:func:`simple_strtoul`, e :c:func:`simple_strtoull` ignorano volutamente
79i possibili overflow, e questo può portare il chiamante a generare risultati
80inaspettati. Le rispettive funzioni :c:func:`kstrtol`, :c:func:`kstrtoll`,
81:c:func:`kstrtoul`, e :c:func:`kstrtoull` sono da considerarsi le corrette
82sostitute; tuttavia va notato che queste richiedono che la stringa sia
83terminata con il carattere NUL o quello di nuova riga.
84
85strcpy()
86--------
87La funzione :c:func:`strcpy` non fa controlli agli estremi del buffer
88di destinazione. Questo può portare ad un overflow oltre i limiti del
89buffer e generare svariati tipi di malfunzionamenti. Nonostante l'opzione
90`CONFIG_FORTIFY_SOURCE=y` e svariate opzioni del compilatore aiutano
91a ridurne il rischio, non c'è alcuna buona ragione per continuare ad usare
92questa funzione. La versione sicura da usare è :c:func:`strscpy`.
93
94strncpy() su stringe terminate con NUL
95--------------------------------------
96L'utilizzo di :c:func:`strncpy` non fornisce alcuna garanzia sul fatto che
97il buffer di destinazione verrà terminato con il carattere NUL. Questo
98potrebbe portare a diversi overflow di lettura o altri malfunzionamenti
99causati, appunto, dalla mancanza del terminatore. Questa estende la
100terminazione nel buffer di destinazione quando la stringa d'origine è più
101corta; questo potrebbe portare ad una penalizzazione delle prestazioni per
102chi usa solo stringe terminate. La versione sicura da usare è
103:c:func:`strscpy`. (chi usa :c:func:`strscpy` e necessita di estendere la
104terminazione con NUL deve aggiungere una chiamata a :c:func:`memset`)
105
106Se il chiamate no usa stringhe terminate con NUL, allore :c:func:`strncpy()`
107può continuare ad essere usata, ma i buffer di destinazione devono essere
108marchiati con l'attributo `__nonstring <https://gcc.gnu.org/onlinedocs/gcc/Common-Variable-Attributes.html>`_
109per evitare avvisi durante la compilazione.
110
111strlcpy()
112---------
113La funzione :c:func:`strlcpy`, per prima cosa, legge interamente il buffer di
114origine, magari leggendo più di quanto verrà effettivamente copiato. Questo
115è inefficiente e può portare a overflow di lettura quando la stringa non è
116terminata con NUL. La versione sicura da usare è :c:func:`strscpy`.
117
118Vettori a dimensione variabile (VLA)
119------------------------------------
120
121Usare VLA sullo stack produce codice molto peggiore rispetto a quando si usano
122vettori a dimensione fissa. Questi `problemi di prestazioni <https://git.kernel.org/linus/02361bc77888>`_,
123tutt'altro che banali, sono già un motivo valido per eliminare i VLA; in
124aggiunta sono anche un problema per la sicurezza. La crescita dinamica di un
125vettore nello stack potrebbe eccedere la memoria rimanente in tale segmento.
126Questo può portare a dei malfunzionamenti, potrebbe sovrascrivere
127dati importanti alla fine dello stack (quando il kernel è compilato senza
128`CONFIG_THREAD_INFO_IN_TASK=y`), o sovrascrivere un pezzo di memoria adiacente
129allo stack (quando il kernel è compilato senza `CONFIG_VMAP_STACK=y`).
diff --git a/Documentation/translations/it_IT/process/kernel-enforcement-statement.rst b/Documentation/translations/it_IT/process/kernel-enforcement-statement.rst
index 4ddf5a35b270..1f62da622e26 100644
--- a/Documentation/translations/it_IT/process/kernel-enforcement-statement.rst
+++ b/Documentation/translations/it_IT/process/kernel-enforcement-statement.rst
@@ -1,13 +1,175 @@
1.. include:: ../disclaimer-ita.rst 1.. include:: ../disclaimer-ita.rst
2 2
3:Original: :ref:`Documentation/process/kernel-enforcement-statement.rst <process_statement_kernel>` 3:Original: :ref:`Documentation/process/kernel-enforcement-statement.rst <process_statement_kernel>`
4 4:Translator: Federico Vaga <federico.vaga@vaga.pv.it>
5 5
6.. _it_process_statement_kernel: 6.. _it_process_statement_kernel:
7 7
8Applicazione della licenza sul kernel Linux 8Applicazione della licenza sul kernel Linux
9=========================================== 9===========================================
10 10
11.. warning:: 11Come sviluppatori del kernel Linux, abbiamo un certo interessa su come il
12nostro software viene usato e su come la sua licenza viene fatta rispettare.
13Il rispetto reciproco degli obblighi di condivisione della GPL-2.0 è
14fondamentale per la sostenibilità di lungo periodo del nostro software e
15della nostra comunità.
16
17Benché ognuno abbia il diritto a far rispettare il diritto d'autore per i
18propri contributi alla nostra comunità, condividiamo l'interesse a far si che
19ogni azione individuale nel far rispettare i propri diritti sia condotta in
20modo da portare beneficio alla comunità e che non abbia, involontariamente,
21impatti negativi sulla salute e la crescita del nostro ecosistema software.
22Al fine di scoraggiare l'esecuzione di azioni inutili, concordiamo che è nel
23migliore interesse della nostra comunità di sviluppo di impegnarci nel
24rispettare i seguenti obblighi nei confronti degli utenti del kernel Linux
25per conto nostro e di qualsiasi successore ai nostri interessi sul diritto
26d'autore:
27
28 Malgrado le clausole di risoluzione della licenza GPL-2.0, abbiamo
29 concordato che è nel migliore interesse della nostra comunità di sviluppo
30 adottare le seguenti disposizioni della GPL-3.0 come permessi aggiuntivi
31 alla nostra licenza nei confronti di qualsiasi affermazione non difensiva
32 di diritti sulla licenza.
33
34 In ogni caso, se cessano tutte le violazioni di questa Licenza, allora
35 la tua licenza da parte di un dato detentore del copyright viene
36 ripristinata (a) in via cautelativa, a meno che e fino a quando il
37 detentore del copyright non cessa esplicitamente e definitivamente
38 la tua licenza, e (b) in via permanente se il detentore del copyright
39 non ti notifica in alcun modo la violazione entro 60 giorni dalla
40 cessazione della licenza.
41
42 Inoltre, la tua licenza da parte di un dato detentore del copyright
43 viene ripristinata in maniera permanente se il detentore del copyright
44 ti notifica la violazione in maniera adeguata, se questa è la prima
45 volta che ricevi una notifica di violazione di questa Licenza (per
46 qualunque Programma) dallo stesso detentore di copyright, e se rimedi
47 alla violazione entro 30 giorni dalla data di ricezione della notifica
48 di violazione.
49
50Fornendo queste garanzie, abbiamo l'intenzione di incoraggiare l'uso del
51software. Vogliamo che le aziende e le persone usino, modifichino e
52distribuiscano a questo software. Vogliamo lavorare con gli utenti in modo
53aperto e trasparente per eliminare ogni incertezza circa le nostre aspettative
54sul rispetto o l'ottemperanza alla licenza che possa limitare l'uso del nostro
55software. Vediamo l'azione legale come ultima spiaggia, da avviare solo quando
56gli altri sforzi della comunità hanno fallito nel risolvere il problema.
57
58Per finire, una volta che un problema di non rispetto della licenza viene
59risolto, speriamo che gli utenti si sentano i benvenuti ad aggregarsi a noi
60nello sviluppo di questo progetto. Lavorando assieme, saremo più forti.
61
62Ad eccezione deve specificato, parliamo per noi stessi, e non per una qualsiasi
63azienda per la quale lavoriamo oggi, o per cui abbiamo lavorato in passato, o
64lavoreremo in futuro.
65
12 66
13 TODO ancora da tradurre 67 - Laura Abbott
68 - Bjorn Andersson (Linaro)
69 - Andrea Arcangeli
70 - Neil Armstrong
71 - Jens Axboe
72 - Pablo Neira Ayuso
73 - Khalid Aziz
74 - Ralf Baechle
75 - Felipe Balbi
76 - Arnd Bergmann
77 - Ard Biesheuvel
78 - Tim Bird
79 - Paolo Bonzini
80 - Christian Borntraeger
81 - Mark Brown (Linaro)
82 - Paul Burton
83 - Javier Martinez Canillas
84 - Rob Clark
85 - Kees Cook (Google)
86 - Jonathan Corbet
87 - Dennis Dalessandro
88 - Vivien Didelot (Savoir-faire Linux)
89 - Hans de Goede
90 - Mel Gorman (SUSE)
91 - Sven Eckelmann
92 - Alex Elder (Linaro)
93 - Fabio Estevam
94 - Larry Finger
95 - Bhumika Goyal
96 - Andy Gross
97 - Juergen Gross
98 - Shawn Guo
99 - Ulf Hansson
100 - Stephen Hemminger (Microsoft)
101 - Tejun Heo
102 - Rob Herring
103 - Masami Hiramatsu
104 - Michal Hocko
105 - Simon Horman
106 - Johan Hovold (Hovold Consulting AB)
107 - Christophe JAILLET
108 - Olof Johansson
109 - Lee Jones (Linaro)
110 - Heiner Kallweit
111 - Srinivas Kandagatla
112 - Jan Kara
113 - Shuah Khan (Samsung)
114 - David Kershner
115 - Jaegeuk Kim
116 - Namhyung Kim
117 - Colin Ian King
118 - Jeff Kirsher
119 - Greg Kroah-Hartman (Linux Foundation)
120 - Christian König
121 - Vinod Koul
122 - Krzysztof Kozlowski
123 - Viresh Kumar
124 - Aneesh Kumar K.V
125 - Julia Lawall
126 - Doug Ledford
127 - Chuck Lever (Oracle)
128 - Daniel Lezcano
129 - Shaohua Li
130 - Xin Long
131 - Tony Luck
132 - Catalin Marinas (Arm Ltd)
133 - Mike Marshall
134 - Chris Mason
135 - Paul E. McKenney
136 - Arnaldo Carvalho de Melo
137 - David S. Miller
138 - Ingo Molnar
139 - Kuninori Morimoto
140 - Trond Myklebust
141 - Martin K. Petersen (Oracle)
142 - Borislav Petkov
143 - Jiri Pirko
144 - Josh Poimboeuf
145 - Sebastian Reichel (Collabora)
146 - Guenter Roeck
147 - Joerg Roedel
148 - Leon Romanovsky
149 - Steven Rostedt (VMware)
150 - Frank Rowand
151 - Ivan Safonov
152 - Anna Schumaker
153 - Jes Sorensen
154 - K.Y. Srinivasan
155 - David Sterba (SUSE)
156 - Heiko Stuebner
157 - Jiri Kosina (SUSE)
158 - Willy Tarreau
159 - Dmitry Torokhov
160 - Linus Torvalds
161 - Thierry Reding
162 - Rik van Riel
163 - Luis R. Rodriguez
164 - Geert Uytterhoeven (Glider bvba)
165 - Eduardo Valentin (Amazon.com)
166 - Daniel Vetter
167 - Linus Walleij
168 - Richard Weinberger
169 - Dan Williams
170 - Rafael J. Wysocki
171 - Arvind Yadav
172 - Masahiro Yamada
173 - Wei Yongjun
174 - Lv Zheng
175 - Marc Zyngier (Arm Ltd)
diff --git a/Documentation/translations/it_IT/process/license-rules.rst b/Documentation/translations/it_IT/process/license-rules.rst
new file mode 100644
index 000000000000..91a8794ffd79
--- /dev/null
+++ b/Documentation/translations/it_IT/process/license-rules.rst
@@ -0,0 +1,452 @@
1.. SPDX-License-Identifier: GPL-2.0
2
3.. include:: ../disclaimer-ita.rst
4
5:Original: :ref:`Documentation/process/license-rules.rst <kernel_licensing>`
6:Translator: Federico Vaga <federico.vaga@vaga.pv.it>
7
8.. _it_kernel_licensing:
9
10Regole per licenziare il kernel Linux
11=====================================
12
13Il kernel Linux viene rilasciato sotto i termini definiti dalla seconda
14versione della licenza *GNU General Public License* (GPL-2.0), di cui una
15copia è disponibile nel file LICENSES/preferred/GPL-2.0; a questo si
16aggiunge eccezione per le chiamate di sistema come descritto in
17LICENSES/exceptions/Linux-syscall-note; tutto ciò è descritto nel file COPYING.
18
19Questo documento fornisce una descrizione su come ogni singolo file sorgente
20debba essere licenziato per far si che sia chiaro e non ambiguo. Questo non
21sostituisce la licenza del kernel.
22
23La licenza descritta nel file COPYING si applica ai sorgenti del kernel nella
24loro interezza, quindi i singoli file sorgenti possono avere diverse licenze ma
25devono essere compatibili con la GPL-2.0::
26
27 GPL-1.0+ : GNU General Public License v1.0 o successiva
28 GPL-2.0+ : GNU General Public License v2.0 o successiva
29 LGPL-2.0 : GNU Library General Public License v2
30 LGPL-2.0+ : GNU Library General Public License v2 o successiva
31 LGPL-2.1 : GNU Lesser General Public License v2.1
32 LGPL-2.1+ : GNU Lesser General Public License v2.1 o successiva
33
34A parte questo, i singolo file possono essere forniti con una doppia licenza,
35per esempio con una delle varianti compatibili della GPL e alternativamente con
36una licenza permissiva come BSD, MIT eccetera.
37
38I file d'intestazione per l'API verso lo spazio utente (UAPI) descrivono
39le interfacce usate dai programmi, e per questo sono un caso speciale.
40Secondo le note nel file COPYING, le chiamate di sistema sono un chiaro
41confine oltre il quale non si estendono i requisiti della GPL per quei
42programmi che le usano per comunicare con il kernel. Dato che i file
43d'intestazione UAPI devono poter essere inclusi nei sorgenti di un
44qualsiasi programma eseguibile sul kernel Linux, questi meritano
45un'eccezione documentata da una clausola speciale.
46
47Il modo più comune per indicare la licenza dei file sorgenti è quello di
48aggiungere il corrispondente blocco di testo come commento in testa a detto
49file. Per via della formattazione, dei refusi, eccetera, questi blocchi di
50testo sono difficili da identificare dagli strumenti usati per verificare il
51rispetto delle licenze.
52
53Un'alternativa ai blocchi di testo è data dall'uso degli identificatori
54*Software Package Data Exchange* (SPDX) in ogni file sorgente. Gli
55identificatori di licenza SPDX sono analizzabili dalle macchine e sono precisi
56simboli stenografici che identificano la licenza sotto la quale viene
57licenziato il file che lo include. Gli identificatori di licenza SPDX sono
58gestiti del gruppo di lavoro SPDX presso la Linux Foundation e sono stati
59concordati fra i soci nell'industria, gli sviluppatori di strumenti, e i
60rispettivi gruppi legali. Per maggiori informazioni, consultate
61https://spdx.org/
62
63Il kernel Linux richiede un preciso identificatore SPDX in tutti i file
64sorgenti. Gli identificatori validi verranno spiegati nella sezione
65`Identificatori di licenza`_ e sono stati copiati dalla lista ufficiale di
66licenze SPDX assieme al rispettivo testo come mostrato in
67https://spdx.org/licenses/.
68
69Sintassi degli identificatori di licenza
70----------------------------------------
71
721. Posizionamento:
73
74 L'identificativo di licenza SPDX dev'essere posizionato come prima riga
75 possibile di un file che possa contenere commenti. Per la maggior parte
76 dei file questa è la prima riga, fanno eccezione gli script che richiedono
77 come prima riga '#!PATH_TO_INTERPRETER'. Per questi script l'identificativo
78 SPDX finisce nella seconda riga.
79
80|
81
822. Stile:
83
84 L'identificativo di licenza SPDX viene aggiunto sotto forma di commento.
85 Lo stile del commento dipende dal tipo di file::
86
87 sorgenti C: // SPDX-License-Identifier: <SPDX License Expression>
88 intestazioni C: /* SPDX-License-Identifier: <SPDX License Expression> */
89 ASM: /* SPDX-License-Identifier: <SPDX License Expression> */
90 scripts: # SPDX-License-Identifier: <SPDX License Expression>
91 .rst: .. SPDX-License-Identifier: <SPDX License Expression>
92 .dts{i}: // SPDX-License-Identifier: <SPDX License Expression>
93
94 Se un particolare programma non dovesse riuscire a gestire lo stile
95 principale per i commenti, allora dev'essere usato il meccanismo accettato
96 dal programma. Questo è il motivo per cui si ha "/\* \*/" nei file
97 d'intestazione C. Notammo che 'ld' falliva nell'analizzare i commenti del
98 C++ nei file .lds che venivano prodotti. Oggi questo è stato corretto,
99 ma ci sono in giro ancora vecchi programmi che non sono in grado di
100 gestire lo stile dei commenti del C++.
101
102|
103
1043. Sintassi:
105
106 Una <espressione di licenza SPDX> può essere scritta usando l'identificatore
107 SPDX della licenza come indicato nella lista di licenze SPDX, oppure la
108 combinazione di due identificatori SPDX separati da "WITH" per i casi
109 eccezionali. Quando si usano più licenze l'espressione viene formata da
110 sottoespressioni separate dalle parole chiave "AND", "OR" e racchiuse fra
111 parentesi tonde "(", ")".
112
113 Gli identificativi di licenza per licenze come la [L]GPL che si avvalgono
114 dell'opzione 'o successive' si formano aggiungendo alla fine il simbolo "+"
115 per indicare l'opzione 'o successive'.::
116
117 // SPDX-License-Identifier: GPL-2.0+
118 // SPDX-License-Identifier: LGPL-2.1+
119
120 WITH dovrebbe essere usato quando sono necessarie delle modifiche alla
121 licenza. Per esempio, la UAPI del kernel linux usa l'espressione::
122
123 // SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note
124 // SPDX-License-Identifier: GPL-2.0+ WITH Linux-syscall-note
125
126 Altri esempi di usi di WITH all'interno del kernel sono::
127
128 // SPDX-License-Identifier: GPL-2.0 WITH mif-exception
129 // SPDX-License-Identifier: GPL-2.0+ WITH GCC-exception-2.0
130
131 Le eccezioni si possono usare solo in combinazione con identificatori di
132 licenza. Gli identificatori di licenza riconosciuti sono elencati nei
133 corrispondenti file d'eccezione. Per maggiori dettagli consultate
134 `Eccezioni`_ nel capitolo `Identificatori di licenza`_
135
136 La parola chiave OR dovrebbe essere usata solo quando si usa una doppia
137 licenza e solo una dev'essere scelta. Per esempio, alcuni file dtsi sono
138 disponibili con doppia licenza::
139
140 // SPDX-License-Identifier: GPL-2.0 OR BSD-3-Clause
141
142 Esempi dal kernel di espressioni per file licenziati con doppia licenza
143 sono::
144
145 // SPDX-License-Identifier: GPL-2.0 OR MIT
146 // SPDX-License-Identifier: GPL-2.0 OR BSD-2-Clause
147 // SPDX-License-Identifier: GPL-2.0 OR Apache-2.0
148 // SPDX-License-Identifier: GPL-2.0 OR MPL-1.1
149 // SPDX-License-Identifier: (GPL-2.0 WITH Linux-syscall-note) OR MIT
150 // SPDX-License-Identifier: GPL-1.0+ OR BSD-3-Clause OR OpenSSL
151
152 La parola chiave AND dovrebbe essere usata quando i termini di più licenze
153 si applicano ad un file. Per esempio, quando il codice viene preso da
154 un altro progetto il quale da i permessi per aggiungerlo nel kernel ma
155 richiede che i termini originali della licenza rimangano intatti::
156
157 // SPDX-License-Identifier: (GPL-2.0 WITH Linux-syscall-note) AND MIT
158
159 Di seguito, un altro esempio dove entrambe i termini di licenza devono
160 essere rispettati::
161
162 // SPDX-License-Identifier: GPL-1.0+ AND LGPL-2.1+
163
164Identificatori di licenza
165-------------------------
166
167Le licenze attualmente in uso, così come le licenze aggiunte al kernel, possono
168essere categorizzate in:
169
1701. _`Licenze raccomandate`:
171
172 Ovunque possibile le licenze qui indicate dovrebbero essere usate perché
173 pienamente compatibili e molto usate. Queste licenze sono disponibile nei
174 sorgenti del kernel, nella cartella::
175
176 LICENSES/preferred/
177
178 I file in questa cartella contengono il testo completo della licenza e i
179 `Metatag`_. Il nome di questi file è lo stesso usato come identificatore
180 di licenza SPDX e che deve essere usato nei file sorgenti.
181
182 Esempi::
183
184 LICENSES/preferred/GPL-2.0
185
186 Contiene il testo della seconda versione della licenza GPL e i metatag
187 necessari::
188
189 LICENSES/preferred/MIT
190
191 Contiene il testo della licenza MIT e i metatag necessari.
192
193 _`Metatag`:
194
195 I seguenti metatag devono essere presenti in un file di licenza:
196
197 - Valid-License-Identifier:
198
199 Una o più righe che dichiarano quali identificatori di licenza sono validi
200 all'interno del progetto per far riferimento alla licenza in questione.
201 Solitamente, questo è un unico identificatore valido, ma per esempio le
202 licenze che permettono l'opzione 'o successive' hanno due identificatori
203 validi.
204
205 - SPDX-URL:
206
207 L'URL della pagina SPDX che contiene informazioni aggiuntive riguardanti
208 la licenza.
209
210 - Usage-Guidance:
211
212 Testo in formato libero per dare suggerimenti agli utenti. Il testo deve
213 includere degli esempi su come usare gli identificatori di licenza SPDX
214 in un file sorgente in conformità con le linea guida in
215 `Sintassi degli identificatori di licenza`_.
216
217 - License-Text:
218
219 Tutto il testo che compare dopo questa etichetta viene trattato
220 come se fosse parte del testo originale della licenza.
221
222 Esempi::
223
224 Valid-License-Identifier: GPL-2.0
225 Valid-License-Identifier: GPL-2.0+
226 SPDX-URL: https://spdx.org/licenses/GPL-2.0.html
227 Usage-Guide:
228 To use this license in source code, put one of the following SPDX
229 tag/value pairs into a comment according to the placement
230 guidelines in the licensing rules documentation.
231 For 'GNU General Public License (GPL) version 2 only' use:
232 SPDX-License-Identifier: GPL-2.0
233 For 'GNU General Public License (GPL) version 2 or any later version' use:
234 SPDX-License-Identifier: GPL-2.0+
235 License-Text:
236 Full license text
237
238 ::
239
240 SPDX-License-Identifier: MIT
241 SPDX-URL: https://spdx.org/licenses/MIT.html
242 Usage-Guide:
243 To use this license in source code, put the following SPDX
244 tag/value pair into a comment according to the placement
245 guidelines in the licensing rules documentation.
246 SPDX-License-Identifier: MIT
247 License-Text:
248 Full license text
249
250|
251
2522. Licenze non raccomandate:
253
254 Questo tipo di licenze dovrebbero essere usate solo per codice già esistente
255 o quando si prende codice da altri progetti. Le licenze sono disponibili
256 nei sorgenti del kernel nella cartella::
257
258 LICENSES/other/
259
260 I file in questa cartella contengono il testo completo della licenza e i
261 `Metatag`_. Il nome di questi file è lo stesso usato come identificatore
262 di licenza SPDX e che deve essere usato nei file sorgenti.
263
264 Esempi::
265
266 LICENSES/other/ISC
267
268 Contiene il testo della licenza Internet System Consortium e i suoi
269 metatag::
270
271 LICENSES/other/ZLib
272
273 Contiene il testo della licenza ZLIB e i suoi metatag.
274
275 Metatag:
276
277 I metatag necessari per le 'altre' ('other') licenze sono gli stessi
278 di usati per le `Licenze raccomandate`_.
279
280 Esempio del formato del file::
281
282 Valid-License-Identifier: ISC
283 SPDX-URL: https://spdx.org/licenses/ISC.html
284 Usage-Guide:
285 Usage of this license in the kernel for new code is discouraged
286 and it should solely be used for importing code from an already
287 existing project.
288 To use this license in source code, put the following SPDX
289 tag/value pair into a comment according to the placement
290 guidelines in the licensing rules documentation.
291 SPDX-License-Identifier: ISC
292 License-Text:
293 Full license text
294
295|
296
2973. _`Eccezioni`:
298
299 Alcune licenze possono essere corrette con delle eccezioni che forniscono
300 diritti aggiuntivi. Queste eccezioni sono disponibili nei sorgenti del
301 kernel nella cartella::
302
303 LICENSES/exceptions/
304
305 I file in questa cartella contengono il testo completo dell'eccezione e i
306 `Metatag per le eccezioni`_.
307
308 Esempi::
309
310 LICENSES/exceptions/Linux-syscall-note
311
312 Contiene la descrizione dell'eccezione per le chiamate di sistema Linux
313 così come documentato nel file COPYING del kernel Linux; questo viene usato
314 per i file d'intestazione per la UAPI. Per esempio
315 /\* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note \*/::
316
317 LICENSES/exceptions/GCC-exception-2.0
318
319 Contiene la 'eccezione di linking' che permette di collegare qualsiasi
320 binario, indipendentemente dalla sua licenza, con un compilato il cui file
321 sorgente è marchiato con questa eccezione. Questo è necessario per creare
322 eseguibili dai sorgenti che non sono compatibili con la GPL.
323
324 _`Metatag per le eccezioni`:
325
326 Un file contenente un'eccezione deve avere i seguenti metatag:
327
328 - SPDX-Exception-Identifier:
329
330 Un identificatore d'eccezione che possa essere usato in combinazione con
331 un identificatore di licenza SPDX.
332
333 - SPDX-URL:
334
335 L'URL della pagina SPDX che contiene informazioni aggiuntive riguardanti
336 l'eccezione.
337
338 - SPDX-Licenses:
339
340 Una lista di licenze SPDX separate da virgola, che possono essere usate
341 con l'eccezione.
342
343 - Usage-Guidance:
344
345 Testo in formato libero per dare suggerimenti agli utenti. Il testo deve
346 includere degli esempi su come usare gli identificatori di licenza SPDX
347 in un file sorgente in conformità con le linea guida in
348 `Sintassi degli identificatori di licenza`_.
349
350 - Exception-Text:
351
352 Tutto il testo che compare dopo questa etichetta viene trattato
353 come se fosse parte del testo originale della licenza.
354
355 Esempi::
356
357 SPDX-Exception-Identifier: Linux-syscall-note
358 SPDX-URL: https://spdx.org/licenses/Linux-syscall-note.html
359 SPDX-Licenses: GPL-2.0, GPL-2.0+, GPL-1.0+, LGPL-2.0, LGPL-2.0+, LGPL-2.1, LGPL-2.1+
360 Usage-Guidance:
361 This exception is used together with one of the above SPDX-Licenses
362 to mark user-space API (uapi) header files so they can be included
363 into non GPL compliant user-space application code.
364 To use this exception add it with the keyword WITH to one of the
365 identifiers in the SPDX-Licenses tag:
366 SPDX-License-Identifier: <SPDX-License> WITH Linux-syscall-note
367 Exception-Text:
368 Full exception text
369
370 ::
371
372 SPDX-Exception-Identifier: GCC-exception-2.0
373 SPDX-URL: https://spdx.org/licenses/GCC-exception-2.0.html
374 SPDX-Licenses: GPL-2.0, GPL-2.0+
375 Usage-Guidance:
376 The "GCC Runtime Library exception 2.0" is used together with one
377 of the above SPDX-Licenses for code imported from the GCC runtime
378 library.
379 To use this exception add it with the keyword WITH to one of the
380 identifiers in the SPDX-Licenses tag:
381 SPDX-License-Identifier: <SPDX-License> WITH GCC-exception-2.0
382 Exception-Text:
383 Full exception text
384
385Per ogni identificatore di licenza SPDX e per le eccezioni dev'esserci un file
386nella sotto-cartella LICENSES. Questo è necessario per permettere agli
387strumenti di effettuare verifiche (come checkpatch.pl), per avere le licenze
388disponibili per la lettura e per estrarre i diritti dai sorgenti, così come
389raccomandato da diverse organizzazioni FOSS, per esempio l'`iniziativa FSFE
390REUSE <https://reuse.software/>`_.
391
392_`MODULE_LICENSE`
393-----------------
394
395 I moduli del kernel necessitano di un'etichetta MODULE_LICENSE(). Questa
396 etichetta non sostituisce le informazioni sulla licenza del codice sorgente
397 (SPDX-License-Identifier) né fornisce informazioni che esprimono o
398 determinano l'esatta licenza sotto la quale viene rilasciato.
399
400 Il solo scopo di questa etichetta è quello di fornire sufficienti
401 informazioni al caricatore di moduli del kernel, o agli strumenti in spazio
402 utente, per capire se il modulo è libero o proprietario.
403
404 Le stringe di licenza valide per MODULE_LICENSE() sono:
405
406 ============================= =============================================
407 "GPL" Il modulo è licenziato con la GPL versione 2.
408 Questo non fa distinzione fra GPL'2.0-only o
409 GPL-2.0-or-later. L'esatta licenza può essere
410 determinata solo leggendo i corrispondenti
411 file sorgenti.
412
413 "GPL v2" Stesso significato di "GPL". Esiste per
414 motivi storici.
415
416 "GPL and additional rights" Questa è una variante che esiste per motivi
417 storici che indica che i sorgenti di un
418 modulo sono rilasciati sotto una variante
419 della licenza GPL v2 e quella MIT. Per favore
420 non utilizzatela per codice nuovo.
421
422 "Dual MIT/GPL" Questo è il modo corretto per esprimere il
423 il fatto che il modulo è rilasciato con
424 doppia licenza a scelta fra: una variante
425 della GPL v2 o la licenza MIT.
426
427 "Dual BSD/GPL" Questo modulo è rilasciato con doppia licenza
428 a scelta fra: una variante della GPL v2 o la
429 licenza BSD. La variante esatta della licenza
430 BSD può essere determinata solo attraverso i
431 corrispondenti file sorgenti.
432
433 "Dual MPL/GPL" Questo modulo è rilasciato con doppia licenza
434 a scelta fra: una variante della GPL v2 o la
435 Mozilla Public License (MPL). La variante
436 esatta della licenza MPL può essere
437 determinata solo attraverso i corrispondenti
438 file sorgenti.
439
440 "Proprietary" Questo modulo è rilasciato con licenza
441 proprietaria. Questa stringa è solo per i
442 moduli proprietari di terze parti e non può
443 essere usata per quelli che risiedono nei
444 sorgenti del kernel. I moduli etichettati in
445 questo modo stanno contaminando il kernel e
446 gli viene assegnato un flag 'P'; quando
447 vengono caricati, il caricatore di moduli del
448 kernel si rifiuterà di collegare questi
449 moduli ai simboli che sono stati esportati
450 con EXPORT_SYMBOL_GPL().
451
452 ============================= =============================================
diff --git a/Documentation/translations/it_IT/process/maintainer-pgp-guide.rst b/Documentation/translations/it_IT/process/maintainer-pgp-guide.rst
index 24a133f0a51d..276db0e37f43 100644
--- a/Documentation/translations/it_IT/process/maintainer-pgp-guide.rst
+++ b/Documentation/translations/it_IT/process/maintainer-pgp-guide.rst
@@ -1,13 +1,946 @@
1.. include:: ../disclaimer-ita.rst 1.. include:: ../disclaimer-ita.rst
2 2
3:Original: :ref:`Documentation/process/maintainer-pgp-guide.rst <pgpguide>` 3:Original: :ref:`Documentation/process/maintainer-pgp-guide.rst <pgpguide>`
4:Translator: Alessia Mantegazza <amantegazza@vaga.pv.it>
4 5
5.. _it_pgpguide: 6.. _it_pgpguide:
6 7
8=========================================
9La guida a PGP per manutentori del kernel
10=========================================
11
12:Author: Konstantin Ryabitsev <konstantin@linuxfoundation.org>
13
14Questo documento è destinato agli sviluppatori del kernel Linux, in particolar
15modo ai manutentori. Contiene degli approfondimenti riguardo informazioni che
16sono state affrontate in maniera più generale nella sezione
17"`Protecting Code Integrity`_" pubblicata dalla Linux Foundation.
18Per approfondire alcuni argomenti trattati in questo documento è consigliato
19leggere il documento sopraindicato
20
21.. _`Protecting Code Integrity`: https://github.com/lfit/itpol/blob/master/protecting-code-integrity.md
22
23Il ruolo di PGP nello sviluppo del kernel Linux
24===============================================
25
26PGP aiuta ad assicurare l'integrità del codice prodotto dalla comunità
27di sviluppo del kernel e, in secondo luogo, stabilisce canali di comunicazione
28affidabili tra sviluppatori attraverso lo scambio di email firmate con PGP.
29
30Il codice sorgente del kernel Linux è disponibile principalmente in due
31formati:
32
33- repositori distribuiti di sorgenti (git)
34- rilasci periodici di istantanee (archivi tar)
35
36Sia i repositori git che gli archivi tar portano le firme PGP degli
37sviluppatori che hanno creato i rilasci ufficiali del kernel. Queste firme
38offrono una garanzia crittografica che le versioni scaricabili rese disponibili
39via kernel.org, o altri portali, siano identiche a quelle che gli sviluppatori
40hanno sul loro posto di lavoro. A tal scopo:
41
42- i repositori git forniscono firme PGP per ogni tag
43- gli archivi tar hanno firme separate per ogni archivio
44
45.. _it_devs_not_infra:
46
47Fidatevi degli sviluppatori e non dell'infrastruttura
48-----------------------------------------------------
49
50Fin dal 2011, quando i sistemi di kernel.org furono compromessi, il principio
51generale del progetto Kernel Archives è stato quello di assumere che qualsiasi
52parte dell'infrastruttura possa essere compromessa in ogni momento. Per questa
53ragione, gli amministratori hanno intrapreso deliberatemene dei passi per
54enfatizzare che la fiducia debba risiedere sempre negli sviluppatori e mai nel
55codice che gestisce l'infrastruttura, indipendentemente da quali che siano le
56pratiche di sicurezza messe in atto.
57
58Il principio sopra indicato è la ragione per la quale è necessaria questa
59guida. Vogliamo essere sicuri che il riporre la fiducia negli sviluppatori
60non sia fatto semplicemente per incolpare qualcun'altro per future falle di
61sicurezza. L'obiettivo è quello di fornire una serie di linee guida che gli
62sviluppatori possano seguire per creare un ambiente di lavoro sicuro e
63salvaguardare le chiavi PGP usate nello stabilire l'integrità del kernel Linux
64stesso.
65
66.. _it_pgp_tools:
67
68Strumenti PGP
69=============
70
71Usare GnuPG v2
72--------------
73
74La vostra distribuzione potrebbe avere già installato GnuPG, dovete solo
75verificare che stia utilizzando la versione 2.x e non la serie 1.4 --
76molte distribuzioni forniscono entrambe, di base il comando ''gpg''
77invoca GnuPG v.1. Per controllate usate::
78
79 $ gpg --version | head -n1
80
81Se visualizzate ``gpg (GnuPG) 1.4.x``, allora state usando GnuPG v.1.
82Provate il comando ``gpg2`` (se non lo avete, potreste aver bisogno
83di installare il pacchetto gnupg2)::
84
85 $ gpg2 --version | head -n1
86
87Se visualizzate ``gpg (GnuPG) 2.x.x``, allora siete pronti a partire.
88Questa guida assume che abbiate la versione 2.2.(o successiva) di GnuPG.
89Se state usando la versione 2.0, alcuni dei comandi indicati qui non
90funzioneranno, in questo caso considerate un aggiornamento all'ultima versione,
91la 2.2. Versioni di gnupg-2.1.11 e successive dovrebbero essere compatibili
92per gli obiettivi di questa guida.
93
94Se avete entrambi i comandi: ``gpg`` e ``gpg2``, assicuratevi di utilizzare
95sempre la versione V2, e non quella vecchia. Per evitare errori potreste creare
96un alias::
97
98 $ alias gpg=gpg2
99
100Potete mettere questa opzione nel vostro ``.bashrc`` in modo da essere sicuri.
101
102Configurare le opzioni di gpg-agent
103~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
104
105L'agente GnuPG è uno strumento di aiuto che partirà automaticamente ogni volta
106che userete il comando ``gpg`` e funzionerà in background con l'obiettivo di
107individuare la passphrase. Ci sono due opzioni che dovreste conoscere
108per personalizzare la scadenza della passphrase nella cache:
109
110- ``default-cache-ttl`` (secondi): Se usate ancora la stessa chiave prima
111 che il time-to-live termini, il conto alla rovescia si resetterà per un
112 altro periodo. Di base è di 600 (10 minuti).
113
114- ``max-cache-ttl`` (secondi): indipendentemente da quanto sia recente l'ultimo
115 uso della chiave da quando avete inserito la passphrase, se il massimo
116 time-to-live è scaduto, dovrete reinserire nuovamente la passphrase.
117 Di base è di 30 minuti.
118
119Se ritenete entrambe questi valori di base troppo corti (o troppo lunghi),
120potete creare il vostro file ``~/.gnupg/gpg-agent.conf`` ed impostare i vostri
121valori::
122
123 # set to 30 minutes for regular ttl, and 2 hours for max ttl
124 default-cache-ttl 1800
125 max-cache-ttl 7200
126
127.. note::
128
129 Non è più necessario far partire l'agente gpg manualmente all'inizio della
130 vostra sessione. Dovreste controllare i file rc per rimuovere tutto ciò che
131 riguarda vecchie le versioni di GnuPG, poiché potrebbero non svolgere più
132 bene il loro compito.
133
134Impostare un *refresh* con cronjob
135~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
136
137Potreste aver bisogno di rinfrescare regolarmente il vostro portachiavi in
138modo aggiornare le chiavi pubbliche di altre persone, lavoro che è svolto
139al meglio con un cronjob giornaliero::
140
141 @daily /usr/bin/gpg2 --refresh >/dev/null 2>&1
142
143Controllate il percorso assoluto del vostro comando ``gpg`` o ``gpg2`` e usate
144il comando ``gpg2`` se per voi ``gpg`` corrisponde alla versione GnuPG v.1.
145
146.. _it_master_key:
147
148Proteggere la vostra chiave PGP primaria
7======================================== 149========================================
8Guida a PGP per i manutentori del kernel 150
9======================================== 151Questa guida parte dal presupposto che abbiate già una chiave PGP che usate
152per lo sviluppo del kernel Linux. Se non ne avete ancora una, date uno sguardo
153al documento "`Protecting Code Integrity`_" che abbiamo menzionato prima.
154
155Dovreste inoltre creare una nuova chiave se quella attuale è inferiore a 2048
156bit (RSA).
157
158Chiave principale o sottochiavi
159-------------------------------
160
161Le sottochiavi sono chiavi PGP totalmente indipendenti, e sono collegate alla
162chiave principale attraverso firme certificate. È quindi importante
163comprendere i seguenti punti:
164
1651. Non ci sono differenze tecniche tra la chiave principale e la sottochiave.
1662. In fesa di creazione, assegniamo limitazioni funzionali ad ogni chiave
167 assegnando capacità specifiche.
1683. Una chiave PGP può avere 4 capacità:
169
170 - **[S]** può essere usata per firmare
171 - **[E]** può essere usata per criptare
172 - **[A]** può essere usata per autenticare
173 - **[C]** può essere usata per certificare altre chiavi
174
1754. Una singola chiave può avere più capacità
1765. Una sottochiave è completamente indipendente dalla chiave principale.
177 Un messaggio criptato con la sottochiave non può essere decrittato con
178 quella principale. Se perdete la vostra sottochiave privata, non può
179 essere rigenerata in nessun modo da quella principale.
180
181La chiave con capacità **[C]** (certify) è identificata come la chiave
182principale perché è l'unica che può essere usata per indicare la relazione
183con altre chiavi. Solo la chiave **[C]** può essere usata per:
184
185- Aggiungere o revocare altre chiavi (sottochiavi) che hanno capacità S/E/A
186- Aggiungere, modificare o eliminare le identità (unids) associate alla chiave
187- Aggiungere o modificare la data di termine di sé stessa o di ogni sottochiave
188- Firmare le chiavi di altre persone a scopo di creare una rete di fiducia
189
190Di base, alla creazione di nuove chiavi, GnuPG genera quanto segue:
191
192- Una chiave madre che porta sia la capacità di certificazione che quella
193 di firma (**[SC]**)
194- Una sottochiave separata con capacità di criptaggio (**[E]**)
195
196Se avete usato i parametri di base per generare la vostra chiave, quello
197sarà il risultato. Potete verificarlo utilizzando ``gpg --list-secret-keys``,
198per esempio::
199
200 sec rsa2048 2018-01-23 [SC] [expires: 2020-01-23]
201 000000000000000000000000AAAABBBBCCCCDDDD
202 uid [ultimate] Alice Dev <adev@kernel.org>
203 ssb rsa2048 2018-01-23 [E] [expires: 2020-01-23]
204
205Qualsiasi chiave che abbia la capacità **[C]** è la vostra chiave madre,
206indipendentemente da quali altre capacità potreste averle assegnato.
207
208La lunga riga sotto la voce ``sec`` è la vostra impronta digitale --
209negli esempi che seguono, quando vedere ``[fpr]`` ci si riferisce a questa
210stringa di 40 caratteri.
211
212Assicuratevi che la vostra passphrase sia forte
213-----------------------------------------------
214
215GnuPG utilizza le passphrases per criptare la vostra chiave privata prima
216di salvarla sul disco. In questo modo, anche se il contenuto della vostra
217cartella ``.gnupg`` venisse letto o trafugato nella sia interezza, gli
218attaccanti non potrebbero comunque utilizzare le vostre chiavi private senza
219aver prima ottenuto la passphrase per decriptarle.
220
221È assolutamente essenziale che le vostre chiavi private siano protette da
222una passphrase forte. Per impostarla o cambiarla, usate::
223
224 $ gpg --change-passphrase [fpr]
225
226Create una sottochiave di firma separata
227----------------------------------------
228
229Il nostro obiettivo è di proteggere la chiave primaria spostandola su un
230dispositivo sconnesso dalla rete, dunque se avete solo una chiave combinata
231**[SC]** allora dovreste creare una sottochiave di firma separata::
232
233 $ gpg --quick-add-key [fpr] ed25519 sign
234
235Ricordate di informare il keyserver del vostro cambiamento, cosicché altri
236possano ricevere la vostra nuova sottochiave::
237
238 $ gpg --send-key [fpr]
239
240.. note:: Supporto ECC in GnuPG
241 GnuPG 2.1 e successivi supportano pienamente *Elliptic Curve Cryptography*,
242 con la possibilità di combinare sottochiavi ECC con le tradizionali chiavi
243 primarie RSA. Il principale vantaggio della crittografia ECC è che è molto
244 più veloce da calcolare e crea firme più piccole se confrontate byte per
245 byte con le chiavi RSA a più di 2048 bit. A meno che non pensiate di
246 utilizzare un dispositivo smartcard che non supporta le operazioni ECC, vi
247 raccomandiamo ti creare sottochiavi di firma ECC per il vostro lavoro col
248 kernel.
249
250 Se per qualche ragione preferite rimanere con sottochiavi RSA, nel comando
251 precedente, sostituite "ed25519" con "rsa2048".
252
253Copia di riserva della chiave primaria per gestire il recupero da disastro
254--------------------------------------------------------------------------
255
256Maggiori sono le firme di altri sviluppatori che vengono applicate alla vostra,
257maggiori saranno i motivi per avere una copia di riserva che non sia digitale,
258al fine di effettuare un recupero da disastro.
259
260Il modo migliore per creare una copia fisica della vostra chiave privata è
261l'uso del programma ``paperkey``. Consultate ``man paperkey`` per maggiori
262dettagli sul formato dell'output ed i suoi punti di forza rispetto ad altre
263soluzioni. Paperkey dovrebbe essere già pacchettizzato per la maggior parte
264delle distribuzioni.
265
266Eseguite il seguente comando per creare una copia fisica di riserva della
267vostra chiave privata::
268
269 $ gpg --export-secret-key [fpr] | paperkey -o /tmp/key-backup.txt
270
271Stampate il file (o fate un pipe direttamente verso lpr), poi prendete
272una penna e scrivete la passphare sul margine del foglio. **Questo è
273caldamente consigliato** perché la copia cartacea è comunque criptata con
274la passphrase, e se mai doveste cambiarla non vi ricorderete qual'era al
275momento della creazione di quella copia -- *garantito*.
276
277Mettete la copia cartacea e la passphrase scritta a mano in una busta e
278mettetela in un posto sicuro e ben protetto, preferibilmente fuori casa,
279magari in una cassetta di sicurezza in banca.
280
281.. note::
282
283 Probabilmente la vostra stampante non è più quello stupido dispositivo
284 connesso alla porta parallela, ma dato che il suo output è comunque
285 criptato con la passphrase, eseguire la stampa in un sistema "cloud"
286 moderno dovrebbe essere comunque relativamente sicuro. Un'opzione potrebbe
287 essere quella di cambiare la passphrase della vostra chiave primaria
288 subito dopo aver finito con paperkey.
289
290Copia di riserva di tutta la cartella GnuPG
291-------------------------------------------
10 292
11.. warning:: 293.. warning::
12 294
13 TODO ancora da tradurre 295 **!!!Non saltate questo passo!!!**
296
297Quando avete bisogno di recuperare le vostre chiavi PGP è importante avere
298una copia di riserva pronta all'uso. Questo sta su un diverso piano di
299prontezza rispetto al recupero da disastro che abbiamo risolto con
300``paperkey``. Vi affiderete a queste copie esterne quando dovreste usare la
301vostra chiave Certify -- ovvero quando fate modifiche alle vostre chiavi o
302firmate le chiavi di altre persone ad una conferenza o ad un gruppo d'incontro.
303
304Incominciate con una piccola chiavetta di memoria USB (preferibilmente due)
305che userete per le copie di riserva. Dovrete criptarle usando LUKS -- fate
306riferimento alla documentazione della vostra distribuzione per capire come
307fare.
308
309Per la passphrase di criptazione, potete usare la stessa della vostra chiave
310primaria.
311
312Una volta che il processo di criptazione è finito, reinserite il disco USB ed
313assicurativi che venga montato correttamente. Copiate interamente la cartella
314``.gnugp`` nel disco criptato::
315
316 $ cp -a ~/.gnupg /media/disk/foo/gnupg-backup
317
318Ora dovreste verificare che tutto continui a funzionare::
319
320 $ gpg --homedir=/media/disk/foo/gnupg-backup --list-key [fpr]
321
322Se non vedete errori, allora dovreste avere fatto tutto con successo.
323Smontate il disco USB, etichettatelo per bene di modo da evitare di
324distruggerne il contenuto non appena vi serve una chiavetta USB a caso, ed
325infine mettetelo in un posto sicuro -- ma non troppo lontano, perché vi servirà
326di tanto in tanto per modificare le identità, aggiungere o revocare
327sottochiavi, o firmare le chiavi di altre persone.
328
329Togliete la chiave primaria dalla vostra home
330---------------------------------------------
331
332I file che si trovano nella vostra cartella home non sono poi così ben protetti
333come potreste pensare. Potrebbero essere letti o trafugati in diversi modi:
334
335- accidentalmente quando fate una rapida copia della cartella home per
336 configurare una nuova postazione
337- da un amministratore di sistema negligente o malintenzionato
338- attraverso copie di riserva insicure
339- attraverso malware installato in alcune applicazioni (browser, lettori PDF,
340 eccetera)
341- attraverso coercizione quando attraversate confini internazionali
342
343Proteggere la vostra chiave con una buona passphare aiuta notevolmente a
344ridurre i rischi elencati qui sopra, ma le passphrase possono essere scoperte
345attraverso i keylogger, il shoulder-surfing, o altri modi. Per questi motivi,
346nella configurazione si raccomanda di rimuove la chiave primaria dalla vostra
347cartella home e la si archivia su un dispositivo disconnesso.
348
349.. warning::
350
351 Per favore, fate riferimento alla sezione precedente e assicuratevi
352 di aver fatto una copia di riserva totale della cartella GnuPG. Quello
353 che stiamo per fare renderà la vostra chiave inutile se non avete delle
354 copie di riserva utilizzabili!
355
356Per prima cosa, identificate il keygrip della vostra chiave primaria::
357
358 $ gpg --with-keygrip --list-key [fpr]
359
360L'output assomiglierà a questo::
361
362 pub rsa2048 2018-01-24 [SC] [expires: 2020-01-24]
363 000000000000000000000000AAAABBBBCCCCDDDD
364 Keygrip = 1111000000000000000000000000000000000000
365 uid [ultimate] Alice Dev <adev@kernel.org>
366 sub rsa2048 2018-01-24 [E] [expires: 2020-01-24]
367 Keygrip = 2222000000000000000000000000000000000000
368 sub ed25519 2018-01-24 [S]
369 Keygrip = 3333000000000000000000000000000000000000
370
371Trovate la voce keygrid che si trova sotto alla riga ``pub`` (appena sotto
372all'impronta digitale della chiave primaria). Questo corrisponderà direttamente
373ad un file nella cartella ``~/.gnupg``::
374
375 $ cd ~/.gnupg/private-keys-v1.d
376 $ ls
377 1111000000000000000000000000000000000000.key
378 2222000000000000000000000000000000000000.key
379 3333000000000000000000000000000000000000.key
380
381Quello che dovrete fare è rimuovere il file .key che corrisponde al keygrip
382della chiave primaria::
383
384 $ cd ~/.gnupg/private-keys-v1.d
385 $ rm 1111000000000000000000000000000000000000.key
386
387Ora, se eseguite il comando ``--list-secret-keys``, vedrete che la chiave
388primaria non compare più (il simbolo ``#`` indica che non è disponibile)::
389
390 $ gpg --list-secret-keys
391 sec# rsa2048 2018-01-24 [SC] [expires: 2020-01-24]
392 000000000000000000000000AAAABBBBCCCCDDDD
393 uid [ultimate] Alice Dev <adev@kernel.org>
394 ssb rsa2048 2018-01-24 [E] [expires: 2020-01-24]
395 ssb ed25519 2018-01-24 [S]
396
397Dovreste rimuovere anche i file ``secring.gpg`` che si trovano nella cartella
398``~/.gnupg``, in quanto rimasugli delle versioni precedenti di GnuPG.
399
400Se non avete la cartella "private-keys-v1.d"
401~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
402
403Se non avete la cartella ``~/.gnupg/private-keys-v1.d``, allora le vostre
404chiavi segrete sono ancora salvate nel vecchio file ``secring.gpg`` usato
405da GnuPG v1. Effettuare una qualsiasi modifica alla vostra chiave, come
406cambiare la passphare o aggiungere una sottochiave, dovrebbe convertire
407automaticamente il vecchio formato ``secring.gpg``nel nuovo
408``private-keys-v1.d``.
409
410Una volta che l'avete fatto, assicuratevi di rimuovere il file ``secring.gpg``,
411che continua a contenere la vostra chiave privata.
412
413.. _it_smartcards:
414
415Spostare le sottochiavi in un apposito dispositivo criptato
416===========================================================
417
418Nonostante la chiave primaria sia ora al riparo da occhi e mani indiscrete,
419le sottochiavi si trovano ancora nella vostra cartella home. Chiunque riesca
420a mettere le sue mani su quelle chiavi riuscirà a decriptare le vostre
421comunicazioni o a falsificare le vostre firme (se conoscono la passphrase).
422Inoltre, ogni volta che viene fatta un'operazione con GnuPG, le chiavi vengono
423caricate nella memoria di sistema e potrebbero essere rubate con l'uso di
424malware sofisticati (pensate a Meltdown e a Spectre).
425
426Il miglior modo per proteggere le proprie chiave è di spostarle su un
427dispositivo specializzato in grado di effettuare operazioni smartcard.
428
429I benefici di una smartcard
430---------------------------
431
432Una smartcard contiene un chip crittografico che è capace di immagazzinare
433le chiavi private ed effettuare operazioni crittografiche direttamente sulla
434carta stessa. Dato che la chiave non lascia mai la smartcard, il sistema
435operativo usato sul computer non sarà in grado di accedere alle chiavi.
436Questo è molto diverso dai dischi USB criptati che abbiamo usato allo scopo di
437avere una copia di riserva sicura -- quando il dispositivo USB è connesso e
438montato, il sistema operativo potrà accedere al contenuto delle chiavi private.
439
440L'uso di un disco USB criptato non può sostituire le funzioni di un dispositivo
441capace di operazioni di tipo smartcard.
442
443Dispositivi smartcard disponibili
444---------------------------------
445
446A meno che tutti i vostri computer dispongano di lettori smartcard, il modo
447più semplice è equipaggiarsi di un dispositivo USB specializzato che
448implementi le funzionalità delle smartcard. Sul mercato ci sono diverse
449soluzioni disponibili:
450
451- `Nitrokey Start`_: è Open hardware e Free Software, è basata sul progetto
452 `GnuK`_ della FSIJ. Ha il supporto per chiavi ECC, ma meno funzionalità di
453 sicurezza (come la resistenza alla manomissione o alcuni attacchi ad un
454 canale laterale).
455- `Nitrokey Pro`_: è simile alla Nitrokey Start, ma è più resistente alla
456 manomissione e offre più funzionalità di sicurezza, ma l'ECC.
457- `Yubikey 4`_: l'hardware e il software sono proprietari, ma è più economica
458 della Nitrokey Pro ed è venduta anche con porta USB-C il che è utile con i
459 computer portatili più recenti. In aggiunta, offre altre funzionalità di
460 sicurezza come FIDO, U2F, ma non l'ECC
461
462`Su LWN c'è una buona recensione`_ dei modelli elencati qui sopra e altri.
463Se volete usare chiavi ECC, la vostra migliore scelta sul mercato è la
464Nitrokey Start.
465
466.. _`Nitrokey Start`: https://shop.nitrokey.com/shop/product/nitrokey-start-6
467.. _`Nitrokey Pro`: https://shop.nitrokey.com/shop/product/nitrokey-pro-3
468.. _`Yubikey 4`: https://www.yubico.com/product/yubikey-4-series/
469.. _Gnuk: http://www.fsij.org/doc-gnuk/
470.. _`Su LWN c'è una buona recensione`: https://lwn.net/Articles/736231/
471
472Configurare il vostro dispositivo smartcard
473-------------------------------------------
474
475Il vostro dispositivo smartcard dovrebbe iniziare a funzionare non appena
476lo collegate ad un qualsiasi computer Linux moderno. Potete verificarlo
477eseguendo::
478
479 $ gpg --card-status
480
481Se vedete tutti i dettagli della smartcard, allora ci siamo. Sfortunatamente,
482affrontare tutti i possibili motivi per cui le cose potrebbero non funzionare
483non è lo scopo di questa guida. Se avete problemi nel far funzionare la carta
484con GnuPG, cercate aiuto attraverso i soliti canali di supporto.
485
486Per configurare la vostra smartcard, dato che non c'è una via facile dalla
487riga di comando, dovrete usate il menu di GnuPG::
488
489 $ gpg --card-edit
490 [...omitted...]
491 gpg/card> admin
492 Admin commands are allowed
493 gpg/card> passwd
494
495Dovreste impostare il PIN dell'utente (1), quello dell'amministratore (3) e il
496codice di reset (4). Assicuratevi di annotare e salvare questi codici in un
497posto sicuro -- specialmente il PIN dell'amministratore e il codice di reset
498(che vi permetterà di azzerare completamente la smartcard). Il PIN
499dell'amministratore viene usato così raramente che è inevitabile dimenticarselo
500se non lo si annota.
501
502Tornando al nostro menu, potete impostare anche altri valori (come il nome,
503il sesso, informazioni d'accesso, eccetera), ma non sono necessari e aggiunge
504altre informazioni sulla carta che potrebbero trapelare in caso di smarrimento.
505
506.. note::
507
508 A dispetto del nome "PIN", né il PIN utente né quello dell'amministratore
509 devono essere esclusivamente numerici.
510
511Spostare le sottochiavi sulla smartcard
512---------------------------------------
513
514Uscite dal menu (usando "q") e salverete tutte le modifiche. Poi, spostiamo
515tutte le sottochiavi sulla smartcard. Per la maggior parte delle operazioni
516vi serviranno sia la passphrase della chiave PGP che il PIN
517dell'amministratore::
518
519 $ gpg --edit-key [fpr]
520
521 Secret subkeys are available.
522
523 pub rsa2048/AAAABBBBCCCCDDDD
524 created: 2018-01-23 expires: 2020-01-23 usage: SC
525 trust: ultimate validity: ultimate
526 ssb rsa2048/1111222233334444
527 created: 2018-01-23 expires: never usage: E
528 ssb ed25519/5555666677778888
529 created: 2017-12-07 expires: never usage: S
530 [ultimate] (1). Alice Dev <adev@kernel.org>
531
532 gpg>
533
534Usando ``--edit-key`` si tornerà alla modalità menu e noterete che
535la lista delle chiavi è leggermente diversa. Da questo momento in poi,
536tutti i comandi saranno eseguiti nella modalità menu, come indicato
537da ``gpg>``.
538
539Per prima cosa, selezioniamo la chiave che verrà messa sulla carta --
540potete farlo digitando ``key 1`` (è la prima della lista, la sottochiave
541**[E]**)::
542
543 gpg> key 1
544
545Nel'output dovreste vedere ``ssb*`` associato alla chiave **[E]**. Il simbolo
546``*`` indica che la chiave è stata "selezionata". Funziona come un
547interruttore, ovvero se scrivete nuovamente ``key 1``, il simbolo ``*`` sparirà
548e la chiave non sarà più selezionata.
549
550Ora, spostiamo la chiave sulla smartcard::
551
552 gpg> keytocard
553 Please select where to store the key:
554 (2) Encryption key
555 Your selection? 2
556
557Dato che è la nostra chiave **[E]**, ha senso metterla nella sezione criptata.
558Quando confermerete la selezione, vi verrà chiesta la passphrase della vostra
559chiave PGP, e poi il PIN dell'amministratore. Se il comando ritorna senza
560errori, allora la vostra chiave è stata spostata con successo.
561
562**Importante**: digitate nuovamente ``key 1`` per deselezionare la prima chiave
563e selezionate la seconda chiave **[S]** con ``key 2``::
564
565 gpg> key 1
566 gpg> key 2
567 gpg> keytocard
568 Please select where to store the key:
569 (1) Signature key
570 (3) Authentication key
571 Your selection? 1
572
573Potete usare la chiave **[S]** sia per firmare che per autenticare, ma vogliamo
574che sia nella sezione di firma, quindi scegliete (1). Ancora una volta, se il
575comando ritorna senza errori, allora l'operazione è avvenuta con successo::
576
577 gpg> q
578 Save changes? (y/N) y
579
580Salvando le modifiche cancellerete dalla vostra cartella home tutte le chiavi
581che avete spostato sulla carta (ma questo non è un problema, perché abbiamo
582fatto delle copie di sicurezza nel caso in cui dovessimo configurare una
583nuova smartcard).
584
585Verificare che le chiavi siano state spostate
586~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
587
588Ora, se doveste usare l'opzione ``--list-secret-keys``, vedrete una
589sottile differenza nell'output::
590
591 $ gpg --list-secret-keys
592 sec# rsa2048 2018-01-24 [SC] [expires: 2020-01-24]
593 000000000000000000000000AAAABBBBCCCCDDDD
594 uid [ultimate] Alice Dev <adev@kernel.org>
595 ssb> rsa2048 2018-01-24 [E] [expires: 2020-01-24]
596 ssb> ed25519 2018-01-24 [S]
597
598Il simbolo ``>`` in ``ssb>`` indica che la sottochiave è disponibile solo
599nella smartcard. Se tornate nella vostra cartella delle chiavi segrete e
600guardate al suo contenuto, noterete che i file ``.key`` sono stati sostituiti
601con degli stub::
602
603 $ cd ~/.gnupg/private-keys-v1.d
604 $ strings *.key | grep 'private-key'
605
606Per indicare che i file sono solo degli stub e che in realtà il contenuto è
607sulla smartcard, l'output dovrebbe mostrarvi ``shadowed-private-key``.
608
609Verificare che la smartcard funzioni
610~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
611
612Per verificare che la smartcard funzioni come dovuto, potete creare
613una firma::
614
615 $ echo "Hello world" | gpg --clearsign > /tmp/test.asc
616 $ gpg --verify /tmp/test.asc
617
618Col primo comando dovrebbe chiedervi il PIN della smartcard, e poi dovrebbe
619mostrare "Good signature" dopo l'esecuzione di ``gpg --verify``.
620
621Complimenti, siete riusciti a rendere estremamente difficile il furto della
622vostra identità digitale di sviluppatore.
623
624Altre operazioni possibili con GnuPG
625------------------------------------
626
627Segue un breve accenno ad alcune delle operazioni più comuni che dovrete
628fare con le vostre chiavi PGP.
629
630Montare il disco con la chiave primaria
631~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
632
633Vi servirà la vostra chiave principale per tutte le operazioni che seguiranno,
634per cui per prima cosa dovrete accedere ai vostri backup e dire a GnuPG di
635usarli::
636
637 $ export GNUPGHOME=/media/disk/foo/gnupg-backup
638 $ gpg --list-secret-keys
639
640Dovete assicurarvi di vedere ``sec`` e non ``sec#`` nell'output del programma
641(il simbolo ``#`` significa che la chiave non è disponibile e che state ancora
642utilizzando la vostra solita cartella di lavoro).
643
644Estendere la data di scadenza di una chiave
645~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
646
647La chiave principale ha una data di scadenza di 2 anni dal momento della sua
648creazione. Questo per motivi di sicurezza e per rendere obsolete le chiavi
649che, eventualmente, dovessero sparire dai keyserver.
650
651Per estendere di un anno, dalla data odierna, la scadenza di una vostra chiave,
652eseguite::
653
654 $ gpg --quick-set-expire [fpr] 1y
655
656Se per voi è più facile da memorizzare, potete anche utilizzare una data
657specifica (per esempio, il vostro compleanno o capodanno)::
658
659 $ gpg --quick-set-expire [fpr] 2020-07-01
660
661Ricordatevi di inviare l'aggiornamento ai keyserver::
662
663 $ gpg --send-key [fpr]
664
665Aggiornare la vostra cartella di lavoro dopo ogni modifica
666~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
667
668Dopo aver fatto delle modifiche alle vostre chiavi usando uno spazio a parte,
669dovreste importarle nella vostra cartella di lavoro abituale::
670
671 $ gpg --export | gpg --homedir ~/.gnupg --import
672 $ unset GNUPGHOME
673
674
675Usare PGP con Git
676=================
677
678Una delle caratteristiche fondanti di Git è la sua natura decentralizzata --
679una volta che il repositorio è stato clonato sul vostro sistema, avete la
680storia completa del progetto, inclusi i suoi tag, i commit ed i rami. Tuttavia,
681con i centinaia di repositori clonati che ci sono in giro, come si fa a
682verificare che la loro copia di linux.git non è stata manomessa da qualcuno?
683
684Oppure, cosa succede se viene scoperta una backdoor nel codice e la riga
685"Autore" dice che sei stato tu, mentre tu sei abbastanza sicuro di
686`non averci niente a che fare`_?
687
688Per risolvere entrambi i problemi, Git ha introdotto l'integrazione con PGP.
689I tag firmati dimostrano che il repositorio è integro assicurando che il suo
690contenuto è lo stesso che si trova sulle macchine degli sviluppatori che hanno
691creato il tag; mentre i commit firmati rendono praticamente impossibile
692ad un malintenzionato di impersonarvi senza avere accesso alle vostre chiavi
693PGP.
694
695.. _`non averci niente a che fare`: https://github.com/jayphelps/git-blame-someone-else
696
697Configurare git per usare la vostra chiave PGP
698----------------------------------------------
699
700Se avete solo una chiave segreta nel vostro portachiavi, allora non avete nulla
701da fare in più dato che sarà la vostra chiave di base. Tuttavia, se doveste
702avere più chiavi segrete, potete dire a git quale dovrebbe usare (``[fpg]``
703è la vostra impronta digitale)::
704
705 $ git config --global user.signingKey [fpr]
706
707**IMPORTANTE**: se avete una comando dedicato per ``gpg2``, allora dovreste
708dire a git di usare sempre quello piuttosto che il vecchio comando ``gpg``::
709
710 $ git config --global gpg.program gpg2
711
712Come firmare i tag
713------------------
714
715Per creare un tag firmato, passate l'opzione ``-s`` al comando tag::
716
717 $ git tag -s [tagname]
718
719La nostra raccomandazione è quella di firmare sempre i tag git, perché
720questo permette agli altri sviluppatori di verificare che il repositorio
721git dal quale stanno prendendo il codice non è stato alterato intenzionalmente.
722
723Come verificare i tag firmati
724~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
725
726Per verificare un tag firmato, potete usare il comando ``verify-tag``::
727
728 $ git verify-tag [tagname]
729
730Se state prendendo un tag da un fork del repositorio del progetto, git
731dovrebbe verificare automaticamente la firma di quello che state prendendo
732e vi mostrerà il risultato durante l'operazione di merge::
733
734 $ git pull [url] tags/sometag
735
736Il merge conterrà qualcosa di simile::
737
738 Merge tag 'sometag' of [url]
739
740 [Tag message]
741
742 # gpg: Signature made [...]
743 # gpg: Good signature from [...]
744
745Se state verificando il tag di qualcun altro, allora dovrete importare
746la loro chiave PGP. Fate riferimento alla sezione ":ref:`it_verify_identities`"
747che troverete più avanti.
748
749Configurare git per firmare sempre i tag con annotazione
750~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
751
752Se state creando un tag con annotazione è molto probabile che vogliate
753firmarlo. Per imporre a git di firmare sempre un tag con annotazione,
754dovete impostare la seguente opzione globale::
755
756 $ git config --global tag.forceSignAnnotated true
757
758Come usare commit firmati
759-------------------------
760
761Creare dei commit firmati è facile, ma è molto più difficile utilizzarli
762nello sviluppo del kernel linux per via del fatto che ci si affida alle
763liste di discussione e questo modo di procedere non mantiene le firme PGP
764nei commit. In aggiunta, quando si usa *rebase* nel proprio repositorio
765locale per allinearsi al kernel anche le proprie firme PGP verranno scartate.
766Per questo motivo, la maggior parte degli sviluppatori del kernel non si
767preoccupano troppo di firmare i propri commit ed ignoreranno quelli firmati
768che si trovano in altri repositori usati per il proprio lavoro.
769
770Tuttavia, se avete il vostro repositorio di lavoro disponibile al pubblico
771su un qualche servizio di hosting git (kernel.org, infradead.org, ozlabs.org,
772o altri), allora la raccomandazione è di firmare tutti i vostri commit
773anche se gli sviluppatori non ne beneficeranno direttamente.
774
775Vi raccomandiamo di farlo per i seguenti motivi:
776
7771. Se dovesse mai esserci la necessità di fare delle analisi forensi o
778 tracciare la provenienza di un codice, anche sorgenti mantenuti
779 esternamente che hanno firme PGP sui commit avranno un certo valore a
780 questo scopo.
7812. Se dovesse mai capitarvi di clonare il vostro repositorio locale (per
782 esempio dopo un danneggiamento del disco), la firma vi permetterà di
783 verificare l'integrità del repositorio prima di riprendere il lavoro.
7843. Se qualcuno volesse usare *cherry-pick* sui vostri commit, allora la firma
785 permetterà di verificare l'integrità dei commit prima di applicarli.
786
787Creare commit firmati
788~~~~~~~~~~~~~~~~~~~~~
789
790Per creare un commit firmato, dovete solamente aggiungere l'opzione ``-S``
791al comando ``git commit`` (si usa la lettera maiuscola per evitare
792conflitti con un'altra opzione)::
793
794 $ git commit -S
795
796Configurare git per firmare sempre i commit
797~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
798
799Potete dire a git di firmare sempre i commit::
800
801 git config --global commit.gpgSign true
802
803.. note::
804
805 Assicuratevi di aver configurato ``gpg-agent`` prima di abilitare
806 questa opzione.
807
808.. _it_verify_identities:
809
810Come verificare l'identità degli sviluppatori del kernel
811========================================================
812
813Firmare i tag e i commit è facile, ma come si fa a verificare che la chiave
814usata per firmare qualcosa appartenga davvero allo sviluppatore e non ad un
815impostore?
816
817Configurare l'auto-key-retrieval usando WKD e DANE
818--------------------------------------------------
819
820Se non siete ancora in possesso di una vasta collezione di chiavi pubbliche
821di altri sviluppatori, allora potreste iniziare il vostro portachiavi
822affidandovi ai servizi di auto-scoperta e auto-recupero. GnuPG può affidarsi
823ad altre tecnologie di delega della fiducia, come DNSSEC e TLS, per sostenervi
824nel caso in cui iniziare una propria rete di fiducia da zero sia troppo
825scoraggiante.
826
827Aggiungete il seguente testo al vostro file ``~/.gnupg/gpg.conf``::
828
829 auto-key-locate wkd,dane,local
830 auto-key-retrieve
831
832La *DNS-Based Authentication of Named Entities* ("DANE") è un metodo
833per la pubblicazione di chiavi pubbliche su DNS e per renderle sicure usando
834zone firmate con DNSSEC. Il *Web Key Directory* ("WKD") è un metodo
835alternativo che usa https a scopo di ricerca. Quando si usano DANE o WKD
836per la ricerca di chiavi pubbliche, GnuPG validerà i certificati DNSSEC o TLS
837prima di aggiungere al vostro portachiavi locale le eventuali chiavi trovate.
838
839Kernel.org pubblica la WKD per tutti gli sviluppatori che hanno un account
840kernel.org. Una volta che avete applicato le modifiche al file ``gpg.conf``,
841potrete auto-recuperare le chiavi di Linus Torvalds e Greg Kroah-Hartman
842(se non le avete già)::
843
844 $ gpg --locate-keys torvalds@kernel.org gregkh@kernel.org
845
846Se avete un account kernel.org, al fine di rendere più utile l'uso di WKD
847da parte di altri sviluppatori del kernel, dovreste `aggiungere alla vostra
848chiave lo UID di kernel.org`_.
849
850.. _`aggiungere alla vostra chiave lo UID di kernel.org`: https://korg.wiki.kernel.org/userdoc/mail#adding_a_kernelorg_uid_to_your_pgp_key
851
852Web of Trust (WOT) o Trust on First Use (TOFU)
853----------------------------------------------
854
855PGP incorpora un meccanismo di delega della fiducia conosciuto come
856"Web of Trust". Di base, questo è un tentativo di sostituire la necessità
857di un'autorità certificativa centralizzata tipica del mondo HTTPS/TLS.
858Invece di avere svariati produttori software che decidono chi dovrebbero
859essere le entità di certificazione di cui dovreste fidarvi, PGP lascia
860la responsabilità ad ogni singolo utente.
861
862Sfortunatamente, solo poche persone capiscono come funziona la rete di fiducia.
863Nonostante sia un importante aspetto della specifica OpenPGP, recentemente
864le versioni di GnuPG (2.2 e successive) hanno implementato un meccanisco
865alternativo chiamato "Trust on First Use" (TOFU). Potete pensare a TOFU come
866"ad un approccio all fidicia simile ad SSH". In SSH, la prima volta che vi
867connettete ad un sistema remoto, l'impronta digitale della chiave viene
868registrata e ricordata. Se la chiave dovesse cambiare in futuro, il programma
869SSH vi avviserà e si rifiuterà di connettersi, obbligandovi a prendere una
870decisione circa la fiducia che riponete nella nuova chiave. In modo simile,
871la prima volta che importate la chiave PGP di qualcuno, si assume sia valida.
872Se ad un certo punto GnuPG trova un'altra chiave con la stessa identità,
873entrambe, la vecchia e la nuova, verranno segnate come invalide e dovrete
874verificare manualmente quale tenere.
875
876Vi raccomandiamo di usare il meccanisco TOFU+PGP (che è la nuova configurazione
877di base di GnuPG v2). Per farlo, aggiungete (o modificate) l'impostazione
878``trust-model`` in ``~/.gnupg/gpg.conf``::
879
880 trust-model tofu+pgp
881
882Come usare i keyserver in sicurezza
883-----------------------------------
884Se ottenete l'errore "No public key" quando cercate di validate il tag di
885qualcuno, allora dovreste cercare quella chiave usando un keyserver. È
886importante tenere bene a mente che non c'è alcuna garanzia che la chiave
887che avete recuperato da un keyserver PGP appartenga davvero alla persona
888reale -- è progettato così. Dovreste usare il Web of Trust per assicurarvi
889che la chiave sia valida.
890
891Come mantenere il Web of Trust va oltre gli scopi di questo documento,
892semplicemente perché farlo come si deve richiede sia sforzi che perseveranza
893che tendono ad andare oltre al livello di interesse della maggior parte degli
894esseri umani. Qui di seguito alcuni rapidi suggerimenti per aiutarvi a ridurre
895il rischio di importare chiavi maligne.
896
897Primo, diciamo che avete provato ad eseguire ``git verify-tag`` ma restituisce
898un errore dicendo che la chiave non è stata trovata::
899
900 $ git verify-tag sunxi-fixes-for-4.15-2
901 gpg: Signature made Sun 07 Jan 2018 10:51:55 PM EST
902 gpg: using RSA key DA73759BF8619E484E5A3B47389A54219C0F2430
903 gpg: issuer "wens@...org"
904 gpg: Can't check signature: No public key
905
906Cerchiamo nel keyserver per maggiori informazioni sull'impronta digitale
907della chiave (l'impronta digitale, probabilmente, appartiene ad una
908sottochiave, dunque non possiamo usarla direttamente senza trovare prima
909l'ID della chiave primaria associata ad essa)::
910
911 $ gpg --search DA73759BF8619E484E5A3B47389A54219C0F2430
912 gpg: data source: hkp://keys.gnupg.net
913 (1) Chen-Yu Tsai <wens@...org>
914 4096 bit RSA key C94035C21B4F2AEB, created: 2017-03-14, expires: 2019-03-15
915 Keys 1-1 of 1 for "DA73759BF8619E484E5A3B47389A54219C0F2430". Enter number(s), N)ext, or Q)uit > q
916
917Localizzate l'ID della chiave primaria, nel nostro esempio
918``C94035C21B4F2AEB``. Ora visualizzate le chiavi di Linus Torvalds
919che avete nel vostro portachiavi::
920
921 $ gpg --list-key torvalds@kernel.org
922 pub rsa2048 2011-09-20 [SC]
923 ABAF11C65A2970B130ABE3C479BE3E4300411886
924 uid [ unknown] Linus Torvalds <torvalds@kernel.org>
925 sub rsa2048 2011-09-20 [E]
926
927Poi, aprite il `PGP pathfinder`_. Nel campo "From", incollate l'impronta
928digitale della chiave di Linus Torvalds che si vede nell'output qui sopra.
929Nel campo "to", incollate il key-id della chiave sconosciuta che avete
930trovato con ``gpg --search``, e poi verificare il risultato:
931
932- `Finding paths to Linus`_
933
934Se trovate un paio di percorsi affidabili è un buon segno circa la validità
935della chiave. Ora, potete aggiungerla al vostro portachiavi dal keyserver::
936
937 $ gpg --recv-key C94035C21B4F2AEB
938
939Questa procedura non è perfetta, e ovviamente state riponendo la vostra
940fiducia nell'amministratore del servizio *PGP Pathfinder* sperando che non
941sia malintenzionato (infatti, questo va contro :ref:`it_devs_not_infra`).
942Tuttavia, se mantenete con cura la vostra rete di fiducia sarà un deciso
943miglioramento rispetto alla cieca fiducia nei keyserver.
944
945.. _`PGP pathfinder`: https://pgp.cs.uu.nl/
946.. _`Finding paths to Linus`: https://pgp.cs.uu.nl/paths/79BE3E4300411886/to/C94035C21B4F2AEB.html
diff --git a/Documentation/translations/it_IT/process/stable-kernel-rules.rst b/Documentation/translations/it_IT/process/stable-kernel-rules.rst
index 6fa5ce9c3572..48e88e5ad2c5 100644
--- a/Documentation/translations/it_IT/process/stable-kernel-rules.rst
+++ b/Documentation/translations/it_IT/process/stable-kernel-rules.rst
@@ -1,12 +1,202 @@
1.. include:: ../disclaimer-ita.rst 1.. include:: ../disclaimer-ita.rst
2 2
3:Original: :ref:`Documentation/process/stable-kernel-rules.rst <stable_kernel_rules>` 3:Original: :ref:`Documentation/process/stable-kernel-rules.rst <stable_kernel_rules>`
4:Translator: Federico Vaga <federico.vaga@vaga.pv.it>
4 5
5.. _it_stable_kernel_rules: 6.. _it_stable_kernel_rules:
6 7
7Tutto quello che volevate sapere sui rilasci -stable di Linux 8Tutto quello che volevate sapere sui rilasci -stable di Linux
8============================================================== 9==============================================================
9 10
10.. warning:: 11Regole sul tipo di patch che vengono o non vengono accettate nei sorgenti
12"-stable":
11 13
12 TODO ancora da tradurre 14 - Ovviamente dev'essere corretta e verificata.
15 - Non dev'essere più grande di 100 righe, incluso il contesto.
16 - Deve correggere una cosa sola.
17 - Deve correggere un baco vero che sta disturbando gli utenti (non cose del
18 tipo "Questo potrebbe essere un problema ...").
19 - Deve correggere un problema di compilazione (ma non per cose già segnate
20 con CONFIG_BROKEN), un kernel oops, un blocco, una corruzione di dati,
21 un vero problema di sicurezza, o problemi del tipo "oh, questo non va bene".
22 In pratica, qualcosa di critico.
23 - Problemi importanti riportati dagli utenti di una distribuzione potrebbero
24 essere considerati se correggono importanti problemi di prestazioni o di
25 interattività. Dato che questi problemi non sono così ovvi e la loro
26 correzione ha un'alta probabilità d'introdurre una regressione, dovrebbero
27 essere sottomessi solo dal manutentore della distribuzione includendo un
28 link, se esiste, ad un rapporto su bugzilla, e informazioni aggiuntive
29 sull'impatto che ha sugli utenti.
30 - Non deve correggere problemi relativi a una "teorica sezione critica",
31 a meno che non venga fornita anche una spiegazione su come questa si
32 possa verificare.
33 - Non deve includere alcuna correzione "banale" (correzioni grammaticali,
34 pulizia dagli spazi bianchi, eccetera).
35 - Deve rispettare le regole scritte in
36 :ref:`Documentation/translation/it_IT/process/submitting-patches.rst <it_submittingpatches>`
37 - Questa patch o una equivalente deve esistere già nei sorgenti principali di
38 Linux
39
40
41Procedura per sottomettere patch per i sorgenti -stable
42-------------------------------------------------------
43
44 - Se la patch contiene modifiche a dei file nelle cartelle net/ o drivers/net,
45 allora seguite le linee guida descritte in
46 :ref:`Documentation/translation/it_IT/networking/netdev-FAQ.rst <it_netdev-FAQ>`;
47 ma solo dopo aver verificato al seguente indirizzo che la patch non sia
48 già in coda:
49 https://patchwork.ozlabs.org/bundle/davem/stable/?series=&submitter=&state=*&q=&archive=
50 - Una patch di sicurezza non dovrebbero essere gestite (solamente) dal processo
51 di revisione -stable, ma dovrebbe seguire le procedure descritte in
52 :ref:`Documentation/translations/it_IT/admin-guide/security-bugs.rst <it_securitybugs>`.
53
54
55Per tutte le altre sottomissioni, scegliere una delle seguenti procedure
56------------------------------------------------------------------------
57
58.. _it_option_1:
59
60Opzione 1
61*********
62
63Per far sì che una patch venga automaticamente inclusa nei sorgenti stabili,
64aggiungete l'etichetta
65
66.. code-block:: none
67
68 Cc: stable@vger.kernel.org
69
70nell'area dedicata alla firme. Una volta che la patch è stata inclusa, verrà
71applicata anche sui sorgenti stabili senza che l'autore o il manutentore
72del sottosistema debba fare qualcosa.
73
74.. _it_option_2:
75
76Opzione 2
77*********
78
79Dopo che la patch è stata inclusa nei sorgenti Linux, inviate una mail a
80stable@vger.kernel.org includendo: il titolo della patch, l'identificativo
81del commit, il perché pensate che debba essere applicata, e in quale versione
82del kernel la vorreste vedere.
83
84.. _it_option_3:
85
86Opzione 3
87*********
88
89Inviata la patch, dopo aver verificato che rispetta le regole descritte in
90precedenza, a stable@vger.kernel.org. Dovete annotare nel changelog
91l'identificativo del commit nei sorgenti principali, così come la versione
92del kernel nel quale vorreste vedere la patch.
93
94L':ref:`it_option_1` è fortemente raccomandata; è il modo più facile e usato.
95L':ref:`it_option_2` e l':ref:`it_option_3` sono più utili quando, al momento
96dell'inclusione dei sorgenti principali, si ritiene che non debbano essere
97incluse anche in quelli stabili (per esempio, perché si crede che si dovrebbero
98fare più verifiche per eventuali regressioni). L':ref:`it_option_3` è
99particolarmente utile se la patch ha bisogno di qualche modifica per essere
100applicata ad un kernel più vecchio (per esempio, perché nel frattempo l'API è
101cambiata).
102
103Notate che per l':ref:`it_option_3`, se la patch è diversa da quella nei
104sorgenti principali (per esempio perché è stato necessario un lavoro di
105adattamento) allora dev'essere ben documentata e giustificata nella descrizione
106della patch.
107
108L'identificativo del commit nei sorgenti principali dev'essere indicato sopra
109al messaggio della patch, così:
110
111.. code-block:: none
112
113 commit <sha1> upstream.
114
115In aggiunta, alcune patch inviate attraverso l':ref:`it_option_1` potrebbero
116dipendere da altre che devo essere incluse. Questa situazione può essere
117indicata nel seguente modo nell'area dedicata alle firme:
118
119.. code-block:: none
120
121 Cc: <stable@vger.kernel.org> # 3.3.x: a1f84a3: sched: Check for idle
122 Cc: <stable@vger.kernel.org> # 3.3.x: 1b9508f: sched: Rate-limit newidle
123 Cc: <stable@vger.kernel.org> # 3.3.x: fd21073: sched: Fix affinity logic
124 Cc: <stable@vger.kernel.org> # 3.3.x
125 Signed-off-by: Ingo Molnar <mingo@elte.hu>
126
127La sequenza di etichette ha il seguente significato:
128
129.. code-block:: none
130
131 git cherry-pick a1f84a3
132 git cherry-pick 1b9508f
133 git cherry-pick fd21073
134 git cherry-pick <this commit>
135
136Inoltre, alcune patch potrebbero avere dei requisiti circa la versione del
137kernel. Questo può essere indicato usando il seguente formato nell'area
138dedicata alle firme:
139
140.. code-block:: none
141
142 Cc: <stable@vger.kernel.org> # 3.3.x
143
144L'etichetta ha il seguente significato:
145
146.. code-block:: none
147
148 git cherry-pick <this commit>
149
150per ogni sorgente "-stable" che inizia con la versione indicata.
151
152Dopo la sottomissione:
153
154 - Il mittente riceverà un ACK quando la patch è stata accettata e messa in
155 coda, oppure un NAK se la patch è stata rigettata. A seconda degli impegni
156 degli sviluppatori, questa risposta potrebbe richiedere alcuni giorni.
157 - Se accettata, la patch verrà aggiunta alla coda -stable per essere
158 revisionata dal altri sviluppatori e dal principale manutentore del
159 sottosistema.
160
161
162Ciclo di una revisione
163----------------------
164
165 - Quando i manutentori -stable decidono di fare un ciclo di revisione, le
166 patch vengono mandate al comitato per la revisione, ai manutentori soggetti
167 alle modifiche delle patch (a meno che il mittente non sia anche il
168 manutentore di quell'area del kernel) e in CC: alla lista di discussione
169 linux-kernel.
170 - La commissione per la revisione ha 48 ore per dare il proprio ACK o NACK
171 alle patch.
172 - Se una patch viene rigettata da un membro della commissione, o un membro
173 della lista linux-kernel obietta la bontà della patch, sollevando problemi
174 che i manutentori ed i membri non avevano compreso, allora la patch verrà
175 rimossa dalla coda.
176 - Alla fine del ciclo di revisione tutte le patch che hanno ricevuto l'ACK
177 verranno aggiunte per il prossimo rilascio -stable, e successivamente
178 questo nuovo rilascio verrà fatto.
179 - Le patch di sicurezza verranno accettate nei sorgenti -stable direttamente
180 dalla squadra per la sicurezza del kernel, e non passerà per il normale
181 ciclo di revisione. Contattate la suddetta squadra per maggiori dettagli
182 su questa procedura.
183
184Sorgenti
185--------
186
187 - La coda delle patch, sia quelle già applicate che in fase di revisione,
188 possono essere trovate al seguente indirizzo:
189
190 https://git.kernel.org/pub/scm/linux/kernel/git/stable/stable-queue.git
191
192 - Il rilascio definitivo, e marchiato, di tutti i kernel stabili può essere
193 trovato in rami distinti per versione al seguente indirizzo:
194
195 https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable.git
196
197
198Comitato per la revisione
199-------------------------
200
201 - Questo comitato è fatto di sviluppatori del kernel che si sono offerti
202 volontari per questo lavoro, e pochi altri che non sono proprio volontari.
diff --git a/Documentation/translations/it_IT/process/submitting-patches.rst b/Documentation/translations/it_IT/process/submitting-patches.rst
index 2ab9c1401aa1..7d7ea92c5c5a 100644
--- a/Documentation/translations/it_IT/process/submitting-patches.rst
+++ b/Documentation/translations/it_IT/process/submitting-patches.rst
@@ -67,8 +67,8 @@ sulla radice dei sorgenti del kernel, e non sulle sue sottocartelle.
67 67
68Per creare una patch per un singolo file, spesso è sufficiente fare:: 68Per creare una patch per un singolo file, spesso è sufficiente fare::
69 69
70 SRCTREE= linux 70 SRCTREE=linux
71 MYFILE= drivers/net/mydriver.c 71 MYFILE=drivers/net/mydriver.c
72 72
73 cd $SRCTREE 73 cd $SRCTREE
74 cp $MYFILE $MYFILE.orig 74 cp $MYFILE $MYFILE.orig
@@ -80,7 +80,7 @@ Per creare una patch per molteplici file, dovreste spacchettare i sorgenti
80"vergini", o comunque non modificati, e fare un ``diff`` coi vostri. 80"vergini", o comunque non modificati, e fare un ``diff`` coi vostri.
81Per esempio:: 81Per esempio::
82 82
83 MYSRC= /devel/linux 83 MYSRC=/devel/linux
84 84
85 tar xvfz linux-3.19.tar.gz 85 tar xvfz linux-3.19.tar.gz
86 mv linux-3.19 linux-3.19-vanilla 86 mv linux-3.19 linux-3.19-vanilla
@@ -567,11 +567,42 @@ alcunché - ma dovrebbe indicare che la persona ha ricevuto una copia della
567patch. Questa etichetta documenta che terzi potenzialmente interessati sono 567patch. Questa etichetta documenta che terzi potenzialmente interessati sono
568stati inclusi nella discussione. 568stati inclusi nella discussione.
569 569
570L'etichetta Co-developed-by: indica che la patch è stata scritta dall'autore in 570Co-developed-by: indica che la patch è stata cosviluppata da diversi
571collaborazione con un altro sviluppatore. Qualche volta questo è utile quando 571sviluppatori; viene usato per assegnare più autori (in aggiunta a quello
572più persone lavorano sulla stessa patch. Notate, questa persona deve avere 572associato all'etichetta From:) quando più persone lavorano ad una patch. Dato
573nella patch anche una riga Signed-off-by:. 573che Co-developed-by: implica la paternità della patch, ogni Co-developed-by:
574dev'essere seguito immediatamente dal Signed-off-by: del corrispondente
575coautore. Qui si applica la procedura di base per sign-off, in pratica
576l'ordine delle etichette Signed-off-by: dovrebbe riflettere il più possibile
577l'ordine cronologico della storia della patch, indipendentemente dal fatto che
578la paternità venga assegnata via From: o Co-developed-by:. Da notare che
579l'ultimo Signed-off-by: dev'essere quello di colui che ha sottomesso la patch.
574 580
581Notate anche che l'etichetta From: è opzionale quando l'autore in From: è
582anche la persona (e indirizzo email) indicato nel From: dell'intestazione
583dell'email.
584
585Esempio di una patch sottomessa dall'autore in From:::
586
587 <changelog>
588
589 Co-developed-by: First Co-Author <first@coauthor.example.org>
590 Signed-off-by: First Co-Author <first@coauthor.example.org>
591 Co-developed-by: Second Co-Author <second@coauthor.example.org>
592 Signed-off-by: Second Co-Author <second@coauthor.example.org>
593 Signed-off-by: From Author <from@author.example.org>
594
595Esempio di una patch sottomessa dall'autore Co-developed-by:::
596
597 From: From Author <from@author.example.org>
598
599 <changelog>
600
601 Co-developed-by: Random Co-Author <random@coauthor.example.org>
602 Signed-off-by: Random Co-Author <random@coauthor.example.org>
603 Signed-off-by: From Author <from@author.example.org>
604 Co-developed-by: Submitting Co-Author <sub@coauthor.example.org>
605 Signed-off-by: Submitting Co-Author <sub@coauthor.example.org>
575 606
57613) Utilizzare Reported-by:, Tested-by:, Reviewed-by:, Suggested-by: e Fixes: 60713) Utilizzare Reported-by:, Tested-by:, Reviewed-by:, Suggested-by: e Fixes:
577----------------------------------------------------------------------------- 608-----------------------------------------------------------------------------
@@ -719,7 +750,7 @@ Un paio di esempi di oggetti::
719La riga ``from`` dev'essere la prima nel corpo del messaggio ed è nel 750La riga ``from`` dev'essere la prima nel corpo del messaggio ed è nel
720formato: 751formato:
721 752
722 From: Original Author <author@example.com> 753 From: Patch Author <author@example.com>
723 754
724La riga ``from`` indica chi verrà accreditato nel changelog permanente come 755La riga ``from`` indica chi verrà accreditato nel changelog permanente come
725l'autore della patch. Se la riga ``from`` è mancante, allora per determinare 756l'autore della patch. Se la riga ``from`` è mancante, allora per determinare
diff --git a/Documentation/translations/ja_JP/SubmittingPatches b/Documentation/translations/ja_JP/SubmittingPatches
index 02139656463e..ad979c3c06a6 100644
--- a/Documentation/translations/ja_JP/SubmittingPatches
+++ b/Documentation/translations/ja_JP/SubmittingPatches
@@ -58,8 +58,8 @@ Linux カーネルに対する全ての変更は diff(1) コマンドによる
581個のファイルについてのパッチを作成するためには、ほとんどの場合、 581個のファイルについてのパッチを作成するためには、ほとんどの場合、
59以下の作業を行えば十分です。 59以下の作業を行えば十分です。
60 60
61 SRCTREE= linux-2.6 61 SRCTREE=linux-2.6
62 MYFILE= drivers/net/mydriver.c 62 MYFILE=drivers/net/mydriver.c
63 63
64 cd $SRCTREE 64 cd $SRCTREE
65 cp $MYFILE $MYFILE.orig 65 cp $MYFILE $MYFILE.orig
@@ -71,7 +71,7 @@ Linux カーネルに対する全ての変更は diff(1) コマンドによる
71なわち変更を加えてない Linux カーネルを展開し、自分の Linux カーネル 71なわち変更を加えてない Linux カーネルを展開し、自分の Linux カーネル
72ソースとの差分を生成しないといけません。例えば、 72ソースとの差分を生成しないといけません。例えば、
73 73
74 MYSRC= /devel/linux-2.6 74 MYSRC=/devel/linux-2.6
75 75
76 tar xvfz linux-2.6.12.tar.gz 76 tar xvfz linux-2.6.12.tar.gz
77 mv linux-2.6.12 linux-2.6.12-vanilla 77 mv linux-2.6.12 linux-2.6.12-vanilla
diff --git a/Documentation/translations/zh_CN/SubmittingPatches b/Documentation/translations/zh_CN/SubmittingPatches
deleted file mode 100644
index e9098da8f1a4..000000000000
--- a/Documentation/translations/zh_CN/SubmittingPatches
+++ /dev/null
@@ -1,412 +0,0 @@
1Chinese translated version of Documentation/process/submitting-patches.rst
2
3If you have any comment or update to the content, please contact the
4original document maintainer directly. However, if you have a problem
5communicating in English you can also ask the Chinese maintainer for
6help. Contact the Chinese maintainer if this translation is outdated
7or if there is a problem with the translation.
8
9Chinese maintainer: TripleX Chung <triplex@zh-kernel.org>
10---------------------------------------------------------------------
11Documentation/process/submitting-patches.rst 的中文翻译
12
13如果想评论或更新本文的内容,请直接联系原文档的维护者。如果你使用英文
14交流有困难的话,也可以向中文版维护者求助。如果本翻译更新不及时或者翻
15译存在问题,请联系中文版维护者。
16
17中文版维护者: 钟宇 TripleX Chung <triplex@zh-kernel.org>
18中文版翻译者: 钟宇 TripleX Chung <triplex@zh-kernel.org>
19中文版校译者: 李阳 Li Yang <leo@zh-kernel.org>
20 王聪 Wang Cong <xiyou.wangcong@gmail.com>
21
22以下为正文
23---------------------------------------------------------------------
24
25 如何让你的改动进入内核
26 或者
27 获得亲爱的 Linus Torvalds 的关注和处理
28----------------------------------
29
30对于想要将改动提交到 Linux 内核的个人或者公司来说,如果不熟悉“规矩”,
31提交的流程会让人畏惧。本文档收集了一系列建议,这些建议可以大大的提高你
32的改动被接受的机会。
33阅读 Documentation/process/submit-checklist.rst 来获得在提交代码前需要检查的项目的列
34表。如果你在提交一个驱动程序,那么同时阅读一下
35Documentation/process/submitting-drivers.rst 。
36
37
38--------------------------
39第一节 - 创建并发送你的改动
40--------------------------
41
421) "diff -up"
43-----------
44
45使用 "diff -up" 或者 "diff -uprN" 来创建补丁。
46
47所有内核的改动,都是以补丁的形式呈现的,补丁由 diff(1) 生成。创建补丁的
48时候,要确认它是以 "unified diff" 格式创建的,这种格式由 diff(1) 的 '-u'
49参数生成。而且,请使用 '-p' 参数,那样会显示每个改动所在的C函数,使得
50产生的补丁容易读得多。补丁应该基于内核源代码树的根目录,而不是里边的任
51何子目录。
52为一个单独的文件创建补丁,一般来说这样做就够了:
53
54 SRCTREE= linux-2.6
55 MYFILE= drivers/net/mydriver.c
56
57 cd $SRCTREE
58 cp $MYFILE $MYFILE.orig
59 vi $MYFILE # make your change
60 cd ..
61 diff -up $SRCTREE/$MYFILE{.orig,} > /tmp/patch
62
63为多个文件创建补丁,你可以解开一个没有修改过的内核源代码树,然后和你自
64己的代码树之间做 diff 。例如:
65
66 MYSRC= /devel/linux-2.6
67
68 tar xvfz linux-2.6.12.tar.gz
69 mv linux-2.6.12 linux-2.6.12-vanilla
70 diff -uprN -X linux-2.6.12-vanilla/Documentation/dontdiff \
71 linux-2.6.12-vanilla $MYSRC > /tmp/patch
72
73"dontdiff" 是内核在编译的时候产生的文件的列表,列表中的文件在 diff(1)
74产生的补丁里会被跳过。"dontdiff" 文件被包含在2.6.12和之后版本的内核源代
75码树中。对于更早的内核版本,你可以从
76<http://www.xenotime.net/linux/doc/dontdiff> 获取它。
77确定你的补丁里没有包含任何不属于这次补丁提交的额外文件。记得在用diff(1)
78生成补丁之后,审阅一次补丁,以确保准确。
79如果你的改动很散乱,你应该研究一下如何将补丁分割成独立的部分,将改动分
80割成一系列合乎逻辑的步骤。这样更容易让其他内核开发者审核,如果你想你的
81补丁被接受,这是很重要的。下面这些脚本能够帮助你做这件事情:
82Quilt:
83http://savannah.nongnu.org/projects/quilt
84
852)描述你的改动。
86描述你的改动包含的技术细节。
87
88要多具体就写多具体。最糟糕的描述可能是像下面这些语句:“更新了某驱动程
89序”,“修正了某驱动程序的bug”,或者“这个补丁包含了某子系统的修改,请
90使用。”
91
92如果你的描述开始变长,这表示你也许需要拆分你的补丁了,请看第3小节,
93继续。
94
953)拆分你的改动
96
97将改动拆分,逻辑类似的放到同一个补丁文件里。
98
99例如,如果你的改动里同时有bug修正和性能优化,那么把这些改动拆分到两个或
100者更多的补丁文件中。如果你的改动包含对API的修改,并且修改了驱动程序来适
101应这些新的API,那么把这些修改分成两个补丁。
102
103另一方面,如果你将一个单独的改动做成多个补丁文件,那么将它们合并成一个
104单独的补丁文件。这样一个逻辑上单独的改动只被包含在一个补丁文件里。
105
106如果有一个补丁依赖另外一个补丁来完成它的改动,那没问题。简单的在你的补
107丁描述里指出“这个补丁依赖某补丁”就好了。
108
109如果你不能将补丁浓缩成更少的文件,那么每次大约发送出15个,然后等待审查
110和整合。
111
1124)选择 e-mail 的收件人
113
114看一遍 MAINTAINERS 文件和源代码,看看你所的改动所在的内核子系统有没有指
115定的维护者。如果有,给他们发e-mail。
116
117如果没有找到维护者,或者维护者没有反馈,将你的补丁发送到内核开发者主邮
118件列表 linux-kernel@vger.kernel.org。大部分的内核开发者都跟踪这个邮件列
119表,可以评价你的改动。
120
121每次不要发送超过15个补丁到 vger 邮件列表!!!
122
123Linus Torvalds 是决定改动能否进入 Linux 内核的最终裁决者。他的 e-mail
124地址是 <torvalds@linux-foundation.org> 。他收到的 e-mail 很多,所以一般
125的说,最好别给他发 e-mail。
126
127那些修正bug,“显而易见”的修改或者是类似的只需要很少讨论的补丁可以直接
128发送或者CC给Linus。那些需要讨论或者没有很清楚的好处的补丁,一般先发送到
129linux-kernel邮件列表。只有当补丁被讨论得差不多了,才提交给Linus。
130
1315)选择CC( e-mail 抄送)列表
132
133除非你有理由不这样做,否则CC linux-kernel@vger.kernel.org。
134
135除了 Linus 之外,其他内核开发者也需要注意到你的改动,这样他们才能评论你
136的改动并提供代码审查和建议。linux-kernel 是 Linux 内核开发者主邮件列表
137。其它的邮件列表为特定的子系统提供服务,比如 USB,framebuffer 设备,虚
138拟文件系统,SCSI 子系统,等等。查看 MAINTAINERS 文件来获得和你的改动有
139关的邮件列表。
140
141Majordomo lists of VGER.KERNEL.ORG at:
142 <http://vger.kernel.org/vger-lists.html>
143
144如果改动影响了用户空间和内核之间的接口,请给 MAN-PAGES 的维护者(列在
145MAINTAINERS 文件里的)发送一个手册页(man-pages)补丁,或者至少通知一下改
146变,让一些信息有途径进入手册页。
147
148即使在第四步的时候,维护者没有作出回应,也要确认在修改他们的代码的时候
149,一直将维护者拷贝到CC列表中。
150
151对于小的补丁,你也许会CC到 Adrian Bunk 管理的搜集琐碎补丁的邮件列表
152(Trivial Patch Monkey)trivial@kernel.org,那里专门收集琐碎的补丁。下面这样
153的补丁会被看作“琐碎的”补丁:
154 文档的拼写修正。
155 修正会影响到 grep(1) 的拼写。
156 警告信息修正(频繁的打印无用的警告是不好的。)
157 编译错误修正(代码逻辑的确是对的,只是编译有问题。)
158 运行时修正(只要真的修正了错误。)
159 移除使用了被废弃的函数/宏的代码(例如 check_region。)
160 联系方式和文档修正。
161 用可移植的代码替换不可移植的代码(即使在体系结构相关的代码中,既然有
162 人拷贝,只要它是琐碎的)
163 任何文件的作者/维护者对该文件的改动(例如 patch monkey 在重传模式下)
164
165EMAIL: trivial@kernel.org
166
167(译注,关于“琐碎补丁”的一些说明:因为原文的这一部分写得比较简单,所以不得不
168违例写一下译注。"trivial"这个英文单词的本意是“琐碎的,不重要的。”但是在这里
169有稍微有一些变化,例如对一些明显的NULL指针的修正,属于运行时修正,会被归类
170到琐碎补丁里。虽然NULL指针的修正很重要,但是这样的修正往往很小而且很容易得到
171检验,所以也被归入琐碎补丁。琐碎补丁更精确的归类应该是
172“simple, localized & easy to verify”,也就是说简单的,局部的和易于检验的。
173trivial@kernel.org邮件列表的目的是针对这样的补丁,为提交者提供一个中心,来
174降低提交的门槛。)
175
1766)没有 MIME 编码,没有链接,没有压缩,没有附件,只有纯文本。
177
178Linus 和其他的内核开发者需要阅读和评论你提交的改动。对于内核开发者来说
179,可以“引用”你的改动很重要,使用一般的 e-mail 工具,他们就可以在你的
180代码的任何位置添加评论。
181
182因为这个原因,所有的提交的补丁都是 e-mail 中“内嵌”的。
183警告:如果你使用剪切-粘贴你的补丁,小心你的编辑器的自动换行功能破坏你的
184补丁。
185
186不要将补丁作为 MIME 编码的附件,不管是否压缩。很多流行的 e-mail 软件不
187是任何时候都将 MIME 编码的附件当作纯文本发送的,这会使得别人无法在你的
188代码中加评论。另外,MIME 编码的附件会让 Linus 多花一点时间来处理,这就
189降低了你的改动被接受的可能性。
190
191警告:一些邮件软件,比如 Mozilla 会将你的信息以如下格式发送:
192---- 邮件头 ----
193Content-Type: text/plain; charset=us-ascii; format=flowed
194---- 邮件头 ----
195问题在于 “format=flowed” 会让接收端的某些邮件软件将邮件中的制表符替换
196成空格以及做一些类似的替换。这样,你发送的时候看起来没问题的补丁就被破
197坏了。
198
199要修正这个问题,只需要将你的 mozilla 的 defaults/pref/mailnews.js 文件
200里的
201pref("mailnews.send_plaintext_flowed", false); // RFC 2646=======
202修改成
203pref("mailnews.display.disable_format_flowed_support", true);
204就可以了。
205
2067) e-mail 的大小
207
208给 Linus 发送补丁的时候,永远按照第6小节说的做。
209
210大的改动对邮件列表不合适,对某些维护者也不合适。如果你的补丁,在不压缩
211的情况下,超过了40kB,那么你最好将补丁放在一个能通过 internet 访问的服
212务器上,然后用指向你的补丁的 URL 替代。
213
2148) 指出你的内核版本
215
216在标题和在补丁的描述中,指出补丁对应的内核的版本,是很重要的。
217
218如果补丁不能干净的在最新版本的内核上打上,Linus 是不会接受它的。
219
2209) 不要气馁,继续提交。
221
222当你提交了改动以后,耐心地等待。如果 Linus 喜欢你的改动并且同意它,那么
223它将在下一个内核发布版本中出现。
224
225然而,如果你的改动没有出现在下一个版本的内核中,可能有若干原因。减少那
226些原因,修正错误,重新提交更新后的改动,是你自己的工作。
227
228Linus不给出任何评论就“丢弃”你的补丁是常见的事情。在系统中这样的事情很
229平常。如果他没有接受你的补丁,也许是由于以下原因:
230* 你的补丁不能在最新版本的内核上干净的打上。
231* 你的补丁在 linux-kernel 邮件列表中没有得到充分的讨论。
232* 风格问题(参照第2小节)
233* 邮件格式问题(重读本节)
234* 你的改动有技术问题。
235* 他收到了成吨的 e-mail,而你的在混乱中丢失了。
236* 你让人为难。
237
238有疑问的时候,在 linux-kernel 邮件列表上请求评论。
239
24010) 在标题上加上 PATCH 的字样
241
242Linus 和 linux-kernel 邮件列表的 e-mail 流量都很高,一个通常的约定是标
243题行以 [PATCH] 开头。这样可以让 Linus 和其他内核开发人员可以从 e-mail
244的讨论中很轻易的将补丁分辨出来。
245
24611)为你的工作签名
247
248为了加强对谁做了何事的追踪,尤其是对那些透过好几层的维护者的补丁,我们
249建议在发送出去的补丁上加一个 “sign-off” 的过程。
250
251"sign-off" 是在补丁的注释的最后的简单的一行文字,认证你编写了它或者其他
252人有权力将它作为开放源代码的补丁传递。规则很简单:如果你能认证如下信息
253
254 开发者来源证书 1.1
255 对于本项目的贡献,我认证如下信息:
256 (a)这些贡献是完全或者部分的由我创建,我有权利以文件中指出
257 的开放源代码许可证提交它;或者
258 (b)这些贡献基于以前的工作,据我所知,这些以前的工作受恰当的开放
259 源代码许可证保护,而且,根据许可证,我有权提交修改后的贡献,
260 无论是完全还是部分由我创造,这些贡献都使用同一个开放源代码许可证
261 (除非我被允许用其它的许可证),正如文件中指出的;或者
262 (c)这些贡献由认证(a),(b)或者(c)的人直接提供给我,而
263 且我没有修改它。
264 (d)我理解并同意这个项目和贡献是公开的,贡献的记录(包括我
265 一起提交的个人记录,包括 sign-off )被永久维护并且可以和这个项目
266 或者开放源代码的许可证同步地再发行。
267 那么加入这样一行:
268 Signed-off-by: Random J Developer <random@developer.example.org>
269
270使用你的真名(抱歉,不能使用假名或者匿名。)
271
272有人在最后加上标签。现在这些东西会被忽略,但是你可以这样做,来标记公司
273内部的过程,或者只是指出关于 sign-off 的一些特殊细节。
274
27512)标准补丁格式
276
277标准的补丁,标题行是:
278 Subject: [PATCH 001/123] 子系统:一句话概述
279
280标准补丁的信体存在如下部分:
281
282 - 一个 "from" 行指出补丁作者。
283
284 - 一个空行
285
286 - 说明的主体,这些说明文字会被拷贝到描述该补丁的永久改动记录里。
287
288 - 一个由"---"构成的标记行
289
290 - 不合适放到改动记录里的额外的注解。
291
292 - 补丁本身(diff 输出)
293
294标题行的格式,使得对标题行按字母序排序非常的容易 - 很多 e-mail 客户端都
295可以支持 - 因为序列号是用零填充的,所以按数字排序和按字母排序是一样的。
296
297e-mail 标题中的“子系统”标识哪个内核子系统将被打补丁。
298
299e-mail 标题中的“一句话概述”扼要的描述 e-mail 中的补丁。“一句话概述”
300不应该是一个文件名。对于一个补丁系列(“补丁系列”指一系列的多个相关补
301丁),不要对每个补丁都使用同样的“一句话概述”。
302
303记住 e-mail 的“一句话概述”会成为该补丁的全局唯一标识。它会蔓延到 git
304的改动记录里。然后“一句话概述”会被用在开发者的讨论里,用来指代这个补
305丁。用户将希望通过 google 来搜索"一句话概述"来找到那些讨论这个补丁的文
306章。
307
308一些标题的例子:
309
310 Subject: [patch 2/5] ext2: improve scalability of bitmap searching
311 Subject: [PATCHv2 001/207] x86: fix eflags tracking
312
313"from" 行是信体里的最上面一行,具有如下格式:
314 From: Original Author <author@example.com>
315
316"from" 行指明在永久改动日志里,谁会被确认为作者。如果没有 "from" 行,那
317么邮件头里的 "From: " 行会被用来决定改动日志中的作者。
318
319说明的主题将会被提交到永久的源代码改动日志里,因此对那些早已经不记得和
320这个补丁相关的讨论细节的有能力的读者来说,是有意义的。
321
322"---" 标记行对于补丁处理工具要找到哪里是改动日志信息的结束,是不可缺少
323的。
324
325对于 "---" 标记之后的额外注解,一个好的用途就是用来写 diffstat,用来显
326示修改了什么文件和每个文件都增加和删除了多少行。diffstat 对于比较大的补
327丁特别有用。其余那些只是和时刻或者开发者相关的注解,不合适放到永久的改
328动日志里的,也应该放这里。
329使用 diffstat的选项 "-p 1 -w 70" 这样文件名就会从内核源代码树的目录开始
330,不会占用太宽的空间(很容易适合80列的宽度,也许会有一些缩进。)
331
332在后面的参考资料中能看到适当的补丁格式的更多细节。
333
334-------------------------------
335第二节 提示,建议和诀窍
336-------------------------------
337
338本节包含很多和提交到内核的代码有关的通常的"规则"。事情永远有例外...但是
339你必须真的有好的理由这样做。你可以把本节叫做Linus的计算机科学入门课。
340
3411) 读 Document/process/coding-style.rst
342
343Nuff 说过,如果你的代码和这个偏离太多,那么它有可能会被拒绝,没有更多的
344审查,没有更多的评价。
345
3462) #ifdef 是丑陋的
347混杂了 ifdef 的代码难以阅读和维护。别这样做。作为替代,将你的 ifdef 放
348在头文件里,有条件地定义 "static inline" 函数,或者宏,在代码里用这些东
349西。让编译器把那些"空操作"优化掉。
350
351一个简单的例子,不好的代码:
352
353 dev = alloc_etherdev (sizeof(struct funky_private));
354 if (!dev)
355 return -ENODEV;
356 #ifdef CONFIG_NET_FUNKINESS
357 init_funky_net(dev);
358 #endif
359
360清理后的例子:
361
362(头文件里)
363 #ifndef CONFIG_NET_FUNKINESS
364 static inline void init_funky_net (struct net_device *d) {}
365 #endif
366
367(代码文件里)
368 dev = alloc_etherdev (sizeof(struct funky_private));
369 if (!dev)
370 return -ENODEV;
371 init_funky_net(dev);
372
3733) 'static inline' 比宏好
374
375Static inline 函数相比宏来说,是好得多的选择。Static inline 函数提供了
376类型安全,没有长度限制,没有格式限制,在 gcc 下开销和宏一样小。
377
378宏只在 static inline 函数不是最优的时候[在 fast paths 里有很少的独立的
379案例],或者不可能用 static inline 函数的时候[例如字符串分配]。
380应该用 'static inline' 而不是 'static __inline__', 'extern inline' 和
381'extern __inline__' 。
382
3834) 不要过度设计
384
385不要试图预计模糊的未来事情,这些事情也许有用也许没有用:"让事情尽可能的
386简单,而不是更简单"。
387
388----------------
389第三节 参考文献
390----------------
391
392Andrew Morton, "The perfect patch" (tpp).
393 <http://www.ozlabs.org/~akpm/stuff/tpp.txt>
394
395Jeff Garzik, "Linux kernel patch submission format".
396 <http://linux.yyz.us/patch-format.html>
397
398Greg Kroah-Hartman, "How to piss off a kernel subsystem maintainer".
399 <http://www.kroah.com/log/2005/03/31/>
400 <http://www.kroah.com/log/2005/07/08/>
401 <http://www.kroah.com/log/2005/10/19/>
402 <http://www.kroah.com/log/2006/01/11/>
403
404NO!!!! No more huge patch bombs to linux-kernel@vger.kernel.org people!
405 <https://lkml.org/lkml/2005/7/11/336>
406
407Kernel Documentation/process/coding-style.rst:
408 <http://sosdg.org/~coywolf/lxr/source/Documentation/process/coding-style.rst>
409
410Linus Torvalds's mail on the canonical patch format:
411 <http://lkml.org/lkml/2005/4/7/183>
412--
diff --git a/Documentation/translations/zh_CN/disclaimer-zh_CN.rst b/Documentation/translations/zh_CN/disclaimer-zh_CN.rst
new file mode 100644
index 000000000000..dcf803ede85a
--- /dev/null
+++ b/Documentation/translations/zh_CN/disclaimer-zh_CN.rst
@@ -0,0 +1,9 @@
1:orphan:
2
3.. warning::
4 此文件的目的是为让中文读者更容易阅读和理解,而不是作为一个分支。 因此,
5 如果您对此文件有任何意见或更新,请先尝试更新原始英文文件。
6
7.. note::
8 如果您发现本文档与原始文件有任何不同或者有翻译问题,请联系该文件的译者,
9 或者请求时奎亮的帮助:<alex.shi@linux.alibaba.com>。
diff --git a/Documentation/translations/zh_CN/index.rst b/Documentation/translations/zh_CN/index.rst
index 75956d669962..d3165535ec9e 100644
--- a/Documentation/translations/zh_CN/index.rst
+++ b/Documentation/translations/zh_CN/index.rst
@@ -3,10 +3,19 @@
3 \renewcommand\thesection* 3 \renewcommand\thesection*
4 \renewcommand\thesubsection* 4 \renewcommand\thesubsection*
5 5
6Chinese translations 6中文翻译
7==================== 7========
8
9这些手册包含有关如何开发内核的整体信息。内核社区非常庞大,一年下来有数千名开发
10人员做出贡献。 与任何大型社区一样,知道如何完成任务将使得更改合并的过程变得更
11加容易。
8 12
9.. toctree:: 13.. toctree::
10 :maxdepth: 1 14 :maxdepth: 2
15
16 process/index
17
18目录和表格
19----------
11 20
12 coding-style 21* :ref:`genindex`
diff --git a/Documentation/translations/zh_CN/magic-number.txt b/Documentation/translations/zh_CN/magic-number.txt
deleted file mode 100644
index 7159cec04090..000000000000
--- a/Documentation/translations/zh_CN/magic-number.txt
+++ /dev/null
@@ -1,153 +0,0 @@
1Chinese translated version of Documentation/process/magic-number.rst
2
3If you have any comment or update to the content, please post to LKML directly.
4However, if you have problem communicating in English you can also ask the
5Chinese maintainer for help. Contact the Chinese maintainer, if this
6translation is outdated or there is problem with translation.
7
8Chinese maintainer: Jia Wei Wei <harryxiyou@gmail.com>
9---------------------------------------------------------------------
10Documentation/process/magic-number.rst的中文翻译
11
12如果想评论或更新本文的内容,请直接发信到LKML。如果你使用英文交流有困难的话,也可
13以向中文版维护者求助。如果本翻译更新不及时或者翻译存在问题,请联系中文版维护者。
14
15中文版维护者: 贾威威 Jia Wei Wei <harryxiyou@gmail.com>
16中文版翻译者: 贾威威 Jia Wei Wei <harryxiyou@gmail.com>
17中文版校译者: 贾威威 Jia Wei Wei <harryxiyou@gmail.com>
18
19以下为正文
20---------------------------------------------------------------------
21这个文件是有关当前使用的魔术值注册表。当你给一个结构添加了一个魔术值,你也应该把这个魔术值添加到这个文件,因为我们最好把用于各种结构的魔术值统一起来。
22
23使用魔术值来保护内核数据结构是一个非常好的主意。这就允许你在运行期检查(a)一个结构是否已经被攻击,或者(b)你已经给一个例行程序通过了一个错误的结构。后一种情况特别地有用---特别是当你通过一个空指针指向结构体的时候。tty源码,例如,经常通过特定驱动使用这种方法并且反复地排列特定方面的结构。
24
25使用魔术值的方法是在结构的开始处声明的,如下:
26
27struct tty_ldisc {
28 int magic;
29 ...
30};
31
32当你以后给内核添加增强功能的时候,请遵守这条规则!这样就会节省数不清的调试时间,特别是一些古怪的情况,例如,数组超出范围并且重新写了超出部分。遵守这个规则,‪这些情况可以被快速地,安全地避免。
33
34 Theodore Ts'o
35 31 Mar 94
36
37给当前的Linux 2.1.55添加魔术表。
38
39 Michael Chastain
40 <mailto:mec@shout.net>
41 22 Sep 1997
42
43现在应该最新的Linux 2.1.112.因为在特性冻结期间,不能在2.2.x前改变任何东西。这些条目被数域所排序。
44
45 Krzysztof G.Baranowski
46 <mailto: kgb@knm.org.pl>
47 29 Jul 1998
48
49更新魔术表到Linux 2.5.45。刚好越过特性冻结,但是有可能还会有一些新的魔术值在2.6.x之前融入到内核中。
50
51 Petr Baudis
52 <pasky@ucw.cz>
53 03 Nov 2002
54
55更新魔术表到Linux 2.5.74。
56
57 Fabian Frederick
58 <ffrederick@users.sourceforge.net>
59 09 Jul 2003
60
61魔术名 地址 结构 所在文件
62===========================================================================
63PG_MAGIC 'P' pg_{read,write}_hdr include/linux/pg.h
64CMAGIC 0x0111 user include/linux/a.out.h
65MKISS_DRIVER_MAGIC 0x04bf mkiss_channel drivers/net/mkiss.h
66HDLC_MAGIC 0x239e n_hdlc drivers/char/n_hdlc.c
67APM_BIOS_MAGIC 0x4101 apm_user arch/x86/kernel/apm_32.c
68CYCLADES_MAGIC 0x4359 cyclades_port include/linux/cyclades.h
69DB_MAGIC 0x4442 fc_info drivers/net/iph5526_novram.c
70DL_MAGIC 0x444d fc_info drivers/net/iph5526_novram.c
71FASYNC_MAGIC 0x4601 fasync_struct include/linux/fs.h
72FF_MAGIC 0x4646 fc_info drivers/net/iph5526_novram.c
73ISICOM_MAGIC 0x4d54 isi_port include/linux/isicom.h
74PTY_MAGIC 0x5001 drivers/char/pty.c
75PPP_MAGIC 0x5002 ppp include/linux/if_pppvar.h
76SERIAL_MAGIC 0x5301 async_struct include/linux/serial.h
77SSTATE_MAGIC 0x5302 serial_state include/linux/serial.h
78SLIP_MAGIC 0x5302 slip drivers/net/slip.h
79STRIP_MAGIC 0x5303 strip drivers/net/strip.c
80X25_ASY_MAGIC 0x5303 x25_asy drivers/net/x25_asy.h
81SIXPACK_MAGIC 0x5304 sixpack drivers/net/hamradio/6pack.h
82AX25_MAGIC 0x5316 ax_disp drivers/net/mkiss.h
83TTY_MAGIC 0x5401 tty_struct include/linux/tty.h
84MGSL_MAGIC 0x5401 mgsl_info drivers/char/synclink.c
85TTY_DRIVER_MAGIC 0x5402 tty_driver include/linux/tty_driver.h
86MGSLPC_MAGIC 0x5402 mgslpc_info drivers/char/pcmcia/synclink_cs.c
87TTY_LDISC_MAGIC 0x5403 tty_ldisc include/linux/tty_ldisc.h
88USB_SERIAL_MAGIC 0x6702 usb_serial drivers/usb/serial/usb-serial.h
89FULL_DUPLEX_MAGIC 0x6969 drivers/net/ethernet/dec/tulip/de2104x.c
90USB_BLUETOOTH_MAGIC 0x6d02 usb_bluetooth drivers/usb/class/bluetty.c
91RFCOMM_TTY_MAGIC 0x6d02 net/bluetooth/rfcomm/tty.c
92USB_SERIAL_PORT_MAGIC 0x7301 usb_serial_port drivers/usb/serial/usb-serial.h
93CG_MAGIC 0x00090255 ufs_cylinder_group include/linux/ufs_fs.h
94RPORT_MAGIC 0x00525001 r_port drivers/char/rocket_int.h
95LSEMAGIC 0x05091998 lse drivers/fc4/fc.c
96GDTIOCTL_MAGIC 0x06030f07 gdth_iowr_str drivers/scsi/gdth_ioctl.h
97RIEBL_MAGIC 0x09051990 drivers/net/atarilance.c
98NBD_REQUEST_MAGIC 0x12560953 nbd_request include/linux/nbd.h
99RED_MAGIC2 0x170fc2a5 (any) mm/slab.c
100BAYCOM_MAGIC 0x19730510 baycom_state drivers/net/baycom_epp.c
101ISDN_X25IFACE_MAGIC 0x1e75a2b9 isdn_x25iface_proto_data
102 drivers/isdn/isdn_x25iface.h
103ECP_MAGIC 0x21504345 cdkecpsig include/linux/cdk.h
104LSOMAGIC 0x27091997 lso drivers/fc4/fc.c
105LSMAGIC 0x2a3b4d2a ls drivers/fc4/fc.c
106WANPIPE_MAGIC 0x414C4453 sdla_{dump,exec} include/linux/wanpipe.h
107CS_CARD_MAGIC 0x43525553 cs_card sound/oss/cs46xx.c
108LABELCL_MAGIC 0x4857434c labelcl_info_s include/asm/ia64/sn/labelcl.h
109ISDN_ASYNC_MAGIC 0x49344C01 modem_info include/linux/isdn.h
110CTC_ASYNC_MAGIC 0x49344C01 ctc_tty_info drivers/s390/net/ctctty.c
111ISDN_NET_MAGIC 0x49344C02 isdn_net_local_s drivers/isdn/i4l/isdn_net_lib.h
112SAVEKMSG_MAGIC2 0x4B4D5347 savekmsg arch/*/amiga/config.c
113CS_STATE_MAGIC 0x4c4f4749 cs_state sound/oss/cs46xx.c
114SLAB_C_MAGIC 0x4f17a36d kmem_cache mm/slab.c
115COW_MAGIC 0x4f4f4f4d cow_header_v1 arch/um/drivers/ubd_user.c
116I810_CARD_MAGIC 0x5072696E i810_card sound/oss/i810_audio.c
117TRIDENT_CARD_MAGIC 0x5072696E trident_card sound/oss/trident.c
118ROUTER_MAGIC 0x524d4157 wan_device [in wanrouter.h pre 3.9]
119SAVEKMSG_MAGIC1 0x53415645 savekmsg arch/*/amiga/config.c
120GDA_MAGIC 0x58464552 gda arch/mips/include/asm/sn/gda.h
121RED_MAGIC1 0x5a2cf071 (any) mm/slab.c
122EEPROM_MAGIC_VALUE 0x5ab478d2 lanai_dev drivers/atm/lanai.c
123HDLCDRV_MAGIC 0x5ac6e778 hdlcdrv_state include/linux/hdlcdrv.h
124PCXX_MAGIC 0x5c6df104 channel drivers/char/pcxx.h
125KV_MAGIC 0x5f4b565f kernel_vars_s arch/mips/include/asm/sn/klkernvars.h
126I810_STATE_MAGIC 0x63657373 i810_state sound/oss/i810_audio.c
127TRIDENT_STATE_MAGIC 0x63657373 trient_state sound/oss/trident.c
128M3_CARD_MAGIC 0x646e6f50 m3_card sound/oss/maestro3.c
129FW_HEADER_MAGIC 0x65726F66 fw_header drivers/atm/fore200e.h
130SLOT_MAGIC 0x67267321 slot drivers/hotplug/cpqphp.h
131SLOT_MAGIC 0x67267322 slot drivers/hotplug/acpiphp.h
132LO_MAGIC 0x68797548 nbd_device include/linux/nbd.h
133OPROFILE_MAGIC 0x6f70726f super_block drivers/oprofile/oprofilefs.h
134M3_STATE_MAGIC 0x734d724d m3_state sound/oss/maestro3.c
135VMALLOC_MAGIC 0x87654320 snd_alloc_track sound/core/memory.c
136KMALLOC_MAGIC 0x87654321 snd_alloc_track sound/core/memory.c
137PWC_MAGIC 0x89DC10AB pwc_device drivers/usb/media/pwc.h
138NBD_REPLY_MAGIC 0x96744668 nbd_reply include/linux/nbd.h
139ENI155_MAGIC 0xa54b872d midway_eprom drivers/atm/eni.h
140CODA_MAGIC 0xC0DAC0DA coda_file_info include/linux/coda_fs_i.h
141DPMEM_MAGIC 0xc0ffee11 gdt_pci_sram drivers/scsi/gdth.h
142YAM_MAGIC 0xF10A7654 yam_port drivers/net/hamradio/yam.c
143CCB_MAGIC 0xf2691ad2 ccb drivers/scsi/ncr53c8xx.c
144QUEUE_MAGIC_FREE 0xf7e1c9a3 queue_entry drivers/scsi/arm/queue.c
145QUEUE_MAGIC_USED 0xf7e1cc33 queue_entry drivers/scsi/arm/queue.c
146HTB_CMAGIC 0xFEFAFEF1 htb_class net/sched/sch_htb.c
147NMI_MAGIC 0x48414d4d455201 nmi_s arch/mips/include/asm/sn/nmi.h
148
149请注意,在声音记忆管理中仍然有一些特殊的为每个驱动定义的魔术值。查看include/sound/sndmagic.h来获取他们完整的列表信息。很多OSS声音驱动拥有自己从声卡PCI ID构建的魔术值-他们也没有被列在这里。
150
151IrDA子系统也使用了大量的自己的魔术值,查看include/net/irda/irda.h来获取他们完整的信息。
152
153HFS是另外一个比较大的使用魔术值的文件系统-你可以在fs/hfs/hfs.h中找到他们。
diff --git a/Documentation/translations/zh_CN/oops-tracing.txt b/Documentation/translations/zh_CN/oops-tracing.txt
index a893f04dfd5d..93fa061cf9e4 100644
--- a/Documentation/translations/zh_CN/oops-tracing.txt
+++ b/Documentation/translations/zh_CN/oops-tracing.txt
@@ -16,7 +16,7 @@ Documentation/admin-guide/bug-hunting.rst 的中文翻译
16 16
17中文版维护者: 杨瑞 Dave Young <hidave.darkstar@gmail.com> 17中文版维护者: 杨瑞 Dave Young <hidave.darkstar@gmail.com>
18中文版翻译者: 杨瑞 Dave Young <hidave.darkstar@gmail.com> 18中文版翻译者: 杨瑞 Dave Young <hidave.darkstar@gmail.com>
19中文版校译者: 李阳 Li Yang <leo@zh-kernel.org> 19中文版校译者: 李阳 Li Yang <leoyang.li@nxp.com>
20 王聪 Wang Cong <xiyou.wangcong@gmail.com> 20 王聪 Wang Cong <xiyou.wangcong@gmail.com>
21 21
22以下为正文 22以下为正文
diff --git a/Documentation/translations/zh_CN/process/1.Intro.rst b/Documentation/translations/zh_CN/process/1.Intro.rst
new file mode 100644
index 000000000000..10a15f3dc282
--- /dev/null
+++ b/Documentation/translations/zh_CN/process/1.Intro.rst
@@ -0,0 +1,186 @@
1.. include:: ../disclaimer-zh_CN.rst
2
3:Original: :ref:`Documentation/process/1.Intro.rst <development_process_intro>`
4:Translator: Alex Shi <alex.shi@linux.alibaba.com>
5
6.. _cn_development_process_intro:
7
8介绍
9====
10
11执行摘要
12--------
13
14本节的其余部分涵盖了内核开发过程的范围,以及开发人员及其雇主在这方面可能遇
15到的各种挫折。内核代码应该合并到正式的(“主线”)内核中有很多原因,包括对用
16户的自动可用性、多种形式的社区支持以及影响内核开发方向的能力。提供给Linux
17内核的代码必须在与GPL兼容的许可证下可用。
18
19:ref:`cn_development_process` 介绍了开发过程、内核发布周期和合并窗口的机制。
20涵盖了补丁开发、审查和合并周期中的各个阶段。有一些关于工具和邮件列表的讨论。
21鼓励希望开始内核开发的开发人员作为初始练习跟踪并修复bug。
22
23
24:ref:`cn_development_early_stage` 包括早期项目规划,重点是尽快让开发社区参与
25
26:ref:`cn_development_coding` 是关于编码过程的;讨论了其他开发人员遇到的几个
27陷阱。对补丁的一些要求已经涵盖,并且介绍了一些工具,这些工具有助于确保内核
28补丁是正确的。
29
30:ref:`cn_development_posting` 讨论发布补丁以供评审的过程。为了让开发社区
31认真对待,补丁必须正确格式化和描述,并且必须发送到正确的地方。遵循本节中的
32建议有助于确保为您的工作提供最好的接纳。
33
34:ref:`cn_development_followthrough` 介绍了发布补丁之后发生的事情;该工作
35在这一点上还远远没有完成。与审阅者一起工作是开发过程中的一个重要部分;本节
36提供了一些关于如何在这个重要阶段避免问题的提示。当补丁被合并到主线中时,
37开发人员要注意不要假定任务已经完成。
38
39:ref:`cn_development_advancedtopics` 介绍了两个“高级”主题:
40使用Git管理补丁和查看其他人发布的补丁。
41
42:ref:`cn_development_conclusion` 总结了有关内核开发的更多信息,附带有带有
43指向资源的链接.
44
45这个文件是关于什么的
46--------------------
47
48Linux内核有超过800万行代码,每个版本的贡献者超过1000人,是现存最大、最活跃
49的免费软件项目之一。从1991年开始,这个内核已经发展成为一个最好的操作系统
50组件,运行在袖珍数字音乐播放器、台式PC、现存最大的超级计算机以及所有类型的
51系统上。它是一种适用于几乎任何情况的健壮、高效和可扩展的解决方案。
52
53随着Linux的发展,希望参与其开发的开发人员(和公司)的数量也在增加。硬件供应商
54希望确保Linux能够很好地支持他们的产品,使这些产品对Linux用户具有吸引力。嵌入
55式系统供应商使用Linux作为集成产品的组件,希望Linux能够尽可能地胜任手头的任务。
56分销商和其他基于Linux的软件供应商对Linux内核的功能、性能和可靠性有着明确的
57兴趣。最终用户也常常希望修改Linux,使之更好地满足他们的需求。
58
59Linux最引人注目的特性之一是这些开发人员可以访问它;任何具备必要技能的人都可以
60改进Linux并影响其开发方向。专有产品不能提供这种开放性,这是自由软件的一个特点。
61但是,如果有什么不同的话,内核比大多数其他自由软件项目更开放。一个典型的三个月
62内核开发周期可以涉及1000多个开发人员,他们为100多个不同的公司
63(或者根本没有公司)工作。
64
65与内核开发社区合作并不是特别困难。但是,尽管如此,许多潜在的贡献者在尝试做
66内核工作时遇到了困难。内核社区已经发展了自己独特的操作方式,使其能够在每天
67都要更改数千行代码的环境中顺利运行(并生成高质量的产品)。因此,Linux内核开发
68过程与专有的开发方法有很大的不同也就不足为奇了。
69
70对于新开发人员来说,内核的开发过程可能会让人感到奇怪和恐惧,但这个背后有充分的
71理由和坚实的经验。一个不了解内核社区的方式的开发人员(或者更糟的是,他们试图
72抛弃或规避内核社区的方式)会有一个令人沮丧的体验。开发社区, 在帮助那些试图学习
73的人的同时,没有时间帮助那些不愿意倾听或不关心开发过程的人。
74
75希望阅读本文的人能够避免这种令人沮丧的经历。这里有很多材料,但阅读时所做的
76努力会在短时间内得到回报。开发社区总是需要能让内核变更好的开发人员;下面的
77文本应该帮助您或为您工作的人员加入我们的社区。
78
79致谢
80----
81
82本文件由Jonathan Corbet撰写,corbet@lwn.net。以下人员的建议使之更为完善:
83Johannes Berg, James Berry, Alex Chiang, Roland Dreier, Randy Dunlap,
84Jake Edge, Jiri Kosina, Matt Mackall, Arthur Marsh, Amanda McPherson,
85Andrew Morton, Andrew Price, Tsugikazu Shibata, 和 Jochen Voß.
86
87这项工作得到了Linux基金会的支持,特别感谢Amanda McPherson,他看到了这项工作
88的价值并把它变成现实。
89
90代码进入主线的重要性
91--------------------
92
93有些公司和开发人员偶尔会想,为什么他们要费心学习如何与内核社区合作,并将代码
94放入主线内核(“主线”是由Linus Torvalds维护的内核,Linux发行商将其用作基础)。
95在短期内,贡献代码看起来像是一种可以避免的开销;仅仅将代码分开并直接支持用户
96似乎更容易。事实上,保持代码独立(“树外”)是在经济上是错误的。
97
98作为说明树外代码成本的一种方法,下面是内核开发过程的一些相关方面;本文稍后将
99更详细地讨论其中的大部分内容。考虑:
100
101- 所有Linux用户都可以使用合并到主线内核中的代码。它将自动出现在所有启用它的
102 发行版上。不需要驱动程序磁盘、下载,也不需要为多个发行版的多个版本提供支持;
103 对于开发人员和用户来说,这一切都是可行的。并入主线解决了大量的分布和支持问题
104
105- 当内核开发人员努力维护一个稳定的用户空间接口时,内部内核API处于不断变化之中.
106 缺乏一个稳定的内部接口是一个深思熟虑的设计决策;它允许在任何时候进行基本的改
107 进,并产生更高质量的代码。但该策略的一个结果是,如果要使用新的内核,任何树外
108 代码都需要持续的维护。维护树外代码需要大量的工作才能使代码保持工作状态。
109
110 相反,位于主线中的代码不需要这样做,因为一个简单的规则要求进行API更改的任何
111 开发人员也必须修复由于该更改而破坏的任何代码。因此,合并到主线中的代码大大
112 降低了维护成本。
113
114- 除此之外,内核中的代码通常会被其他开发人员改进。令人惊讶的结果可能来自授权
115 您的用户社区和客户改进您的产品。
116
117- 内核代码在合并到主线之前和之后都要经过审查。不管原始开发人员的技能有多强,
118 这个审查过程总是能找到改进代码的方法。审查经常发现严重的错误和安全问题。
119 这对于在封闭环境中开发的代码尤其如此;这种代码从外部开发人员的审查中获益
120 匪浅。树外代码是低质量代码。
121
122- 参与开发过程是您影响内核开发方向的方式。旁观者的抱怨会被听到,但是活跃的
123 开发人员有更强的声音——并且能够实现使内核更好地满足其需求的更改。
124
125- 当单独维护代码时,总是存在第三方为类似功能提供不同实现的可能性。如果发生
126 这种情况,合并代码将变得更加困难——甚至到了不可能的地步。然后,您将面临以下
127 令人不快的选择:(1)无限期地维护树外的非标准特性,或(2)放弃代码并将用户
128 迁移到树内版本。
129
130- 代码的贡献是使整个过程工作的根本。通过贡献代码,您可以向内核添加新功能,并
131 提供其他内核开发人员使用的功能和示例。如果您已经为Linux开发了代码(或者
132 正在考虑这样做),那么您显然对这个平台的持续成功感兴趣;贡献代码是确保成功
133 的最好方法之一。
134
135上述所有理由都适用于任何树外内核代码,包括以专有的、仅二进制形式分发的代码。
136然而,在考虑任何类型的纯二进制内核代码分布之前,还需要考虑其他因素。这些包括:
137
138- 围绕专有内核模块分发的法律问题充其量是模糊的;相当多的内核版权所有者认为,
139 大多数仅限二进制的模块是内核的派生产品,因此,它们的分发违反了GNU通用公共
140 许可证(下面将详细介绍)。您的作者不是律师,本文档中的任何内容都不可能被
141 视为法律建议。封闭源代码模块的真实法律地位只能由法院决定。但不管怎样,困扰
142 这些模块的不确定性仍然存在。
143
144- 二进制模块大大增加了调试内核问题的难度,以至于大多数内核开发人员甚至都不会
145 尝试。因此,只分发二进制模块将使您的用户更难从社区获得支持。
146
147- 对于只支持二进制的模块的发行者来说,支持也更加困难,他们必须为他们希望支持
148 的每个发行版和每个内核版本提供一个版本的模块。为了提供相当全面的覆盖范围,
149 可能需要一个模块的几十个构建,并且每次升级内核时,您的用户都必须单独升级
150 您的模块。
151
152- 上面提到的关于代码评审的所有问题都更加存在于封闭源代码。由于该代码根本不可
153 用,因此社区无法对其进行审查,毫无疑问,它将存在严重问题。
154
155尤其是嵌入式系统的制造商,可能会倾向于忽视本节中所说的大部分内容,因为他们
156相信自己正在商用一种使用冻结内核版本的独立产品,在发布后不需要再进行开发。
157这个论点忽略了广泛的代码审查的价值以及允许用户向产品添加功能的价值。但这些
158产品也有有限的商业寿命,之后必须发布新版本的产品。在这一点上,代码在主线上
159并得到良好维护的供应商将能够更好地占位,以使新产品快速上市。
160
161许可
162----
163
164代码是根据一些许可证提供给Linux内核的,但是所有代码都必须与GNU通用公共许可
165证(GPLV2)的版本2兼容,该版本是覆盖整个内核分发的许可证。在实践中,这意味
166着所有代码贡献都由GPLv2(可选地,语言允许在更高版本的GPL下分发)或3子句BSD
167许可(New BSD License, 译者注)覆盖。任何不包含在兼容许可证中的贡献都不会
168被接受到内核中。
169
170贡献给内核的代码不需要(或请求)版权分配。合并到主线内核中的所有代码都保留
171其原始所有权;因此,内核现在拥有数千个所有者。
172
173这种所有权结构的一个暗示是,任何改变内核许可的尝试都注定会失败。很少有实际
174的场景可以获得所有版权所有者的同意(或者从内核中删除他们的代码)。因此,特
175别是,在可预见的将来,不可能迁移到GPL的版本3。
176
177所有贡献给内核的代码都必须是合法的免费软件。因此,不接受匿名(或匿名)贡献
178者的代码。所有贡献者都需要在他们的代码上“sign off”,声明代码可以在GPL下与内
179核一起分发。无法提供未被其所有者许可为免费软件的代码,或可能为内核造成版权
180相关问题的代码(例如,由缺乏适当保护的反向工程工作派生的代码)不能被接受。
181
182有关版权相关问题的问题在Linux开发邮件列表中很常见。这样的问题通常会得到不少
183答案,但要记住,回答这些问题的人不是律师,不能提供法律咨询。如果您有关于
184Linux源代码的法律问题,那么与了解该领域的律师交流是无法替代的。依靠从技术
185邮件列表中获得的答案是一件冒险的事情。
186
diff --git a/Documentation/translations/zh_CN/process/2.Process.rst b/Documentation/translations/zh_CN/process/2.Process.rst
new file mode 100644
index 000000000000..ceb733bb0294
--- /dev/null
+++ b/Documentation/translations/zh_CN/process/2.Process.rst
@@ -0,0 +1,360 @@
1.. include:: ../disclaimer-zh_CN.rst
2
3:Original: :ref:`Documentation/process/2.Process.rst <development_process>`
4:Translator: Alex Shi <alex.shi@linux.alibaba.com>
5
6.. _cn_development_process:
7
8开发流程如何工作
9================
10
1190年代早期的Linux内核开发是一件相当松散的事情,涉及的用户和开发人员相对较
12少。由于拥有数以百万计的用户群,并且在一年的时间里有大约2000名开发人员参与
13进来,内核因此必须发展许多流程来保持开发的顺利进行。要成为流程的有效组成
14部分,需要对流程的工作方式有一个扎实的理解。
15
16总览
17----
18
19内核开发人员使用一个松散的基于时间的发布过程,每两到三个月发布一次新的主要
20内核版本。最近的发布历史记录如下:
21
22 ====== =================
23 4.11 四月 30, 2017
24 4.12 七月 2, 2017
25 4.13 九月 3, 2017
26 4.14 十一月 12, 2017
27 4.15 一月 28, 2018
28 4.16 四月 1, 2018
29 ====== =================
30
31每4.x版本都是一个主要的内核版本,具有新特性、内部API更改等等。一个典型的4.x
32版本包含大约13000个变更集,变更了几十万行代码。因此,4.x是Linux内核开发的前
33沿;内核使用滚动开发模型,不断集成重大变化。
34
35对于每个版本的补丁合并,遵循一个相对简单的规则。在每个开发周期的开始,“合并
36窗口”被打开。当时,被认为足够稳定(并且被开发社区接受)的代码被合并到主线内
37核中。在这段时间内,新开发周期的大部分变更(以及所有主要变更)将以接近每天
381000次变更(“补丁”或“变更集”)的速度合并。
39
40(顺便说一句,值得注意的是,合并窗口期间集成的更改并不是凭空产生的;它们是
41提前收集、测试和分级的。稍后将详细描述该过程的工作方式)。
42
43合并窗口持续大约两周。在这段时间结束时,LinusTorvalds将声明窗口已关闭,并
44释放第一个“rc”内核。例如,对于目标为4.14的内核,在合并窗口结束时发生的释放
45将被称为4.14-rc1。RC1版本是一个信号,表示合并新特性的时间已经过去,稳定下一
46个内核的时间已经开始。
47
48在接下来的6到10周内,只有修复问题的补丁才应该提交给主线。有时会允许更大的
49更改,但这种情况很少发生;试图在合并窗口外合并新功能的开发人员往往会受到不
50友好的接待。一般来说,如果您错过了给定特性的合并窗口,最好的做法是等待下一
51个开发周期。(对于以前不支持的硬件,偶尔会对驱动程序进行例外;如果它们不
52改变已有代码,则不会导致回归,并且应该可以随时安全地添加)。
53
54随着修复程序进入主线,补丁速度将随着时间的推移而变慢。Linus大约每周发布一次
55新的-rc内核;一个正常的系列将在-rc6和-rc9之间,内核被认为足够稳定并最终发布。
56然后,整个过程又重新开始了。
57
58例如,这里是4.16的开发周期进行情况(2018年的所有日期):
59
60 ============== ==============================
61 一月 28 4.15 稳定版发布
62 二月 11 4.16-rc1, 合并窗口关闭
63 二月 18 4.16-rc2
64 二月 25 4.16-rc3
65 三月 4 4.16-rc4
66 三月 11 4.16-rc5
67 三月 18 4.16-rc6
68 三月 25 4.16-rc7
69 四月 1 4.16 稳定版发布
70 ============== ==============================
71
72开发人员如何决定何时结束开发周期并创建稳定的版本?使用的最重要的指标是以前
73版本的回归列表。不欢迎出现任何错误,但是那些破坏了以前能工作的系统的错误被
74认为是特别严重的。因此,导致回归的补丁是不受欢迎的,很可能在稳定期内删除。
75
76开发人员的目标是在稳定发布之前修复所有已知的回归。在现实世界中,这种完美是
77很难实现的;在这种规模的项目中,变量太多了。有一点,延迟最终版本只会使问题
78变得更糟;等待下一个合并窗口的一堆更改将变大,从而在下次创建更多的回归错误。
79因此,大多数4.x内核都有一些已知的回归错误,不过,希望没有一个是严重的。
80
81一旦一个稳定的版本发布,它正在进行的维护工作就被移交给“稳定团队”,目前由
82Greg Kroah-Hartman组成。稳定团队将使用4.x.y编号方案不定期的发布稳定版本的更
83新。要加入更新版本,补丁程序必须(1)修复一个重要的bug,(2)已经合并到
84下一个开发主线中。内核通常会在超过其初始版本的一个以上的开发周期内接收稳定
85的更新。例如,4.13内核的历史如下
86
87 ============== ===============================
88 九月 3 4.13 稳定版发布
89 九月 13 4.13.1
90 九月 20 4.13.2
91 九月 27 4.13.3
92 十月 5 4.13.4
93 十月 12 4.13.5
94 ... ...
95 十一月 24 4.13.16
96 ============== ===============================
97
984.13.16是4.13版本的最终稳定更新。
99
100有些内核被指定为“长期”内核;它们将得到更长时间的支持。在本文中,当前的长期
101内核及其维护者是:
102
103 ====== ====================== ==============================
104 3.16 Ben Hutchings (长期稳定内核)
105 4.1 Sasha Levin
106 4.4 Greg Kroah-Hartman (长期稳定内核)
107 4.9 Greg Kroah-Hartman
108 4.14 Greg Kroah-Hartman
109 ====== ====================== ==============================
110
111为长期支持选择内核纯粹是维护人员有必要和时间来维护该版本的问题。目前还没有
112为即将发布的任何特定版本提供长期支持的已知计划。
113
114补丁的生命周期
115--------------
116
117补丁不会直接从开发人员的键盘进入主线内核。相反,有一个稍微复杂(如果有些非
118正式)的过程,旨在确保对每个补丁进行质量审查,并确保每个补丁实现了一个在主线
119中需要的更改。对于小的修复,这个过程可能会很快发生,或者,在大的和有争议的
120变更的情况下,会持续数年。许多开发人员的挫折来自于对这个过程缺乏理解或者
121试图绕过它。
122
123为了减少这种挫折感,本文将描述补丁如何进入内核。下面是一个介绍,它以某种
124理想化的方式描述了这个过程。更详细的过程将在后面的章节中介绍。
125
126补丁程序经历的阶段通常是:
127
128- 设计。这就是补丁的真正需求——以及满足这些需求的方式——的所在。设计工作通常
129 是在不涉及社区的情况下完成的,但是如果可能的话,最好是在公开的情况下完成
130 这项工作;这样可以节省很多稍后再重新设计的时间。
131
132- 早期评审。补丁被发布到相关的邮件列表中,列表中的开发人员会回复他们可能有
133 的任何评论。如果一切顺利的话,这个过程应该会发现补丁的任何主要问题。
134
135- 更广泛的评审。当补丁接近准备好纳入主线时,它应该被相关的子系统维护人员
136 接受——尽管这种接受并不能保证补丁会一直延伸到主线。补丁将出现在维护人员的
137 子系统树中,并进入 -next 树(如下所述)。当流程工作时,此步骤将导致对补丁
138 进行更广泛的审查,并发现由于将此补丁与其他人所做的工作集成而导致的任何
139 问题。
140
141- 请注意,大多数维护人员也有日常工作,因此合并补丁可能不是他们的最高优先级。
142 如果您的补丁程序得到了关于所需更改的反馈,那么您应该进行这些更改,或者为
143 不应该进行这些更改的原因辩护。如果您的补丁没有评审意见,但没有被其相应的
144 子系统或驱动程序维护者接受,那么您应该坚持不懈地将补丁更新到当前内核,使
145 其干净地应用,并不断地将其发送以供审查和合并。
146
147- 合并到主线。最终,一个成功的补丁将被合并到由LinusTorvalds管理的主线存储库
148 中。此时可能会出现更多的评论和/或问题;开发人员应对这些问题并解决出现的
149 任何问题很重要。
150
151- 稳定版发布。可能受补丁影响的用户数量现在很大,因此可能再次出现新的问题。
152
153- 长期维护。虽然开发人员在合并代码后可能会忘记代码,但这种行为往往会给开发
154 社区留下不良印象。合并代码消除了一些维护负担,因为其他代码将修复由API
155 更改引起的问题。但是,如果代码要长期保持有用,原始开发人员应该继续为
156 代码负责。
157
158内核开发人员(或他们的雇主)犯的最大错误之一是试图将流程简化为一个
159“合并到主线”步骤。这种方法总是会让所有相关人员感到沮丧。
160
161补丁如何进入内核
162----------------
163
164只有一个人可以将补丁合并到主线内核存储库中:LinusTorvalds。但是,在进入
1652.6.38内核的9500多个补丁中,只有112个(大约1.3%)是由Linus自己直接选择的。
166内核项目已经发展到一个规模,没有一个开发人员可以在没有支持的情况下检查和
167选择每个补丁。内核开发人员处理这种增长的方式是通过使用围绕信任链构建的
168助理系统。
169
170内核代码库在逻辑上被分解为一组子系统:网络、特定的体系结构支持、内存管理、
171视频设备等。大多数子系统都有一个指定的维护人员,开发人员对该子系统中的代码
172负有全部责任。这些子系统维护者(松散地)是他们所管理的内核部分的守护者;
173他们(通常)会接受一个补丁以包含到主线内核中。
174
175子系统维护人员每个人都使用git源代码管理工具管理自己版本的内核源代码树。Git
176等工具(以及Quilt或Mercurial等相关工具)允许维护人员跟踪补丁列表,包括作者
177信息和其他元数据。在任何给定的时间,维护人员都可以确定他或她的存储库中的哪
178些补丁在主线中找不到。
179
180当合并窗口打开时,顶级维护人员将要求Linus从其存储库中“拉出”他们为合并选择
181的补丁。如果Linus同意,补丁流将流向他的存储库,成为主线内核的一部分。
182Linus对拉操作中接收到的特定补丁的关注程度各不相同。很明显,有时他看起来很
183关注。但是,作为一般规则,Linus相信子系统维护人员不会向上游发送坏补丁。
184
185子系统维护人员反过来也可以从其他维护人员那里获取补丁。例如,网络树是由首先
186在专用于网络设备驱动程序、无线网络等的树中积累的补丁构建的。此存储链可以
187任意长,但很少超过两个或三个链接。由于链中的每个维护者都信任那些管理较低
188级别树的维护者,所以这个过程称为“信任链”。
189
190显然,在这样的系统中,获取内核补丁取决于找到正确的维护者。直接向Linus发送
191补丁通常不是正确的方法。
192
193Next 树
194-------
195
196子系统树链引导补丁流到内核,但它也提出了一个有趣的问题:如果有人想查看为
197下一个合并窗口准备的所有补丁怎么办?开发人员将感兴趣的是,还有什么其他的
198更改有待解决,以查看是否存在需要担心的冲突;例如,更改核心内核函数原型的
199修补程序将与使用该函数旧形式的任何其他修补程序冲突。审查人员和测试人员希望
200在所有这些变更到达主线内核之前,能够访问它们的集成形式中的变更。您可以从所有
201有趣的子系统树中提取更改,但这将是一项大型且容易出错的工作。
202
203答案以-next树的形式出现,在这里子系统树被收集以供测试和审查。Andrew Morton
204维护的这些旧树被称为“-mm”(用于内存管理,这就是它的启动名字)。-mm 树集成了
205一长串子系统树中的补丁;它还包含一些旨在帮助调试的补丁。
206
207除此之外,-mm 还包含大量由Andrew直接选择的补丁。这些补丁可能已经发布在邮件
208列表上,或者它们可能应用于内核中没有指定子系统树的部分。结果,-mm 作为一种
209最后手段的子系统树运行;如果没有其他明显的路径可以让补丁进入主线,那么它很
210可能以-mm 结束。累积在-mm 中的各种补丁最终将被转发到适当的子系统树,或者直接
211发送到Linus。在典型的开发周期中,大约5-10%的补丁通过-mm 进入主线。
212
213当前-mm 补丁可在“mmotm”(-mm of the moment)目录中找到,地址:
214
215 http://www.ozlabs.org/~akpm/mmotm/
216
217然而,使用mmotm树可能是一种令人沮丧的体验;它甚至可能无法编译。
218
219下一个周期补丁合并的主要树是linux-next,由Stephen Rothwell 维护。根据设计
220linux-next 是下一个合并窗口关闭后主线的快照。linux-next树在Linux-kernel 和
221Linux-next 邮件列表中发布,可从以下位置下载:
222
223 http://www.kernel.org/pub/linux/kernel/next/
224
225Linux-next 已经成为内核开发过程中不可或缺的一部分;在一个给定的合并窗口中合并
226的所有补丁都应该在合并窗口打开之前的一段时间内找到进入Linux-next 的方法。
227
228Staging 树
229----------
230
231内核源代码树包含drivers/staging/directory,其中有许多驱动程序或文件系统的
232子目录正在被添加到内核树中。它们然需要更多的工作的时候可以保留在
233driver/staging目录中;一旦完成,就可以将它们移到内核中。这是一种跟踪不符合
234Linux内核编码或质量标准的驱动程序的方法,但人们可能希望使用它们并跟踪开发。
235
236Greg Kroah Hartman 目前负责维护staging 树。仍需要工作的驱动程序将发送给他,
237每个驱动程序在drivers/staging/中都有自己的子目录。除了驱动程序源文件之外,
238目录中还应该有一个TODO文件。todo文件列出了驱动程序需要接受的挂起的工作,
239以及驱动程序的任何补丁都应该抄送的人员列表。当前的规则要求,staging的驱动
240程序必须至少正确编译。
241
242Staging 是一种相对容易的方法,可以让新的驱动程序进入主线,幸运的是,他们会
243引起其他开发人员的注意,并迅速改进。然而,进入staging并不是故事的结尾;
244staging中没有看到常规进展的代码最终将被删除。经销商也倾向于相对不愿意使用
245staging驱动程序。因此,在成为一名合适的主线驱动的路上,staging 充其量只是
246一个停留。
247
248工具
249----
250
251从上面的文本可以看出,内核开发过程在很大程度上依赖于在不同方向上聚集补丁的
252能力。如果没有适当强大的工具,整个系统将无法在任何地方正常工作。关于如何使用
253这些工具的教程远远超出了本文档的范围,但是还是有一些指南的空间。
254
255到目前为止,内核社区使用的主要源代码管理系统是git。Git是在自由软件社区中开发
256的许多分布式版本控制系统之一。它非常适合内核开发,因为它在处理大型存储库和
257大量补丁时性能非常好。它还有一个难以学习和使用的名声,尽管随着时间的推移它
258变得更好了。对于内核开发人员来说,对Git的某种熟悉几乎是一种要求;即使他们不
259将它用于自己的工作,他们也需要Git来跟上其他开发人员(以及主线)正在做的事情。
260
261现在几乎所有的Linux发行版都打包了Git。主页位于:
262
263 http://git-scm.com/
264
265那个页面有指向文档和教程的指针。
266
267在不使用git的内核开发人员中,最流行的选择几乎肯定是mercurial:
268
269 http://www.seleric.com/mercurial/
270
271Mercurial与Git共享许多特性,但它提供了一个界面,许多人觉得它更易于使用。
272
273另一个值得了解的工具是quilt:
274
275 http://savannah.nongnu.org/projects/quilt
276
277Quilt 是一个补丁管理系统,而不是源代码管理系统。它不会随着时间的推移跟踪历史;
278相反,它面向根据不断发展的代码库跟踪一组特定的更改。一些主要的子系统维护人员
279使用Quilt来管理打算向上游移动的补丁。对于某些树的管理(例如-mm),quilt 是
280最好的工具。
281
282邮件列表
283--------
284
285大量的Linux内核开发工作是通过邮件列表完成的。如果不在某个地方加入至少一个列表,
286就很难成为社区中一个功能完备的成员。但是,Linux邮件列表对开发人员来说也是一个
287潜在的危险,他们可能会被一堆电子邮件淹没,违反Linux列表上使用的约定,或者
288两者兼而有之。
289
290大多数内核邮件列表都在vger.kernel.org上运行;主列表位于:
291
292 http://vger.kernel.org/vger-lists.html
293
294不过,也有一些列表托管在别处;其中一些列表位于lists.redhat.com。
295
296当然,内核开发的核心邮件列表是linux-kernel。这个名单是一个令人生畏的地方;
297每天的信息量可以达到500条,噪音很高,谈话技术性很强,参与者并不总是表现出
298高度的礼貌。但是,没有其他地方可以让内核开发社区作为一个整体聚集在一起;
299避免使用此列表的开发人员将错过重要信息。
300
301有一些提示可以帮助在linux-kernel生存:
302
303- 将邮件转移到单独的文件夹,而不是主邮箱。我们必须能够持续地忽略洪流。
304
305- 不要试图跟踪每一次谈话-其他人都不会。重要的是要对感兴趣的主题(尽管请
306 注意,长时间的对话可以在不更改电子邮件主题行的情况下偏离原始主题)和参与
307 的人进行筛选。
308
309- 不要挑事。如果有人试图激起愤怒的反应,忽略他们。
310
311- 当响应Linux内核电子邮件(或其他列表上的电子邮件)时,请为所有相关人员保留
312 cc:header。如果没有强有力的理由(如明确的请求),则不应删除收件人。一定要
313 确保你要回复的人在cc:list中。这个惯例也使你不必在回复邮件时明确要求被抄送。
314
315- 在提出问题之前,搜索列表档案(和整个网络)。有些开发人员可能会对那些显然
316 没有完成家庭作业的人感到不耐烦。
317
318- 避免贴顶帖(把你的答案放在你要回复的引文上面的做法)。这会让你的回答更难
319 理解,印象也很差。
320
321- 询问正确的邮件列表。linux-kernel 可能是通用的讨论点,但它不是从所有子系统
322 中寻找开发人员的最佳场所。
323
324最后一点——找到正确的邮件列表——是开发人员出错的常见地方。在Linux内核上提出与
325网络相关的问题的人几乎肯定会收到一个礼貌的建议,转而在netdev列表上提出,
326因为这是大多数网络开发人员经常出现的列表。还有其他列表可用于scsi、
327video4linux、ide、filesystem等子系统。查找邮件列表的最佳位置是与内核源代码
328一起打包的MAINTAINERS文件。
329
330开始内核开发
331------------
332
333关于如何开始内核开发过程的问题很常见——来自个人和公司。同样常见的是错误,这
334使得关系的开始比必须的更困难。
335
336公司通常希望聘请知名的开发人员来启动开发团队。实际上,这是一种有效的技术。
337但它也往往是昂贵的,而且没有增长经验丰富的内核开发人员储备。考虑到时间的
338投入,可以让内部开发人员加快Linux内核的开发速度。花这个时间可以让雇主拥有
339一批了解内核和公司的开发人员,他们也可以帮助培训其他人。从中期来看,这往往
340是更有利可图的方法。
341
342可以理解的是,单个开发人员往往对起步感到茫然。从一个大型项目开始可能会很
343吓人;人们往往想先用一些较小的东西来测试水域。这是一些开发人员开始创建修补
344拼写错误或轻微编码风格问题的补丁的地方。不幸的是,这样的补丁会产生一定程度
345的噪音,这会分散整个开发社区的注意力,因此,越来越多的人看不起它们。希望向
346社区介绍自己的新开发人员将无法通过这些方式获得他们想要的那种接待。
347
348Andrew Morton 为有抱负的内核开发人员提供了这个建议
349
350::
351
352 所有内核初学者的No.1项目肯定是“确保内核在所有的机器上,你可以触摸
353 到的,始终运行良好" 通常这样做的方法是与其他人一起解决问题(这
354 可能需要坚持!)但这很好——这是内核开发的一部分
355
356(http://lwn.net/articles/283982/)
357
358在没有明显问题需要解决的情况下,建议开发人员查看当前的回归和开放式错误列表.
359解决需要修复的问题没有任何缺点;通过解决这些问题,开发人员将获得处理过程的
360经验,同时与开发社区的其他人建立尊重。
diff --git a/Documentation/translations/zh_CN/process/3.Early-stage.rst b/Documentation/translations/zh_CN/process/3.Early-stage.rst
new file mode 100644
index 000000000000..b8676aec6005
--- /dev/null
+++ b/Documentation/translations/zh_CN/process/3.Early-stage.rst
@@ -0,0 +1,161 @@
1.. include:: ../disclaimer-zh_CN.rst
2
3:Original: :ref:`Documentation/process/3.Early-stage.rst <development_early_stage>`
4:Translator: Alex Shi <alex.shi@linux.alibaba.com>
5
6.. _cn_development_early_stage:
7
8早期规划
9========
10
11当考虑一个Linux内核开发项目时,很可能会直接跳进去开始编码。然而,与任何重要
12的项目一样,成功的许多基础最好是在第一行代码编写之前就做好了。在早期计划和
13沟通中花费一些时间可以节省更多的时间。
14
15详述问题
16--------
17
18与任何工程项目一样,成功的内核增强从要解决的问题的清晰描述开始。在某些情况
19下,这个步骤很容易:例如,当某个特定硬件需要驱动程序时。不过,在其他方面,
20将实际问题与建议的解决方案混淆是很有诱惑力的,这可能会导致困难。
21
22举个例子:几年前,使用Linux音频的开发人员寻求一种方法来运行应用程序,而不因
23系统延迟过大而导致退出或其他工件。他们得到的解决方案是一个内核模块,旨在连
24接到Linux安全模块(LSM)框架中;这个模块可以配置为允许特定的应用程序访问
25实时调度程序。这个模块被实现并发送到Linux内核邮件列表,在那里它立即遇到问题。
26
27对于音频开发人员来说,这个安全模块足以解决他们当前的问题。但是,对于更广泛的
28内核社区来说,这被视为对LSM框架的滥用(LSM框架并不打算授予他们原本不具备的
29进程特权),并对系统稳定性造成风险。他们首选的解决方案包括短期的通过rlimit
30机制进行实时调度访问,以及长期的减少延迟的工作。
31
32然而,音频社区看不到他们实施的特定解决方案的过去;他们不愿意接受替代方案。
33由此产生的分歧使这些开发人员对整个内核开发过程感到失望;其中一个开发人员返回
34到音频列表并发布了以下内容:
35
36 有很多非常好的Linux内核开发人员,但他们往往会被一群傲慢的傻瓜所压倒。
37 试图向这些人传达用户需求是浪费时间。他们太“聪明”了,根本听不到少数人
38 的话。
39
40(http://lwn.net/articles/131776/)
41
42实际情况不同;与特定模块相比,内核开发人员更关心系统稳定性、长期维护以及找到
43正确的问题解决方案。这个故事的寓意是把重点放在问题上——而不是具体的解决方案
44上——并在投入创建代码之前与开发社区讨论这个问题。
45
46因此,在考虑一个内核开发项目时,我们应该得到一组简短问题的答案:
47
48 - 究竟需要解决的问题是什么?
49
50 - 受此问题影响的用户是谁?解决方案应该解决哪些用例?
51
52 - 内核现在为何没能解决这个问题?
53
54只有这样,才能开始考虑可能的解决方案。
55
56
57早期讨论
58--------
59
60在计划内核开发项目时,在开始实施之前与社区进行讨论是很有意义的。早期沟通可以
61通过多种方式节省时间和麻烦:
62
63 - 很可能问题是由内核以您不理解的方式解决的。Linux内核很大,具有许多不明显
64 的特性和功能。并不是所有的内核功能都像人们所希望的那样有文档记录,而且很
65 容易遗漏一些东西。你的作者发出了一个完整的驱动程序,复制了一个新作者不
66 知道的现有驱动程序。重新设计现有轮子的代码不仅浪费,而且不会被接受到主线
67 内核中。
68
69 - 建议的解决方案中可能有一些元素不适用于主线合并。在编写代码之前,最好先
70 了解这样的问题。
71
72 - 其他开发人员完全有可能考虑过这个问题;他们可能有更好的解决方案的想法,并且
73 可能愿意帮助创建这个解决方案。
74
75在内核开发社区的多年经验给了我们一个明确的教训:闭门设计和开发的内核代码总是
76有一些问题,这些问题只有在代码发布到社区中时才会被发现。有时这些问题很严重,
77需要数月或数年的努力才能使代码达到内核社区的标准。一些例子包括:
78
79 - 设计并实现了单处理器系统的DeviceScape网络栈。只有使其适合于多处理器系统,
80 才能将其合并到主线中。在代码中改装锁等等是一项困难的任务;因此,这段代码
81 (现在称为mac80211)的合并被推迟了一年多。
82
83 - Reiser4文件系统包含许多功能,核心内核开发人员认为这些功能应该在虚拟文件
84 系统层中实现。它还包括一些特性,这些特性在不将系统暴露于用户引起的死锁的
85 情况下是不容易实现的。这些问题的最新发现——以及对其中一些问题的拒绝——已经
86 导致Reiser4远离了主线内核。
87
88 - Apparmor安全模块以被认为不安全和不可靠的方式使用内部虚拟文件系统数据结构。
89 这种担心(包括其他)使Apparmor多年不在主线上。
90
91在每一种情况下,通过与内核开发人员的早期讨论,可以避免大量的痛苦和额外的工作。
92
93找谁交流
94--------
95
96当开发人员决定公开他们的计划时,下一个问题是:我们从哪里开始?答案是找到正确
97的邮件列表和正确的维护者。对于邮件列表,最好的方法是在维护者(MAINTAINERS)文件
98中查找要发布的相关位置。如果有一个合适的子系统列表,那么发布它通常比在Linux
99内核上发布更可取;您更有可能接触到在相关子系统中具有专业知识的开发人员,并且
100环境可能具支持性。
101
102找到维护人员可能会有点困难。同样,维护者文件是开始的地方。但是,该文件往往不总
103是最新的,并且并非所有子系统都在那里表示。实际上,维护者文件中列出的人员可能
104不是当前实际担任该角色的人员。因此,当对联系谁有疑问时,一个有用的技巧是使用
105git(尤其是“git-log”)查看感兴趣的子系统中当前活动的用户。看看谁在写补丁,
106如果有人的话,谁会在这些补丁上加上用线签名的。这些人将是帮助新开发项目的最佳
107人选。
108
109找到合适的维护者的任务有时是非常具有挑战性的,以至于内核开发人员添加了一个
110脚本来简化过程:
111
112::
113
114 .../scripts/get_maintainer.pl
115
116当给定“-f”选项时,此脚本将返回给定文件或目录的当前维护者。如果在命令行上传递
117了一个补丁,它将列出可能接收补丁副本的维护人员。有许多选项可以调节
118get_maintainer.pl搜索维护者的难易程度;请小心使用更具攻击性的选项,因为最终
119可能会包括对您正在修改的代码没有真正兴趣的开发人员。
120
121如果所有其他方法都失败了,那么与Andrew Morton交谈可以成为一种有效的方法来跟踪
122特定代码段的维护人员。
123
124何时邮寄?
125----------
126
127如果可能的话,在早期阶段发布你的计划只会有帮助。描述正在解决的问题以及已经
128制定的关于如何实施的任何计划。您可以提供的任何信息都可以帮助开发社区为项目
129提供有用的输入。
130
131在这个阶段可能发生的一件令人沮丧的事情不是敌对的反应,而是很少或根本没有
132反应。可悲的事实是:(1)内核开发人员往往很忙;(2)不缺少有宏伟计划和很少
133代码(甚至代码前景)支持他们的人;(3)没有人有义务审查或评论别人发表的
134想法。除此之外,高级设计常常隐藏一些问题,这些问题只有在有人真正尝试实现
135这些设计时才会被发现;因此,内核开发人员宁愿看到代码。
136
137如果发表评论的请求在评论的方式上没有什么效果,不要假设这意味着对项目没有
138兴趣。不幸的是,你也不能假设你的想法没有问题。在这种情况下,最好的做法是
139继续进行,把你的进展随时通知社区。
140
141获得官方认可
142-----------------------
143
144如果您的工作是在公司环境中完成的,就像大多数Linux内核工作一样,显然,在您将
145公司的计划或代码发布到公共邮件列表之前,必须获得适当授权的经理的许可。发布
146不确定是否兼容GPL的代码可能是有特别问题的;公司的管理层和法律人员越早能够就
147发布内核开发项目达成一致,对参与的每个人都越好。
148
149一些读者可能会认为他们的核心工作是为了支持还没有正式承认存在的产品。将雇主
150的计划公布在公共邮件列表上可能不是一个可行的选择。在这种情况下,有必要考虑
151保密是否真的是必要的;通常不需要把开发计划关在门内。
152
153也就是说,有些情况下,一家公司在开发过程的早期就不能合法地披露其计划。拥有
154经验丰富的内核开发人员的公司可以选择以开环的方式进行,前提是他们以后能够避免
155严重的集成问题。对于没有这种内部专业知识的公司,最好的选择往往是聘请外部
156开发商根据保密协议审查计划。Linux基金会运行了一个NDA程序,旨在帮助解决这种
157情况;
158
159 http://www.linuxfoundation.org/en/NDA_program
160
161这种审查通常足以避免以后出现严重问题,而无需公开披露项目。
diff --git a/Documentation/translations/zh_CN/process/4.Coding.rst b/Documentation/translations/zh_CN/process/4.Coding.rst
new file mode 100644
index 000000000000..5301e9d55255
--- /dev/null
+++ b/Documentation/translations/zh_CN/process/4.Coding.rst
@@ -0,0 +1,290 @@
1.. include:: ../disclaimer-zh_CN.rst
2
3:Original: :ref:`Documentation/process/4.Coding.rst <development_coding>`
4:Translator: Alex Shi <alex.shi@linux.alibaba.com>
5
6.. _cn_development_coding:
7
8使代码正确
9======================
10
11虽然对于一个坚实的、面向社区的设计过程有很多话要说,但是任何内核开发项目的
12证明都在生成的代码中。它是将由其他开发人员检查并合并(或不合并)到主线树中
13的代码。所以这段代码的质量决定了项目的最终成功。
14
15本节将检查编码过程。我们将从内核开发人员出错的几种方式开始。然后重点将转移
16到正确的事情和可以帮助这个任务的工具上。
17
18陷阱
19----
20
21编码风格
22********
23
24内核长期以来都有一种标准的编码风格,如
25:ref:`Documentation/translations/zh_CN/process/coding-style.rst <cn_codingstyle>`
26中所述。在大部分时间里,该文件中描述的政策被认为至多是建议性的。因此,内核
27中存在大量不符合编码风格准则的代码。代码的存在会给内核开发人员带来两个独立
28的危害。
29
30首先,要相信内核编码标准并不重要,也不强制执行。事实上,如果没有按照标准对代
31码进行编码,那么向内核添加新代码是非常困难的;许多开发人员甚至会在审查代码之
32前要求对代码进行重新格式化。一个与内核一样大的代码库需要一些统一的代码,以使
33开发人员能够快速理解其中的任何部分。所以已经没有空间来存放奇怪的格式化代码了。
34
35偶尔,内核的编码风格会与雇主的强制风格发生冲突。在这种情况下,内核的风格必须
36在代码合并之前获胜。将代码放入内核意味着以多种方式放弃一定程度的控制权——包括
37控制代码的格式化方式。
38
39另一个陷阱是假定已经在内核中的代码迫切需要编码样式的修复。开发人员可能会开始
40生成重新格式化补丁,作为熟悉过程的一种方式,或者作为将其名称写入内核变更日志
41的一种方式,或者两者兼而有之。但是纯编码风格的修复被开发社区视为噪音;它们往
42往受到冷遇。因此,最好避免使用这种类型的补丁。由于其他原因,在处理一段代码的
43同时修复它的样式是很自然的,但是编码样式的更改不应该仅为了更改而进行。
44
45编码风格的文档也不应该被视为绝对的法律,这是永远不会被违反的。如果有一个很好
46的理由反对这种样式(例如,如果拆分为适合80列限制的行,那么它的可读性就会大大
47降低),那么就这样做。
48
49请注意,您还可以使用 ``clang-format`` 工具来帮助您处理这些规则,自动重新格式
50化部分代码,并查看完整的文件,以发现编码样式错误、拼写错误和可能的改进。它还
51可以方便地进行排序,包括对齐变量/宏、回流文本和其他类似任务。有关详细信息,请
52参阅文件 :ref:`Documentation/process/clang-format.rst <clangformat>`
53
54抽象层
55******
56
57计算机科学教授教学生以灵活性和信息隐藏的名义广泛使用抽象层。当然,内核广泛
58地使用了抽象;任何涉及数百万行代码的项目都不能做到这一点并存活下来。但经验
59表明,过度或过早的抽象可能和过早的优化一样有害。抽象应用于所需的级别,
60不要过度。
61
62在一个简单的级别上,考虑一个函数的参数,该参数总是由所有调用方作为零传递。
63我们可以保留这个论点: 以防有人最终需要使用它提供的额外灵活性。不过,到那时,
64实现这个额外参数的代码很有可能以某种从未被注意到的微妙方式被破坏——因为它从
65未被使用过。或者,当需要额外的灵活性时,它不会以符合程序员早期期望的方式来
66这样做。内核开发人员通常会提交补丁来删除未使用的参数;一般来说,首先不应该
67添加这些参数。
68
69隐藏硬件访问的抽象层——通常允许大量的驱动程序在多个操作系统中使用——尤其不受
70欢迎。这样的层使代码变得模糊,可能会造成性能损失;它们不属于Linux内核。
71
72另一方面,如果您发现自己从另一个内核子系统复制了大量的代码,那么现在是时候
73问一下,事实上,将这些代码中的一些提取到单独的库中,或者在更高的层次上实现
74这些功能是否有意义。在整个内核中复制相同的代码没有价值。
75
76#ifdef 和预处理
77***************
78
79C预处理器似乎给一些C程序员带来了强大的诱惑,他们认为它是一种有效地将大量灵
80活性编码到源文件中的方法。但是预处理器不是C,大量使用它会导致代码对其他人来
81说更难读取,对编译器来说更难检查正确性。大量的预处理器几乎总是代码需要一些
82清理工作的标志。
83
84使用ifdef的条件编译实际上是一个强大的功能,它在内核中使用。但是很少有人希望
85看到代码被大量地撒上ifdef块。作为一般规则,ifdef的使用应尽可能限制在头文件
86中。有条件编译的代码可以限制函数,如果代码不存在,这些函数就会变成空的。然后
87编译器将悄悄地优化对空函数的调用。结果是代码更加清晰,更容易理解。
88
89C预处理器宏存在许多危险,包括可能对具有副作用且没有类型安全性的表达式进行多
90重评估。如果您试图定义宏,请考虑创建一个内联函数。结果相同的代码,但是内联
91函数更容易读取,不会多次计算其参数,并且允许编译器对参数和返回值执行类型检查。
92
93内联函数
94********
95
96不过,内联函数本身也存在风险。程序员可以倾心于避免函数调用和用内联函数填充源
97文件所固有的效率。然而,这些功能实际上会降低性能。因为它们的代码在每个调用站
98点都被复制,所以它们最终会增加编译内核的大小。反过来,这会对处理器的内存缓存
99造成压力,从而大大降低执行速度。通常,内联函数应该非常小,而且相对较少。毕竟,
100函数调用的成本并不高;大量内联函数的创建是过早优化的典型例子。
101
102一般来说,内核程序员会忽略缓存效果,这会带来危险。在开始的数据结构课程中,经
103典的时间/空间权衡通常不适用于当代硬件。空间就是时间,因为一个大的程序比一个
104更紧凑的程序运行得慢。
105
106最近的编译器在决定一个给定函数是否应该被内联方面扮演着越来越积极的角色。
107因此,“inline”关键字的自由放置可能不仅仅是过度的,它也可能是无关的。
108
109
110**
111
1122006年5月,“deviceescape”网络堆栈在GPL下发布,并被纳入主线内核。这是一个受
113欢迎的消息;对Linux中无线网络的支持充其量被认为是不合格的,而deviceescape
114堆栈提供了修复这种情况的承诺。然而,直到2007年6月(2.6.22),这段代码才真
115正进入主线。发生了什么?
116
117这段代码显示了许多闭门造车的迹象。但一个特别大的问题是,它并不是设计用于多
118处理器系统。在合并这个网络堆栈(现在称为mac80211)之前,需要对其进行一个锁
119方案的改造。
120
121曾经,Linux内核代码可以在不考虑多处理器系统所带来的并发性问题的情况下进行
122开发。然而,现在,这个文件是写在双核笔记本电脑上的。即使在单处理器系统上,
123为提高响应能力所做的工作也会提高内核内的并发性水平。编写内核代码而不考虑锁
124的日子已经过去很长了。
125
126可以由多个线程并发访问的任何资源(数据结构、硬件寄存器等)必须由锁保护。新
127的代码应该记住这一要求;事后改装锁是一项相当困难的任务。内核开发人员应该花
128时间充分了解可用的锁原语,以便为作业选择正确的工具。显示对并发性缺乏关注的
129代码进入主线将很困难。
130
131回归
132****
133
134最后一个值得一提的危险是:它可能会引起改变(这可能会带来很大的改进),从而
135导致现有用户的某些东西中断。这种变化被称为“回归”,回归已经成为主线内核最不
136受欢迎的。除少数例外情况外,如果回归不能及时修正,会导致回归的变化将被取消。
137最好首先避免回归。
138
139人们常常争论,如果回归让更多人可以工作,远超过产生问题,那么回归是合理的。
140如果它破坏的一个系统却为十个系统带来新的功能,为什么不进行更改呢?2007年7月,
141Linus对这个问题给出了最佳答案:
142
143::
144 所以我们不会通过引入新问题来修复错误。那样的谎言很疯狂,没有人知道
145 你是否真的有进展。是前进两步,后退一步,还是向前一步,向后两步?
146
147(http://lwn.net/articles/243460/)
148
149一种特别不受欢迎的回归类型是用户空间ABI的任何变化。一旦接口被导出到用户空间,
150就必须无限期地支持它。这一事实使得用户空间接口的创建特别具有挑战性:因为它们
151不能以不兼容的方式进行更改,所以必须第一次正确地进行更改。因此,用户空间界面
152总是需要大量的思考、清晰的文档和广泛的审查。
153
154
155代码检查工具
156------------
157
158至少目前,编写无错误代码仍然是我们中很少人能达到的理想状态。不过,我们希望做
159的是,在代码进入主线内核之前,尽可能多地捕获并修复这些错误。为此,内核开发人
160员已经组装了一系列令人印象深刻的工具,可以自动捕获各种各样的模糊问题。计算机
161发现的任何问题都是一个以后不会困扰用户的问题,因此,只要有可能,就应该使用
162自动化工具。
163
164第一步只是注意编译器产生的警告。当代版本的GCC可以检测(并警告)大量潜在错误。
165通常,这些警告都指向真正的问题。提交以供审阅的代码通常不会产生任何编译器警告。
166在消除警告时,注意了解真正的原因,并尽量避免“修复”,使警告消失而不解决其原因。
167
168请注意,并非所有编译器警告都默认启用。使用“make EXTRA_CFLAGS=-W”构建内核以
169获得完整集合。
170
171内核提供了几个配置选项,可以打开调试功能;大多数配置选项位于“kernel hacking”
172子菜单中。对于任何用于开发或测试目的的内核,都应该启用其中几个选项。特别是,
173您应该打开:
174
175 - 启用 ENABLE_MUST_CHECK and FRAME_WARN 以获得一组额外的警告,以解决使用不
176 推荐使用的接口或忽略函数的重要返回值等问题。这些警告生成的输出可能是冗长
177 的,但您不必担心来自内核其他部分的警告。
178
179 - DEBUG_OBJECTS 将添加代码,以跟踪内核创建的各种对象的生存期,并在出现问题时
180 发出警告。如果要添加创建(和导出)自己的复杂对象的子系统,请考虑添加对对象
181 调试基础结构的支持。
182
183 - DEBUG_SLAB 可以发现各种内存分配和使用错误;它应该用于大多数开发内核。
184
185 - DEBUG_SPINLOCK, DEBUG_ATOMIC_SLEEP and DEBUG_MUTEXES 会发现许多常见的
186 锁定错误.
187
188还有很多其他调试选项,其中一些将在下面讨论。其中一些具有显著的性能影响,不应
189一直使用。但是,在学习可用选项上花费的一些时间可能会在短期内得到多次回报。
190
191其中一个较重的调试工具是锁定检查器或“lockdep”。该工具将跟踪系统中每个锁
192(spinlock或mutex)的获取和释放、获取锁的相对顺序、当前中断环境等等。然后,
193它可以确保总是以相同的顺序获取锁,相同的中断假设适用于所有情况,等等。换句话
194说,lockdep可以找到许多场景,在这些场景中,系统很少会死锁。在部署的系统中,
195这种问题可能会很痛苦(对于开发人员和用户而言);LockDep允许提前以自动方式
196发现问题。具有任何类型的非普通锁定的代码在提交包含前应在启用lockdep的情况
197下运行。
198
199作为一个勤奋的内核程序员,毫无疑问,您将检查任何可能失败的操作(如内存分配)
200的返回状态。然而,事实上,最终的故障恢复路径可能完全没有经过测试。未测试的
201代码往往会被破坏;如果所有这些错误处理路径都被执行了几次,那么您可能对代码
202更有信心。
203
204内核提供了一个可以做到这一点的错误注入框架,特别是在涉及内存分配的情况下。
205启用故障注入后,内存分配的可配置百分比将失败;这些失败可以限制在特定的代码
206范围内。在启用了故障注入的情况下运行,程序员可以看到当情况恶化时代码如何响
207应。有关如何使用此工具的详细信息,请参阅
208Documentation/fault-injection/fault-injection.txt。
209
210使用“sparse”静态分析工具可以发现其他类型的错误。对于sparse,可以警告程序员
211用户空间和内核空间地址之间的混淆、big endian和small endian数量的混合、在需
212要一组位标志的地方传递整数值等等。sparse必须单独安装(如果您的分发服务器没
213有将其打包,可以在 https://sparse.wiki.kernel.org/index.php/Main_page)找到,
214然后可以通过在make命令中添加“C=1”在代码上运行它。
215
216“Coccinelle”工具 :ref:`http://coccinelle.lip6.fr/ <devtools_coccinelle>`
217能够发现各种潜在的编码问题;它还可以为这些问题提出修复方案。在
218scripts/coccinelle目录下已经打包了相当多的内核“语义补丁”;运行
219“make coccicheck”将运行这些语义补丁并报告发现的任何问题。有关详细信息,请参阅
220:ref:`Documentation/dev-tools/coccinelle.rst <devtools_coccinelle>`
221
222
223其他类型的可移植性错误最好通过为其他体系结构编译代码来发现。如果没有S/390系统
224或Blackfin开发板,您仍然可以执行编译步骤。可以在以下位置找到一组用于x86系统的
225大型交叉编译器:
226
227 http://www.kernel.org/pub/tools/crosstool/
228
229花一些时间安装和使用这些编译器将有助于避免以后的尴尬。
230
231文档
232----
233
234文档通常比内核开发规则更为例外。即便如此,足够的文档将有助于简化将新代码合并
235到内核中的过程,使其他开发人员的生活更轻松,并对您的用户有所帮助。在许多情况
236下,文件的添加已基本上成为强制性的。
237
238任何补丁的第一个文档是其关联的变更日志。日志条目应该描述正在解决的问题、解决
239方案的形式、处理补丁的人员、对性能的任何相关影响,以及理解补丁可能需要的任何
240其他内容。确保changelog说明了为什么补丁值得应用;大量开发人员未能提供这些信息。
241
242任何添加新用户空间界面的代码(包括新的sysfs或/proc文件)都应该包含该界面的
243文档,该文档使用户空间开发人员能够知道他们在使用什么。请参阅
244Documentation/abi/readme,了解如何格式化此文档以及需要提供哪些信息。
245
246文件 :ref:`Documentation/admin-guide/kernel-parameters.rst <kernelparameters>`
247描述了内核的所有引导时间参数。任何添加新参数的补丁都应该向该文件添加适当的
248条目。
249
250任何新的配置选项都必须附有帮助文本,帮助文本清楚地解释了这些选项以及用户可能
251希望何时选择它们。
252
253许多子系统的内部API信息通过专门格式化的注释进行记录;这些注释可以通过
254“kernel-doc”脚本以多种方式提取和格式化。如果您在具有kerneldoc注释的子系统中
255工作,则应该维护它们,并根据需要为外部可用的功能添加它们。即使在没有如此记录
256的领域中,为将来添加kerneldoc注释也没有坏处;实际上,这对于刚开始开发内核的人
257来说是一个有用的活动。这些注释的格式以及如何创建kerneldoc模板的一些信息可以在
258:ref:`Documentation/doc-guide/ <doc_guide>` 上找到。
259
260任何阅读大量现有内核代码的人都会注意到,注释的缺失往往是最值得注意的。再一次,
261对新代码的期望比过去更高;合并未注释的代码将更加困难。这就是说,人们几乎不希望
262用语言注释代码。代码本身应该是可读的,注释解释了更微妙的方面。
263
264某些事情应该总是被注释。使用内存屏障时,应附上一行文字,解释为什么需要设置内存
265屏障。数据结构的锁定规则通常需要在某个地方解释。一般来说,主要数据结构需要全面
266的文档。应该指出单独代码位之间不明显的依赖性。任何可能诱使代码看门人进行错误的
267“清理”的事情都需要一个注释来说明为什么要这样做。等等。
268
269
270内部API更改
271-----------
272
273内核提供给用户空间的二进制接口不能被破坏,除非在最严重的情况下。相反,内核的
274内部编程接口是高度流动的,当需要时可以更改。如果你发现自己不得不处理一个内核
275API,或者仅仅因为它不满足你的需求而不使用特定的功能,这可能是API需要改变的一
276个标志。作为内核开发人员,您有权进行此类更改。
277
278当然, 可以进行API更改,但它们必须是合理的。因此,任何进行内部API更改的补丁都
279应该附带一个关于更改内容和必要原因的描述。这种变化也应该分解成一个单独的补丁,
280而不是埋在一个更大的补丁中。
281
282另一个要点是,更改内部API的开发人员通常要负责修复内核树中被更改破坏的任何代码。
283对于一个广泛使用的函数,这个职责可以导致成百上千的变化,其中许多变化可能与其他
284开发人员正在做的工作相冲突。不用说,这可能是一项大工作,所以最好确保理由是
285可靠的。请注意,coccinelle工具可以帮助进行广泛的API更改。
286
287在进行不兼容的API更改时,应尽可能确保编译器捕获未更新的代码。这将帮助您确保找
288到该接口的树内用处。它还将警告开发人员树外代码存在他们需要响应的更改。支持树外
289代码不是内核开发人员需要担心的事情,但是我们也不必使树外开发人员的生活有不必要
290的困难。
diff --git a/Documentation/translations/zh_CN/process/5.Posting.rst b/Documentation/translations/zh_CN/process/5.Posting.rst
new file mode 100644
index 000000000000..41aba21ff050
--- /dev/null
+++ b/Documentation/translations/zh_CN/process/5.Posting.rst
@@ -0,0 +1,240 @@
1.. include:: ../disclaimer-zh_CN.rst
2
3:Original: :ref:`Documentation/process/5.Posting.rst <development_posting>`
4:Translator: Alex Shi <alex.shi@linux.alibaba.com>
5
6.. _cn_development_posting:
7
8发送补丁
9========
10
11迟早,当您的工作准备好提交给社区进行审查,并最终包含到主线内核中时。不出所料,
12内核开发社区已经发展出一套用于发布补丁的约定和过程;遵循这些约定和过程将使
13参与其中的每个人的生活更加轻松。本文件将试图合理详细地涵盖这些期望;更多信息
14也可在以下文件中找到
15:ref:`Documentation/translations/zh_CN/process/submitting-patches.rst <cn_submittingpatches>`,
16:ref:`Documentation/process/submitting-drivers.rst <submittingdrivers>`
17和 :ref:`Documentation/translations/zh_CN/process/submit-checklist.rst <cn_submitchecklist>`.
18
19何时邮寄
20--------
21
22在补丁完全“准备好”之前,有一个不断的诱惑来避免发布补丁。对于简单的补丁,
23这不是问题。但是,如果正在完成的工作很复杂,那么在工作完成之前从社区获得
24反馈就可以获得很多好处。因此,您应该考虑发布正在进行的工作,甚至使Git树
25可用,以便感兴趣的开发人员可以随时赶上您的工作。
26
27当发布还没有准备好包含的代码时,最好在发布本身中这样说。还应提及任何有待完成
28的主要工作和任何已知问题。很少有人会看到那些被认为是半生不熟的补丁,但是那些
29人会想到他们可以帮助你把工作推向正确的方向。
30
31创建补丁之前
32------------
33
34在考虑将补丁发送到开发社区之前,有许多事情应该做。这些包括:
35
36 - 尽可能地测试代码。利用内核的调试工具,确保内核使用所有合理的配置选项组合
37 进行构建,使用跨编译器为不同的体系结构进行构建等。
38
39 - 确保您的代码符合内核编码风格指南。
40
41 - 您的更改是否具有性能影响?如果是这样,您应该运行基准测试来显示您的变更的
42 影响(或好处);结果的摘要应该包含在补丁中。
43
44 - 确保您有权发布代码。如果这项工作是为雇主完成的,雇主对这项工作具有所有权,
45 并且必须同意根据GPL对其进行放行。
46
47一般来说,在发布代码之前进行一些额外的思考,几乎总是能在短时间内得到回报。
48
49补丁准备
50--------
51
52准备发布补丁可能是一个惊人的工作量,但再次尝试节省时间在这里通常是不明智的,
53即使在短期内。
54
55必须针对内核的特定版本准备补丁。作为一般规则,补丁程序应该基于Linus的Git树中
56的当前主线。当以主线为基础时,从一个众所周知的发布点开始——一个稳定的或RC的
57发布——而不是在一个主线分支任意点。
58
59但是,可能需要针对-mm、linux-next或子系统树生成版本,以便于更广泛的测试和审查。
60根据补丁的区域以及其他地方的情况,针对这些其他树建立补丁可能需要大量的工作来
61解决冲突和处理API更改。
62
63只有最简单的更改才应格式化为单个补丁;其他所有更改都应作为一系列逻辑更改进行。
64分割补丁是一门艺术;一些开发人员花了很长时间来弄清楚如何按照社区期望的方式来
65做。然而,有一些经验法则可以大大帮助:
66
67 - 您发布的补丁程序系列几乎肯定不会是工作系统中的一系列更改。相反,您所做的
68 更改需要在最终形式中加以考虑,然后以有意义的方式进行拆分。开发人员对离散的、
69 自包含的更改感兴趣,而不是您获取这些更改的路径。
70
71 - 每个逻辑上独立的变更都应该格式化为单独的补丁。这些更改可以是小的(“向此
72 结构添加字段”)或大的(例如,添加一个重要的新驱动程序),但它们在概念上
73 应该是小的,并且可以接受一行描述。每个补丁都应该做一个特定的更改,可以单独
74 检查并验证它所做的事情。
75
76 - 作为重申上述准则的一种方法:不要在同一补丁中混合不同类型的更改。如果一个
77 补丁修复了一个关键的安全漏洞,重新排列了一些结构,并重新格式化了代码,那么
78 很有可能它会被忽略,而重要的修复将丢失。
79
80 - 每个补丁都应该产生一个内核,它可以正确地构建和运行;如果补丁系列在中间被
81 中断,那么结果应该仍然是一个工作的内核。补丁系列的部分应用是使用
82 “git bisct”工具查找回归的一个常见场景;如果结果是一个损坏的内核,那么对于
83 那些从事追踪问题的高尚工作的开发人员和用户来说,将使他们的生活更加艰难。
84
85 - 不过,不要过分。一位开发人员曾经将一组编辑内容作为500个单独的补丁发布到一个
86 文件中,这并没有使他成为内核邮件列表中最受欢迎的人。一个补丁可以相当大,
87 只要它仍然包含一个单一的逻辑变更。
88
89 - 用一系列补丁添加一个全新的基础设施是很有诱惑力的,但是在系列中的最后一个
90 补丁启用整个补丁之前,该基础设施是不使用的。如果可能的话,应该避免这种
91 诱惑;如果这个系列增加了回归,那么二分法将指出最后一个补丁是导致问题的
92 补丁,即使真正的bug在其他地方。只要有可能,添加新代码的补丁程序应该立即
93 激活该代码。
94
95创建完美补丁系列的工作可能是一个令人沮丧的过程,在完成“真正的工作”之后需要花费
96大量的时间和思考。但是,如果做得好,这是一段很好的时间。
97
98补丁格式和更改日志
99------------------
100
101所以现在你有了一系列完美的补丁可以发布,但是这项工作还没有完成。每个补丁都
102需要被格式化成一条消息,它可以快速而清晰地将其目的传达给世界其他地方。为此,
103每个补丁将由以下部分组成:
104
105 - 命名补丁作者的可选“from”行。只有当你通过电子邮件传递别人的补丁时,这一行
106 才是必要的,但是如果有疑问,添加它不会有任何伤害。
107
108 - 一行描述补丁的作用。对于没有其他上下文的读者来说,此消息应该足够了解补丁
109 的范围;这是将在“短格式”变更日志中显示的行。此消息通常首先用相关的子系统
110 名称格式化,然后是补丁的目的。例如:
111
112 ::
113
114 gpio: fix build on CONFIG_GPIO_SYSFS=n
115
116 - 一个空白行,后面是补丁内容的详细描述。这个描述可以是必需的;它应该说明补丁
117 的作用以及为什么它应该应用于内核。
118
119 - 一个或多个标记行,至少有一个由补丁作者的:signed-off-by 签名。签名将在下面
120 更详细地描述。
121
122上面的项目一起构成补丁的变更日志。写一篇好的变更日志是一门至关重要但常常被
123忽视的艺术;值得花一点时间来讨论这个问题。当你写一个变更日志时,你应该记住
124有很多不同的人会读你的话。其中包括子系统维护人员和审查人员,他们需要决定是否
125应该包括补丁,分销商和其他维护人员试图决定是否应该将补丁反向移植到其他内核,
126bug搜寻人员想知道补丁是否负责他们正在追查的问题,想知道内核如何变化的用户。
127等等。一个好的变更日志以最直接和最简洁的方式向所有这些人传达所需的信息。
128
129为此,总结行应该描述变更的影响和动机,以及在一行约束条件下可能发生的变化。
130然后,详细的描述可以详述这些主题,并提供任何需要的附加信息。如果补丁修复了
131一个bug,请引用引入该bug的commit(如果可能,请在引用commits时同时提供commit id
132和标题)。如果某个问题与特定的日志或编译器输出相关联,请包含该输出以帮助其他
133人搜索同一问题的解决方案。如果更改是为了支持以后补丁中的其他更改,那么就这么
134说。如果更改了内部API,请详细说明这些更改以及其他开发人员应该如何响应。一般
135来说,你越能把自己放在每个阅读你的changelog的人的位置上,changelog(和内核
136作为一个整体)就越好。
137
138不用说,变更日志应该是将变更提交到修订控制系统时使用的文本。接下来是:
139
140 - 补丁本身,采用统一的(“-u”)补丁格式。将“-p”选项用于diff将使函数名与更改
141 相关联,从而使结果补丁更容易被其他人读取。
142
143您应该避免在补丁中包括对不相关文件(例如,由构建过程生成的文件或编辑器
144备份文件)的更改。文档目录中的文件“dontdiff”在这方面有帮助;使用“-X”选项将
145其传递给diff。
146
147上面提到的标签用于描述各种开发人员如何与这个补丁的开发相关联。
148:ref:`Documentation/translations/zh_CN/process/submitting-patches.rst <cn_submittingpatches>`
149文档中对它们进行了详细描述;下面是一个简短的总结。每一行的格式如下:
150
151::
152
153 tag: Full Name <email address> optional-other-stuff
154
155常用的标签有:
156
157 - Signed-off-by: 这是一个开发人员的证明,他或她有权提交补丁以包含到内核中。
158 这是开发来源认证协议,其全文可在
159 :ref:`Documentation/translations/zh_CN/process/submitting-patches.rst <cn_submittingpatches>`
160 中找到,如果没有适当的签字,则不能合并到主线中。
161
162 - Co-developed-by: 声明补丁是由多个开发人员共同创建的;当几个人在一个补丁上
163 工作时,它用于将属性赋予共同作者(除了 From: 所赋予的作者之外)。因为
164 Co-developed-by: 表示作者身份,所以每个共同开发人, 必须紧跟在相关合作作者
165 的签名之后。具体内容和示例可以在以下文件中找到
166 :ref:`Documentation/translations/zh_CN/process/submitting-patches.rst <cn_submittingpatches>`
167
168 - Acked-by: 表示另一个开发人员(通常是相关代码的维护人员)同意补丁适合包含
169 在内核中。
170
171 - Tested-by: 声明指定的人已经测试了补丁并发现它可以工作。
172
173 - Reviewed-by: 指定的开发人员已经审查了补丁的正确性;有关详细信息,请参阅
174 :ref:`Documentation/translations/zh_CN/process/submitting-patches.rst <cn_submittingpatches>`
175
176 - Reported-by: 指定报告此补丁修复的问题的用户;此标记用于提供感谢。
177
178 - Cc:指定的人收到了补丁的副本,并有机会对此发表评论。
179
180在补丁中添加标签时要小心:只有cc:才适合在没有指定人员明确许可的情况下添加。
181
182发送补丁
183--------
184
185在邮寄补丁之前,您还需要注意以下几点:
186
187 - 您确定您的邮件发送程序不会损坏补丁吗?有免费的空白更改或由邮件客户端
188 执行的行包装的补丁不会在另一端复原,并且通常不会进行任何详细检查。如果有
189 任何疑问,把补丁寄给你自己,让你自己相信它是完好无损的。
190
191 :ref:`Documentation/translations/zh_CN/process/email-clients.rst <cn_email_clients>`
192 提供了一些有用的提示,可以让特定的邮件客户机工作以发送补丁。
193
194 - 你确定你的补丁没有愚蠢的错误吗?您应该始终通过scripts/checkpatch.pl运行
195 补丁程序,并解决它提出的投诉。请记住,checkpatch.pl虽然是大量思考内核
196 补丁应该是什么样子的体现,但它并不比您聪明。如果修复checkpatch.pl投诉会
197 使代码变得更糟,请不要这样做。
198
199补丁应始终以纯文本形式发送。请不要将它们作为附件发送;这使得审阅者在答复中更难
200引用补丁的部分。相反,只需将补丁直接放到您的消息中。
201
202邮寄补丁时,重要的是将副本发送给任何可能感兴趣的人。与其他一些项目不同,内核
203鼓励人们错误地发送过多的副本;不要假定相关人员会看到您在邮件列表中的发布。
204尤其是,副本应发送至:
205
206 - 受影响子系统的维护人员。如前所述,维护人员文件是查找这些人员的第一个地方。
207
208 - 其他在同一领域工作的开发人员,尤其是那些现在可能在那里工作的开发人员。使用
209 git查看还有谁修改了您正在处理的文件,这很有帮助。
210
211 - 如果您对错误报告或功能请求做出响应,也可以抄送原始发送人。
212
213 - 将副本发送到相关邮件列表,或者,如果没有其他应用,则发送到Linux内核列表。
214
215 - 如果您正在修复一个bug,请考虑该修复是否应进入下一个稳定更新。如果是这样,
216 stable@vger.kernel.org 应该得到补丁的副本。另外,在补丁本身的标签中添加
217 一个“cc:stable@vger.kernel.org”;这将使稳定团队在修复进入主线时收到通知。
218
219当为一个补丁选择接收者时,最好知道你认为谁最终会接受这个补丁并将其合并。虽然
220可以将补丁直接发送给LinusTorvalds并让他合并,但通常情况下不会这样做。Linus
221很忙,并且有子系统维护人员负责监视内核的特定部分。通常您会希望维护人员合并您
222的补丁。如果没有明显的维护人员,Andrew Morton通常是最后的补丁目标。
223
224补丁需要好的主题行。补丁程序行的规范格式如下:
225
226::
227
228 [PATCH nn/mm] subsys: one-line description of the patch
229
230其中“nn”是补丁的序号,“mm”是系列中补丁的总数,“subsys”是受影响子系统的名称。
231显然,一个单独的补丁可以省略nn/mm。
232
233如果您有一系列重要的补丁,那么通常将介绍性描述作为零部分发送。不过,这种约定
234并没有得到普遍遵循;如果您使用它,请记住简介中的信息不会使它进入内核变更日志。
235因此,请确保补丁本身具有完整的变更日志信息。
236
237一般来说,多部分补丁的第二部分和后续部分应作为对第一部分的回复发送,以便它们
238在接收端都连接在一起。像git和coilt这样的工具有命令,可以通过适当的线程发送
239一组补丁。但是,如果您有一个长系列,并且正在使用git,请远离–chain reply-to
240选项,以避免创建异常深的嵌套。
diff --git a/Documentation/translations/zh_CN/process/6.Followthrough.rst b/Documentation/translations/zh_CN/process/6.Followthrough.rst
new file mode 100644
index 000000000000..f509e077e1cb
--- /dev/null
+++ b/Documentation/translations/zh_CN/process/6.Followthrough.rst
@@ -0,0 +1,145 @@
1.. include:: ../disclaimer-zh_CN.rst
2
3:Original: :ref:`Documentation/process/6.Followthrough.rst <development_followthrough>`
4:Translator: Alex Shi <alex.shi@linux.alibaba.com>
5
6.. _cn_development_followthrough:
7
8跟进
9====
10
11在这一点上,您已经遵循了到目前为止给出的指导方针,并且,随着您自己的工程技能
12的增加,已经发布了一系列完美的补丁。即使是经验丰富的内核开发人员也能犯的最大
13错误之一是,认为他们的工作现在已经完成了。事实上,发布补丁意味着进入流程的下
14一个阶段,可能还需要做很多工作。
15
16一个补丁在第一次发布时就非常出色,没有改进的余地,这是很罕见的。内核开发流程
17认识到这一事实,因此,它非常注重对已发布代码的改进。作为代码的作者,您应该与
18内核社区合作,以确保您的代码符合内核的质量标准。如果不参与这个过程,很可能会
19阻止将补丁包含到主线中。
20
21与审阅者合作
22------------
23
24任何意义上的补丁都会导致其他开发人员在审查代码时发表大量评论。对于许多开发
25人员来说,与审查人员合作可能是内核开发过程中最令人生畏的部分。但是,如果你
26记住一些事情,生活会变得容易得多:
27
28 - 如果你已经很好地解释了你的补丁,评论人员会理解它的价值,以及为什么你会
29 费尽心思去写它。但是这个并不能阻止他们提出一个基本的问题:五年或十年后
30 用这个代码维护一个内核会是什么感觉?你可能被要求做出的许多改变——从编码风格
31 的调整到大量的重写——都来自于对Linux的理解,即从现在起十年后,Linux仍将在
32 开发中。
33
34 - 代码审查是一项艰苦的工作,这是一项相对吃力不讨好的工作;人们记得谁编写了
35 内核代码,但对于那些审查它的人来说,几乎没有什么持久的名声。因此,评论
36 人员可能会变得暴躁,尤其是当他们看到同样的错误被一遍又一遍地犯下时。如果
37 你得到了一个看起来愤怒、侮辱或完全冒犯你的评论,抵制以同样方式回应的冲动。
38 代码审查是关于代码的,而不是关于人的,代码审查人员不会亲自攻击您。
39
40 - 同样,代码审查人员也不想以牺牲你雇主的利益为代价来宣传他们雇主的议程。
41 内核开发人员通常希望今后几年能在内核上工作,但他们明白他们的雇主可能会改
42 变。他们真的,几乎毫无例外地,致力于创造他们所能做到的最好的内核;他们并
43 没有试图给雇主的竞争对手造成不适。
44
45所有这些归根结底都是,当审阅者向您发送评论时,您需要注意他们正在进行的技术
46观察。不要让他们的表达方式或你自己的骄傲阻止这种事情的发生。当你在一个补丁
47上得到评论时,花点时间去理解评论人想说什么。如果可能的话,请修复审阅者要求
48您修复的内容。然后回复审稿人:谢谢他们,并描述你将如何回答他们的问题。
49
50请注意,您不必同意审阅者建议的每个更改。如果您认为审阅者误解了您的代码,请
51解释到底发生了什么。如果您对建议的更改有技术上的异议,请描述它并证明您对该
52问题的解决方案是正确的。如果你的解释有道理,审稿人会接受的。不过,如果你的
53解释不能证明是有说服力的,尤其是当其他人开始同意审稿人的观点时,请花些时间
54重新考虑一下。你很容易对自己解决问题的方法视而不见,以至于你没有意识到某个
55问题根本是错误的,或者你甚至没有解决正确的问题。
56
57Andrew Morton建议,每一条不会导致代码更改的评论都应该导致额外的代码注释;
58这可以帮助未来的评论人员避免出现第一次出现的问题。
59
60一个致命的错误是忽视评论,希望它们会消失。他们不会走的。如果您在没有对之前
61收到的注释做出响应的情况下重新发布代码,那么很可能会发现补丁毫无用处。
62
63说到重新发布代码:请记住,审阅者不会记住您上次发布的代码的所有细节。因此,
64提醒审查人员以前提出的问题以及您如何处理这些问题总是一个好主意;补丁变更
65日志是提供此类信息的好地方。审阅者不必搜索列表档案来熟悉上次所说的内容;
66如果您帮助他们开始运行,当他们重新访问您的代码时,他们的心情会更好。
67
68如果你已经试着做正确的事情,但事情仍然没有进展呢?大多数技术上的分歧都可以
69通过讨论来解决,但有时人们只需要做出决定。如果你真的认为这个决定对你不利,
70你可以试着向更高的权力上诉。在这篇文章中,更高的权力倾向于Andrew Morton。
71Andrew在内核开发社区中受i很大的尊重;他经常为似乎被绝望地阻塞事情清障。
72尽管如此,对Andrew的呼吁不应轻而易举,也不应在所有其他替代方案都被探索之前
73使用。当然,记住,他也可能不同意你的意见。
74
75接下来会发生什么
76----------------
77
78如果一个补丁被认为是添加到内核中的一件好事,并且一旦大多数审查问题得到解决,
79下一步通常是进入子系统维护人员的树中。工作方式因子系统而异;每个维护人员都
80有自己的工作方式。特别是,可能有不止一棵树——一棵树,也许,专门用于计划下一
81个合并窗口的补丁,另一棵树用于长期工作。
82
83对于应用于没有明显子系统树(例如内存管理修补程序)的区域的修补程序,默认树
84通常以-mm结尾。影响多个子系统的补丁也可以最终通过-mm树。
85
86包含在子系统树中可以提高补丁的可见性。现在,使用该树的其他开发人员将默认获
87得补丁。子系统树通常也为Linux提供支持,使其内容对整个开发社区可见。在这一点
88上,您很可能会从一组新的审阅者那里得到更多的评论;这些评论需要像上一轮那样
89得到回答。
90
91在这一点上也会发生什么,这取决于你的补丁的性质,是与其他人正在做的工作发生
92冲突。在最坏的情况下,严重的补丁冲突可能会导致一些工作被搁置,以便剩余的补丁
93可以成形并合并。另一些时候,冲突解决将涉及到与其他开发人员合作,可能还会
94在树之间移动一些补丁,以确保所有的应用都是干净的。这项工作可能是一件痛苦的
95事情,但要计算您的福祉:在Linux下一棵树出现之前,这些冲突通常只在合并窗口
96中出现,必须迅速解决。现在可以在合并窗口打开之前,在空闲时解决这些问题。
97
98有朝一日,如果一切顺利,您将登录并看到您的补丁已经合并到主线内核中。祝贺你!
99然而,一旦庆祝活动完成(并且您已经将自己添加到维护人员文件中),就值得记住
100一个重要的小事实:工作仍然没有完成。并入主线带来了自身的挑战。
101
102首先,补丁的可见性再次提高。可能会有新一轮的开发者评论,他们以前不知道这
103个补丁。忽略它们可能很有诱惑力,因为您的代码不再存在任何被合并的问题。但是,
104要抵制这种诱惑,您仍然需要对有问题或建议的开发人员作出响应。
105
106不过,更重要的是:将代码包含在主线中会将代码交给更大的一组测试人员。即使您
107为尚未提供的硬件提供了驱动程序,您也会惊讶于有多少人会将您的代码构建到内核
108中。当然,如果有测试人员,也会有错误报告。
109
110最糟糕的错误报告是回归。如果你的补丁导致回归,你会发现很多不舒服的眼睛盯着
111你;回归需要尽快修复。如果您不愿意或无法修复回归(其他人都不会为您修复),
112那么在稳定期内,您的补丁几乎肯定会被移除。除了否定您为使补丁进入主线所做的
113所有工作之外,如果由于未能修复回归而取消补丁,很可能会使将来的工作更难合并。
114
115在处理完任何回归之后,可能还有其他普通的bug需要处理。稳定期是修复这些错误并
116确保代码在主线内核版本中的首次发布尽可能可靠的最好机会。所以,请回答错误
117报告,并尽可能解决问题。这就是稳定期的目的;一旦解决了旧补丁的任何问题,就
118可以开始创建酷的新补丁。
119
120别忘了,还有其他里程碑也可能会创建bug报告:下一个主线稳定版本,当著名的发行
121商选择包含补丁的内核版本时,等等。继续响应这些报告是您工作的基本骄傲。但是,
122如果这不是足够的动机,那么也值得考虑的是,开发社区会记住那些在合并后对代码
123失去兴趣的开发人员。下一次你发布补丁时,他们会以你以后不会在身边维护它为假
124设来评估它。
125
126其他可能发生的事情
127------------------
128
129有一天,你可以打开你的邮件客户端,看到有人给你寄了一个代码补丁。毕竟,这是
130让您的代码公开存在的好处之一。如果您同意这个补丁,您可以将它转发给子系统
131维护人员(确保包含一个正确的From:行,这样属性是正确的,并添加一个您自己
132的签准),或者回复一个Acked-by,让原始发送者向上发送它。
133
134如果您不同意补丁,请发送一个礼貌的回复,解释原因。如果可能的话,告诉作者需要
135做哪些更改才能让您接受补丁。对于代码的编写者和维护者所反对的合并补丁,存在着
136一定的阻力,但仅此而已。如果你被认为不必要的阻碍了好的工作,那么这些补丁最
137终会经过你身边并进入主线。在Linux内核中,没有人对任何代码拥有绝对的否决权。
138除了Linus。
139
140在非常罕见的情况下,您可能会看到完全不同的东西:另一个开发人员发布了针对您
141的问题的不同解决方案。在这一点上,两个补丁中的一个可能不会合并,“我的在这里
142是第一个”不被认为是一个令人信服的技术论据。如果有人的补丁取代了你的补丁而进
143入了主线,那么只有一种方法可以回应你:高兴你的问题得到解决,继续你的工作。
144以这种方式把一个人的工作推到一边可能会伤害和气馁,但是在他们忘记了谁的补丁
145真正被合并很久之后,社区会记住你的反应。
diff --git a/Documentation/translations/zh_CN/process/7.AdvancedTopics.rst b/Documentation/translations/zh_CN/process/7.AdvancedTopics.rst
new file mode 100644
index 000000000000..956815edbd18
--- /dev/null
+++ b/Documentation/translations/zh_CN/process/7.AdvancedTopics.rst
@@ -0,0 +1,124 @@
1.. include:: ../disclaimer-zh_CN.rst
2
3:Original: :ref:`Documentation/process/7.AdvancedTopics.rst <development_advancedtopics>`
4:Translator: Alex Shi <alex.shi@linux.alibaba.com>
5
6.. _cn_development_advancedtopics:
7
8高级主题
9========
10
11现在,希望您能够掌握开发流程的工作方式。然而,还有更多的东西要学!本节将介绍
12一些主题,这些主题对希望成为Linux内核开发过程常规部分的开发人员有帮助。
13
14使用Git管理补丁
15---------------
16
17内核使用分布式版本控制始于2002年初,当时Linus首次开始使用专有的Bitkeeper应用
18程序。虽然bitkeeper存在争议,但它所体现的软件版本管理方法却肯定不是。分布式
19版本控制可以立即加速内核开发项目。在当前的时代,有几种免费的比特保持器替代品。
20无论好坏,内核项目都将Git作为其选择的工具。
21
22使用Git管理补丁可以使开发人员的生活更加轻松,尤其是随着补丁数量的增加。Git
23也有其粗糙的边缘和一定的危险,它是一个年轻和强大的工具,仍然在其开发人员完善
24中。本文档不会试图教会读者如何使用git;这会是个巨长的文档。相反,这里的重点
25将是Git如何特别适合内核开发过程。想要加快Git的开发人员可以在以下网站上找到
26更多信息:
27
28 http://git-scm.com/
29
30 http://www.kernel.org/pub/software/scm/git/docs/user-manual.html
31
32在尝试使用它使补丁可供其他人使用之前,第一要务是阅读上述站点,对Git的工作
33方式有一个扎实的了解。使用Git的开发人员应该能够获得主线存储库的副本,探索
34修订历史,提交对树的更改,使用分支等。了解Git用于重写历史的工具(如Rebase)
35也很有用。Git有自己的术语和概念;Git的新用户应该了解refs、远程分支、索引、
36快进合并、推拉、分离头等。一开始可能有点吓人,但这些概念不难通过一点学习来
37理解。
38
39使用git生成通过电子邮件提交的补丁是提高速度的一个很好的练习。
40
41当您准备好开始安装Git树供其他人查看时,您当然需要一个可以从中提取的服务器。
42如果您有一个可以访问Internet的系统,那么使用git守护进程设置这样的服务器相
43对简单。否则,免费的公共托管网站(例如github)开始出现在网络上。成熟的开发
44人员可以在kernel.org上获得一个帐户,但这些帐户并不容易找到;有关更多信息,
45请参阅 http://kernel.org/faq/
46
47正常的Git工作流程涉及到许多分支的使用。每一条开发线都可以分为单独的“主题
48分支”,并独立维护。Git的分支机构很便宜,没有理由不免费使用它们。而且,在
49任何情况下,您都不应该在任何您打算让其他人从中受益的分支中进行开发。应该
50小心地创建公开可用的分支;当它们处于完整的形式并准备好运行时(而不是之前),
51合并开发分支的补丁。
52
53Git提供了一些强大的工具,可以让您重写开发历史。一个不方便的补丁(比如说,
54一个打破二分法的补丁,或者有其他一些明显的缺陷)可以在适当的位置修复,或者
55完全从历史中消失。一个补丁系列可以被重写,就好像它是在今天的主线之上写的
56一样,即使你已经花了几个月的时间在写它。可以透明地将更改从一个分支转移到另
57一个分支。等等。明智地使用git修改历史的能力可以帮助创建问题更少的干净补丁集。
58
59然而,过度使用这种能力可能会导致其他问题,而不仅仅是对创建完美项目历史的
60简单痴迷。重写历史将重写该历史中包含的更改,将经过测试(希望)的内核树变
61为未经测试的内核树。但是,除此之外,如果开发人员没有对项目历史的共享视图,
62他们就无法轻松地协作;如果您重写了其他开发人员拉入他们存储库的历史,您将
63使这些开发人员的生活更加困难。因此,这里有一个简单的经验法则:被导出到其他
64人的历史在此后通常被认为是不可变的。
65
66因此,一旦将一组更改推送到公开可用的服务器上,就不应该重写这些更改。如果您
67尝试强制进行不会导致快进合并(即不共享同一历史记录的更改)的更改,Git将尝
68试强制执行此规则。可以重写此检查,有时可能需要重写导出的树。在树之间移动变
69更集以避免Linux-next中的冲突就是一个例子。但这种行为应该是罕见的。这就是为
70什么开发应该在私有分支中进行(必要时可以重写)并且只有在公共分支处于合理的
71高级状态时才转移到公共分支中的原因之一。
72
73当主线(或其他一组变更所基于的树)前进时,很容易与该树合并以保持领先地位。
74对于一个私有的分支,rebasing 可能是一个很容易跟上另一棵树的方法,但是一旦
75一棵树被导出到全世界,rebasing就不是一个选项。一旦发生这种情况,就必须进行
76完全合并(merge)。合并有时是很有意义的,但是过于频繁的合并会不必要地扰乱
77历史。在这种情况下,建议的技术是不经常合并,通常只在特定的发布点(如主线-rc
78发布)合并。如果您对特定的更改感到紧张,则可以始终在私有分支中执行测试合并。
79在这种情况下,git rerere 工具很有用;它记住合并冲突是如何解决的,这样您就
80不必重复相同的工作。
81
82关于Git这样的工具的一个最大的反复抱怨是:补丁从一个存储库到另一个存储库的
83大量移动使得很容易陷入错误建议的变更中,这些变更避开审查雷达进入主线。当内
84核开发人员看到这种情况发生时,他们往往会感到不高兴;在Git树上放置未查看或
85主题外的补丁可能会影响您将来获取树的能力。引用Linus:
86
87::
88
89 你可以给我发补丁,但要我从你哪里取一个Git补丁,我需要知道你知道
90 你在做什么,我需要能够相信事情而不去检查每个个人改变。
91
92(http://lwn.net/articles/224135/)。
93
94为了避免这种情况,请确保给定分支中的所有补丁都与相关主题紧密相关;“驱动程序
95修复”分支不应更改核心内存管理代码。而且,最重要的是,不要使用Git树来绕过
96审查过程。不时的将树的摘要发布到相关的列表中,当时间合适时,请求
97Linux-next 中包含该树。
98
99如果其他人开始发送补丁以包含到您的树中,不要忘记查看它们。还要确保您维护正确
100的作者信息; ``git am`` 工具在这方面做得最好,但是如果它通过第三方转发给您,
101您可能需要在补丁中添加“From:”行。
102
103请求pull操作时,请务必提供所有相关信息:树的位置、要拉的分支以及拉操作将导致
104的更改。在这方面,git request pull 命令非常有用;它将按照其他开发人员的预期
105格式化请求,并检查以确保您记住了将这些更改推送到公共服务器。
106
107审查补丁
108--------
109
110一些读者当然会反对将本节与“高级主题”放在一起,因为即使是刚开始的内核开发人员
111也应该检查补丁。当然,学习如何在内核环境中编程没有比查看其他人发布的代码更好
112的方法了。此外,审阅者永远供不应求;通过查看代码,您可以对整个流程做出重大贡献。
113
114审查代码可能是一个令人生畏的前景,特别是对于一个新的内核开发人员来说,他们
115可能会对公开询问代码感到紧张,而这些代码是由那些有更多经验的人发布的。不过,
116即使是最有经验的开发人员编写的代码也可以得到改进。也许对评审员(所有评审员)
117最好的建议是:把评审评论当成问题而不是批评。询问“在这条路径中如何释放锁?”
118总是比说“这里的锁是错误的”更好。
119
120不同的开发人员将从不同的角度审查代码。一些主要关注的是编码样式以及代码行是
121否有尾随空格。其他人将主要关注补丁作为一个整体实现的变更是否对内核有好处。
122然而,其他人会检查是否存在锁定问题、堆栈使用过度、可能的安全问题、在其他
123地方发现的代码重复、足够的文档、对性能的不利影响、用户空间ABI更改等。所有
124类型的检查,如果它们导致更好的代码进入内核,都是受欢迎和值得的。
diff --git a/Documentation/translations/zh_CN/process/8.Conclusion.rst b/Documentation/translations/zh_CN/process/8.Conclusion.rst
new file mode 100644
index 000000000000..2bbd76161e10
--- /dev/null
+++ b/Documentation/translations/zh_CN/process/8.Conclusion.rst
@@ -0,0 +1,64 @@
1.. include:: ../disclaimer-zh_CN.rst
2
3:Original: :ref:`Documentation/process/8.Conclusion.rst <development_conclusion>`
4:Translator: Alex Shi <alex.shi@linux.alibaba.com>
5
6.. _cn_development_conclusion:
7
8更多信息
9========
10
11关于Linux内核开发和相关主题的信息来源很多。首先是在内核源代码分发中找到的
12文档目录。顶级 :ref:`Documentation/translations/zh_CN/process/howto.rst <cn_process_howto>`
13文件是一个重要的起点
14:ref:`Documentation/translations/zh_CN/process/submitting-patches.rst <cn_submittingpatches>`
15和 :ref:`process/submitting-drivers.rst <submittingdrivers>`
16也是所有内核开发人员都应该阅读的内容。许多内部内核API都是使用kerneldoc机制
17记录的;“make htmldocs”或“make pdfdocs”可用于以HTML或PDF格式生成这些文档(
18尽管某些发行版提供的tex版本会遇到内部限制,无法正确处理文档)。
19
20不同的网站在各个细节层次上讨论内核开发。您的作者想谦虚地建议用 http://lwn.net/
21作为来源;有关许多特定内核主题的信息可以通过以下网址的lwn内核索引找到:
22
23 http://lwn.net/kernel/index/
24
25除此之外,内核开发人员的一个宝贵资源是:
26
27 http://kernelnewbies.org/
28
29当然,我们不应该忘记 http://kernel.org/ 这是内核发布信息的最终位置。
30
31关于内核开发有很多书:
32
33 Linux设备驱动程序,第三版(Jonathan Corbet、Alessandro Rubini和Greg Kroah Hartman)。
34 在线:http://lwn.net/kernel/ldd3/
35
36 Linux内核开发(Robert Love)。
37
38 了解Linux内核(Daniel Bovet和Marco Cesati)。
39
40然而,所有这些书都有一个共同的缺点:当它们上架时,它们往往有些过时,而且它们
41已经上架一段时间了。不过,在那里还可以找到相当多的好信息。
42
43有关git的文档,请访问:
44
45 http://www.kernel.org/pub/software/scm/git/docs/
46
47 http://www.kernel.org/pub/software/scm/git/docs/user-manual.html
48
49结论
50====
51
52祝贺所有通过这篇冗长的文件的人。希望它能够帮助您理解Linux内核是如何开发的,
53以及您如何参与这个过程。
54
55最后,重要的是参与。任何开源软件项目都不超过其贡献者投入其中的总和。Linux内核
56的发展速度和以前一样快,因为它得到了大量开发人员的帮助,他们都在努力使它变得
57更好。内核是一个主要的例子,说明当成千上万的人为了一个共同的目标一起工作时,
58可以做些什么。
59
60不过,内核总是可以从更大的开发人员基础中获益。总有更多的工作要做。但是,同样
61重要的是,Linux生态系统中的大多数其他参与者可以通过为内核做出贡献而受益。使
62代码进入主线是提高代码质量、降低维护和分发成本、提高对内核开发方向的影响程度
63等的关键。这是一种人人都赢的局面。踢开你的编辑,来加入我们吧,你会非常受
64欢迎的。
diff --git a/Documentation/translations/zh_CN/process/code-of-conduct-interpretation.rst b/Documentation/translations/zh_CN/process/code-of-conduct-interpretation.rst
new file mode 100644
index 000000000000..c323ce76e0cb
--- /dev/null
+++ b/Documentation/translations/zh_CN/process/code-of-conduct-interpretation.rst
@@ -0,0 +1,108 @@
1.. include:: ../disclaimer-zh_CN.rst
2
3:Original: :ref:`Documentation/process/code-of-conduct-interpretation.rst <code_of_conduct_interpretation>`
4:Translator: Alex Shi <alex.shi@linux.alibaba.com>
5
6.. _cn_code_of_conduct_interpretation:
7
8Linux内核贡献者契约行为准则解释
9===============================
10
11:ref:`cn_code_of_conduct` 准则是一个通用文档,旨在为几乎所有开源社区提供一套规则。
12每个开源社区都是独一无二的,Linux内核也不例外。因此,本文描述了Linux内核社区中
13如何解释它。我们也不希望这种解释随着时间的推移是静态的,并将根据需要进行调整。
14
15与开发软件的“传统”方法相比,Linux内核开发工作是一个非常个人化的过程。你的贡献
16和背后的想法将被仔细审查,往往导致批判和批评。审查将几乎总是需要改进,材料才
17能包括在内核中。要知道这是因为所有相关人员都希望看到Linux整体成功的最佳解决方
18案。这个开发过程已经被证明可以创建有史以来最健壮的操作系统内核,我们不想做任何
19事情来导致提交质量和最终结果的下降。
20
21维护者
22------
23
24行为准则多次使用“维护者”一词。在内核社区中,“维护者”是负责子系统、驱动程序或
25文件的任何人,并在内核源代码树的维护者文件中列出。
26
27责任
28----
29
30《行为准则》提到了维护人员的权利和责任,这需要进一步澄清。
31
32首先,最重要的是,有一个合理的期望是由维护人员通过实例来领导。
33
34也就是说,我们的社区是广阔的,对维护者没有新的要求,他们单方面处理其他人在
35他们活跃的社区的行为。这一责任由我们所有人承担,最终《行为准则》记录了最终的
36上诉路径,以防有关行为问题的问题悬而未决。
37
38维护人员应该愿意在出现问题时提供帮助,并在需要时与社区中的其他人合作。如果您
39不确定如何处理出现的情况,请不要害怕联系技术咨询委员会(TAB)或其他维护人员。
40除非您愿意,否则不会将其视为违规报告。如果您不确定是否该联系TAB 或任何其他维
41护人员,请联系我们的冲突调解人 Mishi Choudhary <mishi@linux.com>。
42
43最后,“善待对方”才是每个人的最终目标。我们知道每个人都是人,有时我们都会失败,
44但我们所有人的首要目标应该是努力友好地解决问题。执行行为准则将是最后的选择。
45
46我们的目标是创建一个强大的、技术先进的操作系统,以及所涉及的技术复杂性,这自
47然需要专业知识和决策。
48
49所需的专业知识因贡献领域而异。它主要由上下文和技术复杂性决定,其次由贡献者和
50维护者的期望决定。
51
52专家的期望和决策都要经过讨论,但在最后,为了取得进展,必须能够做出决策。这一
53特权掌握在维护人员和项目领导的手中,预计将善意使用。
54
55因此,设定专业知识期望、作出决定和拒绝不适当的贡献不被视为违反行为准则。
56
57虽然维护人员一般都欢迎新来者,但他们帮助(新)贡献者克服障碍的能力有限,因此
58他们必须确定优先事项。这也不应被视为违反了行为准则。内核社区意识到这一点,并
59以各种形式提供入门级节目,如 kernelnewbies.org 。
60
61范围
62----
63
64Linux内核社区主要在一组公共电子邮件列表上进行交互,这些列表分布在由多个不同
65公司或个人控制的多个不同服务器上。所有这些列表都在内核源代码树中的
66MAINTAINERS 文件中定义。发送到这些邮件列表的任何电子邮件都被视为包含在行为
67准则中。
68
69使用 kernel.org bugzilla和其他子系统bugzilla 或bug跟踪工具的开发人员应该遵循
70行为准则的指导原则。Linux内核社区没有“官方”项目电子邮件地址或“官方”社交媒体
71地址。使用kernel.org电子邮件帐户执行的任何活动必须遵循为kernel.org发布的行为
72准则,就像任何使用公司电子邮件帐户的个人必须遵循该公司的特定规则一样。
73
74行为准则并不禁止在邮件列表消息、内核更改日志消息或代码注释中继续包含名称、
75电子邮件地址和相关注释。
76
77其他论坛中的互动包括在适用于上述论坛的任何规则中,通常不包括在行为准则中。
78除了在极端情况下可考虑的例外情况。
79
80提交给内核的贡献应该使用适当的语言。在行为准则之前已经存在的内容现在不会被
81视为违反。然而,不适当的语言可以被视为一个bug;如果任何相关方提交补丁,
82这样的bug将被更快地修复。当前属于用户/内核API的一部分的表达式,或者反映已
83发布标准或规范中使用的术语的表达式,不被视为bug。
84
85执行
86----
87
88行为准则中列出的地址属于行为准则委员会。https://kernel.org/code-of-conduct.html
89列出了在任何给定时间接收这些电子邮件的确切成员。成员不能访问在加入委员会之前
90或离开委员会之后所做的报告。
91
92最初的行为准则委员会由TAB的志愿者以及作为中立第三方的专业调解人组成。委员会
93的首要任务是建立文件化的流程,并将其公开。
94
95如果报告人不希望将整个委员会纳入投诉或关切,可直接联系委员会的任何成员,包括
96调解人。
97
98行为准则委员会根据流程审查案例(见上文),并根据需要和适当与TAB协商,例如请求
99和接收有关内核社区的信息。
100
101委员会做出的任何决定都将提交到表中,以便在必要时与相关维护人员一起执行。行为
102准则委员会的决定可以通过三分之二的投票推翻。
103
104每季度,行为准则委员会和标签将提供一份报告,概述行为准则委员会收到的匿名报告
105及其状态,以及任何否决决定的细节,包括完整和可识别的投票细节。
106
107我们希望在启动期之后为行为准则委员会人员配备建立一个不同的流程。发生此情况时,
108将使用该信息更新此文档。
diff --git a/Documentation/translations/zh_CN/process/code-of-conduct.rst b/Documentation/translations/zh_CN/process/code-of-conduct.rst
new file mode 100644
index 000000000000..99024df058e9
--- /dev/null
+++ b/Documentation/translations/zh_CN/process/code-of-conduct.rst
@@ -0,0 +1,72 @@
1.. include:: ../disclaimer-zh_CN.rst
2
3:Original: :ref:`Documentation/process/code-of-conduct.rst <code_of_conduct>`
4:Translator: Alex Shi <alex.shi@linux.alibaba.com>
5
6.. _cn_code_of_conduct:
7
8贡献者契约行为准则
9++++++++++++++++++
10
11我们的誓言
12==========
13
14为了营造一个开放、友好的环境,我们作为贡献者和维护人承诺,让我们的社区和参
15与者,拥有一个无骚扰的体验,无论年龄、体型、残疾、种族、性别特征、性别认同
16和表达、经验水平、教育程度、社会状况,经济地位、国籍、个人外貌、种族、宗教
17或性身份和取向。
18
19我们的标准
20==========
21
22有助于创造积极环境的行为包括:
23
24* 使用欢迎和包容的语言
25* 尊重不同的观点和经验
26* 优雅地接受建设性的批评
27* 关注什么对社区最有利
28* 对其他社区成员表示同情
29
30参与者的不可接受行为包括:
31
32* 使用性意味的语言或意象以及不受欢迎的性注意或者更过分的行为
33* 煽动、侮辱/贬损评论以及个人或政治攻击
34* 公开或私下骚扰
35* 未经明确许可,发布他人的私人信息,如物理或电子地址。
36* 在专业场合被合理认为不适当的其他行为
37
38我们的责任
39==========
40
41维护人员负责澄清可接受行为的标准,并应针对任何不可接受行为采取适当和公平的
42纠正措施。
43
44维护人员有权和责任删除、编辑或拒绝与本行为准则不一致的评论、承诺、代码、
45wiki编辑、问题和其他贡献,或暂时或永久禁止任何贡献者从事他们认为不适当、
46威胁、冒犯或有害的其他行为。
47
48范围
49====
50
51当个人代表项目或其社区时,本行为准则既适用于项目空间,也适用于公共空间。
52代表一个项目或社区的例子包括使用一个正式的项目电子邮件地址,通过一个正式
53的社交媒体帐户发布,或者在在线或离线事件中担任指定的代表。项目维护人员可以
54进一步定义和澄清项目的表示。
55
56执行
57====
58
59如有滥用、骚扰或其他不可接受的行为,可联系行为准则委员会<conduct@kernel.org>。
60所有投诉都将接受审查和调查,并将得到必要和适当的答复。行为准则委员会有义务
61对事件报告人保密。具体执行政策的进一步细节可单独公布。
62
63归属
64====
65
66本行为准则改编自《贡献者契约》,版本1.4,可从
67https://www.contributor-covenant.org/version/1/4/code-of-conduct.html 获取。
68
69解释
70====
71
72有关Linux内核社区如何解释此文档,请参阅 :ref:`cn_code_of_conduct_interpretation`
diff --git a/Documentation/translations/zh_CN/coding-style.rst b/Documentation/translations/zh_CN/process/coding-style.rst
index 3cb09803e084..5479c591c2f7 100644
--- a/Documentation/translations/zh_CN/coding-style.rst
+++ b/Documentation/translations/zh_CN/process/coding-style.rst
@@ -1,19 +1,10 @@
1Chinese translated version of Documentation/process/coding-style.rst 1.. include:: ../disclaimer-zh_CN.rst
2 2
3If you have any comment or update to the content, please post to LKML directly. 3:Original: :ref:`Documentation/process/coding-style.rst <codingstyle>`
4However, if you have problem communicating in English you can also ask the
5Chinese maintainer for help. Contact the Chinese maintainer, if this
6translation is outdated or there is problem with translation.
7 4
8Chinese maintainer: Zhang Le <r0bertz@gentoo.org> 5.. _cn_codingstyle:
9 6
10--------------------------------------------------------------------- 7译者::
11
12Documentation/process/coding-style.rst 的中文翻译
13
14如果想评论或更新本文的内容,请直接发信到LKML。如果你使用英文交流有困难的话,
15也可以向中文版维护者求助。如果本翻译更新不及时或者翻译存在问题,请联系中文版
16维护者::
17 8
18 中文版维护者: 张乐 Zhang Le <r0bertz@gentoo.org> 9 中文版维护者: 张乐 Zhang Le <r0bertz@gentoo.org>
19 中文版翻译者: 张乐 Zhang Le <r0bertz@gentoo.org> 10 中文版翻译者: 张乐 Zhang Le <r0bertz@gentoo.org>
@@ -23,10 +14,6 @@ Documentation/process/coding-style.rst 的中文翻译
23 Li Zefan <lizf@cn.fujitsu.com> 14 Li Zefan <lizf@cn.fujitsu.com>
24 Wang Chen <wangchen@cn.fujitsu.com> 15 Wang Chen <wangchen@cn.fujitsu.com>
25 16
26以下为正文
27
28---------------------------------------------------------------------
29
30Linux 内核代码风格 17Linux 内核代码风格
31========================= 18=========================
32 19
diff --git a/Documentation/translations/zh_CN/process/development-process.rst b/Documentation/translations/zh_CN/process/development-process.rst
new file mode 100644
index 000000000000..30cffe66c075
--- /dev/null
+++ b/Documentation/translations/zh_CN/process/development-process.rst
@@ -0,0 +1,26 @@
1.. include:: ../disclaimer-zh_CN.rst
2
3:Original: :ref:`Documentation/process/development-process.rst <development_process_main>`
4:Translator: Alex Shi <alex.shi@linux.alibaba.com>
5
6.. _cn_development_process_main:
7
8内核开发过程指南
9================
10
11内容:
12
13.. toctree::
14 :numbered:
15 :maxdepth: 2
16
17 1.Intro
18 2.Process
19 3.Early-stage
20 4.Coding
21 5.Posting
22 6.Followthrough
23 7.AdvancedTopics
24 8.Conclusion
25
26本文档的目的是帮助开发人员(及其经理)以最小的挫折感与开发社区合作。它试图记录这个社区如何以一种不熟悉Linux内核开发(或者实际上是自由软件开发)的人可以访问的方式工作。虽然这里有一些技术资料,但这是一个面向过程的讨论,不需要深入了解内核编程就可以理解。
diff --git a/Documentation/translations/zh_CN/email-clients.txt b/Documentation/translations/zh_CN/process/email-clients.rst
index ec31d97e8d0e..102023651118 100644
--- a/Documentation/translations/zh_CN/email-clients.txt
+++ b/Documentation/translations/zh_CN/process/email-clients.rst
@@ -1,33 +1,34 @@
1Chinese translated version of Documentation/process/email-clients.rst 1.. _cn_email_clients:
2 2
3If you have any comment or update to the content, please contact the 3.. include:: ../disclaimer-zh_CN.rst
4original document maintainer directly. However, if you have a problem
5communicating in English you can also ask the Chinese maintainer for
6help. Contact the Chinese maintainer if this translation is outdated
7or if there is a problem with the translation.
8 4
9Chinese maintainer: Harry Wei <harryxiyou@gmail.com> 5:Original: :ref:`Documentation/process/email-clients.rst <email_clients>`
10---------------------------------------------------------------------
11Documentation/process/email-clients.rst 的中文翻译
12 6
13如果想评论或更新本文的内容,请直接联系原文档的维护者。如果你使用英文 7译者::
14交流有困难的话,也可以向中文版维护者求助。如果本翻译更新不及时或者翻
15译存在问题,请联系中文版维护者。
16 8
17中文版维护者: 贾威威 Harry Wei <harryxiyou@gmail.com> 9 中文版维护者: 贾威威 Harry Wei <harryxiyou@gmail.com>
18中文版翻译者: 贾威威 Harry Wei <harryxiyou@gmail.com> 10 中文版翻译者: 贾威威 Harry Wei <harryxiyou@gmail.com>
19中文版校译者: Yinglin Luan <synmyth@gmail.com> 11 时奎亮 Alex Shi <alex.shi@linux.alibaba.com>
20 Xiaochen Wang <wangxiaochen0@gmail.com> 12 中文版校译者: Yinglin Luan <synmyth@gmail.com>
21 yaxinsn <yaxinsn@163.com> 13 Xiaochen Wang <wangxiaochen0@gmail.com>
22 14 yaxinsn <yaxinsn@163.com>
23以下为正文
24---------------------------------------------------------------------
25 15
26Linux邮件客户端配置信息 16Linux邮件客户端配置信息
27====================================================================== 17=======================
18
19Git
20---
21
22现在大多数开发人员使用 ``git send-email`` 而不是常规的电子邮件客户端。这方面
23的手册非常好。在接收端,维护人员使用 ``git am`` 加载补丁。
24
25如果你是 ``git`` 新手,那么把你的第一个补丁发送给你自己。将其保存为包含所有
26标题的原始文本。运行 ``git am raw_email.txt`` ,然后使用 ``git log`` 查看更
27改日志。如果工作正常,再将补丁发送到相应的邮件列表。
28
28 29
29普通配置 30普通配置
30---------------------------------------------------------------------- 31--------
31Linux内核补丁是通过邮件被提交的,最好把补丁作为邮件体的内嵌文本。有些维护者 32Linux内核补丁是通过邮件被提交的,最好把补丁作为邮件体的内嵌文本。有些维护者
32接收附件,但是附件的内容格式应该是"text/plain"。然而,附件一般是不赞成的, 33接收附件,但是附件的内容格式应该是"text/plain"。然而,附件一般是不赞成的,
33因为这会使补丁的引用部分在评论过程中变的很困难。 34因为这会使补丁的引用部分在评论过程中变的很困难。
@@ -56,7 +57,7 @@ Linux内核补丁是通过邮件被提交的,最好把补丁作为邮件体的
56 57
57 58
58一些邮件客户端提示 59一些邮件客户端提示
59---------------------------------------------------------------------- 60------------------
60这里给出一些详细的MUA配置提示,可以用于给Linux内核发送补丁。这些并不意味是 61这里给出一些详细的MUA配置提示,可以用于给Linux内核发送补丁。这些并不意味是
61所有的软件包配置总结。 62所有的软件包配置总结。
62 63
@@ -64,8 +65,8 @@ Linux内核补丁是通过邮件被提交的,最好把补丁作为邮件体的
64TUI = 以文本为基础的用户接口 65TUI = 以文本为基础的用户接口
65GUI = 图形界面用户接口 66GUI = 图形界面用户接口
66 67
67~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
68Alpine (TUI) 68Alpine (TUI)
69~~~~~~~~~~~~
69 70
70配置选项: 71配置选项:
71在"Sending Preferences"部分: 72在"Sending Preferences"部分:
@@ -76,8 +77,8 @@ Alpine (TUI)
76当写邮件时,光标应该放在补丁会出现的地方,然后按下CTRL-R组合键,使指定的 77当写邮件时,光标应该放在补丁会出现的地方,然后按下CTRL-R组合键,使指定的
77补丁文件嵌入到邮件中。 78补丁文件嵌入到邮件中。
78 79
79~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
80Evolution (GUI) 80Evolution (GUI)
81~~~~~~~~~~~~~~~
81 82
82一些开发者成功的使用它发送补丁 83一些开发者成功的使用它发送补丁
83 84
@@ -89,8 +90,8 @@ Evolution (GUI)
89 90
90你还可以"diff -Nru old.c new.c | xclip",选择Preformat,然后使用中间键进行粘帖。 91你还可以"diff -Nru old.c new.c | xclip",选择Preformat,然后使用中间键进行粘帖。
91 92
92~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
93Kmail (GUI) 93Kmail (GUI)
94~~~~~~~~~~~
94 95
95一些开发者成功的使用它发送补丁。 96一些开发者成功的使用它发送补丁。
96 97
@@ -118,13 +119,13 @@ display",这样内嵌附件更容易让读者看到。
118并且希望这将会被处理。邮件是以只针对某个用户可读写的权限被保存的,所以如果你想把邮件复制到其他地方, 119并且希望这将会被处理。邮件是以只针对某个用户可读写的权限被保存的,所以如果你想把邮件复制到其他地方,
119你不得不把他们的权限改为组或者整体可读。 120你不得不把他们的权限改为组或者整体可读。
120 121
121~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
122Lotus Notes (GUI) 122Lotus Notes (GUI)
123~~~~~~~~~~~~~~~~~
123 124
124不要使用它。 125不要使用它。
125 126
126~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
127Mutt (TUI) 127Mutt (TUI)
128~~~~~~~~~~
128 129
129很多Linux开发人员使用mutt客户端,所以证明它肯定工作的非常漂亮。 130很多Linux开发人员使用mutt客户端,所以证明它肯定工作的非常漂亮。
130 131
@@ -142,12 +143,49 @@ Mutt不自带编辑器,所以不管你使用什么编辑器都不应该带有
142如果想要把补丁作为内嵌文本。 143如果想要把补丁作为内嵌文本。
143(a)ttach工作的很好,不带有"set paste"。 144(a)ttach工作的很好,不带有"set paste"。
144 145
146你可以通过 ``git format-patch`` 生成补丁,然后用 Mutt发送它们::
147
148 $ mutt -H 0001-some-bug-fix.patch
149
145配置选项: 150配置选项:
146它应该以默认设置的形式工作。 151它应该以默认设置的形式工作。
147然而,把"send_charset"设置为"us-ascii::utf-8"也是一个不错的主意。 152然而,把"send_charset"设置为"us-ascii::utf-8"也是一个不错的主意。
148 153
149~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 154Mutt 是高度可配置的。 这里是个使用mutt通过 Gmail 发送的补丁的最小配置::
155
156 # .muttrc
157 # ================ IMAP ====================
158 set imap_user = 'yourusername@gmail.com'
159 set imap_pass = 'yourpassword'
160 set spoolfile = imaps://imap.gmail.com/INBOX
161 set folder = imaps://imap.gmail.com/
162 set record="imaps://imap.gmail.com/[Gmail]/Sent Mail"
163 set postponed="imaps://imap.gmail.com/[Gmail]/Drafts"
164 set mbox="imaps://imap.gmail.com/[Gmail]/All Mail"
165
166 # ================ SMTP ====================
167 set smtp_url = "smtp://username@smtp.gmail.com:587/"
168 set smtp_pass = $imap_pass
169 set ssl_force_tls = yes # Require encrypted connection
170
171 # ================ Composition ====================
172 set editor = `echo \$EDITOR`
173 set edit_headers = yes # See the headers when editing
174 set charset = UTF-8 # value of $LANG; also fallback for send_charset
175 # Sender, email address, and sign-off line must match
176 unset use_domain # because joe@localhost is just embarrassing
177 set realname = "YOUR NAME"
178 set from = "username@gmail.com"
179 set use_from = yes
180
181Mutt文档含有更多信息:
182
183 http://dev.mutt.org/trac/wiki/UseCases/Gmail
184
185 http://dev.mutt.org/doc/manual.html
186
150Pine (TUI) 187Pine (TUI)
188~~~~~~~~~~
151 189
152Pine过去有一些空格删减问题,但是这些现在应该都被修复了。 190Pine过去有一些空格删减问题,但是这些现在应该都被修复了。
153 191
@@ -158,8 +196,8 @@ Pine过去有一些空格删减问题,但是这些现在应该都被修复了
158- "no-strip-whitespace-before-send"选项也是需要的。 196- "no-strip-whitespace-before-send"选项也是需要的。
159 197
160 198
161~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
162Sylpheed (GUI) 199Sylpheed (GUI)
200~~~~~~~~~~~~~~
163 201
164- 内嵌文本可以很好的工作(或者使用附件)。 202- 内嵌文本可以很好的工作(或者使用附件)。
165- 允许使用外部的编辑器。 203- 允许使用外部的编辑器。
@@ -168,8 +206,8 @@ Sylpheed (GUI)
168- 在组成窗口中有一个很有用的ruler bar。 206- 在组成窗口中有一个很有用的ruler bar。
169- 给地址本中添加地址就不会正确的了解显示名。 207- 给地址本中添加地址就不会正确的了解显示名。
170 208
171~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
172Thunderbird (GUI) 209Thunderbird (GUI)
210~~~~~~~~~~~~~~~~~
173 211
174默认情况下,thunderbird很容易损坏文本,但是还有一些方法可以强制它变得更好。 212默认情况下,thunderbird很容易损坏文本,但是还有一些方法可以强制它变得更好。
175 213
@@ -191,13 +229,13 @@ Thunderbird (GUI)
191 $EDITOR来读取或者合并补丁到文本中。要实现它,可以下载并且安装这个扩展,然后添加一个使用它的 229 $EDITOR来读取或者合并补丁到文本中。要实现它,可以下载并且安装这个扩展,然后添加一个使用它的
192 按键View->Toolbars->Customize...最后当你书写信息的时候仅仅点击它就可以了。 230 按键View->Toolbars->Customize...最后当你书写信息的时候仅仅点击它就可以了。
193 231
194~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
195TkRat (GUI) 232TkRat (GUI)
233~~~~~~~~~~~
196 234
197可以使用它。使用"Insert file..."或者外部的编辑器。 235可以使用它。使用"Insert file..."或者外部的编辑器。
198 236
199~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
200Gmail (Web GUI) 237Gmail (Web GUI)
238~~~~~~~~~~~~~~~
201 239
202不要使用它发送补丁。 240不要使用它发送补丁。
203 241
diff --git a/Documentation/translations/zh_CN/HOWTO b/Documentation/translations/zh_CN/process/howto.rst
index 7a00a8a4eb15..5b671178b17b 100644
--- a/Documentation/translations/zh_CN/HOWTO
+++ b/Documentation/translations/zh_CN/process/howto.rst
@@ -1,32 +1,22 @@
1Chinese translated version of Documentation/process/howto.rst 1.. _cn_process_howto:
2 2
3If you have any comment or update to the content, please contact the 3.. include:: ../disclaimer-zh_CN.rst
4original document maintainer directly. However, if you have a problem
5communicating in English you can also ask the Chinese maintainer for
6help. Contact the Chinese maintainer if this translation is outdated
7or if there is a problem with the translation.
8 4
9Maintainer: Greg Kroah-Hartman <greg@kroah.com> 5:Original: :ref:`Documentation/process/howto.rst <process_howto>`
10Chinese maintainer: Li Yang <leoli@freescale.com>
11---------------------------------------------------------------------
12Documentation/process/howto.rst 的中文翻译
13 6
14如果想评论或更新本文的内容,请直接联系原文档的维护者。如果你使用英文 7译者::
15交流有困难的话,也可以向中文版维护者求助。如果本翻译更新不及时或者翻
16译存在问题,请联系中文版维护者。
17 8
18英文版维护者: Greg Kroah-Hartman <greg@kroah.com> 9 英文版维护者: Greg Kroah-Hartman <greg@kroah.com>
19中文版维护者: 李阳 Li Yang <leoli@freescale.com> 10 中文版维护者: 李阳 Li Yang <leoyang.li@nxp.com>
20中文版翻译者: 李阳 Li Yang <leoli@freescale.com> 11 中文版翻译者: 李阳 Li Yang <leoyang.li@nxp.com>
21中文版校译者: 钟宇 TripleX Chung <xxx.phy@gmail.com> 12 时奎亮 Alex Shi <alex.shi@linux.alibaba.com>
22 陈琦 Maggie Chen <chenqi@beyondsoft.com> 13 中文版校译者:
23 王聪 Wang Cong <xiyou.wangcong@gmail.com> 14 钟宇 TripleX Chung <xxx.phy@gmail.com>
24 15 陈琦 Maggie Chen <chenqi@beyondsoft.com>
25以下为正文 16 王聪 Wang Cong <xiyou.wangcong@gmail.com>
26---------------------------------------------------------------------
27 17
28如何参与Linux内核开发 18如何参与Linux内核开发
29--------------------- 19=====================
30 20
31这是一篇将如何参与Linux内核开发的相关问题一网打尽的终极秘笈。它将指导你 21这是一篇将如何参与Linux内核开发的相关问题一网打尽的终极秘笈。它将指导你
32成为一名Linux内核开发者,并且学会如何同Linux内核开发社区合作。它尽可能不 22成为一名Linux内核开发者,并且学会如何同Linux内核开发社区合作。它尽可能不
@@ -47,6 +37,7 @@ Linux内核大部分是由C语言写成的,一些体系结构相关的代码
47参与内核开发,你必须精通C语言。除非你想为某个架构开发底层代码,否则你并 37参与内核开发,你必须精通C语言。除非你想为某个架构开发底层代码,否则你并
48不需要了解(任何体系结构的)汇编语言。下面列举的书籍虽然不能替代扎实的C 38不需要了解(任何体系结构的)汇编语言。下面列举的书籍虽然不能替代扎实的C
49语言教育和多年的开发经验,但如果需要的话,做为参考还是不错的: 39语言教育和多年的开发经验,但如果需要的话,做为参考还是不错的:
40
50 - "The C Programming Language" by Kernighan and Ritchie [Prentice Hall] 41 - "The C Programming Language" by Kernighan and Ritchie [Prentice Hall]
51 《C程序设计语言(第2版·新版)》(徐宝文 李志 译)[机械工业出版社] 42 《C程序设计语言(第2版·新版)》(徐宝文 李志 译)[机械工业出版社]
52 - "Practical C Programming" by Steve Oualline [O'Reilly] 43 - "Practical C Programming" by Steve Oualline [O'Reilly]
@@ -71,9 +62,11 @@ Linux内核使用GNU C和GNU工具链开发。虽然它遵循ISO C89标准,但
71-------- 62--------
72 63
73Linux内核源代码都是在GPL(通用公共许可证)的保护下发布的。要了解这种许可 64Linux内核源代码都是在GPL(通用公共许可证)的保护下发布的。要了解这种许可
74的细节请查看源代码主目录下的COPYING文件。如果你对它还有更深入问题请联系 65的细节请查看源代码主目录下的COPYING文件。Linux内核许可准则和如何使用
75律师,而不要在Linux内核邮件组上提问。因为邮件组里的人并不是律师,不要期 66`SPDX <https://spdx.org/>` 标志符说明在这个文件中
76望他们的话有法律效力。 67:ref:`Documentation/translations/zh_CN/process/license-rules.rst <cn_kernel_licensing>`
68如果你对它还有更深入问题请联系律师,而不要在Linux内核邮件组上提问。因为
69邮件组里的人并不是律师,不要期望他们的话有法律效力。
77 70
78对于GPL的常见问题和解答,请访问以下链接: 71对于GPL的常见问题和解答,请访问以下链接:
79 http://www.gnu.org/licenses/gpl-faq.html 72 http://www.gnu.org/licenses/gpl-faq.html
@@ -89,65 +82,75 @@ Linux内核代码中包含有大量的文档。这些文档对于学习如何与
89的维护者解释这些变化。 82的维护者解释这些变化。
90 83
91以下是内核代码中需要阅读的文档: 84以下是内核代码中需要阅读的文档:
92 README 85 :ref:`Documentation/admin-guide/README.rst <readme>`
93 文件简要介绍了Linux内核的背景,并且描述了如何配置和编译内核。内核的 86 文件简要介绍了Linux内核的背景,并且描述了如何配置和编译内核。内核的
94 新用户应该从这里开始。 87 新用户应该从这里开始。
95 88
96 Documentation/process/changes.rst 89
90 :ref:`Documentation/process/changes.rst <changes>`
97 文件给出了用来编译和使用内核所需要的最小软件包列表。 91 文件给出了用来编译和使用内核所需要的最小软件包列表。
98 92
99 Documentation/process/coding-style.rst 93 :ref:`Documentation/translations/zh_CN/process/coding-style.rst <cn_codingstyle>`
100 描述Linux内核的代码风格和理由。所有新代码需要遵守这篇文档中定义的规 94 描述Linux内核的代码风格和理由。所有新代码需要遵守这篇文档中定义的规
101 范。大多数维护者只会接收符合规定的补丁,很多人也只会帮忙检查符合风格 95 范。大多数维护者只会接收符合规定的补丁,很多人也只会帮忙检查符合风格
102 的代码。 96 的代码。
103 97
104 Documentation/process/submitting-patches.rst 98 :ref:`Documentation/translations/zh_CN/process/submitting-patches.rst <cn_submittingpatches>`
105 Documentation/process/submitting-drivers.rst 99 :ref:`Documentation/process/submitting-drivers.rst <submittingdrivers>`
100
106 这两份文档明确描述如何创建和发送补丁,其中包括(但不仅限于): 101 这两份文档明确描述如何创建和发送补丁,其中包括(但不仅限于):
107 - 邮件内容 102 - 邮件内容
108 - 邮件格式 103 - 邮件格式
109 - 选择收件人 104 - 选择收件人
105
110 遵守这些规定并不能保证提交成功(因为所有补丁需要通过严格的内容和风格 106 遵守这些规定并不能保证提交成功(因为所有补丁需要通过严格的内容和风格
111 审查),但是忽视他们几乎就意味着失败。 107 审查),但是忽视他们几乎就意味着失败。
112 108
113 其他关于如何正确地生成补丁的优秀文档包括: 109 其他关于如何正确地生成补丁的优秀文档包括:
114 "The Perfect Patch" 110 "The Perfect Patch"
111
115 http://www.ozlabs.org/~akpm/stuff/tpp.txt 112 http://www.ozlabs.org/~akpm/stuff/tpp.txt
113
116 "Linux kernel patch submission format" 114 "Linux kernel patch submission format"
115
117 http://linux.yyz.us/patch-format.html 116 http://linux.yyz.us/patch-format.html
118 117
119 Documentation/process/stable-api-nonsense.rst 118 :ref:`Documentation/translations/zh_CN/process/stable-api-nonsense.rst <cn_stable_api_nonsense>`
120 论证内核为什么特意不包括稳定的内核内部API,也就是说不包括像这样的特 119 论证内核为什么特意不包括稳定的内核内部API,也就是说不包括像这样的特
121 性: 120 性:
121
122 - 子系统中间层(为了兼容性?) 122 - 子系统中间层(为了兼容性?)
123 - 在不同操作系统间易于移植的驱动程序 123 - 在不同操作系统间易于移植的驱动程序
124 - 减缓(甚至阻止)内核代码的快速变化 124 - 减缓(甚至阻止)内核代码的快速变化
125
125 这篇文档对于理解Linux的开发哲学至关重要。对于将开发平台从其他操作系 126 这篇文档对于理解Linux的开发哲学至关重要。对于将开发平台从其他操作系
126 统转移到Linux的人来说也很重要。 127 统转移到Linux的人来说也很重要。
127 128
128 Documentation/admin-guide/security-bugs.rst 129 :ref:`Documentation/admin-guide/security-bugs.rst <securitybugs>`
129 如果你认为自己发现了Linux内核的安全性问题,请根据这篇文档中的步骤来 130 如果你认为自己发现了Linux内核的安全性问题,请根据这篇文档中的步骤来
130 提醒其他内核开发者并帮助解决这个问题。 131 提醒其他内核开发者并帮助解决这个问题。
131 132
132 Documentation/process/management-style.rst 133 :ref:`Documentation/translations/zh_CN/process/management-style.rst <cn_managementstyle>`
134
133 描述内核维护者的工作方法及其共有特点。这对于刚刚接触内核开发(或者对 135 描述内核维护者的工作方法及其共有特点。这对于刚刚接触内核开发(或者对
134 它感到好奇)的人来说很重要,因为它解释了很多对于内核维护者独特行为的 136 它感到好奇)的人来说很重要,因为它解释了很多对于内核维护者独特行为的
135 普遍误解与迷惑。 137 普遍误解与迷惑。
136 138
137 Documentation/process/stable-kernel-rules.rst 139 :ref:`Documentation/process/stable-kernel-rules.rst <stable_kernel_rules>`
138 解释了稳定版内核发布的规则,以及如何将改动放入这些版本的步骤。 140 解释了稳定版内核发布的规则,以及如何将改动放入这些版本的步骤。
139 141
140 Documentation/process/kernel-docs.rst 142 :ref:`Documentation/process/kernel-docs.rst <kernel_docs>`
141 有助于内核开发的外部文档列表。如果你在内核自带的文档中没有找到你想找 143 有助于内核开发的外部文档列表。如果你在内核自带的文档中没有找到你想找
142 的内容,可以查看这些文档。 144 的内容,可以查看这些文档。
143 145
144 Documentation/process/applying-patches.rst 146 :ref:`Documentation/process/applying-patches.rst <applying_patches>`
145 关于补丁是什么以及如何将它打在不同内核开发分支上的好介绍 147 关于补丁是什么以及如何将它打在不同内核开发分支上的好介绍
146 148
147内核还拥有大量从代码自动生成的文档。它包含内核内部API的全面介绍以及如何 149内核还拥有大量从代码自动生成的文档。它包含内核内部API的全面介绍以及如何
148妥善处理加锁的规则。生成的文档会放在 Documentation/DocBook/目录下。在内 150妥善处理加锁的规则。生成的文档会放在 Documentation/DocBook/目录下。在内
149核源码的主目录中使用以下不同命令将会分别生成PDF、Postscript、HTML和手册 151核源码的主目录中使用以下不同命令将会分别生成PDF、Postscript、HTML和手册
150页等不同格式的文档: 152页等不同格式的文档::
153
151 make pdfdocs 154 make pdfdocs
152 make htmldocs 155 make htmldocs
153 156
@@ -155,7 +158,9 @@ Linux内核代码中包含有大量的文档。这些文档对于学习如何与
155如何成为内核开发者 158如何成为内核开发者
156------------------ 159------------------
157如果你对Linux内核开发一无所知,你应该访问“Linux内核新手”计划: 160如果你对Linux内核开发一无所知,你应该访问“Linux内核新手”计划:
161
158 http://kernelnewbies.org 162 http://kernelnewbies.org
163
159它拥有一个可以问各种最基本的内核开发问题的邮件列表(在提问之前一定要记得 164它拥有一个可以问各种最基本的内核开发问题的邮件列表(在提问之前一定要记得
160查找已往的邮件,确认是否有人已经回答过相同的问题)。它还拥有一个可以获得 165查找已往的邮件,确认是否有人已经回答过相同的问题)。它还拥有一个可以获得
161实时反馈的IRC聊天频道,以及大量对于学习Linux内核开发相当有帮助的文档。 166实时反馈的IRC聊天频道,以及大量对于学习Linux内核开发相当有帮助的文档。
@@ -166,23 +171,21 @@ Linux内核代码中包含有大量的文档。这些文档对于学习如何与
166 171
167如果你想加入内核开发社区并协助完成一些任务,却找不到从哪里开始,可以访问 172如果你想加入内核开发社区并协助完成一些任务,却找不到从哪里开始,可以访问
168“Linux内核房管员”计划: 173“Linux内核房管员”计划:
174
169 http://kernelnewbies.org/KernelJanitors 175 http://kernelnewbies.org/KernelJanitors
176
170这是极佳的起点。它提供一个相对简单的任务列表,列出内核代码中需要被重新 177这是极佳的起点。它提供一个相对简单的任务列表,列出内核代码中需要被重新
171整理或者改正的地方。通过和负责这个计划的开发者们一同工作,你会学到将补丁 178整理或者改正的地方。通过和负责这个计划的开发者们一同工作,你会学到将补丁
172集成进内核的基本原理。如果还没有决定下一步要做什么的话,你还可能会得到方 179集成进内核的基本原理。如果还没有决定下一步要做什么的话,你还可能会得到方
173向性的指点。 180向性的指点。
174 181
175如果你已经有一些现成的代码想要放到内核中,但是需要一些帮助来使它们拥有正
176确的格式。请访问“内核导师”计划。这个计划就是用来帮助你完成这个目标的。它
177是一个邮件列表,地址如下:
178 http://selenic.com/mailman/listinfo/kernel-mentors
179
180在真正动手修改内核代码之前,理解要修改的代码如何运作是必需的。要达到这个 182在真正动手修改内核代码之前,理解要修改的代码如何运作是必需的。要达到这个
181目的,没什么办法比直接读代码更有效了(大多数花招都会有相应的注释),而且 183目的,没什么办法比直接读代码更有效了(大多数花招都会有相应的注释),而且
182一些特制的工具还可以提供帮助。例如,“Linux代码交叉引用”项目就是一个值得 184一些特制的工具还可以提供帮助。例如,“Linux代码交叉引用”项目就是一个值得
183特别推荐的帮助工具,它将源代码显示在有编目和索引的网页上。其中一个更新及 185特别推荐的帮助工具,它将源代码显示在有编目和索引的网页上。其中一个更新及
184时的内核源码库,可以通过以下地址访问: 186时的内核源码库,可以通过以下地址访问:
185 http://sosdg.org/~coywolf/lxr/ 187
188 https://elixir.bootlin.com/
186 189
187 190
188开发流程 191开发流程
@@ -190,22 +193,23 @@ Linux内核代码中包含有大量的文档。这些文档对于学习如何与
190 193
191目前Linux内核开发流程包括几个“主内核分支”和很多子系统相关的内核分支。这 194目前Linux内核开发流程包括几个“主内核分支”和很多子系统相关的内核分支。这
192些分支包括: 195些分支包括:
193 - 2.6.x主内核源码树
194 - 2.6.x.y -stable内核源码树
195 - 2.6.x -mm内核补丁集
196 - 子系统相关的内核源码树和补丁集
197 196
197 - Linus 的内核源码树
198 - 多个主要版本的稳定版内核树
199 - 子系统相关的内核树
200 - linux-next 集成测试树
201
202
203主线树
204------
205主线树是由Linus Torvalds 维护的。你可以在https://kernel.org 网站或者代码
206库中下找到它。它的开发遵循以下步骤:
198 207
1992.6.x内核主源码树
200-----------------
2012.6.x内核是由Linus Torvalds(Linux的创造者)亲自维护的。你可以在
202kernel.org网站的pub/linux/kernel/v2.6/目录下找到它。它的开发遵循以下步
203骤:
204 - 每当一个新版本的内核被发布,为期两周的集成窗口将被打开。在这段时间里 208 - 每当一个新版本的内核被发布,为期两周的集成窗口将被打开。在这段时间里
205 维护者可以向Linus提交大段的修改,通常这些修改已经被放到-mm内核中几个 209 维护者可以向Linus提交大段的修改,通常这些修改已经被放到-mm内核中几个
206 星期了。提交大量修改的首选方式是使用git工具(内核的代码版本管理工具 210 星期了。提交大量修改的首选方式是使用git工具(内核的代码版本管理工具
207 ,更多的信息可以在http://git-scm.com/获取),不过使用普通补丁也是可以 211 ,更多的信息可以在 http://git-scm.com/ 获取),不过使用普通补丁也是
208 的。 212 可以的。
209 - 两个星期以后-rc1版本内核发布。之后只有不包含可能影响整个内核稳定性的 213 - 两个星期以后-rc1版本内核发布。之后只有不包含可能影响整个内核稳定性的
210 新功能的补丁才可能被接受。请注意一个全新的驱动程序(或者文件系统)有 214 新功能的补丁才可能被接受。请注意一个全新的驱动程序(或者文件系统)有
211 可能在-rc1后被接受是因为这样的修改完全独立,不会影响其他的代码,所以 215 可能在-rc1后被接受是因为这样的修改完全独立,不会影响其他的代码,所以
@@ -220,106 +224,61 @@ kernel.org网站的pub/linux/kernel/v2.6/目录下找到它。它的开发遵循
220 “没有人知道新内核何时会被发布,因为发布是根据已知bug的情况来决定 224 “没有人知道新内核何时会被发布,因为发布是根据已知bug的情况来决定
221 的,而不是根据一个事先制定好的时间表。” 225 的,而不是根据一个事先制定好的时间表。”
222 226
227子系统特定树
228------------
223 229
2242.6.x.y -stable(稳定版)内核源码树 230各种内核子系统的维护者——以及许多内核子系统开发人员——在源代码库中公开了他们
225----------------------------------- 231当前的开发状态。这样,其他人就可以看到内核的不同区域发生了什么。在开发速度
226由4个数字组成的内核版本号说明此内核是-stable版本。它们包含基于2.6.x版本 232很快的领域,可能会要求开发人员将提交的内容建立在这样的子系统内核树上,这样
227内核的相对较小且至关重要的修补,这些修补针对安全性问题或者严重的内核退步。 233就避免了提交与其他已经进行的工作之间的冲突。
228
229这种版本的内核适用于那些期望获得最新的稳定版内核并且不想参与测试开发版或
230者实验版的用户。
231
232如果没有2.6.x.y版本内核存在,那么最新的2.6.x版本内核就相当于是当前的稳定
233版内核。
234
2352.6.x.y版本由“稳定版”小组(邮件地址<stable@vger.kernel.org>)维护,一般隔周发
236布新版本。
237
238内核源码中的Documentation/process/stable-kernel-rules.rst文件具体描述了可被稳定
239版内核接受的修改类型以及发布的流程。
240 234
235这些存储库中的大多数都是Git树,但是也有其他的scm在使用,或者补丁队列被发布
236为Quilt系列。这些子系统存储库的地址列在MAINTAINERS文件中。其中许多可以在
237https://git.kernel.org/上浏览。
241 238
2422.6.x -mm补丁集 239在将一个建议的补丁提交到这样的子系统树之前,需要对它进行审查,审查主要发生
243--------------- 240在邮件列表上(请参见下面相应的部分)。对于几个内核子系统,这个审查过程是通
244这是由Andrew Morton维护的试验性内核补丁集。Andrew将所有子系统的内核源码 241过工具补丁跟踪的。Patchwork提供了一个Web界面,显示补丁发布、对补丁的任何评
245和补丁拼凑到一起,并且加入了大量从linux-kernel邮件列表中采集的补丁。这个 242论或修订,维护人员可以将补丁标记为正在审查、接受或拒绝。大多数补丁网站都列
246源码树是新功能和补丁的试炼场。当补丁在-mm补丁集里证明了其价值以后Andrew 243在 https://patchwork.kernel.org/
247或者相应子系统的维护者会将补丁发给Linus以便集成进主内核源码树。
248 244
249在将所有新补丁发给Linus以集成到主内核源码树之前,我们非常鼓励先把这些补 245Linux-next 集成测试树
250丁放在-mm版内核源码树中进行测试。 246---------------------
251
252这些内核版本不适合在需要稳定运行的系统上运行,因为运行它们比运行任何其他
253内核分支都更具有风险。
254
255如果你想为内核开发进程提供帮助,请尝试并使用这些内核版本,并在
256linux-kernel邮件列表中提供反馈,告诉大家你遇到了问题还是一切正常。
257
258通常-mm版补丁集不光包括这些额外的试验性补丁,还包括发布时-git版主源码树
259中的改动。
260
261-mm版内核没有固定的发布周期,但是通常在每两个-rc版内核发布之间都会有若干
262个-mm版内核发布(一般是1至3个)。
263
264
265子系统相关内核源码树和补丁集
266----------------------------
267相当一部分内核子系统开发者会公开他们自己的开发源码树,以便其他人能了解内
268核的不同领域正在发生的事情。如上所述,这些源码树会被集成到-mm版本内核中。
269
270下面是目前可用的一些内核源码树的列表:
271 通过git管理的源码树:
272 - Kbuild开发源码树, Sam Ravnborg <sam@ravnborg.org>
273 git.kernel.org:/pub/scm/linux/kernel/git/sam/kbuild.git
274
275 - ACPI开发源码树, Len Brown <len.brown@intel.com>
276 git.kernel.org:/pub/scm/linux/kernel/git/lenb/linux-acpi-2.6.git
277
278 - 块设备开发源码树, Jens Axboe <axboe@suse.de>
279 git.kernel.org:/pub/scm/linux/kernel/git/axboe/linux-2.6-block.git
280
281 - DRM开发源码树, Dave Airlie <airlied@linux.ie>
282 git.kernel.org:/pub/scm/linux/kernel/git/airlied/drm-2.6.git
283
284 - ia64开发源码树, Tony Luck <tony.luck@intel.com>
285 git.kernel.org:/pub/scm/linux/kernel/git/aegl/linux-2.6.git
286 247
287 - ieee1394, Jody McIntyre <scjody@modernduck.com> 248子系统并到主之前,需要对它们进行集成测试。为此,存在一个
288 git.kernel.org:/pub/scm/linux/kernel/git/scjody/ieee1394.git 249特殊的测试存储库,其中几乎每天都会提取所有子系统树:
289 250
290 - infiniband开发源码树, Roland Dreier <rolandd@cisco.com> 251 https://git.kernel.org/?p=linux/kernel/git/next/linux-next.git
291 git.kernel.org:/pub/scm/linux/kernel/git/roland/infiniband.git
292 252
293 - libata, Jeff Garzik <jgarzik@pobox.com> 253通过这种方式,Linux-next 并阶段将进入主的内容给出了一个概要
294 git.kernel.org:/pub/scm/linux/kernel/git/jgarzik/libata-dev.git 254展望。非常欢冒险的测试者运行测试Linux-next
295 255
296 - 网络驱动程序开发源码树, Jeff Garzik <jgarzik@pobox.com> 256多个主要版本的稳定版内核树
297 git.kernel.org:/pub/scm/linux/kernel/git/jgarzik/netdev-2.6.git 257-----------------------------------
258由3个数字组成的内核版本号说明此内核是-stable版本。它们包含内核的相对较小且
259至关重要的修补,这些修补针对安全性问题或者严重的内核退步。
298 260
299 - pcmcia, Dominik Brodowski <linux@dominikbrodowski.net> 261这种版本的用于那些期望获稳定版内并且不想参与测试开版或
300 git.kernel.org:/pub/scm/linux/kernel/git/brodo/pcmcia-2.6.git 262者实验版的用户。
301 263
302 - SCSI, James Bottomley <James.Bottomley@SteelEye.com> 264版本由“稳定版”小组(邮件地址<stable@vger.kernel.org>)维护,一般
303 git.kernel.org:/pub/scm/linux/kernel/git/jejb/scsi-misc-2.6.git 265隔周发布新版本。
304 266
305 使用quilt管理的补丁集: 267内核源码中的 :ref:`Documentation/process/stable-kernel-rules.rst <stable_kernel_rules>`
306 - USB, PCI, 驱动程序核心和I2C, Greg Kroah-Hartman <gregkh@linuxfoundation.org> 268文件具体描述了可被稳定版内核接受的修改类型以及发布的流程。
307 kernel.org/pub/linux/kernel/people/gregkh/gregkh-2.6/
308 - x86-64, 部分i386, Andi Kleen <ak@suse.de>
309 ftp.firstfloor.org:/pub/ak/x86_64/quilt/
310 269
311 其他内核源码树可以在http://git.kernel.org的列表中和MAINTAINERS文件里
312 找到。
313 270
314报告bug 271报告bug
315------- 272-------
316 273
317bugzilla.kernel.org是Linux内核开发者们用来跟踪内核Bug的网站。我们鼓励用 274bugzilla.kernel.org是Linux内核开发者们用来跟踪内核Bug的网站。我们鼓励用
318户在这个工具中报告找到的所有bug。如何使用内核bugzilla的细节请访问: 275户在这个工具中报告找到的所有bug。如何使用内核bugzilla的细节请访问:
276
319 http://test.kernel.org/bugzilla/faq.html 277 http://test.kernel.org/bugzilla/faq.html
320 278
321内核源码主目录中的admin-guide/reporting-bugs.rst文件里有一个很好的模板。它指导用户如何报 279内核源码主目录中的:ref:`admin-guide/reporting-bugs.rst <reportingbugs>`
322告可能的内核bug以及需要提供哪些信息来帮助内核开发者们找到问题的根源。 280文件里有一个很好的模板。它指导用户如何报告可能的内核bug以及需要提供哪些信息
281来帮助内核开发者们找到问题的根源。
323 282
324 283
325利用bug报告 284利用bug报告
@@ -330,12 +289,7 @@ bugzilla.kernel.org是Linux内核开发者们用来跟踪内核Bug的网站。
330者感受到你的存在。修改bug是赢得其他开发者赞誉的最好办法,因为并不是很多 289者感受到你的存在。修改bug是赢得其他开发者赞誉的最好办法,因为并不是很多
331人都喜欢浪费时间去修改别人报告的bug。 290人都喜欢浪费时间去修改别人报告的bug。
332 291
333要尝试修改已知的bug,请访问http://bugzilla.kernel.org网址。如果你想获得 292要尝试修改已知的bug,请访问 http://bugzilla.kernel.org 网址。
334最新bug的通知,可以订阅bugme-new邮件列表(只有新的bug报告会被寄到这里)
335或者订阅bugme-janitor邮件列表(所有bugzilla的变动都会被寄到这里)。
336
337 https://lists.linux-foundation.org/mailman/listinfo/bugme-new
338 https://lists.linux-foundation.org/mailman/listinfo/bugme-janitors
339 293
340 294
341邮件列表 295邮件列表
@@ -343,10 +297,14 @@ bugzilla.kernel.org是Linux内核开发者们用来跟踪内核Bug的网站。
343 297
344正如上面的文档所描述,大多数的骨干内核开发者都加入了Linux Kernel邮件列 298正如上面的文档所描述,大多数的骨干内核开发者都加入了Linux Kernel邮件列
345表。如何订阅和退订列表的细节可以在这里找到: 299表。如何订阅和退订列表的细节可以在这里找到:
300
346 http://vger.kernel.org/vger-lists.html#linux-kernel 301 http://vger.kernel.org/vger-lists.html#linux-kernel
302
347网上很多地方都有这个邮件列表的存档(archive)。可以使用搜索引擎来找到这些 303网上很多地方都有这个邮件列表的存档(archive)。可以使用搜索引擎来找到这些
348存档。比如: 304存档。比如:
305
349 http://dir.gmane.org/gmane.linux.kernel 306 http://dir.gmane.org/gmane.linux.kernel
307
350在发信之前,我们强烈建议你先在存档中搜索你想要讨论的问题。很多已经被详细 308在发信之前,我们强烈建议你先在存档中搜索你想要讨论的问题。很多已经被详细
351讨论过的问题只在邮件列表的存档中可以找到。 309讨论过的问题只在邮件列表的存档中可以找到。
352 310
@@ -354,10 +312,12 @@ bugzilla.kernel.org是Linux内核开发者们用来跟踪内核Bug的网站。
354MAINTAINERS文件中可以找到不同话题对应的邮件列表。 312MAINTAINERS文件中可以找到不同话题对应的邮件列表。
355 313
356很多邮件列表架设在kernel.org服务器上。这些列表的信息可以在这里找到: 314很多邮件列表架设在kernel.org服务器上。这些列表的信息可以在这里找到:
315
357 http://vger.kernel.org/vger-lists.html 316 http://vger.kernel.org/vger-lists.html
358 317
359在使用这些邮件列表时,请记住保持良好的行为习惯。下面的链接提供了与这些列 318在使用这些邮件列表时,请记住保持良好的行为习惯。下面的链接提供了与这些列
360表(或任何其它邮件列表)交流的一些简单规则,虽然内容有点滥竽充数。 319表(或任何其它邮件列表)交流的一些简单规则,虽然内容有点滥竽充数。
320
361 http://www.albion.com/netiquette/ 321 http://www.albion.com/netiquette/
362 322
363当有很多人回复你的邮件时,邮件的抄送列表会变得很长。请不要将任何人从抄送 323当有很多人回复你的邮件时,邮件的抄送列表会变得很长。请不要将任何人从抄送
@@ -369,11 +329,12 @@ MAINTAINERS文件中可以找到不同话题对应的邮件列表。
369这几行。将你的评论加在被引用的段落之间而不要放在邮件的顶部。 329这几行。将你的评论加在被引用的段落之间而不要放在邮件的顶部。
370 330
371如果你在邮件中附带补丁,请确认它们是可以直接阅读的纯文本(如 331如果你在邮件中附带补丁,请确认它们是可以直接阅读的纯文本(如
372Documentation/process/submitting-patches.rst文档中所述)。内核开发者们不希望遇到附件 332:ref:`Documentation/translations/zh_CN/process/submitting-patches.rst <cn_submittingpatches>`
373或者被压缩了的补丁。只有这样才能保证他们可以直接评论你的每行代码。请确保 333文档中所述)。内核开发者们不希望遇到附件或者被压缩了的补丁。只有这样才能
374你使用的邮件发送程序不会修改空格和制表符。一个防范性的测试方法是先将邮件 334保证他们可以直接评论你的每行代码。请确保你使用的邮件发送程序不会修改空格
375发送给自己,然后自己尝试是否可以顺利地打上收到的补丁。如果测试不成功,请 335和制表符。一个防范性的测试方法是先将邮件发送给自己,然后自己尝试是否可以
376调整或者更换你的邮件发送程序直到它正确工作为止。 336顺利地打上收到的补丁。如果测试不成功,请调整或者更换你的邮件发送程序直到
337它正确工作为止。
377 338
378总而言之,请尊重其他的邮件列表订阅者。 339总而言之,请尊重其他的邮件列表订阅者。
379 340
@@ -383,6 +344,7 @@ Documentation/process/submitting-patches.rst文档中所述)。内核开发者
383 344
384内核社区的目标就是提供尽善尽美的内核。所以当你提交补丁期望被接受进内核的 345内核社区的目标就是提供尽善尽美的内核。所以当你提交补丁期望被接受进内核的
385时候,它的技术价值以及其他方面都将被评审。那么你可能会得到什么呢? 346时候,它的技术价值以及其他方面都将被评审。那么你可能会得到什么呢?
347
386 - 批评 348 - 批评
387 - 评论 349 - 评论
388 - 要求修改 350 - 要求修改
@@ -395,6 +357,7 @@ Documentation/process/submitting-patches.rst文档中所述)。内核开发者
395没在茫茫信海中。 357没在茫茫信海中。
396 358
397你不应该做的事情: 359你不应该做的事情:
360
398 - 期望自己的补丁不受任何质疑就直接被接受 361 - 期望自己的补丁不受任何质疑就直接被接受
399 - 翻脸 362 - 翻脸
400 - 忽略别人的评论 363 - 忽略别人的评论
@@ -414,7 +377,8 @@ Documentation/process/submitting-patches.rst文档中所述)。内核开发者
414 377
415内核社区的工作模式同大多数传统公司开发队伍的工作模式并不相同。下面这些例 378内核社区的工作模式同大多数传统公司开发队伍的工作模式并不相同。下面这些例
416子,可以帮助你避免某些可能发生问题: 379子,可以帮助你避免某些可能发生问题:
417 用这些话介绍你的修改提案会有好处: 380用这些话介绍你的修改提案会有好处:
381
418 - 它同时解决了多个问题 382 - 它同时解决了多个问题
419 - 它删除了2000行代码 383 - 它删除了2000行代码
420 - 这是补丁,它已经解释了我想要说明的 384 - 这是补丁,它已经解释了我想要说明的
@@ -422,7 +386,8 @@ Documentation/process/submitting-patches.rst文档中所述)。内核开发者
422 - 这是一系列小补丁用来…… 386 - 这是一系列小补丁用来……
423 - 这个修改提高了普通机器的性能…… 387 - 这个修改提高了普通机器的性能……
424 388
425 应该避免如下的说法: 389应该避免如下的说法:
390
426 - 我们在AIX/ptx/Solaris就是这么做的,所以这么做肯定是好的…… 391 - 我们在AIX/ptx/Solaris就是这么做的,所以这么做肯定是好的……
427 - 我做这行已经20年了,所以…… 392 - 我做这行已经20年了,所以……
428 - 为了我们公司赚钱考虑必须这么做 393 - 为了我们公司赚钱考虑必须这么做
@@ -495,6 +460,7 @@ Linux内核社区并不喜欢一下接收大段的代码。修改需要被恰当
495当你发送补丁的时候,需要特别留意邮件正文的内容。因为这里的信息将会做为补 460当你发送补丁的时候,需要特别留意邮件正文的内容。因为这里的信息将会做为补
496丁的修改记录(ChangeLog),会被一直保留以备大家查阅。它需要完全地描述补丁, 461丁的修改记录(ChangeLog),会被一直保留以备大家查阅。它需要完全地描述补丁,
497包括: 462包括:
463
498 - 为什么需要这个修改 464 - 为什么需要这个修改
499 - 补丁的总体设计 465 - 补丁的总体设计
500 - 实现细节 466 - 实现细节
@@ -510,7 +476,8 @@ Linux内核社区并不喜欢一下接收大段的代码。修改需要被恰当
510很多人已经做到了,而他们都曾经和现在的你站在同样的起点上。 476很多人已经做到了,而他们都曾经和现在的你站在同样的起点上。
511 477
512 478
513--------------- 479感谢
480----
514感谢Paolo Ciarrocchi允许“开发流程”部分基于他所写的文章 481感谢Paolo Ciarrocchi允许“开发流程”部分基于他所写的文章
515(http://www.kerneltravel.net/newbie/2.6-development_process),感谢Randy 482(http://www.kerneltravel.net/newbie/2.6-development_process),感谢Randy
516Dunlap和Gerrit Huizenga完善了应该说和不该说的列表。感谢Pat Mochel, Hanna 483Dunlap和Gerrit Huizenga完善了应该说和不该说的列表。感谢Pat Mochel, Hanna
diff --git a/Documentation/translations/zh_CN/process/index.rst b/Documentation/translations/zh_CN/process/index.rst
new file mode 100644
index 000000000000..be1e764a80d2
--- /dev/null
+++ b/Documentation/translations/zh_CN/process/index.rst
@@ -0,0 +1,60 @@
1.. raw:: latex
2
3 \renewcommand\thesection*
4 \renewcommand\thesubsection*
5
6.. include:: ../disclaimer-zh_CN.rst
7
8:Original: :ref:`Documentation/process/index.rst <process_index>`
9:Translator: Alex Shi <alex.shi@linux.alibaba.com>
10
11.. _cn_process_index:
12
13与Linux 内核社区一起工作
14========================
15
16那么你想成为Linux内核开发人员? 欢迎! 不但从技术意义上讲有很多关于内核的知识
17需要学,而且了解我们社区的工作方式也很重要。 阅读这些文章可以让您以更轻松地,
18麻烦最少的方式将更改合并到内核。
19
20以下是每位开发人员应阅读的基本指南。
21
22.. toctree::
23 :maxdepth: 1
24
25 howto
26 code-of-conduct
27 code-of-conduct-interpretation
28 submitting-patches
29 programming-language
30 coding-style
31 development-process
32 email-clients
33 license-rules
34
35其它大多数开发人员感兴趣的社区指南:
36
37
38.. toctree::
39 :maxdepth: 1
40
41 submitting-drivers
42 submit-checklist
43 stable-api-nonsense
44 stable-kernel-rules
45 management-style
46
47这些是一些总体技术指南,由于缺乏更好的地方,现在已经放在这里
48
49.. toctree::
50 :maxdepth: 1
51
52 magic-number
53 volatile-considered-harmful
54
55.. only:: subproject and html
56
57 目录
58 ====
59
60 * :ref:`genindex`
diff --git a/Documentation/translations/zh_CN/process/license-rules.rst b/Documentation/translations/zh_CN/process/license-rules.rst
new file mode 100644
index 000000000000..30c272b2a292
--- /dev/null
+++ b/Documentation/translations/zh_CN/process/license-rules.rst
@@ -0,0 +1,370 @@
1.. SPDX-License-Identifier: GPL-2.0
2
3.. include:: ../disclaimer-zh_CN.rst
4
5:Original: :ref:`Documentation/process/license-rules.rst <kernel_licensing>`
6:Translator: Alex Shi <alex.shi@linux.alibaba.com>
7
8.. _cn_kernel_licensing:
9
10Linux内核许可规则
11=================
12
13Linux内核根据LICENSES/preferred/GPL-2.0中提供的GNU通用公共许可证版本2
14(GPL-2.0)的条款提供,并在LICENSES/exceptions/Linux-syscall-note中显式
15描述了例外的系统调用,如COPYING文件中所述。
16
17此文档文件提供了如何对每个源文件进行注释以使其许可证清晰明确的说明。
18它不会取代内核的许可证。
19
20内核源代码作为一个整体适用于COPYING文件中描述的许可证,但是单个源文件可以
21具有不同的与GPL-20兼容的许可证::
22
23 GPL-1.0+ : GNU通用公共许可证v1.0或更高版本
24 GPL-2.0+ : GNU通用公共许可证v2.0或更高版本
25 LGPL-2.0 : 仅限GNU库通用公共许可证v2
26 LGPL-2.0+: GNU 库通用公共许可证v2或更高版本
27 LGPL-2.1 : 仅限GNU宽通用公共许可证v2.1
28 LGPL-2.1+: GNU宽通用公共许可证v2.1或更高版本
29
30除此之外,个人文件可以在双重许可下提供,例如一个兼容的GPL变体,或者BSD,
31MIT等许可。
32
33用户空间API(UAPI)头文件描述了用户空间程序与内核的接口,这是一种特殊情况。
34根据内核COPYING文件中的注释,syscall接口是一个明确的边界,它不会将GPL要求
35扩展到任何使用它与内核通信的软件。由于UAPI头文件必须包含在创建在Linux内核
36上运行的可执行文件的任何源文件中,因此此例外必须记录在特别的许可证表述中。
37
38表达源文件许可证的常用方法是将匹配的样板文本添加到文件的顶部注释中。由于
39格式,拼写错误等,这些“样板”很难通过那些在上下文中使用的验证许可证合规性
40的工具。
41
42样板文本的替代方法是在每个源文件中使用软件包数据交换(SPDX)许可证标识符。
43SPDX许可证标识符是机器可解析的,并且是用于提供文件内容的许可证的精确缩写。
44SPDX许可证标识符由Linux 基金会的SPDX 工作组管理,并得到了整个行业,工具
45供应商和法律团队的合作伙伴的一致同意。有关详细信息,请参阅
46https://spdx.org/
47
48Linux内核需要所有源文件中的精确SPDX标识符。内核中使用的有效标识符在
49`许可标识符`_ 一节中进行了解释,并且已可以在
50https://spdx.org/licenses/ 上的官方SPDX许可证列表中检索,并附带许可证
51文本。
52
53许可标识符语法
54--------------
55
561.安置:
57
58   内核文件中的SPDX许可证标识符应添加到可包含注释的文件中的第一行。对于大多
59 数文件,这是第一行,除了那些在第一行中需要'#!PATH_TO_INTERPRETER'的脚本。
60 对于这些脚本,SPDX标识符进入第二行。
61
62|
63
642. 风格:
65
66 SPDX许可证标识符以注释的形式添加。注释样式取决于文件类型::
67
68 C source: // SPDX-License-Identifier: <SPDX License Expression>
69 C header: /* SPDX-License-Identifier: <SPDX License Expression> */
70 ASM: /* SPDX-License-Identifier: <SPDX License Expression> */
71 scripts: # SPDX-License-Identifier: <SPDX License Expression>
72 .rst: .. SPDX-License-Identifier: <SPDX License Expression>
73 .dts{i}: // SPDX-License-Identifier: <SPDX License Expression>
74
75 如果特定工具无法处理标准注释样式,则应使用工具接受的相应注释机制。这是在
76 C 头文件中使用“/\*\*/”样式注释的原因。过去在使用生成的.lds文件中观察到
77 构建被破坏,其中'ld'无法解析C++注释。现在已经解决了这个问题,但仍然有较
78 旧的汇编程序工具无法处理C++样式的注释。
79
80|
81
823. 句法:
83
84 <SPDX许可证表达式>是SPDX许可证列表中的SPDX短格式许可证标识符,或者在许可
85 证例外适用时由“WITH”分隔的两个SPDX短格式许可证标识符的组合。当应用多个许
86 可证时,表达式由分隔子表达式的关键字“AND”,“OR”组成,并由“(”,“)”包围。
87
88 带有“或更高”选项的[L]GPL等许可证的许可证标识符通过使用“+”来表示“或更高”
89 选项来构建。::
90
91 // SPDX-License-Identifier: GPL-2.0+
92 // SPDX-License-Identifier: LGPL-2.1+
93
94 当需要修正的许可证时,应使用WITH。 例如,linux内核UAPI文件使用表达式::
95
96 // SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note
97 // SPDX-License-Identifier: GPL-2.0+ WITH Linux-syscall-note
98
99 其它在内核中使用WITH例外的事例如下::
100
101 // SPDX-License-Identifier: GPL-2.0 WITH mif-exception
102 // SPDX-License-Identifier: GPL-2.0+ WITH GCC-exception-2.0
103
104 例外只能与特定的许可证标识符一起使用。有效的许可证标识符列在异常文本文件
105 的标记中。有关详细信息,请参阅 `许可标识符`_ 一章中的 `例外`_ 。
106
107 如果文件是双重许可且只选择一个许可证,则应使用OR。例如,一些dtsi文件在双
108 许可下可用::
109
110 // SPDX-License-Identifier: GPL-2.0 OR BSD-3-Clause
111
112 内核中双许可文件中许可表达式的示例::
113
114 // SPDX-License-Identifier: GPL-2.0 OR MIT
115 // SPDX-License-Identifier: GPL-2.0 OR BSD-2-Clause
116 // SPDX-License-Identifier: GPL-2.0 OR Apache-2.0
117 // SPDX-License-Identifier: GPL-2.0 OR MPL-1.1
118 // SPDX-License-Identifier: (GPL-2.0 WITH Linux-syscall-note) OR MIT
119 // SPDX-License-Identifier: GPL-1.0+ OR BSD-3-Clause OR OpenSSL
120
121 如果文件具有多个许可证,其条款全部适用于使用该文件,则应使用AND。例如,
122 如果代码是从另一个项目继承的,并且已经授予了将其放入内核的权限,但原始
123 许可条款需要保持有效::
124
125 // SPDX-License-Identifier: (GPL-2.0 WITH Linux-syscall-note) AND MIT
126
127 另一个需要遵守两套许可条款的例子是::
128
129 // SPDX-License-Identifier: GPL-1.0+ AND LGPL-2.1+
130
131许可标识符
132----------
133
134当前使用的许可证以及添加到内核的代码许可证可以分解为:
135
1361. _`优先许可`:
137
138 应尽可能使用这些许可证,因为它们已知完全兼容并广泛使用。这些许可证在内核
139 目录::
140
141 LICENSES/preferred/
142
143 此目录中的文件包含完整的许可证文本和 `元标记`_ 。文件名与SPDX许可证标识
144 符相同,后者应用于源文件中的许可证。
145
146 例如::
147
148 LICENSES/preferred/GPL-2.0
149
150 包含GPLv2许可证文本和所需的元标签::
151
152 LICENSES/preferred/MIT
153
154 包含MIT许可证文本和所需的元标记
155
156 _`元标记`:
157
158 许可证文件中必须包含以下元标记:
159
160 - Valid-License-Identifier:
161
162   一行或多行, 声明那些许可标识符在项目内有效, 以引用此特定许可的文本。通
163 常这是一个有效的标识符,但是例如对于带有'或更高'选项的许可证,两个标识
164 符都有效。
165
166 - SPDX-URL:
167
168 SPDX页面的URL,其中包含与许可证相关的其他信息.
169
170 - Usage-Guidance:
171
172 使用建议的自由格式文本。该文本必须包含SPDX许可证标识符的正确示例,因为
173 它们应根据 `许可标识符语法`_ 指南放入源文件中。
174
175 - License-Text:
176
177 此标记之后的所有文本都被视为原始许可文本
178
179 文件格式示例::
180
181 Valid-License-Identifier: GPL-2.0
182 Valid-License-Identifier: GPL-2.0+
183 SPDX-URL: https://spdx.org/licenses/GPL-2.0.html
184 Usage-Guide:
185 To use this license in source code, put one of the following SPDX
186 tag/value pairs into a comment according to the placement
187 guidelines in the licensing rules documentation.
188 For 'GNU General Public License (GPL) version 2 only' use:
189 SPDX-License-Identifier: GPL-2.0
190 For 'GNU General Public License (GPL) version 2 or any later version' use:
191 SPDX-License-Identifier: GPL-2.0+
192 License-Text:
193 Full license text
194
195 ::
196
197 SPDX-License-Identifier: MIT
198 SPDX-URL: https://spdx.org/licenses/MIT.html
199 Usage-Guide:
200 To use this license in source code, put the following SPDX
201 tag/value pair into a comment according to the placement
202 guidelines in the licensing rules documentation.
203 SPDX-License-Identifier: MIT
204 License-Text:
205 Full license text
206
207|
208
2092. 不推荐的许可证:
210
211 这些许可证只应用于现有代码或从其他项目导入代码。这些许可证在内核目录::
212
213 LICENSES/other/
214
215 此目录中的文件包含完整的许可证文本和 `元标记`_ 。文件名与SPDX许可证标识
216 符相同,后者应用于源文件中的许可证。
217
218 例如::
219
220 LICENSES/other/ISC
221
222 包含国际系统联合许可文本和所需的元标签::
223
224 LICENSES/other/ZLib
225
226 包含ZLIB许可文本和所需的元标签.
227
228 元标签:
229
230 “其他”许可证的元标签要求与 `优先许可`_ 的要求相同。
231
232 文件格式示例::
233
234 Valid-License-Identifier: ISC
235 SPDX-URL: https://spdx.org/licenses/ISC.html
236 Usage-Guide:
237 Usage of this license in the kernel for new code is discouraged
238 and it should solely be used for importing code from an already
239 existing project.
240 To use this license in source code, put the following SPDX
241 tag/value pair into a comment according to the placement
242 guidelines in the licensing rules documentation.
243 SPDX-License-Identifier: ISC
244 License-Text:
245 Full license text
246
247|
248
2493. _`例外`:
250
251 某些许可证可以修改,并允许原始许可证不具有的某些例外权利。这些例外在
252 内核目录::
253
254 LICENSES/exceptions/
255
256 此目录中的文件包含完整的例外文本和所需的 `例外元标记`_ 。
257
258 例如::
259
260 LICENSES/exceptions/Linux-syscall-note
261
262 包含Linux内核的COPYING文件中记录的Linux系统调用例外,该文件用于UAPI
263 头文件。例如::
264
265 LICENSES/exceptions/GCC-exception-2.0
266
267 包含GCC'链接例外',它允许独立于其许可证的任何二进制文件与标记有此例外的
268 文件的编译版本链接。这是从GPL不兼容源代码创建可运行的可执行文件所必需的。
269
270 _`例外元标记`:
271
272 以下元标记必须在例外文件中可用:
273
274 - SPDX-Exception-Identifier:
275
276   一个可与SPDX许可证标识符一起使用的例外标识符。
277
278 - SPDX-URL:
279
280 SPDX页面的URL,其中包含与例外相关的其他信息。
281
282 - SPDX-Licenses:
283
284   以逗号分隔的例外可用的SPDX许可证标识符列表。
285
286 - Usage-Guidance:
287
288 使用建议的自由格式文本。必须在文本后面加上SPDX许可证标识符的正确示例,
289 因为它们应根据 `许可标识符语法`_ 指南放入源文件中。
290
291 - Exception-Text:
292
293 此标记之后的所有文本都被视为原始异常文本
294
295 文件格式示例::
296
297 SPDX-Exception-Identifier: Linux-syscall-note
298 SPDX-URL: https://spdx.org/licenses/Linux-syscall-note.html
299 SPDX-Licenses: GPL-2.0, GPL-2.0+, GPL-1.0+, LGPL-2.0, LGPL-2.0+, LGPL-2.1, LGPL-2.1+
300 Usage-Guidance:
301 This exception is used together with one of the above SPDX-Licenses
302 to mark user-space API (uapi) header files so they can be included
303 into non GPL compliant user-space application code.
304 To use this exception add it with the keyword WITH to one of the
305 identifiers in the SPDX-Licenses tag:
306 SPDX-License-Identifier: <SPDX-License> WITH Linux-syscall-note
307 Exception-Text:
308 Full exception text
309
310 ::
311
312 SPDX-Exception-Identifier: GCC-exception-2.0
313 SPDX-URL: https://spdx.org/licenses/GCC-exception-2.0.html
314 SPDX-Licenses: GPL-2.0, GPL-2.0+
315 Usage-Guidance:
316 The "GCC Runtime Library exception 2.0" is used together with one
317 of the above SPDX-Licenses for code imported from the GCC runtime
318 library.
319 To use this exception add it with the keyword WITH to one of the
320 identifiers in the SPDX-Licenses tag:
321 SPDX-License-Identifier: <SPDX-License> WITH GCC-exception-2.0
322 Exception-Text:
323 Full exception text
324
325
326所有SPDX许可证标识符和例外都必须在LICENSES子目录中具有相应的文件。这是允许
327工具验证(例如checkpatch.pl)以及准备好从源读取和提取许可证所必需的, 这是
328各种FOSS组织推荐的,例如 `FSFE REUSE initiative <https://reuse.software/>`_.
329
330_`模块许可`
331-----------------
332
333 可加载内核模块还需要MODULE_LICENSE()标记。此标记既不替代正确的源代码
334 许可证信息(SPDX-License-Identifier),也不以任何方式表示或确定提供模块
335 源代码的确切许可证。
336
337 此标记的唯一目的是提供足够的信息,该模块是否是自由软件或者是内核模块加
338 载器和用户空间工具的专有模块。
339
340 MODULE_LICENSE()的有效许可证字符串是:
341
342 ============================= =============================================
343 "GPL" 模块是根据GPL版本2许可的。这并不表示仅限于
344 GPL-2.0或GPL-2.0或更高版本之间的任何区别。
345 最正确许可证信息只能通过相应源文件中的许可证
346 信息来确定
347
348 "GPL v2" 和"GPL"相同,它的存在是因为历史原因。
349
350 "GPL and additional rights" 表示模块源在GPL v2变体和MIT许可下双重许可的
351 历史变体。请不要在新代码中使用。
352
353 "Dual MIT/GPL" 表达该模块在GPL v2变体或MIT许可证选择下双重
354 许可的正确方式。
355
356 "Dual BSD/GPL" 该模块根据GPL v2变体或BSD许可证选择进行双重
357 许可。 BSD许可证的确切变体只能通过相应源文件
358 中的许可证信息来确定。
359
360 "Dual MPL/GPL" 该模块根据GPL v2变体或Mozilla Public License
361 (MPL)选项进行双重许可。 MPL许可证的确切变体
362 只能通过相应的源文件中的许可证信息来确定。
363
364 "Proprietary" 该模块属于专有许可。此字符串仅用于专有的第三
365 方模块,不能用于在内核树中具有源代码的模块。
366 以这种方式标记的模块在加载时会使用'P'标记污
367 染内核,并且内核模块加载器拒绝将这些模块链接
368 到使用EXPORT_SYMBOL_GPL()导出的符号。
369 ============================= =============================================
370
diff --git a/Documentation/translations/zh_CN/process/magic-number.rst b/Documentation/translations/zh_CN/process/magic-number.rst
new file mode 100644
index 000000000000..15c592518194
--- /dev/null
+++ b/Documentation/translations/zh_CN/process/magic-number.rst
@@ -0,0 +1,151 @@
1.. _cn_magicnumbers:
2
3.. include:: ../disclaimer-zh_CN.rst
4
5:Original: :ref:`Documentation/process/magic-number.rst <magicnumbers>`
6
7如果想评论或更新本文的内容,请直接发信到LKML。如果你使用英文交流有困难的话,也可
8以向中文版维护者求助。如果本翻译更新不及时或者翻译存在问题,请联系中文版维护者::
9
10 中文版维护者: 贾威威 Jia Wei Wei <harryxiyou@gmail.com>
11 中文版翻译者: 贾威威 Jia Wei Wei <harryxiyou@gmail.com>
12 中文版校译者: 贾威威 Jia Wei Wei <harryxiyou@gmail.com>
13
14Linux 魔术数
15============
16
17这个文件是有关当前使用的魔术值注册表。当你给一个结构添加了一个魔术值,你也应该把这个魔术值添加到这个文件,因为我们最好把用于各种结构的魔术值统一起来。
18
19使用魔术值来保护内核数据结构是一个非常好的主意。这就允许你在运行期检查(a)一个结构是否已经被攻击,或者(b)你已经给一个例行程序通过了一个错误的结构。后一种情况特别地有用---特别是当你通过一个空指针指向结构体的时候。tty源码,例如,经常通过特定驱动使用这种方法并且反复地排列特定方面的结构。
20
21使用魔术值的方法是在结构的开始处声明的,如下::
22
23 struct tty_ldisc {
24 int magic;
25 ...
26 };
27
28当你以后给内核添加增强功能的时候,请遵守这条规则!这样就会节省数不清的调试时间,特别是一些古怪的情况,例如,数组超出范围并且重新写了超出部分。遵守这个规则,‪这些情况可以被快速地,安全地避免。
29
30 Theodore Ts'o
31 31 Mar 94
32
33给当前的Linux 2.1.55添加魔术表。
34
35 Michael Chastain
36 <mailto:mec@shout.net>
37 22 Sep 1997
38
39现在应该最新的Linux 2.1.112.因为在特性冻结期间,不能在2.2.x前改变任何东西。这些条目被数域所排序。
40
41 Krzysztof G.Baranowski
42 <mailto: kgb@knm.org.pl>
43 29 Jul 1998
44
45更新魔术表到Linux 2.5.45。刚好越过特性冻结,但是有可能还会有一些新的魔术值在2.6.x之前融入到内核中。
46
47 Petr Baudis
48 <pasky@ucw.cz>
49 03 Nov 2002
50
51更新魔术表到Linux 2.5.74。
52
53 Fabian Frederick
54 <ffrederick@users.sourceforge.net>
55 09 Jul 2003
56
57===================== ================ ======================== ==========================================
58魔术数名 数字 结构 文件
59===================== ================ ======================== ==========================================
60PG_MAGIC 'P' pg_{read,write}_hdr ``include/linux/pg.h``
61CMAGIC 0x0111 user ``include/linux/a.out.h``
62MKISS_DRIVER_MAGIC 0x04bf mkiss_channel ``drivers/net/mkiss.h``
63HDLC_MAGIC 0x239e n_hdlc ``drivers/char/n_hdlc.c``
64APM_BIOS_MAGIC 0x4101 apm_user ``arch/x86/kernel/apm_32.c``
65CYCLADES_MAGIC 0x4359 cyclades_port ``include/linux/cyclades.h``
66DB_MAGIC 0x4442 fc_info ``drivers/net/iph5526_novram.c``
67DL_MAGIC 0x444d fc_info ``drivers/net/iph5526_novram.c``
68FASYNC_MAGIC 0x4601 fasync_struct ``include/linux/fs.h``
69FF_MAGIC 0x4646 fc_info ``drivers/net/iph5526_novram.c``
70ISICOM_MAGIC 0x4d54 isi_port ``include/linux/isicom.h``
71PTY_MAGIC 0x5001 ``drivers/char/pty.c``
72PPP_MAGIC 0x5002 ppp ``include/linux/if_pppvar.h``
73SERIAL_MAGIC 0x5301 async_struct ``include/linux/serial.h``
74SSTATE_MAGIC 0x5302 serial_state ``include/linux/serial.h``
75SLIP_MAGIC 0x5302 slip ``drivers/net/slip.h``
76STRIP_MAGIC 0x5303 strip ``drivers/net/strip.c``
77X25_ASY_MAGIC 0x5303 x25_asy ``drivers/net/x25_asy.h``
78SIXPACK_MAGIC 0x5304 sixpack ``drivers/net/hamradio/6pack.h``
79AX25_MAGIC 0x5316 ax_disp ``drivers/net/mkiss.h``
80TTY_MAGIC 0x5401 tty_struct ``include/linux/tty.h``
81MGSL_MAGIC 0x5401 mgsl_info ``drivers/char/synclink.c``
82TTY_DRIVER_MAGIC 0x5402 tty_driver ``include/linux/tty_driver.h``
83MGSLPC_MAGIC 0x5402 mgslpc_info ``drivers/char/pcmcia/synclink_cs.c``
84TTY_LDISC_MAGIC 0x5403 tty_ldisc ``include/linux/tty_ldisc.h``
85USB_SERIAL_MAGIC 0x6702 usb_serial ``drivers/usb/serial/usb-serial.h``
86FULL_DUPLEX_MAGIC 0x6969 ``drivers/net/ethernet/dec/tulip/de2104x.c``
87USB_BLUETOOTH_MAGIC 0x6d02 usb_bluetooth ``drivers/usb/class/bluetty.c``
88RFCOMM_TTY_MAGIC 0x6d02 ``net/bluetooth/rfcomm/tty.c``
89USB_SERIAL_PORT_MAGIC 0x7301 usb_serial_port ``drivers/usb/serial/usb-serial.h``
90CG_MAGIC 0x00090255 ufs_cylinder_group ``include/linux/ufs_fs.h``
91RPORT_MAGIC 0x00525001 r_port ``drivers/char/rocket_int.h``
92LSEMAGIC 0x05091998 lse ``drivers/fc4/fc.c``
93GDTIOCTL_MAGIC 0x06030f07 gdth_iowr_str ``drivers/scsi/gdth_ioctl.h``
94RIEBL_MAGIC 0x09051990 ``drivers/net/atarilance.c``
95NBD_REQUEST_MAGIC 0x12560953 nbd_request ``include/linux/nbd.h``
96RED_MAGIC2 0x170fc2a5 (any) ``mm/slab.c``
97BAYCOM_MAGIC 0x19730510 baycom_state ``drivers/net/baycom_epp.c``
98ISDN_X25IFACE_MAGIC 0x1e75a2b9 isdn_x25iface_proto_data ``drivers/isdn/isdn_x25iface.h``
99ECP_MAGIC 0x21504345 cdkecpsig ``include/linux/cdk.h``
100LSOMAGIC 0x27091997 lso ``drivers/fc4/fc.c``
101LSMAGIC 0x2a3b4d2a ls ``drivers/fc4/fc.c``
102WANPIPE_MAGIC 0x414C4453 sdla_{dump,exec} ``include/linux/wanpipe.h``
103CS_CARD_MAGIC 0x43525553 cs_card ``sound/oss/cs46xx.c``
104LABELCL_MAGIC 0x4857434c labelcl_info_s ``include/asm/ia64/sn/labelcl.h``
105ISDN_ASYNC_MAGIC 0x49344C01 modem_info ``include/linux/isdn.h``
106CTC_ASYNC_MAGIC 0x49344C01 ctc_tty_info ``drivers/s390/net/ctctty.c``
107ISDN_NET_MAGIC 0x49344C02 isdn_net_local_s ``drivers/isdn/i4l/isdn_net_lib.h``
108SAVEKMSG_MAGIC2 0x4B4D5347 savekmsg ``arch/*/amiga/config.c``
109CS_STATE_MAGIC 0x4c4f4749 cs_state ``sound/oss/cs46xx.c``
110SLAB_C_MAGIC 0x4f17a36d kmem_cache ``mm/slab.c``
111COW_MAGIC 0x4f4f4f4d cow_header_v1 ``arch/um/drivers/ubd_user.c``
112I810_CARD_MAGIC 0x5072696E i810_card ``sound/oss/i810_audio.c``
113TRIDENT_CARD_MAGIC 0x5072696E trident_card ``sound/oss/trident.c``
114ROUTER_MAGIC 0x524d4157 wan_device [in ``wanrouter.h`` pre 3.9]
115SAVEKMSG_MAGIC1 0x53415645 savekmsg ``arch/*/amiga/config.c``
116GDA_MAGIC 0x58464552 gda ``arch/mips/include/asm/sn/gda.h``
117RED_MAGIC1 0x5a2cf071 (any) ``mm/slab.c``
118EEPROM_MAGIC_VALUE 0x5ab478d2 lanai_dev ``drivers/atm/lanai.c``
119HDLCDRV_MAGIC 0x5ac6e778 hdlcdrv_state ``include/linux/hdlcdrv.h``
120PCXX_MAGIC 0x5c6df104 channel ``drivers/char/pcxx.h``
121KV_MAGIC 0x5f4b565f kernel_vars_s ``arch/mips/include/asm/sn/klkernvars.h``
122I810_STATE_MAGIC 0x63657373 i810_state ``sound/oss/i810_audio.c``
123TRIDENT_STATE_MAGIC 0x63657373 trient_state ``sound/oss/trident.c``
124M3_CARD_MAGIC 0x646e6f50 m3_card ``sound/oss/maestro3.c``
125FW_HEADER_MAGIC 0x65726F66 fw_header ``drivers/atm/fore200e.h``
126SLOT_MAGIC 0x67267321 slot ``drivers/hotplug/cpqphp.h``
127SLOT_MAGIC 0x67267322 slot ``drivers/hotplug/acpiphp.h``
128LO_MAGIC 0x68797548 nbd_device ``include/linux/nbd.h``
129OPROFILE_MAGIC 0x6f70726f super_block ``drivers/oprofile/oprofilefs.h``
130M3_STATE_MAGIC 0x734d724d m3_state ``sound/oss/maestro3.c``
131VMALLOC_MAGIC 0x87654320 snd_alloc_track ``sound/core/memory.c``
132KMALLOC_MAGIC 0x87654321 snd_alloc_track ``sound/core/memory.c``
133PWC_MAGIC 0x89DC10AB pwc_device ``drivers/usb/media/pwc.h``
134NBD_REPLY_MAGIC 0x96744668 nbd_reply ``include/linux/nbd.h``
135ENI155_MAGIC 0xa54b872d midway_eprom ``drivers/atm/eni.h``
136CODA_MAGIC 0xC0DAC0DA coda_file_info ``fs/coda/coda_fs_i.h``
137DPMEM_MAGIC 0xc0ffee11 gdt_pci_sram ``drivers/scsi/gdth.h``
138YAM_MAGIC 0xF10A7654 yam_port ``drivers/net/hamradio/yam.c``
139CCB_MAGIC 0xf2691ad2 ccb ``drivers/scsi/ncr53c8xx.c``
140QUEUE_MAGIC_FREE 0xf7e1c9a3 queue_entry ``drivers/scsi/arm/queue.c``
141QUEUE_MAGIC_USED 0xf7e1cc33 queue_entry ``drivers/scsi/arm/queue.c``
142HTB_CMAGIC 0xFEFAFEF1 htb_class ``net/sched/sch_htb.c``
143NMI_MAGIC 0x48414d4d455201 nmi_s ``arch/mips/include/asm/sn/nmi.h``
144===================== ================ ======================== ==========================================
145
146
147请注意,在声音记忆管理中仍然有一些特殊的为每个驱动定义的魔术值。查看include/sound/sndmagic.h来获取他们完整的列表信息。很多OSS声音驱动拥有自己从声卡PCI ID构建的魔术值-他们也没有被列在这里。
148
149IrDA子系统也使用了大量的自己的魔术值,查看include/net/irda/irda.h来获取他们完整的信息。
150
151HFS是另外一个比较大的使用魔术值的文件系统-你可以在fs/hfs/hfs.h中找到他们。
diff --git a/Documentation/translations/zh_CN/process/management-style.rst b/Documentation/translations/zh_CN/process/management-style.rst
new file mode 100644
index 000000000000..a181fa56d19e
--- /dev/null
+++ b/Documentation/translations/zh_CN/process/management-style.rst
@@ -0,0 +1,207 @@
1.. include:: ../disclaimer-zh_CN.rst
2
3:Original: :ref:`Documentation/process/management-style.rst <managementstyle>`
4:Translator: Alex Shi <alex.shi@linux.alibaba.com>
5
6.. _cn_managementstyle:
7
8Linux内核管理风格
9=================
10
11这是一个简短的文档,描述了Linux内核首选的(或胡编的,取决于您问谁)管理风格。
12它的目的是在某种程度上参照 :ref:`process/coding-style.rst <codingstyle>`
13主要是为了避免反复回答 [#cnf1]_ 相同(或类似)的问题。
14
15管理风格是非常个人化的,比简单的编码风格规则更难以量化,因此本文档可能与实
16际情况有关,也可能与实际情况无关。起初它是一个玩笑,但这并不意味着它可能不
17是真的。你得自己决定。
18
19顺便说一句,在谈到“核心管理者”时,主要是技术负责人,而不是在公司内部进行传
20统管理的人。如果你签署了采购订单或者对你的团队的预算有任何了解,你几乎肯定
21不是一个核心管理者。这些建议可能适用于您,也可能不适用于您。
22
23首先,我建议你购买“高效人的七个习惯”,而不是阅读它。烧了它,这是一个伟大的
24象征性姿态。
25
26.. [#cnf1] 本文件并不是通过回答问题,而是通过让提问者痛苦地明白,我们不知道
27 答案是什么。
28
29不管怎样,这里是:
30
31.. _decisions:
32
331)决策
34-------
35
36每个人都认为管理者做决定,而且决策很重要。决定越大越痛苦,管理者就必须越高级。
37这很明显,但事实并非如此。
38
39游戏的名字是 **避免** 做出决定。尤其是,如果有人告诉你“选择(a)或(b),
40我们真的需要你来做决定”,你就是陷入麻烦的管理者。你管理的人比你更了解细节,
41所以如果他们来找你做技术决策,你完蛋了。你显然没有能力为他们做这个决定。
42
43(推论:如果你管理的人不比你更了解细节,你也会被搞砸,尽管原因完全不同。
44也就是说,你的工作是错的,他们应该管理你的才智)
45
46所以游戏的名字是 **避免** 做出决定,至少是那些大而痛苦的决定。做一些小的
47和非结果性的决定是很好的,并且使您看起来好像知道自己在做什么,所以内核管理者
48需要做的是将那些大的和痛苦的决定变成那些没有人真正关心的小事情。
49
50这有助于认识到一个大的决定和一个小的决定之间的关键区别是你是否可以在事后修正
51你的决定。任何决定都可以通过始终确保如果你错了(而且你一定会错),你以后总是
52可以通过回溯来弥补损失。突然间,你就要做两个无关紧要的决定,一个是错误的,另
53一个是正确的。
54
55人们甚至会认为这是真正的领导能力(咳,胡说,咳)。
56
57因此,避免重大决策的关键在于避免做那些无法挽回的事情。不要被引导到一个你无法
58逃离的角落。走投无路的老鼠可能很危险——走投无路的管理者真可怜。
59
60事实证明,由于没有人会愚蠢到让内核管理者承担巨大的财政责任,所以通常很容易
61回溯。既然你不可能浪费掉你无法偿还的巨额资金,你唯一可以回溯的就是技术决策,
62而回溯很容易:只要告诉大家你是个不称职的傻瓜,说对不起,然后撤销你去年让别
63人所做的毫无价值的工作。突然间,你一年前做的决定不在是一个重大的决定,因为
64它很容易被推翻。
65
66事实证明,有些人对接受这种方法有困难,原因有两个:
67
68 - 承认你是个白痴比看起来更难。我们都喜欢保持形象,在公共场合说你错了有时
69 确实很难。
70 - 如果有人告诉你,你去年所做的工作终究是不值得的,那么对那些可怜的低级工
71 程师来说也是很困难的,虽然实际的 **工作** 很容易删除,但你可能已经不可
72 挽回地失去了工程师的信任。记住:“不可撤销”是我们一开始就试图避免的,
73 而你的决定终究是一个重大的决定。
74
75令人欣慰的是,这两个原因都可以通过预先承认你没有任何线索,提前告诉人们你的
76决定完全是初步的,而且可能是错误的事情来有效地缓解。你应该始终保留改变主意
77的权利,并让人们 **意识** 到这一点。当你 **还没有** 做过真正愚蠢的事情的时
78候,承认自己是愚蠢的要容易得多。
79
80然后,当它真的被证明是愚蠢的时候,人们就转动他们的眼珠说“哎呀,下次不要了”。
81
82这种对不称职的先发制人的承认,也可能使真正做这项工作的人也会三思是否值得做。
83毕竟,如果他们不确定这是否是一个好主意,你肯定不应该通过向他们保证他们所做
84的工作将会进入(内核)鼓励他们。在他们开始一项巨大的努力之前,至少让他们三
85思而后行。
86
87记住:他们最好比你更了解细节,而且他们通常认为他们对每件事都有答案。作为一
88个管理者,你能做的最好的事情不是灌输自信,而是对他们所做的事情进行健康的批
89判性思考。
90
91顺便说一句,另一种避免做出决定的方法是看起来很可怜的抱怨 “我们不能两者兼
92得吗?” 相信我,它是有效的。如果不清楚哪种方法更好,他们最终会弄清楚的。
93最终的答案可能是两个团队都会因为这种情况而感到沮丧,以至于他们放弃了。
94
95这听起来像是一个失败,但这通常是一个迹象,表明两个项目都有问题,而参与其中
96的人不能做决定的原因是他们都是错误的。你最终会闻到玫瑰的味道,你避免了另一
97个你本可以搞砸的决定。
98
992)人
100-----
101
102大多数人都是白痴,做一名管理者意味着你必须处理好这件事,也许更重要的是,
103**他们** 必须处理好你。
104
105事实证明,虽然很容易纠正技术错误,但不容易纠正人格障碍。你只能和他们的和
106你的(人格障碍)共处。
107
108但是,为了做好作为内核管理者的准备,最好记住不要烧掉任何桥梁,不要轰炸任何
109无辜的村民,也不要疏远太多的内核开发人员。事实证明,疏远人是相当容易的,而
110亲近一个疏远的人是很难的。因此,“疏远”立即属于“不可逆”的范畴,并根据
111:ref:`decisions` 成为绝不可以做的事情。
112
113这里只有几个简单的规则:
114
115 (1) 不要叫人笨蛋(至少不要在公共场合)
116 (2) 学习如何在忘记规则(1)时道歉
117
118问题在于 #1 很容易去做,因为你可以用数百万种不同的方式说“你是一个笨蛋” [#cnf2]_
119有时甚至没有意识到,而且几乎总是带着一种白热化的信念,认为你是对的。
120
121你越确信自己是对的(让我们面对现实吧,你可以把几乎所有人都称为坏人,而且你
122经常是对的),事后道歉就越难。
123
124要解决此问题,您实际上只有两个选项:
125
126 - 非常擅长道歉
127 - 把“爱”均匀地散开,没有人会真正感觉到自己被不公平地瞄准了。让它有足够的
128 创造性,他们甚至可能会觉得好笑。
129
130选择永远保持礼貌是不存在的。没有人会相信一个如此明显地隐藏了他们真实性格的人。
131
132.. [#cnf2] 保罗·西蒙演唱了“离开爱人的50种方法”,因为坦率地说,“告诉开发者
133 他们是D*CKHEAD" 的100万种方法都无法确认。但我确信他已经这么想了。
134
1353)人2 - 好人
136-------------
137
138虽然大多数人都是白痴,但不幸的是,据此推论你也是白痴,尽管我们都自我感觉良
139好,我们比普通人更好(让我们面对现实吧,没有人相信他们是普通人或低于普通人),
140我们也应该承认我们不是最锋利的刀,而且会有其他人比你更不像白痴。
141
142有些人对聪明人反应不好。其他人利用它们。
143
144作为内核维护人员,确保您在第二组中。接受他们,因为他们会让你的工作更容易。
145特别是,他们能够为你做决定,这就是游戏的全部内容。
146
147所以当你发现一个比你聪明的人时,就顺其自然吧。你的管理职责在很大程度上变成
148了“听起来像是个好主意——去尝试吧”,或者“听起来不错,但是XXX呢?”“。第二个版
149本尤其是一个很好的方法,要么学习一些关于“XXX”的新东西,要么通过指出一些聪明
150人没有想到的东西来显得更具管理性。无论哪种情况,你都会赢。
151
152要注意的一件事是认识到一个领域的伟大不一定会转化为其他领域。所以你可能会向
153特定的方向刺激人们,但让我们面对现实吧,他们可能擅长他们所做的事情,而且对
154其他事情都很差劲。好消息是,人们往往会自然而然地重拾他们擅长的东西,所以当
155你向某个方向刺激他们时,你并不是在做不可逆转的事情,只是不要用力推。
156
1574)责备
158-------
159
160事情会出问题的,人们希望去责备人。贴标签,你就是受责备的人。
161
162事实上,接受责备并不难,尤其是当人们意识到这不 **全是** 你的过错时。这让我
163们找到了承担责任的最佳方式:为别人承担这件事。你会感觉很好,他们会感觉很好,
164没有受到指责. 那谁,失去了他们的全部36GB色情收藏的人,因为你的无能将勉强承
165认,你至少没有试图逃避责任。
166
167然后让真正搞砸了的开发人员(如果你能找到他们)私下知道他们搞砸了。不仅是为
168了将来可以避免,而且为了让他们知道他们欠你一个人情。而且,也许更重要的是,
169他们也可能是能够解决问题的人。因为,让我们面对现实吧,肯定不是你。
170
171承担责任也是你首先成为管理者的原因。这是让人们信任你,让你获得潜在的荣耀的
172一部分,因为你就是那个会说“我搞砸了”的人。如果你已经遵循了以前的规则,你现
173在已经很擅长说了。
174
1755)应避免的事情
176---------------
177
178有一件事人们甚至比被称为“笨蛋”更讨厌,那就是在一个神圣的声音中被称为“笨蛋”。
179第一个你可以道歉,第二个你不会真正得到机会。即使你做得很好,他们也可能不再
180倾听。
181
182我们都认为自己比别人强,这意味着当别人装腔作势时,这会让我们很恼火。你也许
183在道德和智力上比你周围的每个人都优越,但不要试图太明显,除非你真的打算激怒
184某人 [#cnf3]_
185
186同样,不要对事情太客气或太微妙。礼貌很容易落得落花流水,把问题隐藏起来,
187正如他们所说,“在互联网上,没人能听到你的含蓄。”用一个钝器把这一点锤进去,
188因为你不能真的依靠别人来获得你的观点。
189
190一些幽默可以帮助缓和直率和道德化。过度到荒谬的地步,可以灌输一个观点,而不
191会让接受者感到痛苦,他们只是认为你是愚蠢的。因此,它可以帮助我们摆脱对批评
192的个人心理障碍。
193
194.. [#cnf3] 提示:与你的工作没有直接关系的网络新闻组是消除你对他人不满的好
195 方法。偶尔写些侮辱性的帖子,打个喷嚏,让你的情绪得到净化。别把牢骚带回家
196
1976)为什么是我?
198---------------
199
200既然你的主要责任似乎是为别人的错误承担责任,并且让别人痛苦地明白你是不称职
201的,那么显而易见的问题之一就变成了为什么首先要这样做。
202
203首先,虽然你可能会或可能不会听到十几岁女孩(或男孩,让我们不要在这里评判或
204性别歧视)敲你的更衣室门,你会得到一个巨大的个人成就感为“负责”。别介意你真
205的在领导别人,你要跟上别人,尽可能快地追赶他们。每个人都会认为你是负责人。
206
207如果你可以做到这个, 这是个伟大的工作!
diff --git a/Documentation/translations/zh_CN/process/programming-language.rst b/Documentation/translations/zh_CN/process/programming-language.rst
new file mode 100644
index 000000000000..51fd4ef48ea1
--- /dev/null
+++ b/Documentation/translations/zh_CN/process/programming-language.rst
@@ -0,0 +1,41 @@
1.. include:: ../disclaimer-zh_CN.rst
2
3:Original: :ref:`Documentation/process/programming-language.rst <programming_language>`
4:Translator: Alex Shi <alex.shi@linux.alibaba.com>
5
6.. _cn_programming_language:
7
8程序设计语言
9============
10
11内核是用C语言 [c-language]_ 编写的。更准确地说,内核通常是用 ``gcc`` [gcc]_
12在 ``-std=gnu89`` [gcc-c-dialect-options]_ 下编译的:ISO C90的 GNU 方言(
13包括一些C99特性)
14
15这种方言包含对语言 [gnu-extensions]_ 的许多扩展,当然,它们许多都在内核中使用。
16
17对于一些体系结构,有一些使用 ``clang`` [clang]_ 和 ``icc`` [icc]_ 编译内核
18的支持,尽管在编写此文档时还没有完成,仍需要第三方补丁。
19
20属性
21----
22
23在整个内核中使用的一个常见扩展是属性(attributes) [gcc-attribute-syntax]_
24属性允许将实现定义的语义引入语言实体(如变量、函数或类型),而无需对语言进行
25重大的语法更改(例如添加新关键字) [n2049]_
26
27在某些情况下,属性是可选的(即不支持这些属性的编译器仍然应该生成正确的代码,
28即使其速度较慢或执行的编译时检查/诊断次数不够)
29
30内核定义了伪关键字(例如, ``pure`` ),而不是直接使用GNU属性语法(例如,
31``__attribute__((__pure__))`` ),以检测可以使用哪些关键字和/或缩短代码, 具体
32请参阅 ``include/linux/compiler_attributes.h``
33
34.. [c-language] http://www.open-std.org/jtc1/sc22/wg14/www/standards
35.. [gcc] https://gcc.gnu.org
36.. [clang] https://clang.llvm.org
37.. [icc] https://software.intel.com/en-us/c-compilers
38.. [gcc-c-dialect-options] https://gcc.gnu.org/onlinedocs/gcc/C-Dialect-Options.html
39.. [gnu-extensions] https://gcc.gnu.org/onlinedocs/gcc/C-Extensions.html
40.. [gcc-attribute-syntax] https://gcc.gnu.org/onlinedocs/gcc/Attribute-Syntax.html
41.. [n2049] http://www.open-std.org/jtc1/sc22/wg14/www/docs/n2049.pdf
diff --git a/Documentation/translations/zh_CN/stable_api_nonsense.txt b/Documentation/translations/zh_CN/process/stable-api-nonsense.rst
index a2b27fab382c..b4ddb6e88d9d 100644
--- a/Documentation/translations/zh_CN/stable_api_nonsense.txt
+++ b/Documentation/translations/zh_CN/process/stable-api-nonsense.rst
@@ -1,26 +1,18 @@
1Chinese translated version of Documentation/process/stable-api-nonsense.rst 1.. _cn_stable_api_nonsense:
2 2
3If you have any comment or update to the content, please contact the 3.. include:: ../disclaimer-zh_CN.rst
4original document maintainer directly. However, if you have problem
5communicating in English you can also ask the Chinese maintainer for help.
6Contact the Chinese maintainer, if this translation is outdated or there
7is problem with translation.
8 4
9Maintainer: Greg Kroah-Hartman <greg@kroah.com> 5:Original: :ref:`Documentation/process/stable-api-nonsense.rst
10Chinese maintainer: TripleX Chung <zhongyu@18mail.cn> 6 <stable_api_nonsense>`
11---------------------------------------------------------------------
12Documentation/process/stable-api-nonsense.rst 的中文翻译
13 7
14如果想评论或更新本文的内容,请直接联系原文档的维护者。如果你使用英文 8译者::
15交流有困难的话,也可以向中文版维护者求助。如果本翻译更新不及时或者翻
16译存在问题,请联系中文版维护者。
17 9
18文版维护者: Greg Kroah-Hartman <greg@kroah.com> 10文版维护者: 钟宇 TripleX Chung <xxx.phy@gmail.com>
19中文版者: 钟宇 TripleX Chung <zhongyu@18mail.cn> 11 中文版: 钟宇 TripleX Chung <xxx.phy@gmail.com>
20中文版译者: TripleX Chung <zhongyu@18mail.cn> 12 中文版译者: Li Yang <leoyang.li@nxp.com>
21中文版校译者: 李阳 Li Yang <leoli@freescale.com> 13
22 14Linux 内驱动
23--------------------------------------------------------------------- 15==================
24 16
25写作本文档的目的,是为了解释为什么Linux既没有二进制内核接口,也没有稳定 17写作本文档的目的,是为了解释为什么Linux既没有二进制内核接口,也没有稳定
26的内核接口。这里所说的内核接口,是指内核里的接口,而不是内核和用户空间 18的内核接口。这里所说的内核接口,是指内核里的接口,而不是内核和用户空间
@@ -59,18 +51,22 @@ Linux能成为强壮,稳定,成熟的操作系统,这也是你最开始选
59-------------- 51--------------
60假如我们有一个稳定的内核源代码接口,那么自然而然的,我们就拥有了稳定的 52假如我们有一个稳定的内核源代码接口,那么自然而然的,我们就拥有了稳定的
61二进制接口,是这样的吗?错。让我们看看关于Linux内核的几点事实: 53二进制接口,是这样的吗?错。让我们看看关于Linux内核的几点事实:
54
62 - 取决于所用的C编译器的版本,不同的内核数据结构里的结构体的对齐方 55 - 取决于所用的C编译器的版本,不同的内核数据结构里的结构体的对齐方
63式会有差别,代码中不同函数的表现形式也不一样(函数是不是被inline编译取 56 式会有差别,代码中不同函数的表现形式也不一样(函数是不是被inline
64决于编译器行为)。不同的函数的表现形式并不重要,但是数据结构内部的对齐 57 编译取决于编译器行为)。不同的函数的表现形式并不重要,但是数据
65方式很关键。 58 结构内部的对齐方式很关键。
59
66 - 取决于内核的配置选项,不同的选项会让内核的很多东西发生改变: 60 - 取决于内核的配置选项,不同的选项会让内核的很多东西发生改变:
61
67 - 同一个结构体可能包含不同的成员变量 62 - 同一个结构体可能包含不同的成员变量
68 - 有的函数可能根本不会被实现(比如编译的时候没有选择SMP支持 63 - 有的函数可能根本不会被实现(比如编译的时候没有选择SMP支持
69一些锁函数就会被定义成空函数)。 64 一些锁函数就会被定义成空函数)。
70 - 内核使用的内存会以不同的方式对齐,这取决于不同的内核配置选 65 - 内核使用的内存会以不同的方式对齐,这取决于不同的内核配置选
71项。 66 项。
67
72 - Linux可以在很多的不同体系结构的处理器上运行。在某个体系结构上编 68 - Linux可以在很多的不同体系结构的处理器上运行。在某个体系结构上编
73译好的二进制驱动程序,不可能在另外一个体系结构上正确的运行。 69 译好的二进制驱动程序,不可能在另外一个体系结构上正确的运行。
74 70
75对于一个特定的内核,满足这些条件并不难,使用同一个C编译器和同样的内核配 71对于一个特定的内核,满足这些条件并不难,使用同一个C编译器和同样的内核配
76置选项来编译驱动程序模块就可以了。这对于给一个特定Linux发布的特定版本提 72置选项来编译驱动程序模块就可以了。这对于给一个特定Linux发布的特定版本提
@@ -90,7 +86,7 @@ Linux能成为强壮,稳定,成熟的操作系统,这也是你最开始选
90 86
91如果有人不将他的内核驱动程序,放入公版内核的源代码树,而又想让驱动程序 87如果有人不将他的内核驱动程序,放入公版内核的源代码树,而又想让驱动程序
92一直保持在最新的内核中可用,那么这个话题将会变得没完没了。 88一直保持在最新的内核中可用,那么这个话题将会变得没完没了。
93 内核开发是持续而且快节奏的,从来都不会慢下来。内核开发人员在当前接口中 89内核开发是持续而且快节奏的,从来都不会慢下来。内核开发人员在当前接口中
94找到bug,或者找到更好的实现方式。一旦发现这些,他们就很快会去修改当前的 90找到bug,或者找到更好的实现方式。一旦发现这些,他们就很快会去修改当前的
95接口。修改接口意味着,函数名可能会改变,结构体可能被扩充或者删减,函数 91接口。修改接口意味着,函数名可能会改变,结构体可能被扩充或者删减,函数
96的参数也可能发生改变。一旦接口被修改,内核中使用这些接口的地方需要同时 92的参数也可能发生改变。一旦接口被修改,内核中使用这些接口的地方需要同时
@@ -98,21 +94,22 @@ Linux能成为强壮,稳定,成熟的操作系统,这也是你最开始选
98 94
99举一个例子,内核的USB驱动程序接口在USB子系统的整个生命周期中,至少经历 95举一个例子,内核的USB驱动程序接口在USB子系统的整个生命周期中,至少经历
100了三次重写。这些重写解决以下问题: 96了三次重写。这些重写解决以下问题:
97
101 - 把数据流从同步模式改成非同步模式,这个改动减少了一些驱动程序的 98 - 把数据流从同步模式改成非同步模式,这个改动减少了一些驱动程序的
102复杂度,提高了所有USB驱动程序的吞吐率,这样几乎所有的USB设备都能以最大 99 复杂度,提高了所有USB驱动程序的吞吐率,这样几乎所有的USB设备都
103速率工作了。 100 能以最大速率工作了。
104 - 修改了USB核心代码中为USB驱动分配数据包内存的方式,所有的驱动都 101 - 修改了USB核心代码中为USB驱动分配数据包内存的方式,所有的驱动都
105需要提供更多的参数给USB核心,以修正了很多已经被记录在案的死锁。 102 需要提供更多的参数给USB核心,以修正了很多已经被记录在案的死锁。
106 103
107这和一些封闭源代码的操作系统形成鲜明的对比,在那些操作系统上,不得不额 104这和一些封闭源代码的操作系统形成鲜明的对比,在那些操作系统上,不得不额
108外的维护旧的USB接口。这导致了一个可能性,新的开发者依然会不小心使用旧的 105外的维护旧的USB接口。这导致了一个可能性,新的开发者依然会不小心使用旧的
109接口,以不恰当的方式编写代码,进而影响到操作系统的稳定性。 106接口,以不恰当的方式编写代码,进而影响到操作系统的稳定性。
110 在上面的例子中,所有的开发者都同意这些重要的改动,在这样的情况下修改代 107在上面的例子中,所有的开发者都同意这些重要的改动,在这样的情况下修改代
111价很低。如果Linux保持一个稳定的内核源代码接口,那么就得创建一个新的接口 108价很低。如果Linux保持一个稳定的内核源代码接口,那么就得创建一个新的接口
112;旧的,有问题的接口必须一直维护,给Linux USB开发者带来额外的工作。既然 109;旧的,有问题的接口必须一直维护,给Linux USB开发者带来额外的工作。既然
113所有的Linux USB驱动的作者都是利用自己的时间工作,那么要求他们去做毫无意 110所有的Linux USB驱动的作者都是利用自己的时间工作,那么要求他们去做毫无意
114义的免费额外工作,是不可能的。 111义的免费额外工作,是不可能的。
115 安全问题对Linux来说十分重要。一个安全问题被发现,就会在短时间内得到修 112安全问题对Linux来说十分重要。一个安全问题被发现,就会在短时间内得到修
116正。在很多情况下,这将导致Linux内核中的一些接口被重写,以从根本上避免安 113正。在很多情况下,这将导致Linux内核中的一些接口被重写,以从根本上避免安
117全问题。一旦接口被重写,所有使用这些接口的驱动程序,必须同时得到修正, 114全问题。一旦接口被重写,所有使用这些接口的驱动程序,必须同时得到修正,
118以确定安全问题已经得到修复并且不可能在未来还有同样的安全问题。如果内核 115以确定安全问题已经得到修复并且不可能在未来还有同样的安全问题。如果内核
@@ -124,7 +121,7 @@ Linux能成为强壮,稳定,成熟的操作系统,这也是你最开始选
124 121
125 122
126要做什么 123要做什么
127------- 124--------
128 125
129如果你写了一个Linux内核驱动,但是它还不在Linux源代码树里,作为一个开发 126如果你写了一个Linux内核驱动,但是它还不在Linux源代码树里,作为一个开发
130者,你应该怎么做?为每个发布的每个版本提供一个二进制驱动,那简直是一个 127者,你应该怎么做?为每个发布的每个版本提供一个二进制驱动,那简直是一个
@@ -137,20 +134,21 @@ Linux能成为强壮,稳定,成熟的操作系统,这也是你最开始选
137做什么事情。 134做什么事情。
138 135
139把驱动放到内核源代码树里会有很多的好处: 136把驱动放到内核源代码树里会有很多的好处:
137
140 - 驱动的质量会提升,而维护成本(对原始作者来说)会下降。 138 - 驱动的质量会提升,而维护成本(对原始作者来说)会下降。
141 - 其他人会给驱动添加新特性。 139 - 其他人会给驱动添加新特性。
142 - 其他人会找到驱动中的bug并修复。 140 - 其他人会找到驱动中的bug并修复。
143 - 其他人会在驱动中找到性能优化的机会。 141 - 其他人会在驱动中找到性能优化的机会。
144 - 当外部的接口的改变需要修改驱动程序的时候,其他人会修改驱动程序 142 - 当外部的接口的改变需要修改驱动程序的时候,其他人会修改驱动程序
145
146 - 不需要联系任何发行商,这个驱动会自动的随着所有的Linux发布一起发 143 - 不需要联系任何发行商,这个驱动会自动的随着所有的Linux发布一起发
147布。 144 布。
148 145
149和别的操作系统相比,Linux为更多不同的设备提供现成的驱动,而且能在更多不 146和别的操作系统相比,Linux为更多不同的设备提供现成的驱动,而且能在更多不
150同体系结构的处理器上支持这些设备。这个经过考验的开发模式,必然是错不了 147同体系结构的处理器上支持这些设备。这个经过考验的开发模式,必然是错不了
151的 :) 148的 :)
152 149
153------------- 150感谢
151----
154感谢 Randy Dunlap, Andrew Morton, David Brownell, Hanna Linder, 152感谢 Randy Dunlap, Andrew Morton, David Brownell, Hanna Linder,
155Robert Love, and Nishanth Aravamudan 对于本文档早期版本的评审和建议。 153Robert Love, and Nishanth Aravamudan 对于本文档早期版本的评审和建议。
156 154
diff --git a/Documentation/translations/zh_CN/stable_kernel_rules.txt b/Documentation/translations/zh_CN/process/stable-kernel-rules.rst
index db4ba5a0c39a..fba361f2ddfd 100644
--- a/Documentation/translations/zh_CN/stable_kernel_rules.txt
+++ b/Documentation/translations/zh_CN/process/stable-kernel-rules.rst
@@ -1,31 +1,26 @@
1Chinese translated version of Documentation/process/stable-kernel-rules.rst 1.. _cn_stable_kernel_rules:
2 2
3If you have any comment or update to the content, please contact the 3.. include:: ../disclaimer-zh_CN.rst
4original document maintainer directly. However, if you have a problem
5communicating in English you can also ask the Chinese maintainer for
6help. Contact the Chinese maintainer if this translation is outdated
7or if there is a problem with the translation.
8 4
9Chinese maintainer: TripleX Chung <triplex@zh-kernel.org> 5:Original: :ref:`Documentation/process/stable-kernel-rules.rst <stable_kernel_rules>`
10---------------------------------------------------------------------
11Documentation/process/stable-kernel-rules.rst 的中文翻译
12 6
13如果想评论或更新本文的内容,请直接联系原文档的维护者。如果你使用英文 7如果想评论或更新本文的内容,请直接联系原文档的维护者。如果你使用英文
14交流有困难的话,也可以向中文版维护者求助。如果本翻译更新不及时或者翻 8交流有困难的话,也可以向中文版维护者求助。如果本翻译更新不及时或者翻
15译存在问题,请联系中文版维护者 9译存在问题,请联系中文版维护者::
16 10
11 中文版维护者: 钟宇 TripleX Chung <xxx.phy@gmail.com>
12 中文版翻译者: 钟宇 TripleX Chung <xxx.phy@gmail.com>
13 中文版校译者:
14 - 李阳 Li Yang <leoyang.li@nxp.com>
15 - Kangkai Yin <e12051@motorola.com>
17 16
18中文版维护者: 钟宇 TripleX Chung <triplex@zh-kernel.org> 17所有你想知道的事情 - 关于linux稳定版发布
19中文版翻译者: 钟宇 TripleX Chung <triplex@zh-kernel.org> 18========================================
20中文版校译者: 李阳 Li Yang <leo@zh-kernel.org>
21 Kangkai Yin <e12051@motorola.com>
22
23以下为正文
24---------------------------------------------------------------------
25 19
26关于Linux 2.6稳定版发布,所有你想知道的事情。 20关于Linux 2.6稳定版发布,所有你想知道的事情。
27 21
28关于哪些类型的补丁可以被接收进入稳定版代码树,哪些不可以的规则: 22关于哪些类型的补丁可以被接收进入稳定版代码树,哪些不可以的规则:
23----------------------------------------------------------------
29 24
30 - 必须是显而易见的正确,并且经过测试的。 25 - 必须是显而易见的正确,并且经过测试的。
31 - 连同上下文,不能大于100行。 26 - 连同上下文,不能大于100行。
@@ -38,9 +33,10 @@ Documentation/process/stable-kernel-rules.rst 的中文翻译
38 - 没有“理论上的竞争条件”,除非能给出竞争条件如何被利用的解释。 33 - 没有“理论上的竞争条件”,除非能给出竞争条件如何被利用的解释。
39 - 不能存在任何的“琐碎的”修正(拼写修正,去掉多余空格之类的)。 34 - 不能存在任何的“琐碎的”修正(拼写修正,去掉多余空格之类的)。
40 - 必须被相关子系统的维护者接受。 35 - 必须被相关子系统的维护者接受。
41 - 必须遵循Documentation/process/submitting-patches.rst里的规则。 36 - 必须遵循Documentation/translations/zh_CN/process/submitting-patches.rst里的规则。
42 37
43向稳定版代码树提交补丁的过程: 38向稳定版代码树提交补丁的过程:
39------------------------------
44 40
45 - 在确认了补丁符合以上的规则后,将补丁发送到stable@vger.kernel.org。 41 - 在确认了补丁符合以上的规则后,将补丁发送到stable@vger.kernel.org。
46 - 如果补丁被接受到队列里,发送者会收到一个ACK回复,如果没有被接受,收 42 - 如果补丁被接受到队列里,发送者会收到一个ACK回复,如果没有被接受,收
@@ -49,6 +45,7 @@ Documentation/process/stable-kernel-rules.rst 的中文翻译
49 - 安全方面的补丁不要发到这个列表,应该发送到security@kernel.org。 45 - 安全方面的补丁不要发到这个列表,应该发送到security@kernel.org。
50 46
51审查周期: 47审查周期:
48----------
52 49
53 - 当稳定版的维护者决定开始一个审查周期,补丁将被发送到审查委员会,以 50 - 当稳定版的维护者决定开始一个审查周期,补丁将被发送到审查委员会,以
54 及被补丁影响的领域的维护者(除非提交者就是该领域的维护者)并且抄送 51 及被补丁影响的领域的维护者(除非提交者就是该领域的维护者)并且抄送
@@ -63,4 +60,5 @@ Documentation/process/stable-kernel-rules.rst 的中文翻译
63 通常的审查周期。请联系内核安全小组以获得关于这个过程的更多细节。 60 通常的审查周期。请联系内核安全小组以获得关于这个过程的更多细节。
64 61
65审查委员会: 62审查委员会:
63------------
66 - 由一些自愿承担这项任务的内核开发者,和几个非志愿的组成。 64 - 由一些自愿承担这项任务的内核开发者,和几个非志愿的组成。
diff --git a/Documentation/translations/zh_CN/process/submit-checklist.rst b/Documentation/translations/zh_CN/process/submit-checklist.rst
new file mode 100644
index 000000000000..89061aa8fdbe
--- /dev/null
+++ b/Documentation/translations/zh_CN/process/submit-checklist.rst
@@ -0,0 +1,107 @@
1.. include:: ../disclaimer-zh_CN.rst
2
3:Original: :ref:`Documentation/process/submit-checklist.rst <submitchecklist>`
4:Translator: Alex Shi <alex.shi@linux.alibaba.com>
5
6.. _cn_submitchecklist:
7
8Linux内核补丁提交清单
9~~~~~~~~~~~~~~~~~~~~~
10
11如果开发人员希望看到他们的内核补丁提交更快地被接受,那么他们应该做一些基本
12的事情。
13
14这些都是在
15:ref:`Documentation/translations/zh_CN/process/submitting-patches.rst <cn_submittingpatches>`
16和其他有关提交Linux内核补丁的文档中提供的。
17
181) 如果使用工具,则包括定义/声明该工具的文件。不要依赖于其他头文件拉入您使用
19 的头文件。
20
212) 干净的编译:
22
23 a) 使用适用或修改的 ``CONFIG`` 选项 ``=y``、``=m`` 和 ``=n`` 。没有GCC
24 警告/错误,没有链接器警告/错误。
25
26 b) 通过allnoconfig、allmodconfig
27
28 c) 使用 ``O=builddir`` 时可以成功编译
29
303) 通过使用本地交叉编译工具或其他一些构建场在多个CPU体系结构上构建。
31
324) PPC64是一种很好的交叉编译检查体系结构,因为它倾向于对64位的数使用无符号
33 长整型。
34
355) 如下所述 :ref:`Documentation/translations/zh_CN/process/coding-style.rst <cn_codingstyle>`.
36 检查您的补丁是否为常规样式。在提交( ``scripts/check patch.pl`` )之前,
37 使用补丁样式检查器检查是否有轻微的冲突。您应该能够处理您的补丁中存在的所有
38 违规行为。
39
406) 任何新的或修改过的 ``CONFIG`` 选项都不会弄脏配置菜单,并默认为关闭,除非
41 它们符合 ``Documentation/kbuild/kconfig-language.txt`` 中记录的异常条件,
42 菜单属性:默认值.
43
447) 所有新的 ``kconfig`` 选项都有帮助文本。
45
468) 已仔细审查了相关的 ``Kconfig`` 组合。这很难用测试来纠正——脑力在这里是有
47 回报的。
48
499) 用 sparse 检查干净。
50
5110) 使用 ``make checkstack`` 和 ``make namespacecheck`` 并修复他们发现的任何
52 问题。
53
54 .. note::
55
56 ``checkstack`` 并没有明确指出问题,但是任何一个在堆栈上使用超过512
57 字节的函数都可以进行更改。
58
5911) 包括 :ref:`kernel-doc <kernel_doc>` 内核文档以记录全局内核API。(静态函数
60 不需要,但也可以。)使用 ``make htmldocs`` 或 ``make pdfdocs`` 检查
61 :ref:`kernel-doc <kernel_doc>` 并修复任何问题。
62
6312) 通过以下选项同时启用的测试 ``CONFIG_PREEMPT``, ``CONFIG_DEBUG_PREEMPT``,
64 ``CONFIG_DEBUG_SLAB``, ``CONFIG_DEBUG_PAGEALLOC``, ``CONFIG_DEBUG_MUTEXES``,
65 ``CONFIG_DEBUG_SPINLOCK``, ``CONFIG_DEBUG_ATOMIC_SLEEP``,
66 ``CONFIG_PROVE_RCU`` and ``CONFIG_DEBUG_OBJECTS_RCU_HEAD``
67
6813) 已经过构建和运行时测试,包括有或没有 ``CONFIG_SMP``, ``CONFIG_PREEMPT``.
69
7014) 如果补丁程序影响IO/磁盘等:使用或不使用 ``CONFIG_LBDAF`` 进行测试。
71
7215) 所有代码路径都已在启用所有lockdep功能的情况下运行。
73
7416) 所有新的/proc条目都记录在 ``Documentation/``
75
7617) 所有新的内核引导参数都记录在
77 Documentation/admin-guide/kernel-parameters.rst 中。
78
7918) 所有新的模块参数都记录在 ``MODULE_PARM_DESC()``
80
8119) 所有新的用户空间接口都记录在 ``Documentation/ABI/`` 中。有关详细信息,
82 请参阅 ``Documentation/ABI/README`` 。更改用户空间接口的补丁应该抄送
83 linux-api@vger.kernel.org。
84
8520) 检查是否全部通过 ``make headers_check`` 。
86
8721) 已通过至少注入slab和page分配失败进行检查。请参阅 ``Documentation/fault-injection/``
88 如果新代码是实质性的,那么添加子系统特定的故障注入可能是合适的。
89
9022) 新添加的代码已经用 ``gcc -W`` 编译(使用 ``make EXTRA-CFLAGS=-W`` )。这
91 将产生大量噪声,但对于查找诸如“警告:有符号和无符号之间的比较”之类的错误
92 很有用。
93
9423) 在它被合并到-mm补丁集中之后进行测试,以确保它仍然与所有其他排队的补丁以
95 及VM、VFS和其他子系统中的各种更改一起工作。
96
9724) 所有内存屏障例如 ``barrier()``, ``rmb()``, ``wmb()`` 都需要源代码中的注
98 释来解释它们正在执行的操作及其原因的逻辑。
99
10025) 如果补丁添加了任何ioctl,那么也要更新 ``Documentation/ioctl/ioctl-number.txt``
101
10226) 如果修改后的源代码依赖或使用与以下 ``Kconfig`` 符号相关的任何内核API或
103 功能,则在禁用相关 ``Kconfig`` 符号和/或 ``=m`` (如果该选项可用)的情况
104 下测试以下多个构建[并非所有这些都同时存在,只是它们的各种/随机组合]:
105
106 ``CONFIG_SMP``, ``CONFIG_SYSFS``, ``CONFIG_PROC_FS``, ``CONFIG_INPUT``, ``CONFIG_PCI``, ``CONFIG_BLOCK``, ``CONFIG_PM``, ``CONFIG_MAGIC_SYSRQ``,
107 ``CONFIG_NET``, ``CONFIG_INET=n`` (但是后者伴随 ``CONFIG_NET=y``).
diff --git a/Documentation/translations/zh_CN/SubmittingDrivers b/Documentation/translations/zh_CN/process/submitting-drivers.rst
index 15e73562f710..72c6cd935821 100644
--- a/Documentation/translations/zh_CN/SubmittingDrivers
+++ b/Documentation/translations/zh_CN/process/submitting-drivers.rst
@@ -1,36 +1,28 @@
1Chinese translated version of Documentation/process/submitting-drivers.rst 1.. _cn_submittingdrivers:
2 2
3If you have any comment or update to the content, please contact the 3.. include:: ../disclaimer-zh_CN.rst
4original document maintainer directly. However, if you have a problem
5communicating in English you can also ask the Chinese maintainer for
6help. Contact the Chinese maintainer if this translation is outdated
7or if there is a problem with the translation.
8 4
9Chinese maintainer: Li Yang <leo@zh-kernel.org> 5:Original: :ref:`Documentation/process/submitting-drivers.rst
10--------------------------------------------------------------------- 6 <submittingdrivers>`
11Documentation/process/submitting-drivers.rst 的中文翻译
12 7
13如果想评论或更新本文的内容,请直接联系原文档的维护者。如果你使用英文 8如果想评论或更新本文的内容,请直接联系原文档的维护者。如果你使用英文
14交流有困难的话,也可以向中文版维护者求助。如果本翻译更新不及时或者翻 9交流有困难的话,也可以向中文版维护者求助。如果本翻译更新不及时或者翻
15译存在问题,请联系中文版维护者 10译存在问题,请联系中文版维护者::
16 11
17中文版维护者: 李阳 Li Yang <leo@zh-kernel.org> 12 中文版维护者: 李阳 Li Yang <leoyang.li@nxp.com>
18中文版翻译者: 李阳 Li Yang <leo@zh-kernel.org> 13 中文版翻译者: 李阳 Li Yang <leoyang.li@nxp.com>
19中文版校译者: 陈琦 Maggie Chen <chenqi@beyondsoft.com> 14 中文版校译者: 陈琦 Maggie Chen <chenqi@beyondsoft.com>
20 王聪 Wang Cong <xiyou.wangcong@gmail.com> 15 王聪 Wang Cong <xiyou.wangcong@gmail.com>
21 张巍 Zhang Wei <Wei.Zhang@freescale.com> 16 张巍 Zhang Wei <wezhang@outlook.com>
22
23以下为正文
24---------------------------------------------------------------------
25 17
26如何向 Linux 内核提交驱动程序 18如何向 Linux 内核提交驱动程序
27----------------------------- 19=============================
28 20
29这篇文档将会解释如何向不同的内核源码树提交设备驱动程序。请注意,如果你感 21这篇文档将会解释如何向不同的内核源码树提交设备驱动程序。请注意,如果你感
30兴趣的是显卡驱动程序,你也许应该访问 XFree86 项目(http://www.xfree86.org/) 22兴趣的是显卡驱动程序,你也许应该访问 XFree86 项目(http://www.xfree86.org/)
31和/或 X.org 项目 (http://x.org)。 23和/或 X.org 项目 (http://x.org)。
32 24
33另请参阅 Documentation/process/submitting-patches.rst 文档。 25另请参阅 Documentation/Documentation/translations/zh_CN/process/submitting-patches.rst 文档。
34 26
35 27
36分配设备号 28分配设备号
@@ -145,9 +137,13 @@ Linux 设备驱动程序,第三版(探讨 2.6.10 版内核):
145 137
146LWN.net: 138LWN.net:
147 每周内核开发活动摘要 - http://lwn.net/ 139 每周内核开发活动摘要 - http://lwn.net/
140
148 2.6 版中 API 的变更: 141 2.6 版中 API 的变更:
142
149 http://lwn.net/Articles/2.6-kernel-api/ 143 http://lwn.net/Articles/2.6-kernel-api/
144
150 将旧版内核的驱动程序移植到 2.6 版: 145 将旧版内核的驱动程序移植到 2.6 版:
146
151 http://lwn.net/Articles/driver-porting/ 147 http://lwn.net/Articles/driver-porting/
152 148
153内核新手(KernelNewbies): 149内核新手(KernelNewbies):
diff --git a/Documentation/translations/zh_CN/process/submitting-patches.rst b/Documentation/translations/zh_CN/process/submitting-patches.rst
new file mode 100644
index 000000000000..437c23b367bb
--- /dev/null
+++ b/Documentation/translations/zh_CN/process/submitting-patches.rst
@@ -0,0 +1,682 @@
1.. _cn_submittingpatches:
2
3.. include:: ../disclaimer-zh_CN.rst
4
5:Original: :ref:`Documentation/process/submitting-patches.rst <submittingpatches>`
6
7译者::
8
9 中文版维护者: 钟宇 TripleX Chung <xxx.phy@gmail.com>
10 中文版翻译者: 钟宇 TripleX Chung <xxx.phy@gmail.com>
11 时奎亮 Alex Shi <alex.shi@linux.alibaba.com>
12 中文版校译者: 李阳 Li Yang <leoyang.li@nxp.com>
13 王聪 Wang Cong <xiyou.wangcong@gmail.com>
14
15
16如何让你的改动进入内核
17======================
18
19对于想要将改动提交到 Linux 内核的个人或者公司来说,如果不熟悉“规矩”,
20提交的流程会让人畏惧。本文档收集了一系列建议,这些建议可以大大的提高你
21的改动被接受的机会.
22
23以下文档含有大量简洁的建议, 具体请见:
24:ref:`Documentation/process <development_process_main>`
25同样,:ref:`Documentation/translations/zh_CN/process/submit-checklist.rst <cn_submitchecklist>`
26给出在提交代码前需要检查的项目的列表。如果你在提交一个驱动程序,那么
27同时阅读一下:
28:ref:`Documentation/process/submitting-drivers.rst <submittingdrivers>`
29
30其中许多步骤描述了Git版本控制系统的默认行为;如果您使用Git来准备补丁,
31您将发现它为您完成的大部分机械工作,尽管您仍然需要准备和记录一组合理的
32补丁。一般来说,使用git将使您作为内核开发人员的生活更轻松。
33
34
350) 获取当前源码树
36-----------------
37
38如果您没有一个可以使用当前内核源代码的存储库,请使用git获取一个。您将要
39从主线存储库开始,它可以通过以下方式获取::
40
41 git clone git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
42
43但是,请注意,您可能不希望直接针对主线树进行开发。大多数子系统维护人员运
44行自己的树,并希望看到针对这些树准备的补丁。请参见MAINTAINERS文件中子系
45统的 **T:** 项以查找该树,或者简单地询问维护者该树是否未在其中列出。
46
47仍然可以通过tarballs下载内核版本(如下一节所述),但这是进行内核开发的
48一种困难的方式。
49
501) "diff -up"
51-------------
52
53使用 "diff -up" 或者 "diff -uprN" 来创建补丁。
54
55所有内核的改动,都是以补丁的形式呈现的,补丁由 diff(1) 生成。创建补丁的
56时候,要确认它是以 "unified diff" 格式创建的,这种格式由 diff(1) 的 '-u'
57参数生成。而且,请使用 '-p' 参数,那样会显示每个改动所在的C函数,使得
58产生的补丁容易读得多。补丁应该基于内核源代码树的根目录,而不是里边的任
59何子目录。
60
61为一个单独的文件创建补丁,一般来说这样做就够了::
62
63 SRCTREE=linux
64 MYFILE=drivers/net/mydriver.c
65
66 cd $SRCTREE
67 cp $MYFILE $MYFILE.orig
68 vi $MYFILE # make your change
69 cd ..
70 diff -up $SRCTREE/$MYFILE{.orig,} > /tmp/patch
71
72为多个文件创建补丁,你可以解开一个没有修改过的内核源代码树,然后和你自
73己的代码树之间做 diff 。例如::
74
75 MYSRC=/devel/linux
76
77 tar xvfz linux-3.19.tar.gz
78 mv linux-3.19 linux-3.19-vanilla
79 diff -uprN -X linux-3.19-vanilla/Documentation/dontdiff \
80 linux-3.19-vanilla $MYSRC > /tmp/patch
81
82"dontdiff" 是内核在编译的时候产生的文件的列表,列表中的文件在 diff(1)
83产生的补丁里会被跳过。
84
85确定你的补丁里没有包含任何不属于这次补丁提交的额外文件。记得在用diff(1)
86生成补丁之后,审阅一次补丁,以确保准确。
87
88如果你的改动很散乱,你应该研究一下如何将补丁分割成独立的部分,将改动分
89割成一系列合乎逻辑的步骤。这样更容易让其他内核开发者审核,如果你想你的
90补丁被接受,这是很重要的。请参阅:
91:ref:`cn_split_changes`
92
93如果你用 ``git`` , ``git rebase -i`` 可以帮助你这一点。如果你不用 ``git``,
94``quilt`` <http://savannah.nongnu.org/projects/quilt> 另外一个流行的选择。
95
96.. _cn_describe_changes:
97
982) 描述你的改动
99---------------
100
101描述你的问题。无论您的补丁是一行错误修复还是5000行新功能,都必须有一个潜在
102的问题激励您完成这项工作。让审稿人相信有一个问题值得解决,让他们读完第一段
103是有意义的。
104
105描述用户可见的影响。直接崩溃和锁定是相当有说服力的,但并不是所有的错误都那么
106明目张胆。即使在代码审查期间发现了这个问题,也要描述一下您认为它可能对用户产
107生的影响。请记住,大多数Linux安装运行的内核来自二级稳定树或特定于供应商/产品
108的树,只从上游精选特定的补丁,因此请包含任何可以帮助您将更改定位到下游的内容:
109触发的场景、DMESG的摘录、崩溃描述、性能回归、延迟尖峰、锁定等。
110
111量化优化和权衡。如果您声称在性能、内存消耗、堆栈占用空间或二进制大小方面有所
112改进,请包括支持它们的数字。但也要描述不明显的成本。优化通常不是免费的,而是
113在CPU、内存和可读性之间进行权衡;或者,探索性的工作,在不同的工作负载之间进
114行权衡。请描述优化的预期缺点,以便审阅者可以权衡成本和收益。
115
116一旦问题建立起来,就要详细地描述一下您实际在做什么。对于审阅者来说,用简单的
117英语描述代码的变化是很重要的,以验证代码的行为是否符合您的意愿。
118
119如果您将补丁描述写在一个表单中,这个表单可以很容易地作为“提交日志”放入Linux
120的源代码管理系统git中,那么维护人员将非常感谢您。见 :ref:`cn_explicit_in_reply_to`.
121
122每个补丁只解决一个问题。如果你的描述开始变长,这就表明你可能需要拆分你的补丁。
123请见 :ref:`cn_split_changes`
124
125提交或重新提交修补程序或修补程序系列时,请包括完整的修补程序说明和理由。不要
126只说这是补丁(系列)的第几版。不要期望子系统维护人员引用更早的补丁版本或引用
127URL来查找补丁描述并将其放入补丁中。也就是说,补丁(系列)及其描述应该是独立的。
128这对维护人员和审查人员都有好处。一些评审者可能甚至没有收到补丁的早期版本。
129
130描述你在命令语气中的变化,例如“make xyzzy do frotz”而不是“[这个补丁]make
131xyzzy do frotz”或“[我]changed xyzzy to do frotz”,就好像你在命令代码库改变
132它的行为一样。
133
134如果修补程序修复了一个记录的bug条目,请按编号和URL引用该bug条目。如果补丁来
135自邮件列表讨论,请给出邮件列表存档的URL;使用带有 ``Message-ID`` 的
136https://lkml.kernel.org/ 重定向,以确保链接不会过时。
137
138但是,在没有外部资源的情况下,尽量让你的解释可理解。除了提供邮件列表存档或
139bug的URL之外,还要总结需要提交补丁的相关讨论要点。
140
141如果您想要引用一个特定的提交,不要只引用提交的 SHA-1 ID。还请包括提交的一行
142摘要,以便于审阅者了解它是关于什么的。例如::
143
144 Commit e21d2170f36602ae2708 ("video: remove unnecessary
145 platform_set_drvdata()") removed the unnecessary
146 platform_set_drvdata(), but left the variable "dev" unused,
147 delete it.
148
149您还应该确保至少使用前12位 SHA-1 ID. 内核存储库包含*许多*对象,使与较短的ID
150发生冲突的可能性很大。记住,即使现在不会与您的六个字符ID发生冲突,这种情况
151可能五年后改变。
152
153如果修补程序修复了特定提交中的错误,例如,使用 ``git bisct`` ,请使用带有前
15412个字符SHA-1 ID 的"Fixes:"标记和单行摘要。为了简化不要将标记拆分为多个,
155行、标记不受分析脚本“75列换行”规则的限制。例如::
156
157 Fixes: 54a4f0239f2e ("KVM: MMU: make kvm_mmu_zap_page() return the number of pages it actually freed")
158
159下列 ``git config`` 设置可以添加让 ``git log``, ``git show`` 漂亮的显示格式::
160
161 [core]
162 abbrev = 12
163 [pretty]
164 fixes = Fixes: %h (\"%s\")
165
166.. _cn_split_changes:
167
1683) 拆分你的改动
169---------------
170
171将每个逻辑更改分隔成一个单独的补丁。
172
173例如,如果你的改动里同时有bug修正和性能优化,那么把这些改动拆分到两个或
174者更多的补丁文件中。如果你的改动包含对API的修改,并且修改了驱动程序来适
175应这些新的API,那么把这些修改分成两个补丁。
176
177另一方面,如果你将一个单独的改动做成多个补丁文件,那么将它们合并成一个
178单独的补丁文件。这样一个逻辑上单独的改动只被包含在一个补丁文件里。
179
180如果有一个补丁依赖另外一个补丁来完成它的改动,那没问题。简单的在你的补
181丁描述里指出“这个补丁依赖某补丁”就好了。
182
183在将您的更改划分为一系列补丁时,要特别注意确保内核在系列中的每个补丁之后
184都能正常构建和运行。使用 ``git bisect`` 来追踪问题的开发者可能会在任何时
185候分割你的补丁系列;如果你在中间引入错误,他们不会感谢你。
186
187如果你不能将补丁浓缩成更少的文件,那么每次大约发送出15个,然后等待审查
188和集成。
189
1904) 检查你的更改风格
191-------------------
192
193检查您的补丁是否存在基本样式冲突,详细信息可在
194:ref:`Documentation/translations/zh_CN/process/coding-style.rst <cn_codingstyle>`
195中找到。如果不这样做,只会浪费审稿人的时间,并且会导致你的补丁被拒绝,甚至
196可能没有被阅读。
197
198一个重要的例外是在将代码从一个文件移动到另一个文件时——在这种情况下,您不应
199该在移动代码的同一个补丁中修改移动的代码。这清楚地描述了移动代码和您的更改
200的行为。这大大有助于审查实际差异,并允许工具更好地跟踪代码本身的历史。
201
202在提交之前,使用补丁样式检查程序检查补丁(scripts/check patch.pl)。不过,
203请注意,样式检查程序应该被视为一个指南,而不是作为人类判断的替代品。如果您
204的代码看起来更好,但有违规行为,那么最好不要使用它。
205
206检查者报告三个级别:
207
208 - ERROR:很可能出错的事情
209 - WARNING:需要仔细审查的事项
210 - CHECK:需要思考的事情
211
212您应该能够判断您的补丁中存在的所有违规行为。
213
2145) 选择补丁收件人
215-----------------
216
217您应该总是在任何补丁上复制相应的子系统维护人员,以获得他们维护的代码;查看
218维护人员文件和源代码修订历史记录,以了解这些维护人员是谁。脚本
219scripts/get_Maintainer.pl在这个步骤中非常有用。如果您找不到正在工作的子系统
220的维护人员,那么Andrew Morton(akpm@linux-foundation.org)将充当最后的维护
221人员。
222
223您通常还应该选择至少一个邮件列表来接收补丁集的。linux-kernel@vger.kernel.org
224作为最后一个解决办法的列表,但是这个列表上的体积已经引起了许多开发人员的拒绝。
225在MAINTAINERS文件中查找子系统特定的列表;您的补丁可能会在那里得到更多的关注。
226不过,请不要发送垃圾邮件到无关的列表。
227
228许多与内核相关的列表托管在vger.kernel.org上;您可以在
229http://vger.kernel.org/vger-lists.html 上找到它们的列表。不过,也有与内核相关
230的列表托管在其他地方。
231
232不要一次发送超过15个补丁到vger邮件列表!!!!
233
234Linus Torvalds 是决定改动能否进入 Linux 内核的最终裁决者。他的 e-mail
235地址是 <torvalds@linux-foundation.org> 。他收到的 e-mail 很多,所以一般
236的说,最好别给他发 e-mail。
237
238如果您有修复可利用安全漏洞的补丁,请将该补丁发送到 security@kernel.org。对于
239严重的bug,可以考虑短期暂停以允许分销商向用户发布补丁;在这种情况下,显然不应
240将补丁发送到任何公共列表。
241
242修复已发布内核中严重错误的补丁程序应该指向稳定版维护人员,方法是放这样的一行::
243
244 Cc: stable@vger.kernel.org
245
246进入补丁的签准区(注意,不是电子邮件收件人)。除了这个文件之外,您还应该阅读
247:ref:`Documentation/process/stable-kernel-rules.rst <stable_kernel_rules>`
248
249但是,请注意,一些子系统维护人员希望得出他们自己的结论,即哪些补丁应该被放到
250稳定的树上。尤其是网络维护人员,不希望看到单个开发人员在补丁中添加像上面这样
251的行。
252
253如果更改影响到用户和内核接口,请向手册页维护人员(如维护人员文件中所列)发送
254手册页补丁,或至少发送更改通知,以便一些信息进入手册页。还应将用户空间API
255更改复制到 linux-api@vger.kernel.org。
256
257对于小的补丁,你也许会CC到搜集琐碎补丁的邮件列表(Trivial Patch Monkey)
258trivial@kernel.org,那里专门收集琐碎的补丁。下面这样的补丁会被看作“琐碎的”
259补丁:
260
261 - 文档的拼写修正。
262 - 修正会影响到 grep(1) 的拼写。
263 - 警告信息修正(频繁的打印无用的警告是不好的。)
264 - 编译错误修正(代码逻辑的确是对的,只是编译有问题。)
265 - 运行时修正(只要真的修正了错误。)
266 - 移除使用了被废弃的函数/宏的代码(例如 check_region。)
267 - 联系方式和文档修正。
268 - 用可移植的代码替换不可移植的代码(即使在体系结构相关的代码中,既然有
269 - 人拷贝,只要它是琐碎的)
270 - 任何文件的作者/维护者对该文件的改动(例如 patch monkey 在重传模式下)
271
272(译注,关于“琐碎补丁”的一些说明:因为原文的这一部分写得比较简单,所以不得不
273违例写一下译注。"trivial"这个英文单词的本意是“琐碎的,不重要的。”但是在这里
274有稍微有一些变化,例如对一些明显的NULL指针的修正,属于运行时修正,会被归类
275到琐碎补丁里。虽然NULL指针的修正很重要,但是这样的修正往往很小而且很容易得到
276检验,所以也被归入琐碎补丁。琐碎补丁更精确的归类应该是
277“simple, localized & easy to verify”,也就是说简单的,局部的和易于检验的。
278trivial@kernel.org邮件列表的目的是针对这样的补丁,为提交者提供一个中心,来
279降低提交的门槛。)
280
2816) 没有 MIME 编码,没有链接,没有压缩,没有附件,只有纯文本
282-----------------------------------------------------------
283
284Linus 和其他的内核开发者需要阅读和评论你提交的改动。对于内核开发者来说
285,可以“引用”你的改动很重要,使用一般的 e-mail 工具,他们就可以在你的
286代码的任何位置添加评论。
287
288因为这个原因,所有的提交的补丁都是 e-mail 中“内嵌”的。
289
290.. warning::
291 如果你使用剪切-粘贴你的补丁,小心你的编辑器的自动换行功能破坏你的补丁
292
293不要将补丁作为 MIME 编码的附件,不管是否压缩。很多流行的 e-mail 软件不
294是任何时候都将 MIME 编码的附件当作纯文本发送的,这会使得别人无法在你的
295代码中加评论。另外,MIME 编码的附件会让 Linus 多花一点时间来处理,这就
296降低了你的改动被接受的可能性。
297
298例外:如果你的邮递员弄坏了补丁,那么有人可能会要求你使用mime重新发送补丁
299
300请参阅 :ref:`Documentation/translations/zh_CN/process/email-clients.rst <cn_email_clients>`
301以获取有关配置电子邮件客户端以使其不受影响地发送修补程序的提示。
302
3037) e-mail 的大小
304----------------
305
306大的改动对邮件列表不合适,对某些维护者也不合适。如果你的补丁,在不压缩
307的情况下,超过了300kB,那么你最好将补丁放在一个能通过 internet 访问的服
308务器上,然后用指向你的补丁的 URL 替代。但是请注意,如果您的补丁超过了
309300kb,那么它几乎肯定需要被破坏。
310
3118)回复评审意见
312---------------
313
314你的补丁几乎肯定会得到评审者对补丁改进方法的评论。您必须对这些评论作出
315回应;让补丁被忽略的一个好办法就是忽略审阅者的意见。不会导致代码更改的
316意见或问题几乎肯定会带来注释或变更日志的改变,以便下一个评审者更好地了解
317正在发生的事情。
318
319一定要告诉审稿人你在做什么改变,并感谢他们的时间。代码审查是一个累人且
320耗时的过程,审查人员有时会变得暴躁。即使在这种情况下,也要礼貌地回应并
321解决他们指出的问题。
322
3239)不要泄气或不耐烦
324-------------------
325
326提交更改后,请耐心等待。审阅者是忙碌的人,可能无法立即访问您的修补程序。
327
328曾几何时,补丁曾在没有评论的情况下消失在空白中,但开发过程比现在更加顺利。
329您应该在一周左右的时间内收到评论;如果没有收到评论,请确保您已将补丁发送
330到正确的位置。在重新提交或联系审阅者之前至少等待一周-在诸如合并窗口之类的
331繁忙时间可能更长。
332
33310)主题中包含 PATCH
334--------------------
335
336由于到linus和linux内核的电子邮件流量很高,通常会在主题行前面加上[PATCH]
337前缀. 这使Linus和其他内核开发人员更容易将补丁与其他电子邮件讨论区分开。
338
33911)签署你的作品-开发者原始认证
340-------------------------------
341
342为了加强对谁做了何事的追踪,尤其是对那些透过好几层的维护者的补丁,我们
343建议在发送出去的补丁上加一个 “sign-off” 的过程。
344
345"sign-off" 是在补丁的注释的最后的简单的一行文字,认证你编写了它或者其他
346人有权力将它作为开放源代码的补丁传递。规则很简单:如果你能认证如下信息:
347
348开发者来源证书 1.1
349^^^^^^^^^^^^^^^^^^
350
351对于本项目的贡献,我认证如下信息:
352
353 (a)这些贡献是完全或者部分的由我创建,我有权利以文件中指出
354 的开放源代码许可证提交它;或者
355 (b)这些贡献基于以前的工作,据我所知,这些以前的工作受恰当的开放
356 源代码许可证保护,而且,根据许可证,我有权提交修改后的贡献,
357 无论是完全还是部分由我创造,这些贡献都使用同一个开放源代码许可证
358 (除非我被允许用其它的许可证),正如文件中指出的;或者
359 (c)这些贡献由认证(a),(b)或者(c)的人直接提供给我,而
360 且我没有修改它。
361 (d)我理解并同意这个项目和贡献是公开的,贡献的记录(包括我
362 一起提交的个人记录,包括 sign-off )被永久维护并且可以和这个项目
363 或者开放源代码的许可证同步地再发行。
364
365那么加入这样一行::
366
367 Signed-off-by: Random J Developer <random@developer.example.org>
368
369使用你的真名(抱歉,不能使用假名或者匿名。)
370
371有人在最后加上标签。现在这些东西会被忽略,但是你可以这样做,来标记公司
372内部的过程,或者只是指出关于 sign-off 的一些特殊细节。
373
374如果您是子系统或分支维护人员,有时需要稍微修改收到的补丁,以便合并它们,
375因为树和提交者中的代码不完全相同。如果你严格遵守规则(c),你应该要求提交者
376重新发布,但这完全是在浪费时间和精力。规则(b)允许您调整代码,但是更改一个
377提交者的代码并让他认可您的错误是非常不礼貌的。要解决此问题,建议在最后一个
378由签名行和您的行之间添加一行,指示更改的性质。虽然这并不是强制性的,但似乎
379在描述前加上您的邮件和/或姓名(全部用方括号括起来),这足以让人注意到您对最
380后一分钟的更改负有责任。例如::
381
382 Signed-off-by: Random J Developer <random@developer.example.org>
383 [lucky@maintainer.example.org: struct foo moved from foo.c to foo.h]
384 Signed-off-by: Lucky K Maintainer <lucky@maintainer.example.org>
385
386如果您维护一个稳定的分支机构,同时希望对作者进行致谢、跟踪更改、合并修复并
387保护提交者不受投诉,那么这种做法尤其有用。请注意,在任何情况下都不能更改作者
388的ID(From 头),因为它是出现在更改日志中的标识。
389
390对回合(back-porters)的特别说明:在提交消息的顶部(主题行之后)插入一个补丁
391的起源指示似乎是一种常见且有用的实践,以便于跟踪。例如,下面是我们在3.x稳定
392版本中看到的内容::
393
394 Date: Tue Oct 7 07:26:38 2014 -0400
395
396 libata: Un-break ATA blacklist
397
398 commit 1c40279960bcd7d52dbdf1d466b20d24b99176c8 upstream.
399
400还有, 这里是一个旧版内核中的一个回合补丁::
401
402 Date: Tue May 13 22:12:27 2008 +0200
403
404 wireless, airo: waitbusy() won't delay
405
406 [backport of 2.6 commit b7acbdfbd1f277c1eb23f344f899cfa4cd0bf36a]
407
40812)何时使用Acked-by:,CC:,和Co-Developed by:
409----------------------------------------------
410
411Singed-off-by: 标记表示签名者参与了补丁的开发,或者他/她在补丁的传递路径中。
412
413如果一个人没有直接参与补丁的准备或处理,但希望表示并记录他们对补丁的批准,
414那么他们可以要求在补丁的变更日志中添加一个 Acked-by:
415
416Acked-by:通常由受影响代码的维护者使用,当该维护者既没有贡献也没有转发补丁时。
417
418Acked-by: 不像签字人那样正式。这是一个记录,确认人至少审查了补丁,并表示接受。
419因此,补丁合并有时会手动将Acker的“Yep,looks good to me”转换为 Acked-By:(但
420请注意,通常最好要求一个明确的Ack)。
421
422Acked-by:不一定表示对整个补丁的确认。例如,如果一个补丁影响多个子系统,并且
423有一个:来自一个子系统维护者,那么这通常表示只确认影响维护者代码的部分。这里
424应该仔细判断。如有疑问,应参考邮件列表档案中的原始讨论。
425
426如果某人有机会对补丁进行评论,但没有提供此类评论,您可以选择在补丁中添加 ``Cc:``
427这是唯一一个标签,它可以在没有被它命名的人显式操作的情况下添加,但它应该表明
428这个人是在补丁上抄送的。讨论中包含了潜在利益相关方。
429
430Co-developed-by: 声明补丁是由多个开发人员共同创建的;当几个人在一个补丁上工
431作时,它用于将属性赋予共同作者(除了 From: 所赋予的作者之外)。因为
432Co-developed-by: 表示作者身份,所以每个共同开发人:必须紧跟在相关合作作者的
433签名之后。标准的签核程序要求:标记的签核顺序应尽可能反映补丁的时间历史,而不
434管作者是通过 From :还是由 Co-developed-by: 共同开发的。值得注意的是,最后一
435个签字人:必须始终是提交补丁的开发人员。
436
437注意,当作者也是电子邮件标题“发件人:”行中列出的人时,“From: ” 标记是可选的。
438
439作者提交的补丁程序示例::
440
441 <changelog>
442
443 Co-developed-by: First Co-Author <first@coauthor.example.org>
444 Signed-off-by: First Co-Author <first@coauthor.example.org>
445 Co-developed-by: Second Co-Author <second@coauthor.example.org>
446 Signed-off-by: Second Co-Author <second@coauthor.example.org>
447 Signed-off-by: From Author <from@author.example.org>
448
449合作开发者提交的补丁示例::
450
451 From: From Author <from@author.example.org>
452
453 <changelog>
454
455 Co-developed-by: Random Co-Author <random@coauthor.example.org>
456 Signed-off-by: Random Co-Author <random@coauthor.example.org>
457 Signed-off-by: From Author <from@author.example.org>
458 Co-developed-by: Submitting Co-Author <sub@coauthor.example.org>
459 Signed-off-by: Submitting Co-Author <sub@coauthor.example.org>
460
461
46213)使用报告人:、测试人:、审核人:、建议人:、修复人:
463--------------------------------------------------------
464
465Reported-by: 给那些发现错误并报告错误的人致谢,它希望激励他们在将来再次帮助
466我们。请注意,如果bug是以私有方式报告的,那么在使用Reported-by标记之前,请
467先请求权限。
468
469Tested-by: 标记表示补丁已由指定的人(在某些环境中)成功测试。这个标签通知
470维护人员已经执行了一些测试,为将来的补丁提供了一种定位测试人员的方法,并确
471保测试人员的信誉。
472
473Reviewed-by:相反,根据审查人的声明,表明该补丁已被审查并被认为是可接受的:
474
475
476审查人的监督声明
477^^^^^^^^^^^^^^^^
478
479通过提供我的 Reviewed-by,我声明:
480
481 (a) 我已经对这个补丁进行了一次技术审查,以评估它是否适合被包含到
482 主线内核中。
483
484 (b) 与补丁相关的任何问题、顾虑或问题都已反馈给提交者。我对提交者对
485 我的评论的回应感到满意。
486
487 (c) 虽然这一提交可能会改进一些东西,但我相信,此时,(1)对内核
488 进行了有价值的修改,(2)没有包含争论中涉及的已知问题。
489
490 (d) 虽然我已经审查了补丁并认为它是健全的,但我不会(除非另有明确
491 说明)作出任何保证或保证它将在任何给定情况下实现其规定的目的
492 或正常运行。
493
494Reviewed-by 是一种观点声明,即补丁是对内核的适当修改,没有任何遗留的严重技术
495问题。任何感兴趣的审阅者(完成工作的人)都可以为一个补丁提供一个 Review-by
496标签。此标签用于向审阅者提供致谢,并通知维护者已在修补程序上完成的审阅程度。
497Reviewed-by: 当由已知了解主题区域并执行彻底检查的审阅者提供时,通常会增加
498补丁进入内核的可能性。
499
500Suggested-by: 表示补丁的想法是由指定的人提出的,并确保将此想法归功于指定的
501人。请注意,未经许可,不得添加此标签,特别是如果该想法未在公共论坛上发布。
502这就是说,如果我们勤快地致谢我们的创意者,他们很有希望在未来得到鼓舞,再次
503帮助我们。
504
505Fixes: 指示补丁在以前的提交中修复了一个问题。它可以很容易地确定错误的来源,
506这有助于检查错误修复。这个标记还帮助稳定内核团队确定应该接收修复的稳定内核
507版本。这是指示补丁修复的错误的首选方法。请参阅 :ref:`cn_describe_changes`
508描述您的更改以了解更多详细信息。
509
510.. _cn_the_canonical_patch_format:
511
51212)标准补丁格式
513----------------
514
515本节描述如何格式化补丁本身。请注意,如果您的补丁存储在 ``Git`` 存储库中,则
516可以使用 ``git format-patch`` 进行正确的补丁格式设置。但是,这些工具无法创建
517必要的文本,因此请务必阅读下面的说明。
518
519标准的补丁,标题行是::
520
521 Subject: [PATCH 001/123] 子系统:一句话概述
522
523标准补丁的信体存在如下部分:
524
525 - 一个 "from" 行指出补丁作者。后跟空行(仅当发送修补程序的人不是作者时才需要)。
526
527 - 解释的正文,行以75列包装,这将被复制到永久变更日志来描述这个补丁。
528
529 - 一个空行
530
531 - 上面描述的“Signed-off-by” 行,也将出现在更改日志中。
532
533 - 只包含 ``---`` 的标记线。
534
535 - 任何其他不适合放在变更日志的注释。
536
537 - 实际补丁( ``diff`` 输出)。
538
539标题行的格式,使得对标题行按字母序排序非常的容易 - 很多 e-mail 客户端都
540可以支持 - 因为序列号是用零填充的,所以按数字排序和按字母排序是一样的。
541
542e-mail 标题中的“子系统”标识哪个内核子系统将被打补丁。
543
544e-mail 标题中的“一句话概述”扼要的描述 e-mail 中的补丁。“一句话概述”
545不应该是一个文件名。对于一个补丁系列(“补丁系列”指一系列的多个相关补
546丁),不要对每个补丁都使用同样的“一句话概述”。
547
548记住 e-mail 的“一句话概述”会成为该补丁的全局唯一标识。它会蔓延到 git
549的改动记录里。然后“一句话概述”会被用在开发者的讨论里,用来指代这个补
550丁。用户将希望通过 google 来搜索"一句话概述"来找到那些讨论这个补丁的文
551章。当人们在两三个月后使用诸如 ``gitk`` 或 ``git log --oneline`` 之类
552的工具查看数千个补丁时,也会很快看到它。
553
554出于这些原因,概述必须不超过70-75个字符,并且必须描述补丁的更改以及为
555什么需要补丁。既要简洁又要描述性很有挑战性,但写得好的概述应该这样做。
556
557概述的前缀可以用方括号括起来:“Subject: [PATCH <tag>...] <概述>”。标记
558不被视为概述的一部分,而是描述应该如何处理补丁。如果补丁的多个版本已发
559送出来以响应评审(即“v1,v2,v3”)或“rfc”,以指示评审请求,那么通用标记
560可能包括版本描述符。如果一个补丁系列中有四个补丁,那么各个补丁可以这样
561编号:1/4、2/4、3/4、4/4。这可以确保开发人员了解补丁应用的顺序,并且他们
562已经查看或应用了补丁系列中的所有补丁。
563
564一些标题的例子::
565
566 Subject: [patch 2/5] ext2: improve scalability of bitmap searching
567 Subject: [PATCHv2 001/207] x86: fix eflags tracking
568
569"From" 行是信体里的最上面一行,具有如下格式:
570 From: Patch Author <author@example.com>
571
572"From" 行指明在永久改动日志里,谁会被确认为作者。如果没有 "From" 行,那
573么邮件头里的 "From: " 行会被用来决定改动日志中的作者。
574
575说明的主题将会被提交到永久的源代码改动日志里,因此对那些早已经不记得和
576这个补丁相关的讨论细节的有能力的读者来说,是有意义的。包括补丁程序定位
577错误的(内核日志消息、OOPS消息等)症状,对于搜索提交日志以寻找适用补丁的人
578尤其有用。如果一个补丁修复了一个编译失败,那么可能不需要包含所有编译失败;
579只要足够让搜索补丁的人能够找到它就行了。与概述一样,既要简洁又要描述性。
580
581"---" 标记行对于补丁处理工具要找到哪里是改动日志信息的结束,是不可缺少
582的。
583
584对于 "---" 标记之后的额外注解,一个好的用途就是用来写 diffstat,用来显
585示修改了什么文件和每个文件都增加和删除了多少行。diffstat 对于比较大的补
586丁特别有用。其余那些只是和时刻或者开发者相关的注解,不合适放到永久的改
587动日志里的,也应该放这里。
588使用 diffstat的选项 "-p 1 -w 70" 这样文件名就会从内核源代码树的目录开始
589,不会占用太宽的空间(很容易适合80列的宽度,也许会有一些缩进。)
590
591在后面的参考资料中能看到适当的补丁格式的更多细节。
592
593.. _cn_explicit_in_reply_to:
594
59515) 明确回复邮件头(In-Reply-To)
596-------------------------------
597
598手动添加回复补丁的的标题头(In-Reply_To:) 是有帮助的(例如,使用 ``git send-email`` )
599将补丁与以前的相关讨论关联起来,例如,将bug修复程序链接到电子邮件和bug报告。
600但是,对于多补丁系列,最好避免在回复时使用链接到该系列的旧版本。这样,
601补丁的多个版本就不会成为电子邮件客户端中无法管理的引用序列。如果链接有用,
602可以使用 https://lkml.kernel.org/ 重定向器(例如,在封面电子邮件文本中)
603链接到补丁系列的早期版本。
604
60516) 发送git pull请求
606--------------------
607
608如果您有一系列补丁,那么让维护人员通过git pull操作将它们直接拉入子系统存储
609库可能是最方便的。但是,请注意,从开发人员那里获取补丁比从邮件列表中获取补
610丁需要更高的信任度。因此,许多子系统维护人员不愿意接受请求,特别是来自新的
611未知开发人员的请求。如果有疑问,您可以在封面邮件中使用pull 请求作为补丁系列
612正常发布的一个选项,让维护人员可以选择使用其中之一。
613
614pull 请求的主题行中应该有[Git Pull]。请求本身应该在一行中包含存储库名称和
615感兴趣的分支;它应该看起来像::
616
617 Please pull from
618
619 git://jdelvare.pck.nerim.net/jdelvare-2.6 i2c-for-linus
620
621 to get these changes:
622
623
624pull 请求还应该包含一条整体消息,说明请求中将包含什么,一个补丁本身的 ``Git shortlog``
625以及一个显示补丁系列整体效果的 ``diffstat`` 。当然,将所有这些信息收集在一起
626的最简单方法是让 ``git`` 使用 ``git request-pull`` 命令为您完成这些工作。
627
628一些维护人员(包括Linus)希望看到来自已签名提交的请求;这增加了他们对你的
629请求信心。特别是,在没有签名标签的情况下,Linus 不会从像 Github 这样的公共
630托管站点拉请求。
631
632创建此类签名的第一步是生成一个 GNRPG 密钥,并由一个或多个核心内核开发人员对
633其进行签名。这一步对新开发人员来说可能很困难,但没有办法绕过它。参加会议是
634找到可以签署您的密钥的开发人员的好方法。
635
636一旦您在Git 中准备了一个您希望有人拉的补丁系列,就用 ``git tag -s`` 创建一
637个签名标记。这将创建一个新标记,标识该系列中的最后一次提交,并包含用您的私
638钥创建的签名。您还可以将changelog样式的消息添加到标记中;这是一个描述拉请求
639整体效果的理想位置。
640
641如果维护人员将要从中提取的树不是您正在使用的存储库,请不要忘记将已签名的标记
642显式推送到公共树。
643
644生成拉请求时,请使用已签名的标记作为目标。这样的命令可以实现::
645
646 git request-pull master git://my.public.tree/linux.git my-signed-tag
647
648参考文献
649--------
650
651Andrew Morton, "The perfect patch" (tpp).
652 <http://www.ozlabs.org/~akpm/stuff/tpp.txt>
653
654Jeff Garzik, "Linux kernel patch submission format".
655 <http://linux.yyz.us/patch-format.html>
656
657Greg Kroah-Hartman, "How to piss off a kernel subsystem maintainer".
658 <http://www.kroah.com/log/linux/maintainer.html>
659
660 <http://www.kroah.com/log/linux/maintainer-02.html>
661
662 <http://www.kroah.com/log/linux/maintainer-03.html>
663
664 <http://www.kroah.com/log/linux/maintainer-04.html>
665
666 <http://www.kroah.com/log/linux/maintainer-05.html>
667
668 <http://www.kroah.com/log/linux/maintainer-06.html>
669
670NO!!!! No more huge patch bombs to linux-kernel@vger.kernel.org people!
671 <https://lkml.org/lkml/2005/7/11/336>
672
673Kernel Documentation/process/coding-style.rst:
674 :ref:`Documentation/translations/zh_CN/process/coding-style.rst <cn_codingstyle>`
675
676Linus Torvalds's mail on the canonical patch format:
677 <http://lkml.org/lkml/2005/4/7/183>
678
679Andi Kleen, "On submitting kernel patches"
680 Some strategies to get difficult or controversial changes in.
681
682 http://halobates.de/on-submitting-patches.pdf
diff --git a/Documentation/translations/zh_CN/volatile-considered-harmful.txt b/Documentation/translations/zh_CN/process/volatile-considered-harmful.rst
index 475125967197..48b32ce58ef1 100644
--- a/Documentation/translations/zh_CN/volatile-considered-harmful.txt
+++ b/Documentation/translations/zh_CN/process/volatile-considered-harmful.rst
@@ -1,30 +1,23 @@
1Chinese translated version of Documentation/process/volatile-considered-harmful.rst 1.. _cn_volatile_considered_harmful:
2 2
3If you have any comment or update to the content, please contact the 3.. include:: ../disclaimer-zh_CN.rst
4original document maintainer directly. However, if you have a problem
5communicating in English you can also ask the Chinese maintainer for
6help. Contact the Chinese maintainer if this translation is outdated
7or if there is a problem with the translation.
8 4
9Maintainer: Jonathan Corbet <corbet@lwn.net> 5:Original: :ref:`Documentation/process/volatile-considered-harmful.rst
10Chinese maintainer: Bryan Wu <bryan.wu@analog.com> 6 <volatile_considered_harmful>`
11---------------------------------------------------------------------
12Documentation/process/volatile-considered-harmful.rst 的中文翻译
13 7
14如果想评论或更新本文的内容,请直接联系原文档的维护者。如果你使用英文 8如果想评论或更新本文的内容,请直接联系原文档的维护者。如果你使用英文
15交流有困难的话,也可以向中文版维护者求助。如果本翻译更新不及时或者翻 9交流有困难的话,也可以向中文版维护者求助。如果本翻译更新不及时或者翻
16译存在问题,请联系中文版维护者 10译存在问题,请联系中文版维护者::
17 11
18英文版维护者: Jonathan Corbet <corbet@lwn.net> 12 英文版维护者: Jonathan Corbet <corbet@lwn.net>
19中文版维护者: 伍鹏 Bryan Wu <bryan.wu@analog.com> 13 中文版维护者: 伍鹏 Bryan Wu <bryan.wu@analog.com>
20中文版翻译者: 伍鹏 Bryan Wu <bryan.wu@analog.com> 14 中文版翻译者: 伍鹏 Bryan Wu <bryan.wu@analog.com>
21中文版校译者: 张汉辉 Eugene Teo <eugeneteo@kernel.sg> 15 中文版校译者: 张汉辉 Eugene Teo <eugeneteo@kernel.sg>
22 杨瑞 Dave Young <hidave.darkstar@gmail.com> 16 杨瑞 Dave Young <hidave.darkstar@gmail.com>
23以下为正文 17 时奎亮 Alex Shi <alex.shi@linux.alibaba.com>
24---------------------------------------------------------------------
25 18
26为什么不应该使用“volatile”类型 19为什么不应该使用“volatile”类型
27------------------------------ 20==============================
28 21
29C程序员通常认为volatile表示某个变量可以在当前执行的线程之外被改变;因此,在内核 22C程序员通常认为volatile表示某个变量可以在当前执行的线程之外被改变;因此,在内核
30中用到共享数据结构时,常常会有C程序员喜欢使用volatile这类变量。换句话说,他们经 23中用到共享数据结构时,常常会有C程序员喜欢使用volatile这类变量。换句话说,他们经
@@ -41,7 +34,7 @@ C程序员通常认为volatile表示某个变量可以在当前执行的线程
41必要再使用volatile。如果仍然必须使用volatile,那么几乎可以肯定在代码的某处有一 34必要再使用volatile。如果仍然必须使用volatile,那么几乎可以肯定在代码的某处有一
42个bug。在正确设计的内核代码中,volatile能带来的仅仅是使事情变慢。 35个bug。在正确设计的内核代码中,volatile能带来的仅仅是使事情变慢。
43 36
44思考一下这段典型的内核代码 37思考一下这段典型的内核代码::
45 38
46 spin_lock(&the_lock); 39 spin_lock(&the_lock);
47 do_something_on(&shared_data); 40 do_something_on(&shared_data);
@@ -66,7 +59,7 @@ volatile的存储类型最初是为那些内存映射的I/O寄存器而定义。
66是必需的。 59是必需的。
67 60
68另一种引起用户可能使用volatile的情况是当处理器正忙着等待一个变量的值。正确执行一 61另一种引起用户可能使用volatile的情况是当处理器正忙着等待一个变量的值。正确执行一
69个忙等待的方法是 62个忙等待的方法是::
70 63
71 while (my_variable != what_i_want) 64 while (my_variable != what_i_want)
72 cpu_relax(); 65 cpu_relax();
diff --git a/Documentation/translations/zh_CN/sparse.txt b/Documentation/translations/zh_CN/sparse.txt
index 2f728962a8e2..47fc4a06ebe8 100644
--- a/Documentation/translations/zh_CN/sparse.txt
+++ b/Documentation/translations/zh_CN/sparse.txt
@@ -6,7 +6,7 @@ communicating in English you can also ask the Chinese maintainer for
6help. Contact the Chinese maintainer if this translation is outdated 6help. Contact the Chinese maintainer if this translation is outdated
7or if there is a problem with the translation. 7or if there is a problem with the translation.
8 8
9Chinese maintainer: Li Yang <leo@zh-kernel.org> 9Chinese maintainer: Li Yang <leoyang.li@nxp.com>
10--------------------------------------------------------------------- 10---------------------------------------------------------------------
11Documentation/dev-tools/sparse.rst 的中文翻译 11Documentation/dev-tools/sparse.rst 的中文翻译
12 12
@@ -14,8 +14,8 @@ Documentation/dev-tools/sparse.rst 的中文翻译
14交流有困难的话,也可以向中文版维护者求助。如果本翻译更新不及时或者翻 14交流有困难的话,也可以向中文版维护者求助。如果本翻译更新不及时或者翻
15译存在问题,请联系中文版维护者。 15译存在问题,请联系中文版维护者。
16 16
17中文版维护者: 李阳 Li Yang <leo@zh-kernel.org> 17中文版维护者: 李阳 Li Yang <leoyang.li@nxp.com>
18中文版翻译者: 李阳 Li Yang <leo@zh-kernel.org> 18中文版翻译者: 李阳 Li Yang <leoyang.li@nxp.com>
19 19
20 20
21以下为正文 21以下为正文
diff --git a/Documentation/unaligned-memory-access.txt b/Documentation/unaligned-memory-access.txt
index 51b4ff031586..1ee82419d8aa 100644
--- a/Documentation/unaligned-memory-access.txt
+++ b/Documentation/unaligned-memory-access.txt
@@ -1,5 +1,5 @@
1========================= 1=========================
2UNALIGNED MEMORY ACCESSES 2Unaligned Memory Accesses
3========================= 3=========================
4 4
5:Author: Daniel Drake <dsd@gentoo.org>, 5:Author: Daniel Drake <dsd@gentoo.org>,
diff --git a/Documentation/userspace-api/seccomp_filter.rst b/Documentation/userspace-api/seccomp_filter.rst
index b1b846d8a094..bd9165241b6c 100644
--- a/Documentation/userspace-api/seccomp_filter.rst
+++ b/Documentation/userspace-api/seccomp_filter.rst
@@ -123,9 +123,9 @@ In precedence order, they are:
123 to userland as the errno without executing the system call. 123 to userland as the errno without executing the system call.
124 124
125``SECCOMP_RET_USER_NOTIF``: 125``SECCOMP_RET_USER_NOTIF``:
126 Results in a ``struct seccomp_notif`` message sent on the userspace 126 Results in a ``struct seccomp_notif`` message sent on the userspace
127 notification fd, if it is attached, or ``-ENOSYS`` if it is not. See below 127 notification fd, if it is attached, or ``-ENOSYS`` if it is not. See
128 on discussion of how to handle user notifications. 128 below on discussion of how to handle user notifications.
129 129
130``SECCOMP_RET_TRACE``: 130``SECCOMP_RET_TRACE``:
131 When returned, this value will cause the kernel to attempt to 131 When returned, this value will cause the kernel to attempt to
@@ -133,7 +133,7 @@ In precedence order, they are:
133 call. If there is no tracer present, ``-ENOSYS`` is returned to 133 call. If there is no tracer present, ``-ENOSYS`` is returned to
134 userland and the system call is not executed. 134 userland and the system call is not executed.
135 135
136 A tracer will be notified if it requests ``PTRACE_O_TRACESECCOM``P 136 A tracer will be notified if it requests ``PTRACE_O_TRACESECCOMP``
137 using ``ptrace(PTRACE_SETOPTIONS)``. The tracer will be notified 137 using ``ptrace(PTRACE_SETOPTIONS)``. The tracer will be notified
138 of a ``PTRACE_EVENT_SECCOMP`` and the ``SECCOMP_RET_DATA`` portion of 138 of a ``PTRACE_EVENT_SECCOMP`` and the ``SECCOMP_RET_DATA`` portion of
139 the BPF program return value will be available to the tracer 139 the BPF program return value will be available to the tracer
diff --git a/Documentation/video-output.txt b/Documentation/video-output.txt
index e517011be4f9..56d6fa2e2368 100644
--- a/Documentation/video-output.txt
+++ b/Documentation/video-output.txt
@@ -1,34 +1,34 @@
1Video Output Switcher Control
2~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1 3
2 Video Output Switcher Control 42006 luming.yu@intel.com
3 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
4 2006 luming.yu@intel.com
5 5
6The output sysfs class driver provides an abstract video output layer that 6The output sysfs class driver provides an abstract video output layer that
7can be used to hook platform specific methods to enable/disable video output 7can be used to hook platform specific methods to enable/disable video output
8device through common sysfs interface. For example, on my IBM ThinkPad T42 8device through common sysfs interface. For example, on my IBM ThinkPad T42
9laptop, The ACPI video driver registered its output devices and read/write 9laptop, The ACPI video driver registered its output devices and read/write
10method for 'state' with output sysfs class. The user interface under sysfs is: 10method for 'state' with output sysfs class. The user interface under sysfs is::
11 11
12linux:/sys/class/video_output # tree . 12 linux:/sys/class/video_output # tree .
13. 13 .
14|-- CRT0 14 |-- CRT0
15| |-- device -> ../../../devices/pci0000:00/0000:00:01.0 15 | |-- device -> ../../../devices/pci0000:00/0000:00:01.0
16| |-- state 16 | |-- state
17| |-- subsystem -> ../../../class/video_output 17 | |-- subsystem -> ../../../class/video_output
18| `-- uevent 18 | `-- uevent
19|-- DVI0 19 |-- DVI0
20| |-- device -> ../../../devices/pci0000:00/0000:00:01.0 20 | |-- device -> ../../../devices/pci0000:00/0000:00:01.0
21| |-- state 21 | |-- state
22| |-- subsystem -> ../../../class/video_output 22 | |-- subsystem -> ../../../class/video_output
23| `-- uevent 23 | `-- uevent
24|-- LCD0 24 |-- LCD0
25| |-- device -> ../../../devices/pci0000:00/0000:00:01.0 25 | |-- device -> ../../../devices/pci0000:00/0000:00:01.0
26| |-- state 26 | |-- state
27| |-- subsystem -> ../../../class/video_output 27 | |-- subsystem -> ../../../class/video_output
28| `-- uevent 28 | `-- uevent
29`-- TV0 29 `-- TV0
30 |-- device -> ../../../devices/pci0000:00/0000:00:01.0 30 |-- device -> ../../../devices/pci0000:00/0000:00:01.0
31 |-- state 31 |-- state
32 |-- subsystem -> ../../../class/video_output 32 |-- subsystem -> ../../../class/video_output
33 `-- uevent 33 `-- uevent
34 34
diff --git a/Documentation/vm/hugetlbfs_reserv.rst b/Documentation/vm/hugetlbfs_reserv.rst
index 9d200762114f..f143954e0d05 100644
--- a/Documentation/vm/hugetlbfs_reserv.rst
+++ b/Documentation/vm/hugetlbfs_reserv.rst
@@ -85,10 +85,10 @@ Reservation Map Location (Private or Shared)
85A huge page mapping or segment is either private or shared. If private, 85A huge page mapping or segment is either private or shared. If private,
86it is typically only available to a single address space (task). If shared, 86it is typically only available to a single address space (task). If shared,
87it can be mapped into multiple address spaces (tasks). The location and 87it can be mapped into multiple address spaces (tasks). The location and
88semantics of the reservation map is significantly different for two types 88semantics of the reservation map is significantly different for the two types
89of mappings. Location differences are: 89of mappings. Location differences are:
90 90
91- For private mappings, the reservation map hangs off the the VMA structure. 91- For private mappings, the reservation map hangs off the VMA structure.
92 Specifically, vma->vm_private_data. This reserve map is created at the 92 Specifically, vma->vm_private_data. This reserve map is created at the
93 time the mapping (mmap(MAP_PRIVATE)) is created. 93 time the mapping (mmap(MAP_PRIVATE)) is created.
94- For shared mappings, the reservation map hangs off the inode. Specifically, 94- For shared mappings, the reservation map hangs off the inode. Specifically,
@@ -109,15 +109,15 @@ These operations result in a call to the routine hugetlb_reserve_pages()::
109 struct vm_area_struct *vma, 109 struct vm_area_struct *vma,
110 vm_flags_t vm_flags) 110 vm_flags_t vm_flags)
111 111
112The first thing hugetlb_reserve_pages() does is check for the NORESERVE 112The first thing hugetlb_reserve_pages() does is check if the NORESERVE
113flag was specified in either the shmget() or mmap() call. If NORESERVE 113flag was specified in either the shmget() or mmap() call. If NORESERVE
114was specified, then this routine returns immediately as no reservation 114was specified, then this routine returns immediately as no reservations
115are desired. 115are desired.
116 116
117The arguments 'from' and 'to' are huge page indices into the mapping or 117The arguments 'from' and 'to' are huge page indices into the mapping or
118underlying file. For shmget(), 'from' is always 0 and 'to' corresponds to 118underlying file. For shmget(), 'from' is always 0 and 'to' corresponds to
119the length of the segment/mapping. For mmap(), the offset argument could 119the length of the segment/mapping. For mmap(), the offset argument could
120be used to specify the offset into the underlying file. In such a case 120be used to specify the offset into the underlying file. In such a case,
121the 'from' and 'to' arguments have been adjusted by this offset. 121the 'from' and 'to' arguments have been adjusted by this offset.
122 122
123One of the big differences between PRIVATE and SHARED mappings is the way 123One of the big differences between PRIVATE and SHARED mappings is the way
@@ -138,7 +138,8 @@ to indicate this VMA owns the reservations.
138 138
139The reservation map is consulted to determine how many huge page reservations 139The reservation map is consulted to determine how many huge page reservations
140are needed for the current mapping/segment. For private mappings, this is 140are needed for the current mapping/segment. For private mappings, this is
141always the value (to - from). However, for shared mappings it is possible that some reservations may already exist within the range (to - from). See the 141always the value (to - from). However, for shared mappings it is possible that
142some reservations may already exist within the range (to - from). See the
142section :ref:`Reservation Map Modifications <resv_map_modifications>` 143section :ref:`Reservation Map Modifications <resv_map_modifications>`
143for details on how this is accomplished. 144for details on how this is accomplished.
144 145
@@ -165,7 +166,7 @@ these counters.
165If there were enough free huge pages and the global count resv_huge_pages 166If there were enough free huge pages and the global count resv_huge_pages
166was adjusted, then the reservation map associated with the mapping is 167was adjusted, then the reservation map associated with the mapping is
167modified to reflect the reservations. In the case of a shared mapping, a 168modified to reflect the reservations. In the case of a shared mapping, a
168file_region will exist that includes the range 'from' 'to'. For private 169file_region will exist that includes the range 'from' - 'to'. For private
169mappings, no modifications are made to the reservation map as lack of an 170mappings, no modifications are made to the reservation map as lack of an
170entry indicates a reservation exists. 171entry indicates a reservation exists.
171 172
@@ -239,7 +240,7 @@ subpool accounting when the page is freed.
239The routine vma_commit_reservation() is then called to adjust the reserve 240The routine vma_commit_reservation() is then called to adjust the reserve
240map based on the consumption of the reservation. In general, this involves 241map based on the consumption of the reservation. In general, this involves
241ensuring the page is represented within a file_region structure of the region 242ensuring the page is represented within a file_region structure of the region
242map. For shared mappings where the the reservation was present, an entry 243map. For shared mappings where the reservation was present, an entry
243in the reserve map already existed so no change is made. However, if there 244in the reserve map already existed so no change is made. However, if there
244was no reservation in a shared mapping or this was a private mapping a new 245was no reservation in a shared mapping or this was a private mapping a new
245entry must be created. 246entry must be created.
diff --git a/Documentation/vm/index.rst b/Documentation/vm/index.rst
index b58cc3bfe777..e8d943b21cf9 100644
--- a/Documentation/vm/index.rst
+++ b/Documentation/vm/index.rst
@@ -37,6 +37,7 @@ descriptions of data structures and algorithms.
37 hwpoison 37 hwpoison
38 hugetlbfs_reserv 38 hugetlbfs_reserv
39 ksm 39 ksm
40 memory-model
40 mmu_notifier 41 mmu_notifier
41 numa 42 numa
42 overcommit-accounting 43 overcommit-accounting
diff --git a/Documentation/vm/memory-model.rst b/Documentation/vm/memory-model.rst
new file mode 100644
index 000000000000..382f72ace1fc
--- /dev/null
+++ b/Documentation/vm/memory-model.rst
@@ -0,0 +1,183 @@
1.. SPDX-License-Identifier: GPL-2.0
2
3.. _physical_memory_model:
4
5=====================
6Physical Memory Model
7=====================
8
9Physical memory in a system may be addressed in different ways. The
10simplest case is when the physical memory starts at address 0 and
11spans a contiguous range up to the maximal address. It could be,
12however, that this range contains small holes that are not accessible
13for the CPU. Then there could be several contiguous ranges at
14completely distinct addresses. And, don't forget about NUMA, where
15different memory banks are attached to different CPUs.
16
17Linux abstracts this diversity using one of the three memory models:
18FLATMEM, DISCONTIGMEM and SPARSEMEM. Each architecture defines what
19memory models it supports, what the default memory model is and
20whether it is possible to manually override that default.
21
22.. note::
23 At time of this writing, DISCONTIGMEM is considered deprecated,
24 although it is still in use by several architectures.
25
26All the memory models track the status of physical page frames using
27:c:type:`struct page` arranged in one or more arrays.
28
29Regardless of the selected memory model, there exists one-to-one
30mapping between the physical page frame number (PFN) and the
31corresponding `struct page`.
32
33Each memory model defines :c:func:`pfn_to_page` and :c:func:`page_to_pfn`
34helpers that allow the conversion from PFN to `struct page` and vice
35versa.
36
37FLATMEM
38=======
39
40The simplest memory model is FLATMEM. This model is suitable for
41non-NUMA systems with contiguous, or mostly contiguous, physical
42memory.
43
44In the FLATMEM memory model, there is a global `mem_map` array that
45maps the entire physical memory. For most architectures, the holes
46have entries in the `mem_map` array. The `struct page` objects
47corresponding to the holes are never fully initialized.
48
49To allocate the `mem_map` array, architecture specific setup code
50should call :c:func:`free_area_init_node` function or its convenience
51wrapper :c:func:`free_area_init`. Yet, the mappings array is not
52usable until the call to :c:func:`memblock_free_all` that hands all
53the memory to the page allocator.
54
55If an architecture enables `CONFIG_ARCH_HAS_HOLES_MEMORYMODEL` option,
56it may free parts of the `mem_map` array that do not cover the
57actual physical pages. In such case, the architecture specific
58:c:func:`pfn_valid` implementation should take the holes in the
59`mem_map` into account.
60
61With FLATMEM, the conversion between a PFN and the `struct page` is
62straightforward: `PFN - ARCH_PFN_OFFSET` is an index to the
63`mem_map` array.
64
65The `ARCH_PFN_OFFSET` defines the first page frame number for
66systems with physical memory starting at address different from 0.
67
68DISCONTIGMEM
69============
70
71The DISCONTIGMEM model treats the physical memory as a collection of
72`nodes` similarly to how Linux NUMA support does. For each node Linux
73constructs an independent memory management subsystem represented by
74`struct pglist_data` (or `pg_data_t` for short). Among other
75things, `pg_data_t` holds the `node_mem_map` array that maps
76physical pages belonging to that node. The `node_start_pfn` field of
77`pg_data_t` is the number of the first page frame belonging to that
78node.
79
80The architecture setup code should call :c:func:`free_area_init_node` for
81each node in the system to initialize the `pg_data_t` object and its
82`node_mem_map`.
83
84Every `node_mem_map` behaves exactly as FLATMEM's `mem_map` -
85every physical page frame in a node has a `struct page` entry in the
86`node_mem_map` array. When DISCONTIGMEM is enabled, a portion of the
87`flags` field of the `struct page` encodes the node number of the
88node hosting that page.
89
90The conversion between a PFN and the `struct page` in the
91DISCONTIGMEM model became slightly more complex as it has to determine
92which node hosts the physical page and which `pg_data_t` object
93holds the `struct page`.
94
95Architectures that support DISCONTIGMEM provide :c:func:`pfn_to_nid`
96to convert PFN to the node number. The opposite conversion helper
97:c:func:`page_to_nid` is generic as it uses the node number encoded in
98page->flags.
99
100Once the node number is known, the PFN can be used to index
101appropriate `node_mem_map` array to access the `struct page` and
102the offset of the `struct page` from the `node_mem_map` plus
103`node_start_pfn` is the PFN of that page.
104
105SPARSEMEM
106=========
107
108SPARSEMEM is the most versatile memory model available in Linux and it
109is the only memory model that supports several advanced features such
110as hot-plug and hot-remove of the physical memory, alternative memory
111maps for non-volatile memory devices and deferred initialization of
112the memory map for larger systems.
113
114The SPARSEMEM model presents the physical memory as a collection of
115sections. A section is represented with :c:type:`struct mem_section`
116that contains `section_mem_map` that is, logically, a pointer to an
117array of struct pages. However, it is stored with some other magic
118that aids the sections management. The section size and maximal number
119of section is specified using `SECTION_SIZE_BITS` and
120`MAX_PHYSMEM_BITS` constants defined by each architecture that
121supports SPARSEMEM. While `MAX_PHYSMEM_BITS` is an actual width of a
122physical address that an architecture supports, the
123`SECTION_SIZE_BITS` is an arbitrary value.
124
125The maximal number of sections is denoted `NR_MEM_SECTIONS` and
126defined as
127
128.. math::
129
130 NR\_MEM\_SECTIONS = 2 ^ {(MAX\_PHYSMEM\_BITS - SECTION\_SIZE\_BITS)}
131
132The `mem_section` objects are arranged in a two-dimensional array
133called `mem_sections`. The size and placement of this array depend
134on `CONFIG_SPARSEMEM_EXTREME` and the maximal possible number of
135sections:
136
137* When `CONFIG_SPARSEMEM_EXTREME` is disabled, the `mem_sections`
138 array is static and has `NR_MEM_SECTIONS` rows. Each row holds a
139 single `mem_section` object.
140* When `CONFIG_SPARSEMEM_EXTREME` is enabled, the `mem_sections`
141 array is dynamically allocated. Each row contains PAGE_SIZE worth of
142 `mem_section` objects and the number of rows is calculated to fit
143 all the memory sections.
144
145The architecture setup code should call :c:func:`memory_present` for
146each active memory range or use :c:func:`memblocks_present` or
147:c:func:`sparse_memory_present_with_active_regions` wrappers to
148initialize the memory sections. Next, the actual memory maps should be
149set up using :c:func:`sparse_init`.
150
151With SPARSEMEM there are two possible ways to convert a PFN to the
152corresponding `struct page` - a "classic sparse" and "sparse
153vmemmap". The selection is made at build time and it is determined by
154the value of `CONFIG_SPARSEMEM_VMEMMAP`.
155
156The classic sparse encodes the section number of a page in page->flags
157and uses high bits of a PFN to access the section that maps that page
158frame. Inside a section, the PFN is the index to the array of pages.
159
160The sparse vmemmap uses a virtually mapped memory map to optimize
161pfn_to_page and page_to_pfn operations. There is a global `struct
162page *vmemmap` pointer that points to a virtually contiguous array of
163`struct page` objects. A PFN is an index to that array and the the
164offset of the `struct page` from `vmemmap` is the PFN of that
165page.
166
167To use vmemmap, an architecture has to reserve a range of virtual
168addresses that will map the physical pages containing the memory
169map and make sure that `vmemmap` points to that range. In addition,
170the architecture should implement :c:func:`vmemmap_populate` method
171that will allocate the physical memory and create page tables for the
172virtual memory map. If an architecture does not have any special
173requirements for the vmemmap mappings, it can use default
174:c:func:`vmemmap_populate_basepages` provided by the generic memory
175management.
176
177The virtually mapped memory map allows storing `struct page` objects
178for persistent memory devices in pre-allocated storage on those
179devices. This storage is represented with :c:type:`struct vmem_altmap`
180that is eventually passed to vmemmap_populate() through a long chain
181of function calls. The vmemmap_populate() implementation may use the
182`vmem_altmap` along with :c:func:`altmap_alloc_block_buf` helper to
183allocate memory map on the persistent memory device.
diff --git a/Documentation/vm/numa.rst b/Documentation/vm/numa.rst
index 185d8a568168..5cae13e9a08b 100644
--- a/Documentation/vm/numa.rst
+++ b/Documentation/vm/numa.rst
@@ -109,8 +109,8 @@ System administrators and application designers can restrict a task's migration
109to improve NUMA locality using various CPU affinity command line interfaces, 109to improve NUMA locality using various CPU affinity command line interfaces,
110such as taskset(1) and numactl(1), and program interfaces such as 110such as taskset(1) and numactl(1), and program interfaces such as
111sched_setaffinity(2). Further, one can modify the kernel's default local 111sched_setaffinity(2). Further, one can modify the kernel's default local
112allocation behavior using Linux NUMA memory policy. 112allocation behavior using Linux NUMA memory policy. [see
113[see Documentation/admin-guide/mm/numa_memory_policy.rst.] 113:ref:`Documentation/admin-guide/mm/numa_memory_policy.rst <numa_memory_policy>`].
114 114
115System administrators can restrict the CPUs and nodes' memories that a non- 115System administrators can restrict the CPUs and nodes' memories that a non-
116privileged user can specify in the scheduling or NUMA commands and functions 116privileged user can specify in the scheduling or NUMA commands and functions
diff --git a/Documentation/vm/transhuge.rst b/Documentation/vm/transhuge.rst
index a8cf6809e36e..37c57ca32629 100644
--- a/Documentation/vm/transhuge.rst
+++ b/Documentation/vm/transhuge.rst
@@ -4,8 +4,9 @@
4Transparent Hugepage Support 4Transparent Hugepage Support
5============================ 5============================
6 6
7This document describes design principles Transparent Hugepage (THP) 7This document describes design principles for Transparent Hugepage (THP)
8Support and its interaction with other parts of the memory management. 8support and its interaction with other parts of the memory management
9system.
9 10
10Design principles 11Design principles
11================= 12=================
@@ -37,31 +38,25 @@ get_user_pages and follow_page
37 38
38get_user_pages and follow_page if run on a hugepage, will return the 39get_user_pages and follow_page if run on a hugepage, will return the
39head or tail pages as usual (exactly as they would do on 40head or tail pages as usual (exactly as they would do on
40hugetlbfs). Most gup users will only care about the actual physical 41hugetlbfs). Most GUP users will only care about the actual physical
41address of the page and its temporary pinning to release after the I/O 42address of the page and its temporary pinning to release after the I/O
42is complete, so they won't ever notice the fact the page is huge. But 43is complete, so they won't ever notice the fact the page is huge. But
43if any driver is going to mangle over the page structure of the tail 44if any driver is going to mangle over the page structure of the tail
44page (like for checking page->mapping or other bits that are relevant 45page (like for checking page->mapping or other bits that are relevant
45for the head page and not the tail page), it should be updated to jump 46for the head page and not the tail page), it should be updated to jump
46to check head page instead. Taking reference on any head/tail page would 47to check head page instead. Taking a reference on any head/tail page would
47prevent page from being split by anyone. 48prevent the page from being split by anyone.
48 49
49.. note:: 50.. note::
50 these aren't new constraints to the GUP API, and they match the 51 these aren't new constraints to the GUP API, and they match the
51 same constrains that applies to hugetlbfs too, so any driver capable 52 same constraints that apply to hugetlbfs too, so any driver capable
52 of handling GUP on hugetlbfs will also work fine on transparent 53 of handling GUP on hugetlbfs will also work fine on transparent
53 hugepage backed mappings. 54 hugepage backed mappings.
54 55
55In case you can't handle compound pages if they're returned by 56In case you can't handle compound pages if they're returned by
56follow_page, the FOLL_SPLIT bit can be specified as parameter to 57follow_page, the FOLL_SPLIT bit can be specified as a parameter to
57follow_page, so that it will split the hugepages before returning 58follow_page, so that it will split the hugepages before returning
58them. Migration for example passes FOLL_SPLIT as parameter to 59them.
59follow_page because it's not hugepage aware and in fact it can't work
60at all on hugetlbfs (but it instead works fine on transparent
61hugepages thanks to FOLL_SPLIT). migration simply can't deal with
62hugepages being returned (as it's not only checking the pfn of the
63page and pinning it during the copy but it pretends to migrate the
64memory in regular page sizes and with regular pte/pmd mappings).
65 60
66Graceful fallback 61Graceful fallback
67================= 62=================
@@ -72,11 +67,11 @@ pmd_offset. It's trivial to make the code transparent hugepage aware
72by just grepping for "pmd_offset" and adding split_huge_pmd where 67by just grepping for "pmd_offset" and adding split_huge_pmd where
73missing after pmd_offset returns the pmd. Thanks to the graceful 68missing after pmd_offset returns the pmd. Thanks to the graceful
74fallback design, with a one liner change, you can avoid to write 69fallback design, with a one liner change, you can avoid to write
75hundred if not thousand of lines of complex code to make your code 70hundreds if not thousands of lines of complex code to make your code
76hugepage aware. 71hugepage aware.
77 72
78If you're not walking pagetables but you run into a physical hugepage 73If you're not walking pagetables but you run into a physical hugepage
79but you can't handle it natively in your code, you can split it by 74that you can't handle natively in your code, you can split it by
80calling split_huge_page(page). This is what the Linux VM does before 75calling split_huge_page(page). This is what the Linux VM does before
81it tries to swapout the hugepage for example. split_huge_page() can fail 76it tries to swapout the hugepage for example. split_huge_page() can fail
82if the page is pinned and you must handle this correctly. 77if the page is pinned and you must handle this correctly.
@@ -103,18 +98,18 @@ split_huge_page() or split_huge_pmd() has a cost.
103 98
104To make pagetable walks huge pmd aware, all you need to do is to call 99To make pagetable walks huge pmd aware, all you need to do is to call
105pmd_trans_huge() on the pmd returned by pmd_offset. You must hold the 100pmd_trans_huge() on the pmd returned by pmd_offset. You must hold the
106mmap_sem in read (or write) mode to be sure an huge pmd cannot be 101mmap_sem in read (or write) mode to be sure a huge pmd cannot be
107created from under you by khugepaged (khugepaged collapse_huge_page 102created from under you by khugepaged (khugepaged collapse_huge_page
108takes the mmap_sem in write mode in addition to the anon_vma lock). If 103takes the mmap_sem in write mode in addition to the anon_vma lock). If
109pmd_trans_huge returns false, you just fallback in the old code 104pmd_trans_huge returns false, you just fallback in the old code
110paths. If instead pmd_trans_huge returns true, you have to take the 105paths. If instead pmd_trans_huge returns true, you have to take the
111page table lock (pmd_lock()) and re-run pmd_trans_huge. Taking the 106page table lock (pmd_lock()) and re-run pmd_trans_huge. Taking the
112page table lock will prevent the huge pmd to be converted into a 107page table lock will prevent the huge pmd being converted into a
113regular pmd from under you (split_huge_pmd can run in parallel to the 108regular pmd from under you (split_huge_pmd can run in parallel to the
114pagetable walk). If the second pmd_trans_huge returns false, you 109pagetable walk). If the second pmd_trans_huge returns false, you
115should just drop the page table lock and fallback to the old code as 110should just drop the page table lock and fallback to the old code as
116before. Otherwise you can proceed to process the huge pmd and the 111before. Otherwise, you can proceed to process the huge pmd and the
117hugepage natively. Once finished you can drop the page table lock. 112hugepage natively. Once finished, you can drop the page table lock.
118 113
119Refcounts and transparent huge pages 114Refcounts and transparent huge pages
120==================================== 115====================================
@@ -122,61 +117,61 @@ Refcounts and transparent huge pages
122Refcounting on THP is mostly consistent with refcounting on other compound 117Refcounting on THP is mostly consistent with refcounting on other compound
123pages: 118pages:
124 119
125 - get_page()/put_page() and GUP operate in head page's ->_refcount. 120 - get_page()/put_page() and GUP operate on head page's ->_refcount.
126 121
127 - ->_refcount in tail pages is always zero: get_page_unless_zero() never 122 - ->_refcount in tail pages is always zero: get_page_unless_zero() never
128 succeed on tail pages. 123 succeeds on tail pages.
129 124
130 - map/unmap of the pages with PTE entry increment/decrement ->_mapcount 125 - map/unmap of the pages with PTE entry increment/decrement ->_mapcount
131 on relevant sub-page of the compound page. 126 on relevant sub-page of the compound page.
132 127
133 - map/unmap of the whole compound page accounted in compound_mapcount 128 - map/unmap of the whole compound page is accounted for in compound_mapcount
134 (stored in first tail page). For file huge pages, we also increment 129 (stored in first tail page). For file huge pages, we also increment
135 ->_mapcount of all sub-pages in order to have race-free detection of 130 ->_mapcount of all sub-pages in order to have race-free detection of
136 last unmap of subpages. 131 last unmap of subpages.
137 132
138PageDoubleMap() indicates that the page is *possibly* mapped with PTEs. 133PageDoubleMap() indicates that the page is *possibly* mapped with PTEs.
139 134
140For anonymous pages PageDoubleMap() also indicates ->_mapcount in all 135For anonymous pages, PageDoubleMap() also indicates ->_mapcount in all
141subpages is offset up by one. This additional reference is required to 136subpages is offset up by one. This additional reference is required to
142get race-free detection of unmap of subpages when we have them mapped with 137get race-free detection of unmap of subpages when we have them mapped with
143both PMDs and PTEs. 138both PMDs and PTEs.
144 139
145This is optimization required to lower overhead of per-subpage mapcount 140This optimization is required to lower the overhead of per-subpage mapcount
146tracking. The alternative is alter ->_mapcount in all subpages on each 141tracking. The alternative is to alter ->_mapcount in all subpages on each
147map/unmap of the whole compound page. 142map/unmap of the whole compound page.
148 143
149For anonymous pages, we set PG_double_map when a PMD of the page got split 144For anonymous pages, we set PG_double_map when a PMD of the page is split
150for the first time, but still have PMD mapping. The additional references 145for the first time, but still have a PMD mapping. The additional references
151go away with last compound_mapcount. 146go away with the last compound_mapcount.
152 147
153File pages get PG_double_map set on first map of the page with PTE and 148File pages get PG_double_map set on the first map of the page with PTE and
154goes away when the page gets evicted from page cache. 149goes away when the page gets evicted from the page cache.
155 150
156split_huge_page internally has to distribute the refcounts in the head 151split_huge_page internally has to distribute the refcounts in the head
157page to the tail pages before clearing all PG_head/tail bits from the page 152page to the tail pages before clearing all PG_head/tail bits from the page
158structures. It can be done easily for refcounts taken by page table 153structures. It can be done easily for refcounts taken by page table
159entries. But we don't have enough information on how to distribute any 154entries, but we don't have enough information on how to distribute any
160additional pins (i.e. from get_user_pages). split_huge_page() fails any 155additional pins (i.e. from get_user_pages). split_huge_page() fails any
161requests to split pinned huge page: it expects page count to be equal to 156requests to split pinned huge pages: it expects page count to be equal to
162sum of mapcount of all sub-pages plus one (split_huge_page caller must 157the sum of mapcount of all sub-pages plus one (split_huge_page caller must
163have reference for head page). 158have a reference to the head page).
164 159
165split_huge_page uses migration entries to stabilize page->_refcount and 160split_huge_page uses migration entries to stabilize page->_refcount and
166page->_mapcount of anonymous pages. File pages just got unmapped. 161page->_mapcount of anonymous pages. File pages just get unmapped.
167 162
168We safe against physical memory scanners too: the only legitimate way 163We are safe against physical memory scanners too: the only legitimate way
169scanner can get reference to a page is get_page_unless_zero(). 164a scanner can get a reference to a page is get_page_unless_zero().
170 165
171All tail pages have zero ->_refcount until atomic_add(). This prevents the 166All tail pages have zero ->_refcount until atomic_add(). This prevents the
172scanner from getting a reference to the tail page up to that point. After the 167scanner from getting a reference to the tail page up to that point. After the
173atomic_add() we don't care about the ->_refcount value. We already known how 168atomic_add() we don't care about the ->_refcount value. We already know how
174many references should be uncharged from the head page. 169many references should be uncharged from the head page.
175 170
176For head page get_page_unless_zero() will succeed and we don't mind. It's 171For head page get_page_unless_zero() will succeed and we don't mind. It's
177clear where reference should go after split: it will stay on head page. 172clear where references should go after split: it will stay on the head page.
178 173
179Note that split_huge_pmd() doesn't have any limitation on refcounting: 174Note that split_huge_pmd() doesn't have any limitations on refcounting:
180pmd can be split at any point and never fails. 175pmd can be split at any point and never fails.
181 176
182Partial unmap and deferred_split_huge_page() 177Partial unmap and deferred_split_huge_page()
@@ -188,10 +183,10 @@ in page_remove_rmap() and queue the THP for splitting if memory pressure
188comes. Splitting will free up unused subpages. 183comes. Splitting will free up unused subpages.
189 184
190Splitting the page right away is not an option due to locking context in 185Splitting the page right away is not an option due to locking context in
191the place where we can detect partial unmap. It's also might be 186the place where we can detect partial unmap. It also might be
192counterproductive since in many cases partial unmap happens during exit(2) if 187counterproductive since in many cases partial unmap happens during exit(2) if
193a THP crosses a VMA boundary. 188a THP crosses a VMA boundary.
194 189
195Function deferred_split_huge_page() is used to queue page for splitting. 190The function deferred_split_huge_page() is used to queue a page for splitting.
196The splitting itself will happen when we get memory pressure via shrinker 191The splitting itself will happen when we get memory pressure via shrinker
197interface. 192interface.
diff --git a/Documentation/x86/boot.txt b/Documentation/x86/boot.txt
index f4c2a97bfdbd..223e484a1304 100644
--- a/Documentation/x86/boot.txt
+++ b/Documentation/x86/boot.txt
@@ -61,6 +61,10 @@ Protocol 2.12: (Kernel 3.8) Added the xloadflags field and extension fields
61 to struct boot_params for loading bzImage and ramdisk 61 to struct boot_params for loading bzImage and ramdisk
62 above 4G in 64bit. 62 above 4G in 64bit.
63 63
64Protocol 2.13: (Kernel 3.14) Support 32- and 64-bit flags being set in
65 xloadflags to support booting a 64-bit kernel from 32-bit
66 EFI
67
64**** MEMORY LAYOUT 68**** MEMORY LAYOUT
65 69
66The traditional memory map for the kernel loader, used for Image or 70The traditional memory map for the kernel loader, used for Image or
diff --git a/LICENSES/other/GPL-1.0 b/LICENSES/deprecated/GPL-1.0
index 3a4fa969e4c2..3a4fa969e4c2 100644
--- a/LICENSES/other/GPL-1.0
+++ b/LICENSES/deprecated/GPL-1.0
diff --git a/LICENSES/other/ISC b/LICENSES/deprecated/ISC
index 8953c3142079..8953c3142079 100644
--- a/LICENSES/other/ISC
+++ b/LICENSES/deprecated/ISC
diff --git a/LICENSES/other/Linux-OpenIB b/LICENSES/deprecated/Linux-OpenIB
index 1ad85f6b3a89..1ad85f6b3a89 100644
--- a/LICENSES/other/Linux-OpenIB
+++ b/LICENSES/deprecated/Linux-OpenIB
diff --git a/LICENSES/other/X11 b/LICENSES/deprecated/X11
index fe4353fd0000..fe4353fd0000 100644
--- a/LICENSES/other/X11
+++ b/LICENSES/deprecated/X11
diff --git a/LICENSES/other/Apache-2.0 b/LICENSES/dual/Apache-2.0
index 7cd903f573e5..6e89ddeab187 100644
--- a/LICENSES/other/Apache-2.0
+++ b/LICENSES/dual/Apache-2.0
@@ -1,6 +1,10 @@
1Valid-License-Identifier: Apache-2.0 1Valid-License-Identifier: Apache-2.0
2SPDX-URL: https://spdx.org/licenses/Apache-2.0.html 2SPDX-URL: https://spdx.org/licenses/Apache-2.0.html
3Usage-Guide: 3Usage-Guide:
4 Do NOT use. The Apache-2.0 is not GPL2 compatible. It may only be used
5 for dual-licensed files where the other license is GPL2 compatible.
6 If you end up using this it MUST be used together with a GPL2 compatible
7 license using "OR".
4 To use the Apache License version 2.0 put the following SPDX tag/value 8 To use the Apache License version 2.0 put the following SPDX tag/value
5 pair into a comment according to the placement guidelines in the 9 pair into a comment according to the placement guidelines in the
6 licensing rules documentation: 10 licensing rules documentation:
diff --git a/LICENSES/other/CDDL-1.0 b/LICENSES/dual/CDDL-1.0
index 25f614276ddd..b0ca1016db79 100644
--- a/LICENSES/other/CDDL-1.0
+++ b/LICENSES/dual/CDDL-1.0
@@ -1,8 +1,8 @@
1Valid-License-Identifier: CDDL-1.0 1Valid-License-Identifier: CDDL-1.0
2SPDX-URL: https://spdx.org/licenses/CDDL-1.0.html 2SPDX-URL: https://spdx.org/licenses/CDDL-1.0.html
3Usage-Guide: 3Usage-Guide:
4 Do NOT use. The CDDL-1.0 is not GPL compatible. It may only be used for 4 Do NOT use. The CDDL-1.0 is not GPL2 compatible. It may only be used for
5 dual-licensed files where the other license is GPL compatible. 5 dual-licensed files where the other license is GPL2 compatible.
6 If you end up using this it MUST be used together with a GPL2 compatible 6 If you end up using this it MUST be used together with a GPL2 compatible
7 license using "OR". 7 license using "OR".
8 To use the Common Development and Distribution License 1.0 put the 8 To use the Common Development and Distribution License 1.0 put the
diff --git a/LICENSES/other/MPL-1.1 b/LICENSES/dual/MPL-1.1
index 568b6049efe6..61706859e1b2 100644
--- a/LICENSES/other/MPL-1.1
+++ b/LICENSES/dual/MPL-1.1
@@ -1,6 +1,10 @@
1Valid-License-Identifier: MPL-1.1 1Valid-License-Identifier: MPL-1.1
2SPDX-URL: https://spdx.org/licenses/MPL-1.1.html 2SPDX-URL: https://spdx.org/licenses/MPL-1.1.html
3Usage-Guide: 3Usage-Guide:
4 Do NOT use. The MPL-1.1 is not GPL2 compatible. It may only be used for
5 dual-licensed files where the other license is GPL2 compatible.
6 If you end up using this it MUST be used together with a GPL2 compatible
7 license using "OR".
4 To use the Mozilla Public License version 1.1 put the following SPDX 8 To use the Mozilla Public License version 1.1 put the following SPDX
5 tag/value pair into a comment according to the placement guidelines in 9 tag/value pair into a comment according to the placement guidelines in
6 the licensing rules documentation: 10 the licensing rules documentation:
diff --git a/MAINTAINERS b/MAINTAINERS
index e897d9521000..4244dd341eb7 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -3737,8 +3737,8 @@ F: scripts/checkpatch.pl
3737 3737
3738CHINESE DOCUMENTATION 3738CHINESE DOCUMENTATION
3739M: Harry Wei <harryxiyou@gmail.com> 3739M: Harry Wei <harryxiyou@gmail.com>
3740M: Alex Shi <alex.shi@linux.alibaba.com>
3740L: xiyoulinuxkernelgroup@googlegroups.com (subscribers-only) 3741L: xiyoulinuxkernelgroup@googlegroups.com (subscribers-only)
3741L: linux-kernel@zh-kernel.org (moderated for non-subscribers)
3742S: Maintained 3742S: Maintained
3743F: Documentation/translations/zh_CN/ 3743F: Documentation/translations/zh_CN/
3744 3744
diff --git a/include/linux/wait.h b/include/linux/wait.h
index 5f3efabc36f4..b6f77cf60dd7 100644
--- a/include/linux/wait.h
+++ b/include/linux/wait.h
@@ -101,7 +101,7 @@ init_waitqueue_func_entry(struct wait_queue_entry *wq_entry, wait_queue_func_t f
101 * lead to sporadic and non-obvious failure. 101 * lead to sporadic and non-obvious failure.
102 * 102 *
103 * Use either while holding wait_queue_head::lock or when used for wakeups 103 * Use either while holding wait_queue_head::lock or when used for wakeups
104 * with an extra smp_mb() like: 104 * with an extra smp_mb() like::
105 * 105 *
106 * CPU0 - waker CPU1 - waiter 106 * CPU0 - waker CPU1 - waiter
107 * 107 *
diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
index a09333fd7cef..bb28b178d929 100755
--- a/scripts/checkpatch.pl
+++ b/scripts/checkpatch.pl
@@ -2687,6 +2687,24 @@ sub process {
2687 } else { 2687 } else {
2688 $signatures{$sig_nospace} = 1; 2688 $signatures{$sig_nospace} = 1;
2689 } 2689 }
2690
2691# Check Co-developed-by: immediately followed by Signed-off-by: with same name and email
2692 if ($sign_off =~ /^co-developed-by:$/i) {
2693 if ($email eq $author) {
2694 WARN("BAD_SIGN_OFF",
2695 "Co-developed-by: should not be used to attribute nominal patch author '$author'\n" . "$here\n" . $rawline);
2696 }
2697 if (!defined $lines[$linenr]) {
2698 WARN("BAD_SIGN_OFF",
2699 "Co-developed-by: must be immediately followed by Signed-off-by:\n" . "$here\n" . $rawline);
2700 } elsif ($rawlines[$linenr] !~ /^\s*signed-off-by:\s*(.*)/i) {
2701 WARN("BAD_SIGN_OFF",
2702 "Co-developed-by: must be immediately followed by Signed-off-by:\n" . "$here\n" . $rawline . "\n" .$rawlines[$linenr]);
2703 } elsif ($1 ne $email) {
2704 WARN("BAD_SIGN_OFF",
2705 "Co-developed-by and Signed-off-by: name/email do not match \n" . "$here\n" . $rawline . "\n" .$rawlines[$linenr]);
2706 }
2707 }
2690 } 2708 }
2691 2709
2692# Check email subject for common tools that don't need to be mentioned 2710# Check email subject for common tools that don't need to be mentioned
diff --git a/scripts/documentation-file-ref-check b/scripts/documentation-file-ref-check
index ad9db6821824..63e9542656f1 100755
--- a/scripts/documentation-file-ref-check
+++ b/scripts/documentation-file-ref-check
@@ -30,6 +30,34 @@ print "Finding broken references. This may take a while... " if ($fix);
30 30
31my %broken_ref; 31my %broken_ref;
32 32
33my $doc_fix = 0;
34
35open IN, "git grep ':doc:\`' Documentation/|"
36 or die "Failed to run git grep";
37while (<IN>) {
38 next if (!m,^([^:]+):.*\:doc\:\`([^\`]+)\`,);
39
40 my $d = $1;
41 my $doc_ref = $2;
42
43 my $f = $doc_ref;
44
45 $d =~ s,(.*/).*,$1,;
46 $f =~ s,.*\<([^\>]+)\>,$1,;
47
48 $f ="$d$f.rst";
49
50 next if (grep -e, glob("$f"));
51
52 if ($fix && !$doc_fix) {
53 print STDERR "\nWARNING: Currently, can't fix broken :doc:`` fields\n";
54 }
55 $doc_fix++;
56
57 print STDERR "$f: :doc:`$doc_ref`\n";
58}
59close IN;
60
33open IN, "git grep 'Documentation/'|" 61open IN, "git grep 'Documentation/'|"
34 or die "Failed to run git grep"; 62 or die "Failed to run git grep";
35while (<IN>) { 63while (<IN>) {
@@ -38,6 +66,9 @@ while (<IN>) {
38 my $f = $1; 66 my $f = $1;
39 my $ln = $2; 67 my $ln = $2;
40 68
69 # On linux-next, discard the Next/ directory
70 next if ($f =~ m,^Next/,);
71
41 # Makefiles and scripts contain nasty expressions to parse docs 72 # Makefiles and scripts contain nasty expressions to parse docs
42 next if ($f =~ m/Makefile/ || $f =~ m/\.sh$/); 73 next if ($f =~ m/Makefile/ || $f =~ m/\.sh$/);
43 74
@@ -100,6 +131,7 @@ while (<IN>) {
100 } 131 }
101 } 132 }
102} 133}
134close IN;
103 135
104exit 0 if (!$fix); 136exit 0 if (!$fix);
105 137
diff --git a/scripts/sphinx-pre-install b/scripts/sphinx-pre-install
index 067459760a7b..f6a5c0bae31e 100755
--- a/scripts/sphinx-pre-install
+++ b/scripts/sphinx-pre-install
@@ -532,6 +532,7 @@ sub check_needs()
532 check_program("dot", 1); 532 check_program("dot", 1);
533 check_program("convert", 1); 533 check_program("convert", 1);
534 check_program("rsvg-convert", 1) if ($pdf); 534 check_program("rsvg-convert", 1) if ($pdf);
535 check_program("latexmk", 1) if ($pdf);
535 536
536 check_distros(); 537 check_distros();
537 538
diff --git a/tools/objtool/Documentation/stack-validation.txt b/tools/objtool/Documentation/stack-validation.txt
index 3995735a878f..8df526c80b65 100644
--- a/tools/objtool/Documentation/stack-validation.txt
+++ b/tools/objtool/Documentation/stack-validation.txt
@@ -111,7 +111,7 @@ c) Higher live patching compatibility rate
111 be detectable). Objtool makes that possible. 111 be detectable). Objtool makes that possible.
112 112
113 For more details, see the livepatch documentation in the Linux kernel 113 For more details, see the livepatch documentation in the Linux kernel
114 source tree at Documentation/livepatch/livepatch.txt. 114 source tree at Documentation/livepatch/livepatch.rst.
115 115
116Rules 116Rules
117----- 117-----