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

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

Pull documentation updates from Jonathan Corbet:
"A fairly routine cycle for docs - lots of typo fixes, some new
documents, and more translations. There's also some LICENSES
adjustments from Thomas"

* tag 'docs-5.1' of git://git.lwn.net/linux: (74 commits)
docs: Bring some order to filesystem documentation
Documentation/locking/lockdep: Drop last two chars of sample states
doc: rcu: Suspicious RCU usage is a warning
docs: driver-api: iio: fix errors in documentation
Documentation/process/howto: Update for 4.x -> 5.x versioning
docs: Explicitly state that the 'Fixes:' tag shouldn't split lines
doc: security: Add kern-doc for lsm_hooks.h
doc: sctp: Merge and clean up rst files
Docs: Correct /proc/stat path
scripts/spdxcheck.py: fix C++ comment style detection
doc: fix typos in license-rules.rst
Documentation: fix admin-guide/README.rst minimum gcc version requirement
doc: process: complete removal of info about -git patches
doc: translations: sync translations 'remove info about -git patches'
perf-security: wrap paragraphs on 72 columns
perf-security: elaborate on perf_events/Perf privileged users
perf-security: document collected perf_events/Perf data categories
perf-security: document perf_events/Perf resource control
sysfs.txt: add note on available attribute macros
docs: kernel-doc: typo "if ... if" -> "if ... is"
...

+3741 -1134
+3 -3
Documentation/DMA-API.txt
··· 530 530 dma_free_attrs(struct device *dev, size_t size, void *cpu_addr, 531 531 dma_addr_t dma_handle, unsigned long attrs) 532 532 533 - Free memory allocated by the dma_alloc_attrs(). All parameters common 534 - parameters must identical to those otherwise passed to dma_fre_coherent, 533 + Free memory allocated by the dma_alloc_attrs(). All common 534 + parameters must be identical to those otherwise passed to dma_free_coherent, 535 535 and the attrs argument must be identical to the attrs passed to 536 536 dma_alloc_attrs(). 537 537 ··· 717 717 dma-api/nr_total_entries The total number of dma_debug_entries in the 718 718 allocator, both free and used. 719 719 720 - dma-api/driver-filter You can write a name of a driver into this file 720 + dma-api/driver_filter You can write a name of a driver into this file 721 721 to limit the debug output to requests from that 722 722 particular driver. Write an empty string to 723 723 that file to disable the filter and see
+2 -2
Documentation/DMA-ISA-LPC.txt
··· 52 52 ------------------- 53 53 54 54 To translate the virtual address to a bus address, use the normal DMA 55 - API. Do _not_ use isa_virt_to_phys() even though it does the same 56 - thing. The reason for this is that the function isa_virt_to_phys() 55 + API. Do _not_ use isa_virt_to_bus() even though it does the same 56 + thing. The reason for this is that the function isa_virt_to_bus() 57 57 will require a Kconfig dependency to ISA, not just ISA_DMA_API which 58 58 is really all you need. Remember that even though the DMA controller 59 59 has its origins in ISA it is used elsewhere.
+6 -6
Documentation/RCU/lockdep-splat.txt
··· 14 14 So let's look at an example RCU lockdep splat from 3.0-rc5, one that 15 15 has long since been fixed: 16 16 17 - =============================== 18 - [ INFO: suspicious RCU usage. ] 19 - ------------------------------- 17 + ============================= 18 + WARNING: suspicious RCU usage 19 + ----------------------------- 20 20 block/cfq-iosched.c:2776 suspicious rcu_dereference_protected() usage! 21 21 22 22 other info that might help us debug this: ··· 24 24 25 25 rcu_scheduler_active = 1, debug_locks = 0 26 26 3 locks held by scsi_scan_6/1552: 27 - #0: (&shost->scan_mutex){+.+.+.}, at: [<ffffffff8145efca>] 27 + #0: (&shost->scan_mutex){+.+.}, at: [<ffffffff8145efca>] 28 28 scsi_scan_host_selected+0x5a/0x150 29 - #1: (&eq->sysfs_lock){+.+...}, at: [<ffffffff812a5032>] 29 + #1: (&eq->sysfs_lock){+.+.}, at: [<ffffffff812a5032>] 30 30 elevator_exit+0x22/0x60 31 - #2: (&(&q->__queue_lock)->rlock){-.-...}, at: [<ffffffff812b6233>] 31 + #2: (&(&q->__queue_lock)->rlock){-.-.}, at: [<ffffffff812b6233>] 32 32 cfq_exit_queue+0x43/0x190 33 33 34 34 stack backtrace:
+1 -1
Documentation/admin-guide/README.rst
··· 251 251 Compiling the kernel 252 252 -------------------- 253 253 254 - - Make sure you have at least gcc 3.2 available. 254 + - Make sure you have at least gcc 4.6 available. 255 255 For more information, refer to :ref:`Documentation/process/changes.rst <changes>`. 256 256 257 257 Please note that you can still run a.out user programs with this kernel.
+10 -3
Documentation/admin-guide/kernel-parameters.txt
··· 1197 1197 arch/x86/kernel/cpu/cpufreq/elanfreq.c. 1198 1198 1199 1199 elevator= [IOSCHED] 1200 - Format: {"cfq" | "deadline" | "noop"} 1201 - See Documentation/block/cfq-iosched.txt and 1202 - Documentation/block/deadline-iosched.txt for details. 1200 + Format: { "mq-deadline" | "kyber" | "bfq" } 1201 + See Documentation/block/deadline-iosched.txt, 1202 + Documentation/block/kyber-iosched.txt and 1203 + Documentation/block/bfq-iosched.txt for details. 1203 1204 1204 1205 elfcorehdr=[size[KMG]@]offset[KMG] [IA64,PPC,SH,X86,S390] 1205 1206 Specifies physical address of start of kernel core ··· 1996 1995 Default: on 1997 1996 Built with CONFIG_DEBUG_KMEMLEAK_DEFAULT_OFF=y, 1998 1997 the default is off. 1998 + 1999 + kpti= [ARM64] Control page table isolation of user 2000 + and kernel address spaces. 2001 + Default: enabled on cores which need mitigation. 2002 + 0: force disabled 2003 + 1: force enabled 1999 2004 2000 2005 kvm.ignore_msrs=[KVM] Ignore guest accesses to unhandled MSRs. 2001 2006 Default is 0 (don't ignore, but inject #GP)
+188 -55
Documentation/admin-guide/perf-security.rst
··· 6 6 Overview 7 7 -------- 8 8 9 - Usage of Performance Counters for Linux (perf_events) [1]_ , [2]_ , [3]_ can 10 - impose a considerable risk of leaking sensitive data accessed by monitored 11 - processes. The data leakage is possible both in scenarios of direct usage of 12 - perf_events system call API [2]_ and over data files generated by Perf tool user 13 - mode utility (Perf) [3]_ , [4]_ . The risk depends on the nature of data that 14 - perf_events performance monitoring units (PMU) [2]_ collect and expose for 15 - performance analysis. Having that said perf_events/Perf performance monitoring 16 - is the subject for security access control management [5]_ . 9 + Usage of Performance Counters for Linux (perf_events) [1]_ , [2]_ , [3]_ 10 + can impose a considerable risk of leaking sensitive data accessed by 11 + monitored processes. The data leakage is possible both in scenarios of 12 + direct usage of perf_events system call API [2]_ and over data files 13 + generated by Perf tool user mode utility (Perf) [3]_ , [4]_ . The risk 14 + depends on the nature of data that perf_events performance monitoring 15 + units (PMU) [2]_ and Perf collect and expose for performance analysis. 16 + Collected system and performance data may be split into several 17 + categories: 18 + 19 + 1. System hardware and software configuration data, for example: a CPU 20 + model and its cache configuration, an amount of available memory and 21 + its topology, used kernel and Perf versions, performance monitoring 22 + setup including experiment time, events configuration, Perf command 23 + line parameters, etc. 24 + 25 + 2. User and kernel module paths and their load addresses with sizes, 26 + process and thread names with their PIDs and TIDs, timestamps for 27 + captured hardware and software events. 28 + 29 + 3. Content of kernel software counters (e.g., for context switches, page 30 + faults, CPU migrations), architectural hardware performance counters 31 + (PMC) [8]_ and machine specific registers (MSR) [9]_ that provide 32 + execution metrics for various monitored parts of the system (e.g., 33 + memory controller (IMC), interconnect (QPI/UPI) or peripheral (PCIe) 34 + uncore counters) without direct attribution to any execution context 35 + state. 36 + 37 + 4. Content of architectural execution context registers (e.g., RIP, RSP, 38 + RBP on x86_64), process user and kernel space memory addresses and 39 + data, content of various architectural MSRs that capture data from 40 + this category. 41 + 42 + Data that belong to the fourth category can potentially contain 43 + sensitive process data. If PMUs in some monitoring modes capture values 44 + of execution context registers or data from process memory then access 45 + to such monitoring capabilities requires to be ordered and secured 46 + properly. So, perf_events/Perf performance monitoring is the subject for 47 + security access control management [5]_ . 17 48 18 49 perf_events/Perf access control 19 50 ------------------------------- 20 51 21 - To perform security checks, the Linux implementation splits processes into two 22 - categories [6]_ : a) privileged processes (whose effective user ID is 0, referred 23 - to as superuser or root), and b) unprivileged processes (whose effective UID is 24 - nonzero). Privileged processes bypass all kernel security permission checks so 25 - perf_events performance monitoring is fully available to privileged processes 26 - without access, scope and resource restrictions. 52 + To perform security checks, the Linux implementation splits processes 53 + into two categories [6]_ : a) privileged processes (whose effective user 54 + ID is 0, referred to as superuser or root), and b) unprivileged 55 + processes (whose effective UID is nonzero). Privileged processes bypass 56 + all kernel security permission checks so perf_events performance 57 + monitoring is fully available to privileged processes without access, 58 + scope and resource restrictions. 27 59 28 - Unprivileged processes are subject to a full security permission check based on 29 - the process's credentials [5]_ (usually: effective UID, effective GID, and 30 - supplementary group list). 60 + Unprivileged processes are subject to a full security permission check 61 + based on the process's credentials [5]_ (usually: effective UID, 62 + effective GID, and supplementary group list). 31 63 32 - Linux divides the privileges traditionally associated with superuser into 33 - distinct units, known as capabilities [6]_ , which can be independently enabled 34 - and disabled on per-thread basis for processes and files of unprivileged users. 64 + Linux divides the privileges traditionally associated with superuser 65 + into distinct units, known as capabilities [6]_ , which can be 66 + independently enabled and disabled on per-thread basis for processes and 67 + files of unprivileged users. 35 68 36 - Unprivileged processes with enabled CAP_SYS_ADMIN capability are treated as 37 - privileged processes with respect to perf_events performance monitoring and 38 - bypass *scope* permissions checks in the kernel. 69 + Unprivileged processes with enabled CAP_SYS_ADMIN capability are treated 70 + as privileged processes with respect to perf_events performance 71 + monitoring and bypass *scope* permissions checks in the kernel. 39 72 40 - Unprivileged processes using perf_events system call API is also subject for 41 - PTRACE_MODE_READ_REALCREDS ptrace access mode check [7]_ , whose outcome 42 - determines whether monitoring is permitted. So unprivileged processes provided 43 - with CAP_SYS_PTRACE capability are effectively permitted to pass the check. 73 + Unprivileged processes using perf_events system call API is also subject 74 + for PTRACE_MODE_READ_REALCREDS ptrace access mode check [7]_ , whose 75 + outcome determines whether monitoring is permitted. So unprivileged 76 + processes provided with CAP_SYS_PTRACE capability are effectively 77 + permitted to pass the check. 44 78 45 - Other capabilities being granted to unprivileged processes can effectively 46 - enable capturing of additional data required for later performance analysis of 47 - monitored processes or a system. For example, CAP_SYSLOG capability permits 48 - reading kernel space memory addresses from /proc/kallsyms file. 79 + Other capabilities being granted to unprivileged processes can 80 + effectively enable capturing of additional data required for later 81 + performance analysis of monitored processes or a system. For example, 82 + CAP_SYSLOG capability permits reading kernel space memory addresses from 83 + /proc/kallsyms file. 84 + 85 + perf_events/Perf privileged users 86 + --------------------------------- 87 + 88 + Mechanisms of capabilities, privileged capability-dumb files [6]_ and 89 + file system ACLs [10]_ can be used to create a dedicated group of 90 + perf_events/Perf privileged users who are permitted to execute 91 + performance monitoring without scope limits. The following steps can be 92 + taken to create such a group of privileged Perf users. 93 + 94 + 1. Create perf_users group of privileged Perf users, assign perf_users 95 + group to Perf tool executable and limit access to the executable for 96 + other users in the system who are not in the perf_users group: 97 + 98 + :: 99 + 100 + # groupadd perf_users 101 + # ls -alhF 102 + -rwxr-xr-x 2 root root 11M Oct 19 15:12 perf 103 + # chgrp perf_users perf 104 + # ls -alhF 105 + -rwxr-xr-x 2 root perf_users 11M Oct 19 15:12 perf 106 + # chmod o-rwx perf 107 + # ls -alhF 108 + -rwxr-x--- 2 root perf_users 11M Oct 19 15:12 perf 109 + 110 + 2. Assign the required capabilities to the Perf tool executable file and 111 + enable members of perf_users group with performance monitoring 112 + privileges [6]_ : 113 + 114 + :: 115 + 116 + # setcap "cap_sys_admin,cap_sys_ptrace,cap_syslog=ep" perf 117 + # setcap -v "cap_sys_admin,cap_sys_ptrace,cap_syslog=ep" perf 118 + perf: OK 119 + # getcap perf 120 + perf = cap_sys_ptrace,cap_sys_admin,cap_syslog+ep 121 + 122 + As a result, members of perf_users group are capable of conducting 123 + performance monitoring by using functionality of the configured Perf 124 + tool executable that, when executes, passes perf_events subsystem scope 125 + checks. 126 + 127 + This specific access control management is only available to superuser 128 + or root running processes with CAP_SETPCAP, CAP_SETFCAP [6]_ 129 + capabilities. 49 130 50 131 perf_events/Perf unprivileged users 51 132 ----------------------------------- 52 133 53 - perf_events/Perf *scope* and *access* control for unprivileged processes is 54 - governed by perf_event_paranoid [2]_ setting: 134 + perf_events/Perf *scope* and *access* control for unprivileged processes 135 + is governed by perf_event_paranoid [2]_ setting: 55 136 56 137 -1: 57 - Impose no *scope* and *access* restrictions on using perf_events performance 58 - monitoring. Per-user per-cpu perf_event_mlock_kb [2]_ locking limit is 59 - ignored when allocating memory buffers for storing performance data. 60 - This is the least secure mode since allowed monitored *scope* is 61 - maximized and no perf_events specific limits are imposed on *resources* 62 - allocated for performance monitoring. 138 + Impose no *scope* and *access* restrictions on using perf_events 139 + performance monitoring. Per-user per-cpu perf_event_mlock_kb [2]_ 140 + locking limit is ignored when allocating memory buffers for storing 141 + performance data. This is the least secure mode since allowed 142 + monitored *scope* is maximized and no perf_events specific limits 143 + are imposed on *resources* allocated for performance monitoring. 63 144 64 145 >=0: 65 146 *scope* includes per-process and system wide performance monitoring 66 - but excludes raw tracepoints and ftrace function tracepoints monitoring. 67 - CPU and system events happened when executing either in user or 68 - in kernel space can be monitored and captured for later analysis. 69 - Per-user per-cpu perf_event_mlock_kb locking limit is imposed but 70 - ignored for unprivileged processes with CAP_IPC_LOCK [6]_ capability. 147 + but excludes raw tracepoints and ftrace function tracepoints 148 + monitoring. CPU and system events happened when executing either in 149 + user or in kernel space can be monitored and captured for later 150 + analysis. Per-user per-cpu perf_event_mlock_kb locking limit is 151 + imposed but ignored for unprivileged processes with CAP_IPC_LOCK 152 + [6]_ capability. 71 153 72 154 >=1: 73 - *scope* includes per-process performance monitoring only and excludes 74 - system wide performance monitoring. CPU and system events happened when 75 - executing either in user or in kernel space can be monitored and 76 - captured for later analysis. Per-user per-cpu perf_event_mlock_kb 77 - locking limit is imposed but ignored for unprivileged processes with 78 - CAP_IPC_LOCK capability. 155 + *scope* includes per-process performance monitoring only and 156 + excludes system wide performance monitoring. CPU and system events 157 + happened when executing either in user or in kernel space can be 158 + monitored and captured for later analysis. Per-user per-cpu 159 + perf_event_mlock_kb locking limit is imposed but ignored for 160 + unprivileged processes with CAP_IPC_LOCK capability. 79 161 80 162 >=2: 81 - *scope* includes per-process performance monitoring only. CPU and system 82 - events happened when executing in user space only can be monitored and 83 - captured for later analysis. Per-user per-cpu perf_event_mlock_kb 84 - locking limit is imposed but ignored for unprivileged processes with 85 - CAP_IPC_LOCK capability. 163 + *scope* includes per-process performance monitoring only. CPU and 164 + system events happened when executing in user space only can be 165 + monitored and captured for later analysis. Per-user per-cpu 166 + perf_event_mlock_kb locking limit is imposed but ignored for 167 + unprivileged processes with CAP_IPC_LOCK capability. 168 + 169 + perf_events/Perf resource control 170 + --------------------------------- 171 + 172 + Open file descriptors 173 + +++++++++++++++++++++ 174 + 175 + The perf_events system call API [2]_ allocates file descriptors for 176 + every configured PMU event. Open file descriptors are a per-process 177 + accountable resource governed by the RLIMIT_NOFILE [11]_ limit 178 + (ulimit -n), which is usually derived from the login shell process. When 179 + configuring Perf collection for a long list of events on a large server 180 + system, this limit can be easily hit preventing required monitoring 181 + configuration. RLIMIT_NOFILE limit can be increased on per-user basis 182 + modifying content of the limits.conf file [12]_ . Ordinarily, a Perf 183 + sampling session (perf record) requires an amount of open perf_event 184 + file descriptors that is not less than the number of monitored events 185 + multiplied by the number of monitored CPUs. 186 + 187 + Memory allocation 188 + +++++++++++++++++ 189 + 190 + The amount of memory available to user processes for capturing 191 + performance monitoring data is governed by the perf_event_mlock_kb [2]_ 192 + setting. This perf_event specific resource setting defines overall 193 + per-cpu limits of memory allowed for mapping by the user processes to 194 + execute performance monitoring. The setting essentially extends the 195 + RLIMIT_MEMLOCK [11]_ limit, but only for memory regions mapped 196 + specifically for capturing monitored performance events and related data. 197 + 198 + For example, if a machine has eight cores and perf_event_mlock_kb limit 199 + is set to 516 KiB, then a user process is provided with 516 KiB * 8 = 200 + 4128 KiB of memory above the RLIMIT_MEMLOCK limit (ulimit -l) for 201 + perf_event mmap buffers. In particular, this means that, if the user 202 + wants to start two or more performance monitoring processes, the user is 203 + required to manually distribute the available 4128 KiB between the 204 + monitoring processes, for example, using the --mmap-pages Perf record 205 + mode option. Otherwise, the first started performance monitoring process 206 + allocates all available 4128 KiB and the other processes will fail to 207 + proceed due to the lack of memory. 208 + 209 + RLIMIT_MEMLOCK and perf_event_mlock_kb resource constraints are ignored 210 + for processes with the CAP_IPC_LOCK capability. Thus, perf_events/Perf 211 + privileged users can be provided with memory above the constraints for 212 + perf_events/Perf performance monitoring purpose by providing the Perf 213 + executable with CAP_IPC_LOCK capability. 86 214 87 215 Bibliography 88 216 ------------ ··· 222 94 .. [5] `<https://www.kernel.org/doc/html/latest/security/credentials.html>`_ 223 95 .. [6] `<http://man7.org/linux/man-pages/man7/capabilities.7.html>`_ 224 96 .. [7] `<http://man7.org/linux/man-pages/man2/ptrace.2.html>`_ 97 + .. [8] `<https://en.wikipedia.org/wiki/Hardware_performance_counter>`_ 98 + .. [9] `<https://en.wikipedia.org/wiki/Model-specific_register>`_ 99 + .. [10] `<http://man7.org/linux/man-pages/man5/acl.5.html>`_ 100 + .. [11] `<http://man7.org/linux/man-pages/man2/getrlimit.2.html>`_ 101 + .. [12] `<http://man7.org/linux/man-pages/man5/limits.conf.5.html>`_ 225 102
+131 -26
Documentation/admin-guide/tainted-kernels.rst
··· 1 1 Tainted kernels 2 2 --------------- 3 3 4 - Some oops reports contain the string **'Tainted: '** after the program 5 - counter. This indicates that the kernel has been tainted by some 6 - mechanism. The string is followed by a series of position-sensitive 7 - characters, each representing a particular tainted value. 4 + The kernel will mark itself as 'tainted' when something occurs that might be 5 + relevant later when investigating problems. Don't worry too much about this, 6 + most of the time it's not a problem to run a tainted kernel; the information is 7 + mainly of interest once someone wants to investigate some problem, as its real 8 + cause might be the event that got the kernel tainted. That's why bug reports 9 + from tainted kernels will often be ignored by developers, hence try to reproduce 10 + problems with an untainted kernel. 8 11 9 - 1) ``G`` if all modules loaded have a GPL or compatible license, ``P`` if 12 + Note the kernel will remain tainted even after you undo what caused the taint 13 + (i.e. unload a proprietary kernel module), to indicate the kernel remains not 14 + trustworthy. That's also why the kernel will print the tainted state when it 15 + notices an internal problem (a 'kernel bug'), a recoverable error 16 + ('kernel oops') or a non-recoverable error ('kernel panic') and writes debug 17 + information about this to the logs ``dmesg`` outputs. It's also possible to 18 + check the tainted state at runtime through a file in ``/proc/``. 19 + 20 + 21 + Tainted flag in bugs, oops or panics messages 22 + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 23 + 24 + You find the tainted state near the top in a line starting with 'CPU:'; if or 25 + why the kernel was tainted is shown after the Process ID ('PID:') and a shortened 26 + name of the command ('Comm:') that triggered the event:: 27 + 28 + BUG: unable to handle kernel NULL pointer dereference at 0000000000000000 29 + Oops: 0002 [#1] SMP PTI 30 + CPU: 0 PID: 4424 Comm: insmod Tainted: P W O 4.20.0-0.rc6.fc30 #1 31 + Hardware name: Red Hat KVM, BIOS 0.5.1 01/01/2011 32 + RIP: 0010:my_oops_init+0x13/0x1000 [kpanic] 33 + [...] 34 + 35 + You'll find a 'Not tainted: ' there if the kernel was not tainted at the 36 + time of the event; if it was, then it will print 'Tainted: ' and characters 37 + either letters or blanks. In above example it looks like this:: 38 + 39 + Tainted: P W O 40 + 41 + The meaning of those characters is explained in the table below. In tis case 42 + the kernel got tainted earlier because a proprietary Module (``P``) was loaded, 43 + a warning occurred (``W``), and an externally-built module was loaded (``O``). 44 + To decode other letters use the table below. 45 + 46 + 47 + Decoding tainted state at runtime 48 + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 49 + 50 + At runtime, you can query the tainted state by reading 51 + ``cat /proc/sys/kernel/tainted``. If that returns ``0``, the kernel is not 52 + tainted; any other number indicates the reasons why it is. The easiest way to 53 + decode that number is the script ``tools/debugging/kernel-chktaint``, which your 54 + distribution might ship as part of a package called ``linux-tools`` or 55 + ``kernel-tools``; if it doesn't you can download the script from 56 + `git.kernel.org <https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/plain/tools/debugging/kernel-chktaint>`_ 57 + and execute it with ``sh kernel-chktaint``, which would print something like 58 + this on the machine that had the statements in the logs that were quoted earlier:: 59 + 60 + Kernel is Tainted for following reasons: 61 + * Proprietary module was loaded (#0) 62 + * Kernel issued warning (#9) 63 + * Externally-built ('out-of-tree') module was loaded (#12) 64 + See Documentation/admin-guide/tainted-kernels.rst in the the Linux kernel or 65 + https://www.kernel.org/doc/html/latest/admin-guide/tainted-kernels.html for 66 + a more details explanation of the various taint flags. 67 + Raw taint value as int/string: 4609/'P W O ' 68 + 69 + You can try to decode the number yourself. That's easy if there was only one 70 + reason that got your kernel tainted, as in this case you can find the number 71 + with the table below. If there were multiple reasons you need to decode the 72 + number, as it is a bitfield, where each bit indicates the absence or presence of 73 + a particular type of taint. It's best to leave that to the aforementioned 74 + script, but if you need something quick you can use this shell command to check 75 + which bits are set:: 76 + 77 + $ for i in $(seq 18); do echo $(($i-1)) $(($(cat /proc/sys/kernel/tainted)>>($i-1)&1));done 78 + 79 + Table for decoding tainted state 80 + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 81 + 82 + === === ====== ======================================================== 83 + Bit Log Number Reason that got the kernel tainted 84 + === === ====== ======================================================== 85 + 0 G/P 1 proprietary module was loaded 86 + 1 _/F 2 module was force loaded 87 + 2 _/S 4 SMP kernel oops on an officially SMP incapable processor 88 + 3 _/R 8 module was force unloaded 89 + 4 _/M 16 processor reported a Machine Check Exception (MCE) 90 + 5 _/B 32 bad page referenced or some unexpected page flags 91 + 6 _/U 64 taint requested by userspace application 92 + 7 _/D 128 kernel died recently, i.e. there was an OOPS or BUG 93 + 8 _/A 256 ACPI table overridden by user 94 + 9 _/W 512 kernel issued warning 95 + 10 _/C 1024 staging driver was loaded 96 + 11 _/I 2048 workaround for bug in platform firmware applied 97 + 12 _/O 4096 externally-built ("out-of-tree") module was loaded 98 + 13 _/E 8192 unsigned module was loaded 99 + 14 _/L 16384 soft lockup occurred 100 + 15 _/K 32768 kernel has been live patched 101 + 16 _/X 65536 auxiliary taint, defined for and used by distros 102 + 17 _/T 131072 kernel was built with the struct randomization plugin 103 + === === ====== ======================================================== 104 + 105 + Note: The character ``_`` is representing a blank in this table to make reading 106 + easier. 107 + 108 + More detailed explanation for tainting 109 + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 110 + 111 + 0) ``G`` if all modules loaded have a GPL or compatible license, ``P`` if 10 112 any proprietary module has been loaded. Modules without a 11 113 MODULE_LICENSE or with a MODULE_LICENSE that is not recognised by 12 114 insmod as GPL compatible are assumed to be proprietary. 13 115 14 - 2) ``F`` if any module was force loaded by ``insmod -f``, ``' '`` if all 116 + 1) ``F`` if any module was force loaded by ``insmod -f``, ``' '`` if all 15 117 modules were loaded normally. 16 118 17 - 3) ``S`` if the oops occurred on an SMP kernel running on hardware that 119 + 2) ``S`` if the oops occurred on an SMP kernel running on hardware that 18 120 hasn't been certified as safe to run multiprocessor. 19 121 Currently this occurs only on various Athlons that are not 20 122 SMP capable. 21 123 22 - 4) ``R`` if a module was force unloaded by ``rmmod -f``, ``' '`` if all 124 + 3) ``R`` if a module was force unloaded by ``rmmod -f``, ``' '`` if all 23 125 modules were unloaded normally. 24 126 25 - 5) ``M`` if any processor has reported a Machine Check Exception, 127 + 4) ``M`` if any processor has reported a Machine Check Exception, 26 128 ``' '`` if no Machine Check Exceptions have occurred. 27 129 28 - 6) ``B`` if a page-release function has found a bad page reference or 29 - some unexpected page flags. 130 + 5) ``B`` If a page-release function has found a bad page reference or some 131 + unexpected page flags. This indicates a hardware problem or a kernel bug; 132 + there should be other information in the log indicating why this tainting 133 + occured. 30 134 31 - 7) ``U`` if a user or user application specifically requested that the 135 + 6) ``U`` if a user or user application specifically requested that the 32 136 Tainted flag be set, ``' '`` otherwise. 33 137 34 - 8) ``D`` if the kernel has died recently, i.e. there was an OOPS or BUG. 138 + 7) ``D`` if the kernel has died recently, i.e. there was an OOPS or BUG. 35 139 36 - 9) ``A`` if the ACPI table has been overridden. 140 + 8) ``A`` if an ACPI table has been overridden. 37 141 38 - 10) ``W`` if a warning has previously been issued by the kernel. 142 + 9) ``W`` if a warning has previously been issued by the kernel. 39 143 (Though some warnings may set more specific taint flags.) 40 144 41 - 11) ``C`` if a staging driver has been loaded. 145 + 10) ``C`` if a staging driver has been loaded. 42 146 43 - 12) ``I`` if the kernel is working around a severe bug in the platform 147 + 11) ``I`` if the kernel is working around a severe bug in the platform 44 148 firmware (BIOS or similar). 45 149 46 - 13) ``O`` if an externally-built ("out-of-tree") module has been loaded. 150 + 12) ``O`` if an externally-built ("out-of-tree") module has been loaded. 47 151 48 - 14) ``E`` if an unsigned module has been loaded in a kernel supporting 152 + 13) ``E`` if an unsigned module has been loaded in a kernel supporting 49 153 module signature. 50 154 51 - 15) ``L`` if a soft lockup has previously occurred on the system. 155 + 14) ``L`` if a soft lockup has previously occurred on the system. 52 156 53 - 16) ``K`` if the kernel has been live patched. 157 + 15) ``K`` if the kernel has been live patched. 54 158 55 - The primary reason for the **'Tainted: '** string is to tell kernel 56 - debuggers if this is a clean kernel or if anything unusual has 57 - occurred. Tainting is permanent: even if an offending module is 58 - unloaded, the tainted value remains to indicate that the kernel is not 59 - trustworthy. 159 + 16) ``X`` Auxiliary taint, defined for and used by Linux distributors. 160 + 161 + 17) ``T`` Kernel was build with the randstruct plugin, which can intentionally 162 + produce extremely unusual kernel structure layouts (even performance 163 + pathological ones), which is important to know when debugging. Set at 164 + build time.
+4 -3
Documentation/cgroup-v1/memory.txt
··· 70 70 memory.soft_limit_in_bytes # set/show soft limit of memory usage 71 71 memory.stat # show various statistics 72 72 memory.use_hierarchy # set/show hierarchical account enabled 73 - memory.force_empty # trigger forced move charge to parent 73 + memory.force_empty # trigger forced page reclaim 74 74 memory.pressure_level # set memory pressure notifications 75 75 memory.swappiness # set/show swappiness parameter of vmscan 76 76 (See sysctl's vm.swappiness) ··· 459 459 the cgroup will be reclaimed and as many pages reclaimed as possible. 460 460 461 461 The typical use case for this interface is before calling rmdir(). 462 - Because rmdir() moves all pages to parent, some out-of-use page caches can be 463 - moved to the parent. If you want to avoid that, force_empty will be useful. 462 + Though rmdir() offlines memcg, but the memcg may still stay there due to 463 + charged file caches. Some out-of-use page caches may keep charged until 464 + memory pressure happens. If you want to avoid that, force_empty will be useful. 464 465 465 466 Also, note that when memory.kmem.limit_in_bytes is set the charges due to 466 467 kernel pages will still be seen. This is not considered a failure and the
-4
Documentation/core-api/kernel-api.rst
··· 356 356 357 357 .. kernel-doc:: include/linux/rcupdate.h 358 358 359 - .. kernel-doc:: include/linux/rcupdate_wait.h 360 - 361 - .. kernel-doc:: include/linux/rcutree.h 362 - 363 359 .. kernel-doc:: kernel/rcu/tree.c 364 360 365 361 .. kernel-doc:: kernel/rcu/tree_plugin.h
+6 -4
Documentation/core-api/memory-allocation.rst
··· 1 - .. _memory-allocation: 1 + .. _memory_allocation: 2 2 3 3 ======================= 4 4 Memory Allocation Guide ··· 113 113 114 114 If you need to allocate many identical objects you can use the slab 115 115 cache allocator. The cache should be set up with 116 - :c:func:`kmem_cache_create` before it can be used. Afterwards 117 - :c:func:`kmem_cache_alloc` and its convenience wrappers can allocate 118 - memory from that cache. 116 + :c:func:`kmem_cache_create` or :c:func:`kmem_cache_create_usercopy` 117 + before it can be used. The second function should be used if a part of 118 + the cache might be copied to the userspace. After the cache is 119 + created :c:func:`kmem_cache_alloc` and its convenience wrappers can 120 + allocate memory from that cache. 119 121 120 122 When the allocated memory is no longer needed it must be freed. You 121 123 can use :c:func:`kvfree` for the memory allocated with `kmalloc`,
+1 -1
Documentation/core-api/mm-api.rst
··· 35 35 :doc: Reclaim modifiers 36 36 37 37 .. kernel-doc:: include/linux/gfp.h 38 - :doc: Common combinations 38 + :doc: Useful GFP flag combinations 39 39 40 40 The Slab Cache 41 41 ==============
+1 -1
Documentation/dev-tools/kcov.rst
··· 22 22 23 23 CONFIG_KCOV=y 24 24 25 - CONFIG_KCOV requires gcc built on revision 231296 or later. 25 + CONFIG_KCOV requires gcc 6.1.0 or later. 26 26 27 27 If the comparison operands need to be collected, set:: 28 28
+15 -2
Documentation/doc-guide/kernel-doc.rst
··· 490 490 491 491 functions: *[ function ...]* 492 492 Include documentation for each *function* in *source*. 493 - If no *function* if specified, the documentaion for all functions 493 + If no *function* is specified, the documentation for all functions 494 494 and types in the *source* will be included. 495 495 496 496 Examples:: ··· 517 517 If you just want to use kernel-doc to generate man pages you can do this 518 518 from the kernel git tree:: 519 519 520 - $ scripts/kernel-doc -man $(git grep -l '/\*\*' -- :^Documentation :^tools) | scripts/split-man.pl /tmp/man 520 + $ scripts/kernel-doc -man \ 521 + $(git grep -l '/\*\*' -- :^Documentation :^tools) \ 522 + | scripts/split-man.pl /tmp/man 523 + 524 + Some older versions of git do not support some of the variants of syntax for 525 + path exclusion. One of the following commands may work for those versions:: 526 + 527 + $ scripts/kernel-doc -man \ 528 + $(git grep -l '/\*\*' -- . ':!Documentation' ':!tools') \ 529 + | scripts/split-man.pl /tmp/man 530 + 531 + $ scripts/kernel-doc -man \ 532 + $(git grep -l '/\*\*' -- . ":(exclude)Documentation" ":(exclude)tools") \ 533 + | scripts/split-man.pl /tmp/man
+6 -6
Documentation/doc-guide/sphinx.rst
··· 27 27 ============== 28 28 29 29 The ReST markups currently used by the Documentation/ files are meant to be 30 - built with ``Sphinx`` version 1.3 or upper. If you're desiring to build 31 - PDF outputs, it is recommended to use version 1.4.6 or upper. 30 + built with ``Sphinx`` version 1.3 or higher. If you desire to build 31 + PDF output, it is recommended to use version 1.4.6 or higher. 32 32 33 33 There's a script that checks for the Sphinx requirements. Please see 34 34 :ref:`sphinx-pre-install` for further details. ··· 37 37 and it is not uncommon that upgrading it or some other Python packages 38 38 on your machine would cause the documentation build to break. 39 39 40 - A way to get rid of that is to use a different version than the one shipped 41 - on your distributions. In order to do that, it is recommended to install 40 + A way to avoid that is to use a different version than the one shipped 41 + with your distributions. In order to do so, it is recommended to install 42 42 Sphinx inside a virtual environment, using ``virtualenv-3`` 43 43 or ``virtualenv``, depending on how your distribution packaged Python 3. 44 44 45 45 .. note:: 46 46 47 47 #) Sphinx versions below 1.5 don't work properly with Python's 48 - docutils version 0.13.1 or upper. So, if you're willing to use 48 + docutils version 0.13.1 or higher. So, if you're willing to use 49 49 those versions, you should run ``pip install 'docutils==0.12'``. 50 50 51 51 #) It is recommended to use the RTD theme for html output. Depending ··· 82 82 PDF and LaTeX builds 83 83 -------------------- 84 84 85 - Such builds are currently supported only with Sphinx versions 1.4 and upper. 85 + Such builds are currently supported only with Sphinx versions 1.4 and higher. 86 86 87 87 For PDF and LaTeX output, you'll also need ``XeLaTeX`` version 3.14159265. 88 88
+7
Documentation/driver-api/dmaengine/client.rst
··· 168 168 dmaengine_submit() will not start the DMA operation, it merely adds 169 169 it to the pending queue. For this, see step 5, dma_async_issue_pending. 170 170 171 + .. note:: 172 + 173 + After calling ``dmaengine_submit()`` the submitted transfer descriptor 174 + (``struct dma_async_tx_descriptor``) belongs to the DMA engine. 175 + Consequentially, the client must consider invalid the pointer to that 176 + descriptor. 177 + 171 178 5. Issue pending DMA requests and wait for callback notification 172 179 173 180 The transactions in the pending queue can be activated by calling the
+1 -1
Documentation/driver-api/iio/buffers.rst
··· 26 26 ================ 27 27 28 28 The meta information associated with a channel reading placed in a buffer is 29 - called a scan element . The important bits configuring scan elements are 29 + called a scan element. The important bits configuring scan elements are 30 30 exposed to userspace applications via the 31 31 :file:`/sys/bus/iio/iio:device{X}/scan_elements/*` directory. This file contains 32 32 attributes of the following form:
+3 -3
Documentation/driver-api/iio/core.rst
··· 2 2 Core elements 3 3 ============= 4 4 5 - The Industrial I/O core offers a unified framework for writing drivers for 6 - many different types of embedded sensors. a standard interface to user space 5 + The Industrial I/O core offers both a unified framework for writing drivers for 6 + many different types of embedded sensors and a standard interface to user space 7 7 applications manipulating sensors. The implementation can be found under 8 8 :file:`drivers/iio/industrialio-*` 9 9 ··· 11 11 ---------------------- 12 12 13 13 * struct :c:type:`iio_dev` - industrial I/O device 14 - * :c:func:`iio_device_alloc()` - alocate an :c:type:`iio_dev` from a driver 14 + * :c:func:`iio_device_alloc()` - allocate an :c:type:`iio_dev` from a driver 15 15 * :c:func:`iio_device_free()` - free an :c:type:`iio_dev` from a driver 16 16 * :c:func:`iio_device_register()` - register a device with the IIO subsystem 17 17 * :c:func:`iio_device_unregister()` - unregister a device from the IIO
+1 -1
Documentation/driver-api/iio/hw-consumer.rst
··· 1 1 =========== 2 2 HW consumer 3 3 =========== 4 - An IIO device can be directly connected to another device in hardware. in this 4 + An IIO device can be directly connected to another device in hardware. In this 5 5 case the buffers between IIO provider and IIO consumer are handled by hardware. 6 6 The Industrial I/O HW consumer offers a way to bond these IIO devices without 7 7 software buffer for data. The implementation can be found under
+1 -1
Documentation/driver-api/iio/triggers.rst
··· 38 38 39 39 * :file:`/sys/bus/iio/devices/iio:device{X}/trigger/*`, this directory is 40 40 created once the device supports a triggered buffer. We can associate a 41 - trigger with our device by writing the trigger's name in the 41 + trigger with our device by writing the trigger's name in the 42 42 :file:`current_trigger` file. 43 43 44 44 IIO trigger setup
+1 -1
Documentation/fault-injection/fault-injection.txt
··· 195 195 196 196 o define the fault attributes 197 197 198 - DECLARE_FAULT_INJECTION(name); 198 + DECLARE_FAULT_ATTR(name); 199 199 200 200 Please see the definition of struct fault_attr in fault-inject.h 201 201 for details.
+150
Documentation/filesystems/api-summary.rst
··· 1 + ============================= 2 + Linux Filesystems API summary 3 + ============================= 4 + 5 + This section contains API-level documentation, mostly taken from the source 6 + code itself. 7 + 8 + The Linux VFS 9 + ============= 10 + 11 + The Filesystem types 12 + -------------------- 13 + 14 + .. kernel-doc:: include/linux/fs.h 15 + :internal: 16 + 17 + The Directory Cache 18 + ------------------- 19 + 20 + .. kernel-doc:: fs/dcache.c 21 + :export: 22 + 23 + .. kernel-doc:: include/linux/dcache.h 24 + :internal: 25 + 26 + Inode Handling 27 + -------------- 28 + 29 + .. kernel-doc:: fs/inode.c 30 + :export: 31 + 32 + .. kernel-doc:: fs/bad_inode.c 33 + :export: 34 + 35 + Registration and Superblocks 36 + ---------------------------- 37 + 38 + .. kernel-doc:: fs/super.c 39 + :export: 40 + 41 + File Locks 42 + ---------- 43 + 44 + .. kernel-doc:: fs/locks.c 45 + :export: 46 + 47 + .. kernel-doc:: fs/locks.c 48 + :internal: 49 + 50 + Other Functions 51 + --------------- 52 + 53 + .. kernel-doc:: fs/mpage.c 54 + :export: 55 + 56 + .. kernel-doc:: fs/namei.c 57 + :export: 58 + 59 + .. kernel-doc:: fs/buffer.c 60 + :export: 61 + 62 + .. kernel-doc:: block/bio.c 63 + :export: 64 + 65 + .. kernel-doc:: fs/seq_file.c 66 + :export: 67 + 68 + .. kernel-doc:: fs/filesystems.c 69 + :export: 70 + 71 + .. kernel-doc:: fs/fs-writeback.c 72 + :export: 73 + 74 + .. kernel-doc:: fs/block_dev.c 75 + :export: 76 + 77 + .. kernel-doc:: fs/anon_inodes.c 78 + :export: 79 + 80 + .. kernel-doc:: fs/attr.c 81 + :export: 82 + 83 + .. kernel-doc:: fs/d_path.c 84 + :export: 85 + 86 + .. kernel-doc:: fs/dax.c 87 + :export: 88 + 89 + .. kernel-doc:: fs/direct-io.c 90 + :export: 91 + 92 + .. kernel-doc:: fs/file_table.c 93 + :export: 94 + 95 + .. kernel-doc:: fs/libfs.c 96 + :export: 97 + 98 + .. kernel-doc:: fs/posix_acl.c 99 + :export: 100 + 101 + .. kernel-doc:: fs/stat.c 102 + :export: 103 + 104 + .. kernel-doc:: fs/sync.c 105 + :export: 106 + 107 + .. kernel-doc:: fs/xattr.c 108 + :export: 109 + 110 + The proc filesystem 111 + =================== 112 + 113 + sysctl interface 114 + ---------------- 115 + 116 + .. kernel-doc:: kernel/sysctl.c 117 + :export: 118 + 119 + proc filesystem interface 120 + ------------------------- 121 + 122 + .. kernel-doc:: fs/proc/base.c 123 + :internal: 124 + 125 + Events based on file descriptors 126 + ================================ 127 + 128 + .. kernel-doc:: fs/eventfd.c 129 + :export: 130 + 131 + The Filesystem for Exporting Kernel Objects 132 + =========================================== 133 + 134 + .. kernel-doc:: fs/sysfs/file.c 135 + :export: 136 + 137 + .. kernel-doc:: fs/sysfs/symlink.c 138 + :export: 139 + 140 + The debugfs filesystem 141 + ====================== 142 + 143 + debugfs interface 144 + ----------------- 145 + 146 + .. kernel-doc:: fs/debugfs/inode.c 147 + :export: 148 + 149 + .. kernel-doc:: fs/debugfs/file.c 150 + :export:
+68
Documentation/filesystems/binderfs.rst
··· 1 + .. SPDX-License-Identifier: GPL-2.0 2 + 3 + The Android binderfs Filesystem 4 + =============================== 5 + 6 + Android binderfs is a filesystem for the Android binder IPC mechanism. It 7 + allows to dynamically add and remove binder devices at runtime. Binder devices 8 + located in a new binderfs instance are independent of binder devices located in 9 + other binderfs instances. Mounting a new binderfs instance makes it possible 10 + to get a set of private binder devices. 11 + 12 + Mounting binderfs 13 + ----------------- 14 + 15 + Android binderfs can be mounted with:: 16 + 17 + mkdir /dev/binderfs 18 + mount -t binder binder /dev/binderfs 19 + 20 + at which point a new instance of binderfs will show up at ``/dev/binderfs``. 21 + In a fresh instance of binderfs no binder devices will be present. There will 22 + only be a ``binder-control`` device which serves as the request handler for 23 + binderfs. Mounting another binderfs instance at a different location will 24 + create a new and separate instance from all other binderfs mounts. This is 25 + identical to the behavior of e.g. ``devpts`` and ``tmpfs``. The Android 26 + binderfs filesystem can be mounted in user namespaces. 27 + 28 + Options 29 + ------- 30 + max 31 + binderfs instances can be mounted with a limit on the number of binder 32 + devices that can be allocated. The ``max=<count>`` mount option serves as 33 + a per-instance limit. If ``max=<count>`` is set then only ``<count>`` number 34 + of binder devices can be allocated in this binderfs instance. 35 + 36 + Allocating binder Devices 37 + ------------------------- 38 + 39 + .. _ioctl: http://man7.org/linux/man-pages/man2/ioctl.2.html 40 + 41 + To allocate a new binder device in a binderfs instance a request needs to be 42 + sent through the ``binder-control`` device node. A request is sent in the form 43 + of an `ioctl() <ioctl_>`_. 44 + 45 + What a program needs to do is to open the ``binder-control`` device node and 46 + send a ``BINDER_CTL_ADD`` request to the kernel. Users of binderfs need to 47 + tell the kernel which name the new binder device should get. By default a name 48 + can only contain up to ``BINDERFS_MAX_NAME`` chars including the terminating 49 + zero byte. 50 + 51 + Once the request is made via an `ioctl() <ioctl_>`_ passing a ``struct 52 + binder_device`` with the name to the kernel it will allocate a new binder 53 + device and return the major and minor number of the new device in the struct 54 + (This is necessary because binderfs allocates a major device number 55 + dynamically.). After the `ioctl() <ioctl_>`_ returns there will be a new 56 + binder device located under /dev/binderfs with the chosen name. 57 + 58 + Deleting binder Devices 59 + ----------------------- 60 + 61 + .. _unlink: http://man7.org/linux/man-pages/man2/unlink.2.html 62 + .. _rm: http://man7.org/linux/man-pages/man1/rm.1.html 63 + 64 + Binderfs binder devices can be deleted via `unlink() <unlink_>`_. This means 65 + that the `rm() <rm_>`_ tool can be used to delete them. Note that the 66 + ``binder-control`` device cannot be deleted since this would make the binderfs 67 + instance unuseable. The ``binder-control`` device will be deleted when the 68 + binderfs instance is unmounted and all references to it have been dropped.
+34 -373
Documentation/filesystems/index.rst
··· 1 - ===================== 2 - Linux Filesystems API 3 - ===================== 1 + =============================== 2 + Filesystems in the Linux kernel 3 + =============================== 4 4 5 - The Linux VFS 6 - ============= 5 + This under-development manual will, some glorious day, provide 6 + comprehensive information on how the Linux virtual filesystem (VFS) layer 7 + works, along with the filesystems that sit below it. For now, what we have 8 + can be found below. 7 9 8 - The Filesystem types 9 - -------------------- 10 - 11 - .. kernel-doc:: include/linux/fs.h 12 - :internal: 13 - 14 - The Directory Cache 15 - ------------------- 16 - 17 - .. kernel-doc:: fs/dcache.c 18 - :export: 19 - 20 - .. kernel-doc:: include/linux/dcache.h 21 - :internal: 22 - 23 - Inode Handling 24 - -------------- 25 - 26 - .. kernel-doc:: fs/inode.c 27 - :export: 28 - 29 - .. kernel-doc:: fs/bad_inode.c 30 - :export: 31 - 32 - Registration and Superblocks 33 - ---------------------------- 34 - 35 - .. kernel-doc:: fs/super.c 36 - :export: 37 - 38 - File Locks 39 - ---------- 40 - 41 - .. kernel-doc:: fs/locks.c 42 - :export: 43 - 44 - .. kernel-doc:: fs/locks.c 45 - :internal: 46 - 47 - Other Functions 48 - --------------- 49 - 50 - .. kernel-doc:: fs/mpage.c 51 - :export: 52 - 53 - .. kernel-doc:: fs/namei.c 54 - :export: 55 - 56 - .. kernel-doc:: fs/buffer.c 57 - :export: 58 - 59 - .. kernel-doc:: block/bio.c 60 - :export: 61 - 62 - .. kernel-doc:: fs/seq_file.c 63 - :export: 64 - 65 - .. kernel-doc:: fs/filesystems.c 66 - :export: 67 - 68 - .. kernel-doc:: fs/fs-writeback.c 69 - :export: 70 - 71 - .. kernel-doc:: fs/block_dev.c 72 - :export: 73 - 74 - .. kernel-doc:: fs/anon_inodes.c 75 - :export: 76 - 77 - .. kernel-doc:: fs/attr.c 78 - :export: 79 - 80 - .. kernel-doc:: fs/d_path.c 81 - :export: 82 - 83 - .. kernel-doc:: fs/dax.c 84 - :export: 85 - 86 - .. kernel-doc:: fs/direct-io.c 87 - :export: 88 - 89 - .. kernel-doc:: fs/file_table.c 90 - :export: 91 - 92 - .. kernel-doc:: fs/libfs.c 93 - :export: 94 - 95 - .. kernel-doc:: fs/posix_acl.c 96 - :export: 97 - 98 - .. kernel-doc:: fs/stat.c 99 - :export: 100 - 101 - .. kernel-doc:: fs/sync.c 102 - :export: 103 - 104 - .. kernel-doc:: fs/xattr.c 105 - :export: 106 - 107 - The proc filesystem 108 - =================== 109 - 110 - sysctl interface 111 - ---------------- 112 - 113 - .. kernel-doc:: kernel/sysctl.c 114 - :export: 115 - 116 - proc filesystem interface 117 - ------------------------- 118 - 119 - .. kernel-doc:: fs/proc/base.c 120 - :internal: 121 - 122 - Events based on file descriptors 123 - ================================ 124 - 125 - .. kernel-doc:: fs/eventfd.c 126 - :export: 127 - 128 - The Filesystem for Exporting Kernel Objects 129 - =========================================== 130 - 131 - .. kernel-doc:: fs/sysfs/file.c 132 - :export: 133 - 134 - .. kernel-doc:: fs/sysfs/symlink.c 135 - :export: 136 - 137 - The debugfs filesystem 10 + Core VFS documentation 138 11 ====================== 139 12 140 - debugfs interface 141 - ----------------- 142 - 143 - .. kernel-doc:: fs/debugfs/inode.c 144 - :export: 145 - 146 - .. kernel-doc:: fs/debugfs/file.c 147 - :export: 148 - 149 - The Linux Journalling API 150 - ========================= 151 - 152 - Overview 153 - -------- 154 - 155 - Details 156 - ~~~~~~~ 157 - 158 - The journalling layer is easy to use. You need to first of all create a 159 - journal_t data structure. There are two calls to do this dependent on 160 - how you decide to allocate the physical media on which the journal 161 - resides. The :c:func:`jbd2_journal_init_inode` call is for journals stored in 162 - filesystem inodes, or the :c:func:`jbd2_journal_init_dev` call can be used 163 - for journal stored on a raw device (in a continuous range of blocks). A 164 - journal_t is a typedef for a struct pointer, so when you are finally 165 - finished make sure you call :c:func:`jbd2_journal_destroy` on it to free up 166 - any used kernel memory. 167 - 168 - Once you have got your journal_t object you need to 'mount' or load the 169 - journal file. The journalling layer expects the space for the journal 170 - was already allocated and initialized properly by the userspace tools. 171 - When loading the journal you must call :c:func:`jbd2_journal_load` to process 172 - journal contents. If the client file system detects the journal contents 173 - does not need to be processed (or even need not have valid contents), it 174 - may call :c:func:`jbd2_journal_wipe` to clear the journal contents before 175 - calling :c:func:`jbd2_journal_load`. 176 - 177 - Note that jbd2_journal_wipe(..,0) calls 178 - :c:func:`jbd2_journal_skip_recovery` for you if it detects any outstanding 179 - transactions in the journal and similarly :c:func:`jbd2_journal_load` will 180 - call :c:func:`jbd2_journal_recover` if necessary. I would advise reading 181 - :c:func:`ext4_load_journal` in fs/ext4/super.c for examples on this stage. 182 - 183 - Now you can go ahead and start modifying the underlying filesystem. 184 - Almost. 185 - 186 - You still need to actually journal your filesystem changes, this is done 187 - by wrapping them into transactions. Additionally you also need to wrap 188 - the modification of each of the buffers with calls to the journal layer, 189 - so it knows what the modifications you are actually making are. To do 190 - this use :c:func:`jbd2_journal_start` which returns a transaction handle. 191 - 192 - :c:func:`jbd2_journal_start` and its counterpart :c:func:`jbd2_journal_stop`, 193 - which indicates the end of a transaction are nestable calls, so you can 194 - reenter a transaction if necessary, but remember you must call 195 - :c:func:`jbd2_journal_stop` the same number of times as 196 - :c:func:`jbd2_journal_start` before the transaction is completed (or more 197 - accurately leaves the update phase). Ext4/VFS makes use of this feature to 198 - simplify handling of inode dirtying, quota support, etc. 199 - 200 - Inside each transaction you need to wrap the modifications to the 201 - individual buffers (blocks). Before you start to modify a buffer you 202 - need to call :c:func:`jbd2_journal_get_create_access()` / 203 - :c:func:`jbd2_journal_get_write_access()` / 204 - :c:func:`jbd2_journal_get_undo_access()` as appropriate, this allows the 205 - journalling layer to copy the unmodified 206 - data if it needs to. After all the buffer may be part of a previously 207 - uncommitted transaction. At this point you are at last ready to modify a 208 - buffer, and once you are have done so you need to call 209 - :c:func:`jbd2_journal_dirty_metadata`. Or if you've asked for access to a 210 - buffer you now know is now longer required to be pushed back on the 211 - device you can call :c:func:`jbd2_journal_forget` in much the same way as you 212 - might have used :c:func:`bforget` in the past. 213 - 214 - A :c:func:`jbd2_journal_flush` may be called at any time to commit and 215 - checkpoint all your transactions. 216 - 217 - Then at umount time , in your :c:func:`put_super` you can then call 218 - :c:func:`jbd2_journal_destroy` to clean up your in-core journal object. 219 - 220 - Unfortunately there a couple of ways the journal layer can cause a 221 - deadlock. The first thing to note is that each task can only have a 222 - single outstanding transaction at any one time, remember nothing commits 223 - until the outermost :c:func:`jbd2_journal_stop`. This means you must complete 224 - the transaction at the end of each file/inode/address etc. operation you 225 - perform, so that the journalling system isn't re-entered on another 226 - journal. Since transactions can't be nested/batched across differing 227 - journals, and another filesystem other than yours (say ext4) may be 228 - modified in a later syscall. 229 - 230 - The second case to bear in mind is that :c:func:`jbd2_journal_start` can block 231 - if there isn't enough space in the journal for your transaction (based 232 - on the passed nblocks param) - when it blocks it merely(!) needs to wait 233 - for transactions to complete and be committed from other tasks, so 234 - essentially we are waiting for :c:func:`jbd2_journal_stop`. So to avoid 235 - deadlocks you must treat :c:func:`jbd2_journal_start` / 236 - :c:func:`jbd2_journal_stop` as if they were semaphores and include them in 237 - your semaphore ordering rules to prevent 238 - deadlocks. Note that :c:func:`jbd2_journal_extend` has similar blocking 239 - behaviour to :c:func:`jbd2_journal_start` so you can deadlock here just as 240 - easily as on :c:func:`jbd2_journal_start`. 241 - 242 - Try to reserve the right number of blocks the first time. ;-). This will 243 - be the maximum number of blocks you are going to touch in this 244 - transaction. I advise having a look at at least ext4_jbd.h to see the 245 - basis on which ext4 uses to make these decisions. 246 - 247 - Another wriggle to watch out for is your on-disk block allocation 248 - strategy. Why? Because, if you do a delete, you need to ensure you 249 - haven't reused any of the freed blocks until the transaction freeing 250 - these blocks commits. If you reused these blocks and crash happens, 251 - there is no way to restore the contents of the reallocated blocks at the 252 - end of the last fully committed transaction. One simple way of doing 253 - this is to mark blocks as free in internal in-memory block allocation 254 - structures only after the transaction freeing them commits. Ext4 uses 255 - journal commit callback for this purpose. 256 - 257 - With journal commit callbacks you can ask the journalling layer to call 258 - a callback function when the transaction is finally committed to disk, 259 - so that you can do some of your own management. You ask the journalling 260 - layer for calling the callback by simply setting 261 - ``journal->j_commit_callback`` function pointer and that function is 262 - called after each transaction commit. You can also use 263 - ``transaction->t_private_list`` for attaching entries to a transaction 264 - that need processing when the transaction commits. 265 - 266 - JBD2 also provides a way to block all transaction updates via 267 - :c:func:`jbd2_journal_lock_updates()` / 268 - :c:func:`jbd2_journal_unlock_updates()`. Ext4 uses this when it wants a 269 - window with a clean and stable fs for a moment. E.g. 270 - 271 - :: 272 - 273 - 274 - jbd2_journal_lock_updates() //stop new stuff happening.. 275 - jbd2_journal_flush() // checkpoint everything. 276 - ..do stuff on stable fs 277 - jbd2_journal_unlock_updates() // carry on with filesystem use. 278 - 279 - The opportunities for abuse and DOS attacks with this should be obvious, 280 - if you allow unprivileged userspace to trigger codepaths containing 281 - these calls. 282 - 283 - Summary 284 - ~~~~~~~ 285 - 286 - Using the journal is a matter of wrapping the different context changes, 287 - being each mount, each modification (transaction) and each changed 288 - buffer to tell the journalling layer about them. 289 - 290 - Data Types 291 - ---------- 292 - 293 - The journalling layer uses typedefs to 'hide' the concrete definitions 294 - of the structures used. As a client of the JBD2 layer you can just rely 295 - on the using the pointer as a magic cookie of some sort. Obviously the 296 - hiding is not enforced as this is 'C'. 297 - 298 - Structures 299 - ~~~~~~~~~~ 300 - 301 - .. kernel-doc:: include/linux/jbd2.h 302 - :internal: 303 - 304 - Functions 305 - --------- 306 - 307 - The functions here are split into two groups those that affect a journal 308 - as a whole, and those which are used to manage transactions 309 - 310 - Journal Level 311 - ~~~~~~~~~~~~~ 312 - 313 - .. kernel-doc:: fs/jbd2/journal.c 314 - :export: 315 - 316 - .. kernel-doc:: fs/jbd2/recovery.c 317 - :internal: 318 - 319 - Transasction Level 320 - ~~~~~~~~~~~~~~~~~~ 321 - 322 - .. kernel-doc:: fs/jbd2/transaction.c 323 - 324 - See also 325 - -------- 326 - 327 - `Journaling the Linux ext2fs Filesystem, LinuxExpo 98, Stephen 328 - Tweedie <http://kernel.org/pub/linux/kernel/people/sct/ext3/journal-design.ps.gz>`__ 329 - 330 - `Ext3 Journalling FileSystem, OLS 2000, Dr. Stephen 331 - Tweedie <http://olstrans.sourceforge.net/release/OLS2000-ext3/OLS2000-ext3.html>`__ 332 - 333 - splice API 334 - ========== 335 - 336 - splice is a method for moving blocks of data around inside the kernel, 337 - without continually transferring them between the kernel and user space. 338 - 339 - .. kernel-doc:: fs/splice.c 340 - 341 - pipes API 342 - ========= 343 - 344 - Pipe interfaces are all for in-kernel (builtin image) use. They are not 345 - exported for use by modules. 346 - 347 - .. kernel-doc:: include/linux/pipe_fs_i.h 348 - :internal: 349 - 350 - .. kernel-doc:: fs/pipe.c 351 - 352 - Encryption API 353 - ============== 354 - 355 - A library which filesystems can hook into to support transparent 356 - encryption of files and directories. 357 - 358 - .. toctree:: 359 - :maxdepth: 2 360 - 361 - fscrypt 362 - 363 - Pathname lookup 364 - =============== 365 - 366 - 367 - This write-up is based on three articles published at lwn.net: 368 - 369 - - <https://lwn.net/Articles/649115/> Pathname lookup in Linux 370 - - <https://lwn.net/Articles/649729/> RCU-walk: faster pathname lookup in Linux 371 - - <https://lwn.net/Articles/650786/> A walk among the symlinks 372 - 373 - Written by Neil Brown with help from Al Viro and Jon Corbet. 374 - It has subsequently been updated to reflect changes in the kernel 375 - including: 376 - 377 - - per-directory parallel name lookup. 13 + See these manuals for documentation about the VFS layer itself and how its 14 + algorithms work. 378 15 379 16 .. toctree:: 380 17 :maxdepth: 2 381 18 382 19 path-lookup.rst 20 + api-summary 21 + splice 22 + 23 + Filesystem support layers 24 + ========================= 25 + 26 + Documentation for the support code within the filesystem layer for use in 27 + filesystem implementations. 28 + 29 + .. toctree:: 30 + :maxdepth: 2 31 + 32 + journalling 33 + fscrypt 34 + 35 + Filesystem-specific documentation 36 + ================================= 37 + 38 + Documentation for individual filesystem types can be found here. 39 + 40 + .. toctree:: 41 + :maxdepth: 2 42 + 43 + binderfs.rst
+184
Documentation/filesystems/journalling.rst
··· 1 + The Linux Journalling API 2 + ========================= 3 + 4 + Overview 5 + -------- 6 + 7 + Details 8 + ~~~~~~~ 9 + 10 + The journalling layer is easy to use. You need to first of all create a 11 + journal_t data structure. There are two calls to do this dependent on 12 + how you decide to allocate the physical media on which the journal 13 + resides. The :c:func:`jbd2_journal_init_inode` call is for journals stored in 14 + filesystem inodes, or the :c:func:`jbd2_journal_init_dev` call can be used 15 + for journal stored on a raw device (in a continuous range of blocks). A 16 + journal_t is a typedef for a struct pointer, so when you are finally 17 + finished make sure you call :c:func:`jbd2_journal_destroy` on it to free up 18 + any used kernel memory. 19 + 20 + Once you have got your journal_t object you need to 'mount' or load the 21 + journal file. The journalling layer expects the space for the journal 22 + was already allocated and initialized properly by the userspace tools. 23 + When loading the journal you must call :c:func:`jbd2_journal_load` to process 24 + journal contents. If the client file system detects the journal contents 25 + does not need to be processed (or even need not have valid contents), it 26 + may call :c:func:`jbd2_journal_wipe` to clear the journal contents before 27 + calling :c:func:`jbd2_journal_load`. 28 + 29 + Note that jbd2_journal_wipe(..,0) calls 30 + :c:func:`jbd2_journal_skip_recovery` for you if it detects any outstanding 31 + transactions in the journal and similarly :c:func:`jbd2_journal_load` will 32 + call :c:func:`jbd2_journal_recover` if necessary. I would advise reading 33 + :c:func:`ext4_load_journal` in fs/ext4/super.c for examples on this stage. 34 + 35 + Now you can go ahead and start modifying the underlying filesystem. 36 + Almost. 37 + 38 + You still need to actually journal your filesystem changes, this is done 39 + by wrapping them into transactions. Additionally you also need to wrap 40 + the modification of each of the buffers with calls to the journal layer, 41 + so it knows what the modifications you are actually making are. To do 42 + this use :c:func:`jbd2_journal_start` which returns a transaction handle. 43 + 44 + :c:func:`jbd2_journal_start` and its counterpart :c:func:`jbd2_journal_stop`, 45 + which indicates the end of a transaction are nestable calls, so you can 46 + reenter a transaction if necessary, but remember you must call 47 + :c:func:`jbd2_journal_stop` the same number of times as 48 + :c:func:`jbd2_journal_start` before the transaction is completed (or more 49 + accurately leaves the update phase). Ext4/VFS makes use of this feature to 50 + simplify handling of inode dirtying, quota support, etc. 51 + 52 + Inside each transaction you need to wrap the modifications to the 53 + individual buffers (blocks). Before you start to modify a buffer you 54 + need to call :c:func:`jbd2_journal_get_create_access()` / 55 + :c:func:`jbd2_journal_get_write_access()` / 56 + :c:func:`jbd2_journal_get_undo_access()` as appropriate, this allows the 57 + journalling layer to copy the unmodified 58 + data if it needs to. After all the buffer may be part of a previously 59 + uncommitted transaction. At this point you are at last ready to modify a 60 + buffer, and once you are have done so you need to call 61 + :c:func:`jbd2_journal_dirty_metadata`. Or if you've asked for access to a 62 + buffer you now know is now longer required to be pushed back on the 63 + device you can call :c:func:`jbd2_journal_forget` in much the same way as you 64 + might have used :c:func:`bforget` in the past. 65 + 66 + A :c:func:`jbd2_journal_flush` may be called at any time to commit and 67 + checkpoint all your transactions. 68 + 69 + Then at umount time , in your :c:func:`put_super` you can then call 70 + :c:func:`jbd2_journal_destroy` to clean up your in-core journal object. 71 + 72 + Unfortunately there a couple of ways the journal layer can cause a 73 + deadlock. The first thing to note is that each task can only have a 74 + single outstanding transaction at any one time, remember nothing commits 75 + until the outermost :c:func:`jbd2_journal_stop`. This means you must complete 76 + the transaction at the end of each file/inode/address etc. operation you 77 + perform, so that the journalling system isn't re-entered on another 78 + journal. Since transactions can't be nested/batched across differing 79 + journals, and another filesystem other than yours (say ext4) may be 80 + modified in a later syscall. 81 + 82 + The second case to bear in mind is that :c:func:`jbd2_journal_start` can block 83 + if there isn't enough space in the journal for your transaction (based 84 + on the passed nblocks param) - when it blocks it merely(!) needs to wait 85 + for transactions to complete and be committed from other tasks, so 86 + essentially we are waiting for :c:func:`jbd2_journal_stop`. So to avoid 87 + deadlocks you must treat :c:func:`jbd2_journal_start` / 88 + :c:func:`jbd2_journal_stop` as if they were semaphores and include them in 89 + your semaphore ordering rules to prevent 90 + deadlocks. Note that :c:func:`jbd2_journal_extend` has similar blocking 91 + behaviour to :c:func:`jbd2_journal_start` so you can deadlock here just as 92 + easily as on :c:func:`jbd2_journal_start`. 93 + 94 + Try to reserve the right number of blocks the first time. ;-). This will 95 + be the maximum number of blocks you are going to touch in this 96 + transaction. I advise having a look at at least ext4_jbd.h to see the 97 + basis on which ext4 uses to make these decisions. 98 + 99 + Another wriggle to watch out for is your on-disk block allocation 100 + strategy. Why? Because, if you do a delete, you need to ensure you 101 + haven't reused any of the freed blocks until the transaction freeing 102 + these blocks commits. If you reused these blocks and crash happens, 103 + there is no way to restore the contents of the reallocated blocks at the 104 + end of the last fully committed transaction. One simple way of doing 105 + this is to mark blocks as free in internal in-memory block allocation 106 + structures only after the transaction freeing them commits. Ext4 uses 107 + journal commit callback for this purpose. 108 + 109 + With journal commit callbacks you can ask the journalling layer to call 110 + a callback function when the transaction is finally committed to disk, 111 + so that you can do some of your own management. You ask the journalling 112 + layer for calling the callback by simply setting 113 + ``journal->j_commit_callback`` function pointer and that function is 114 + called after each transaction commit. You can also use 115 + ``transaction->t_private_list`` for attaching entries to a transaction 116 + that need processing when the transaction commits. 117 + 118 + JBD2 also provides a way to block all transaction updates via 119 + :c:func:`jbd2_journal_lock_updates()` / 120 + :c:func:`jbd2_journal_unlock_updates()`. Ext4 uses this when it wants a 121 + window with a clean and stable fs for a moment. E.g. 122 + 123 + :: 124 + 125 + 126 + jbd2_journal_lock_updates() //stop new stuff happening.. 127 + jbd2_journal_flush() // checkpoint everything. 128 + ..do stuff on stable fs 129 + jbd2_journal_unlock_updates() // carry on with filesystem use. 130 + 131 + The opportunities for abuse and DOS attacks with this should be obvious, 132 + if you allow unprivileged userspace to trigger codepaths containing 133 + these calls. 134 + 135 + Summary 136 + ~~~~~~~ 137 + 138 + Using the journal is a matter of wrapping the different context changes, 139 + being each mount, each modification (transaction) and each changed 140 + buffer to tell the journalling layer about them. 141 + 142 + Data Types 143 + ---------- 144 + 145 + The journalling layer uses typedefs to 'hide' the concrete definitions 146 + of the structures used. As a client of the JBD2 layer you can just rely 147 + on the using the pointer as a magic cookie of some sort. Obviously the 148 + hiding is not enforced as this is 'C'. 149 + 150 + Structures 151 + ~~~~~~~~~~ 152 + 153 + .. kernel-doc:: include/linux/jbd2.h 154 + :internal: 155 + 156 + Functions 157 + --------- 158 + 159 + The functions here are split into two groups those that affect a journal 160 + as a whole, and those which are used to manage transactions 161 + 162 + Journal Level 163 + ~~~~~~~~~~~~~ 164 + 165 + .. kernel-doc:: fs/jbd2/journal.c 166 + :export: 167 + 168 + .. kernel-doc:: fs/jbd2/recovery.c 169 + :internal: 170 + 171 + Transasction Level 172 + ~~~~~~~~~~~~~~~~~~ 173 + 174 + .. kernel-doc:: fs/jbd2/transaction.c 175 + 176 + See also 177 + -------- 178 + 179 + `Journaling the Linux ext2fs Filesystem, LinuxExpo 98, Stephen 180 + Tweedie <http://kernel.org/pub/linux/kernel/people/sct/ext3/journal-design.ps.gz>`__ 181 + 182 + `Ext3 Journalling FileSystem, OLS 2000, Dr. Stephen 183 + Tweedie <http://olstrans.sourceforge.net/release/OLS2000-ext3/OLS2000-ext3.html>`__ 184 +
+27 -12
Documentation/filesystems/path-lookup.rst
··· 1 + =============== 2 + Pathname lookup 3 + =============== 4 + 5 + This write-up is based on three articles published at lwn.net: 6 + 7 + - <https://lwn.net/Articles/649115/> Pathname lookup in Linux 8 + - <https://lwn.net/Articles/649729/> RCU-walk: faster pathname lookup in Linux 9 + - <https://lwn.net/Articles/650786/> A walk among the symlinks 10 + 11 + Written by Neil Brown with help from Al Viro and Jon Corbet. 12 + It has subsequently been updated to reflect changes in the kernel 13 + including: 14 + 15 + - per-directory parallel name lookup. 1 16 2 17 Introduction to pathname lookup 3 18 =============================== ··· 359 344 table, and the mount point hash table. 360 345 361 346 Bringing it together with ``struct nameidata`` 362 - -------------------------------------------- 347 + ---------------------------------------------- 363 348 364 349 .. _First edition Unix: http://minnie.tuhs.org/cgi-bin/utree.pl?file=V1/u2.s 365 350 ··· 370 355 other fields): 371 356 372 357 ``struct path path`` 373 - ~~~~~~~~~~~~~~~~~~ 358 + ~~~~~~~~~~~~~~~~~~~~ 374 359 375 360 A ``path`` contains a ``struct vfsmount`` (which is 376 361 embedded in a ``struct mount``) and a ``struct dentry``. Together these ··· 381 366 held. 382 367 383 368 ``struct qstr last`` 384 - ~~~~~~~~~~~~~~~~~~ 369 + ~~~~~~~~~~~~~~~~~~~~ 385 370 386 371 This is a string together with a length (i.e. _not_ ``nul`` terminated) 387 372 that is the "next" component in the pathname. 388 373 389 374 ``int last_type`` 390 - ~~~~~~~~~~~~~~~ 375 + ~~~~~~~~~~~~~~~~~ 391 376 392 377 This is one of ``LAST_NORM``, ``LAST_ROOT``, ``LAST_DOT``, ``LAST_DOTDOT``, or 393 378 ``LAST_BIND``. The ``last`` field is only valid if the type is ··· 396 381 fairly self-explanatory. 397 382 398 383 ``struct path root`` 399 - ~~~~~~~~~~~~~~~~~~ 384 + ~~~~~~~~~~~~~~~~~~~~ 400 385 401 386 This is used to hold a reference to the effective root of the 402 387 filesystem. Often that reference won't be needed, so this field is ··· 525 510 to three different flags that might be set in ``dentry->d_flags``: 526 511 527 512 ``DCACHE_MANAGE_TRANSIT`` 528 - ~~~~~~~~~~~~~~~~~~~~~~~ 513 + ~~~~~~~~~~~~~~~~~~~~~~~~~ 529 514 530 515 If this flag has been set, then the filesystem has requested that the 531 516 ``d_manage()`` dentry operation be called before handling any possible ··· 544 529 ``d_manage()`` by returning ``-EISDIR``. 545 530 546 531 ``DCACHE_MOUNTED`` 547 - ~~~~~~~~~~~~~~~~ 532 + ~~~~~~~~~~~~~~~~~~ 548 533 549 534 This flag is set on every dentry that is mounted on. As Linux 550 535 supports multiple filesystem namespaces, it is possible that the ··· 557 542 and a new ``dentry`` (both with counted references). 558 543 559 544 ``DCACHE_NEED_AUTOMOUNT`` 560 - ~~~~~~~~~~~~~~~~~~~~~~~ 545 + ~~~~~~~~~~~~~~~~~~~~~~~~~ 561 546 562 547 If ``d_manage()`` allowed us to get this far, and ``lookup_mnt()`` didn't 563 548 find a mount point, then this flag causes the ``d_automount()`` dentry ··· 713 698 the bigger picture of how RCU-walk uses seqlocks. 714 699 715 700 ``mount_lock`` and ``nd->m_seq`` 716 - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 701 + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 717 702 718 703 We already met the ``mount_lock`` seqlock when REF-walk used it to 719 704 ensure that crossing a mount point is performed safely. RCU-walk uses ··· 742 727 at least for vfsmount structures. 743 728 744 729 ``dentry->d_seq`` and ``nd->seq`` 745 - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 730 + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 746 731 747 732 In place of taking a count or lock on ``d_reflock``, RCU-walk samples 748 733 the per-dentry ``d_seq`` seqlock, and stores the sequence number in the ··· 789 774 the old dentry which we saw in REF-walk. 790 775 791 776 No ``inode->i_rwsem`` or even ``rename_lock`` 792 - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 777 + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 793 778 794 779 A semaphore is a fairly heavyweight lock that can only be taken when it is 795 780 permissible to sleep. As ``rcu_read_lock()`` forbids sleeping, ··· 811 796 rename_lock would bring no significant value. 812 797 813 798 ``unlazy walk()`` and ``complete_walk()`` 814 - ------------------------------------- 799 + ----------------------------------------- 815 800 816 801 That "dropping down to REF-walk" typically involves a call to 817 802 ``unlazy_walk()``, so named because "RCU-walk" is also sometimes
+22
Documentation/filesystems/splice.rst
··· 1 + ================ 2 + splice and pipes 3 + ================ 4 + 5 + splice API 6 + ========== 7 + 8 + splice is a method for moving blocks of data around inside the kernel, 9 + without continually transferring them between the kernel and user space. 10 + 11 + .. kernel-doc:: fs/splice.c 12 + 13 + pipes API 14 + ========= 15 + 16 + Pipe interfaces are all for in-kernel (builtin image) use. They are not 17 + exported for use by modules. 18 + 19 + .. kernel-doc:: include/linux/pipe_fs_i.h 20 + :internal: 21 + 22 + .. kernel-doc:: fs/pipe.c
+21
Documentation/filesystems/sysfs.txt
··· 116 116 .store = store_foo, 117 117 }; 118 118 119 + Note as stated in include/linux/kernel.h "OTHER_WRITABLE? Generally 120 + considered a bad idea." so trying to set a sysfs file writable for 121 + everyone will fail reverting to RO mode for "Others". 122 + 123 + For the common cases sysfs.h provides convenience macros to make 124 + defining attributes easier as well as making code more concise and 125 + readable. The above case could be shortened to: 126 + 127 + static struct device_attribute dev_attr_foo = __ATTR_RW(foo); 128 + 129 + the list of helpers available to define your wrapper function is: 130 + __ATTR_RO(name): assumes default name_show and mode 0444 131 + __ATTR_WO(name): assumes a name_store only and is restricted to mode 132 + 0200 that is root write access only. 133 + __ATTR_RO_MODE(name, mode): fore more restrictive RO access currently 134 + only use case is the EFI System Resource Table 135 + (see drivers/firmware/efi/esrt.c) 136 + __ATTR_RW(name): assumes default name_show, name_store and setting 137 + mode to 0644. 138 + __ATTR_NULL: which sets the name to NULL and is used as end of list 139 + indicator (see: kernel/workqueue.c) 119 140 120 141 Subsystem-Specific Callbacks 121 142 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+1 -1
Documentation/hwmon/f71882fg
··· 94 94 to the border between the highest and one but highest temperature zones, and 95 95 vica versa. So the temperature zone trip points 1-4 (or 1-2) go from high temp 96 96 to low temp! This is how things are implemented in the IC, and the driver 97 - mimicks this. 97 + mimics this. 98 98 99 99 There are 2 modes to specify the speed of the fan, PWM duty cycle (or DC 100 100 voltage) mode, where 0-100% duty cycle (0-100% of 12V) is specified. And RPM
+1
Documentation/index.rst
··· 90 90 filesystems/index 91 91 vm/index 92 92 bpf/index 93 + misc-devices/index 93 94 94 95 Architecture-specific documentation 95 96 -----------------------------------
+1 -1
Documentation/input/devices/xpad.rst
··· 218 218 .. [1] http://euc.jp/periphs/xbox-controller.ja.html (ITO Takayuki) 219 219 .. [2] http://xpad.xbox-scene.com/ 220 220 .. [3] http://www.markosweb.com/www/xboxhackz.com/ 221 - .. [4] http://lxr.free-electrons.com/ident?i=xpad_device 221 + .. [4] https://elixir.bootlin.com/linux/latest/ident/xpad_device 222 222 223 223 224 224 Historic Edits
+3 -1
Documentation/laptops/lg-laptop.rst
··· 1 1 .. SPDX-License-Identifier: GPL-2.0+ 2 + 2 3 LG Gram laptop extra features 3 4 ============================= 4 5 ··· 10 9 ------- 11 10 12 11 The following FN keys are ignored by the kernel without this driver: 12 + 13 13 - FN-F1 (LG control panel) - Generates F15 14 14 - FN-F5 (Touchpad toggle) - Generates F13 15 15 - FN-F6 (Airplane mode) - Generates RFKILL ··· 18 16 This key also changes keyboard backlight mode. 19 17 - FN-F9 (Reader mode) - Generates F14 20 18 21 - The rest of the FN key work without a need for a special driver. 19 + The rest of the FN keys work without a need for a special driver. 22 20 23 21 24 22 Reader mode
+2 -2
Documentation/locking/lockdep-design.txt
··· 45 45 locking error messages, inside curlies. A contrived example: 46 46 47 47 modprobe/2287 is trying to acquire lock: 48 - (&sio_locks[i].lock){-.-...}, at: [<c02867fd>] mutex_lock+0x21/0x24 48 + (&sio_locks[i].lock){-.-.}, at: [<c02867fd>] mutex_lock+0x21/0x24 49 49 50 50 but task is already holding lock: 51 - (&sio_locks[i].lock){-.-...}, at: [<c02867fd>] mutex_lock+0x21/0x24 51 + (&sio_locks[i].lock){-.-.}, at: [<c02867fd>] mutex_lock+0x21/0x24 52 52 53 53 54 54 The bit position indicates STATE, STATE-read, for each of the states listed
+1
Documentation/misc-devices/ibmvmc.rst
··· 1 1 .. SPDX-License-Identifier: GPL-2.0+ 2 + 2 3 ====================================================== 3 4 IBM Virtual Management Channel Kernel Driver (IBMVMC) 4 5 ======================================================
+17
Documentation/misc-devices/index.rst
··· 1 + .. SPDX-License-Identifier: GPL-2.0 2 + 3 + ============================================ 4 + Assorted Miscellaneous Devices Documentation 5 + ============================================ 6 + 7 + This documentation contains information for assorted devices that do not 8 + fit into other categories. 9 + 10 + .. class:: toc-title 11 + 12 + Table of contents 13 + 14 + .. toctree:: 15 + :maxdepth: 2 16 + 17 + ibmvmc
+143
Documentation/networking/checksum-offloads.rst
··· 1 + .. SPDX-License-Identifier: GPL-2.0 2 + 3 + ================= 4 + Checksum Offloads 5 + ================= 6 + 7 + 8 + Introduction 9 + ============ 10 + 11 + This document describes a set of techniques in the Linux networking stack to 12 + take advantage of checksum offload capabilities of various NICs. 13 + 14 + The following technologies are described: 15 + 16 + * TX Checksum Offload 17 + * LCO: Local Checksum Offload 18 + * RCO: Remote Checksum Offload 19 + 20 + Things that should be documented here but aren't yet: 21 + 22 + * RX Checksum Offload 23 + * CHECKSUM_UNNECESSARY conversion 24 + 25 + 26 + TX Checksum Offload 27 + =================== 28 + 29 + The interface for offloading a transmit checksum to a device is explained in 30 + detail in comments near the top of include/linux/skbuff.h. 31 + 32 + In brief, it allows to request the device fill in a single ones-complement 33 + checksum defined by the sk_buff fields skb->csum_start and skb->csum_offset. 34 + The device should compute the 16-bit ones-complement checksum (i.e. the 35 + 'IP-style' checksum) from csum_start to the end of the packet, and fill in the 36 + result at (csum_start + csum_offset). 37 + 38 + Because csum_offset cannot be negative, this ensures that the previous value of 39 + the checksum field is included in the checksum computation, thus it can be used 40 + to supply any needed corrections to the checksum (such as the sum of the 41 + pseudo-header for UDP or TCP). 42 + 43 + This interface only allows a single checksum to be offloaded. Where 44 + encapsulation is used, the packet may have multiple checksum fields in 45 + different header layers, and the rest will have to be handled by another 46 + mechanism such as LCO or RCO. 47 + 48 + CRC32c can also be offloaded using this interface, by means of filling 49 + skb->csum_start and skb->csum_offset as described above, and setting 50 + skb->csum_not_inet: see skbuff.h comment (section 'D') for more details. 51 + 52 + No offloading of the IP header checksum is performed; it is always done in 53 + software. This is OK because when we build the IP header, we obviously have it 54 + in cache, so summing it isn't expensive. It's also rather short. 55 + 56 + The requirements for GSO are more complicated, because when segmenting an 57 + encapsulated packet both the inner and outer checksums may need to be edited or 58 + recomputed for each resulting segment. See the skbuff.h comment (section 'E') 59 + for more details. 60 + 61 + A driver declares its offload capabilities in netdev->hw_features; see 62 + Documentation/networking/netdev-features.txt for more. Note that a device 63 + which only advertises NETIF_F_IP[V6]_CSUM must still obey the csum_start and 64 + csum_offset given in the SKB; if it tries to deduce these itself in hardware 65 + (as some NICs do) the driver should check that the values in the SKB match 66 + those which the hardware will deduce, and if not, fall back to checksumming in 67 + software instead (with skb_csum_hwoffload_help() or one of the 68 + skb_checksum_help() / skb_crc32c_csum_help functions, as mentioned in 69 + include/linux/skbuff.h). 70 + 71 + The stack should, for the most part, assume that checksum offload is supported 72 + by the underlying device. The only place that should check is 73 + validate_xmit_skb(), and the functions it calls directly or indirectly. That 74 + function compares the offload features requested by the SKB (which may include 75 + other offloads besides TX Checksum Offload) and, if they are not supported or 76 + enabled on the device (determined by netdev->features), performs the 77 + corresponding offload in software. In the case of TX Checksum Offload, that 78 + means calling skb_csum_hwoffload_help(skb, features). 79 + 80 + 81 + LCO: Local Checksum Offload 82 + =========================== 83 + 84 + LCO is a technique for efficiently computing the outer checksum of an 85 + encapsulated datagram when the inner checksum is due to be offloaded. 86 + 87 + The ones-complement sum of a correctly checksummed TCP or UDP packet is equal 88 + to the complement of the sum of the pseudo header, because everything else gets 89 + 'cancelled out' by the checksum field. This is because the sum was 90 + complemented before being written to the checksum field. 91 + 92 + More generally, this holds in any case where the 'IP-style' ones complement 93 + checksum is used, and thus any checksum that TX Checksum Offload supports. 94 + 95 + That is, if we have set up TX Checksum Offload with a start/offset pair, we 96 + know that after the device has filled in that checksum, the ones complement sum 97 + from csum_start to the end of the packet will be equal to the complement of 98 + whatever value we put in the checksum field beforehand. This allows us to 99 + compute the outer checksum without looking at the payload: we simply stop 100 + summing when we get to csum_start, then add the complement of the 16-bit word 101 + at (csum_start + csum_offset). 102 + 103 + Then, when the true inner checksum is filled in (either by hardware or by 104 + skb_checksum_help()), the outer checksum will become correct by virtue of the 105 + arithmetic. 106 + 107 + LCO is performed by the stack when constructing an outer UDP header for an 108 + encapsulation such as VXLAN or GENEVE, in udp_set_csum(). Similarly for the 109 + IPv6 equivalents, in udp6_set_csum(). 110 + 111 + It is also performed when constructing an IPv4 GRE header, in 112 + net/ipv4/ip_gre.c:build_header(). It is *not* currently performed when 113 + constructing an IPv6 GRE header; the GRE checksum is computed over the whole 114 + packet in net/ipv6/ip6_gre.c:ip6gre_xmit2(), but it should be possible to use 115 + LCO here as IPv6 GRE still uses an IP-style checksum. 116 + 117 + All of the LCO implementations use a helper function lco_csum(), in 118 + include/linux/skbuff.h. 119 + 120 + LCO can safely be used for nested encapsulations; in this case, the outer 121 + encapsulation layer will sum over both its own header and the 'middle' header. 122 + This does mean that the 'middle' header will get summed multiple times, but 123 + there doesn't seem to be a way to avoid that without incurring bigger costs 124 + (e.g. in SKB bloat). 125 + 126 + 127 + RCO: Remote Checksum Offload 128 + ============================ 129 + 130 + RCO is a technique for eliding the inner checksum of an encapsulated datagram, 131 + allowing the outer checksum to be offloaded. It does, however, involve a 132 + change to the encapsulation protocols, which the receiver must also support. 133 + For this reason, it is disabled by default. 134 + 135 + RCO is detailed in the following Internet-Drafts: 136 + 137 + * https://tools.ietf.org/html/draft-herbert-remotecsumoffload-00 138 + * https://tools.ietf.org/html/draft-herbert-vxlan-rco-00 139 + 140 + In Linux, RCO is implemented individually in each encapsulation protocol, and 141 + most tunnel types have flags controlling its use. For instance, VXLAN has the 142 + flag VXLAN_F_REMCSUM_TX (per struct vxlan_rdst) to indicate that RCO should be 143 + used when transmitting to a given remote destination.
-122
Documentation/networking/checksum-offloads.txt
··· 1 - Checksum Offloads in the Linux Networking Stack 2 - 3 - 4 - Introduction 5 - ============ 6 - 7 - This document describes a set of techniques in the Linux networking stack 8 - to take advantage of checksum offload capabilities of various NICs. 9 - 10 - The following technologies are described: 11 - * TX Checksum Offload 12 - * LCO: Local Checksum Offload 13 - * RCO: Remote Checksum Offload 14 - 15 - Things that should be documented here but aren't yet: 16 - * RX Checksum Offload 17 - * CHECKSUM_UNNECESSARY conversion 18 - 19 - 20 - TX Checksum Offload 21 - =================== 22 - 23 - The interface for offloading a transmit checksum to a device is explained 24 - in detail in comments near the top of include/linux/skbuff.h. 25 - In brief, it allows to request the device fill in a single ones-complement 26 - checksum defined by the sk_buff fields skb->csum_start and 27 - skb->csum_offset. The device should compute the 16-bit ones-complement 28 - checksum (i.e. the 'IP-style' checksum) from csum_start to the end of the 29 - packet, and fill in the result at (csum_start + csum_offset). 30 - Because csum_offset cannot be negative, this ensures that the previous 31 - value of the checksum field is included in the checksum computation, thus 32 - it can be used to supply any needed corrections to the checksum (such as 33 - the sum of the pseudo-header for UDP or TCP). 34 - This interface only allows a single checksum to be offloaded. Where 35 - encapsulation is used, the packet may have multiple checksum fields in 36 - different header layers, and the rest will have to be handled by another 37 - mechanism such as LCO or RCO. 38 - CRC32c can also be offloaded using this interface, by means of filling 39 - skb->csum_start and skb->csum_offset as described above, and setting 40 - skb->csum_not_inet: see skbuff.h comment (section 'D') for more details. 41 - No offloading of the IP header checksum is performed; it is always done in 42 - software. This is OK because when we build the IP header, we obviously 43 - have it in cache, so summing it isn't expensive. It's also rather short. 44 - The requirements for GSO are more complicated, because when segmenting an 45 - encapsulated packet both the inner and outer checksums may need to be 46 - edited or recomputed for each resulting segment. See the skbuff.h comment 47 - (section 'E') for more details. 48 - 49 - A driver declares its offload capabilities in netdev->hw_features; see 50 - Documentation/networking/netdev-features.txt for more. Note that a device 51 - which only advertises NETIF_F_IP[V6]_CSUM must still obey the csum_start 52 - and csum_offset given in the SKB; if it tries to deduce these itself in 53 - hardware (as some NICs do) the driver should check that the values in the 54 - SKB match those which the hardware will deduce, and if not, fall back to 55 - checksumming in software instead (with skb_csum_hwoffload_help() or one of 56 - the skb_checksum_help() / skb_crc32c_csum_help functions, as mentioned in 57 - include/linux/skbuff.h). 58 - 59 - The stack should, for the most part, assume that checksum offload is 60 - supported by the underlying device. The only place that should check is 61 - validate_xmit_skb(), and the functions it calls directly or indirectly. 62 - That function compares the offload features requested by the SKB (which 63 - may include other offloads besides TX Checksum Offload) and, if they are 64 - not supported or enabled on the device (determined by netdev->features), 65 - performs the corresponding offload in software. In the case of TX 66 - Checksum Offload, that means calling skb_csum_hwoffload_help(skb, features). 67 - 68 - 69 - LCO: Local Checksum Offload 70 - =========================== 71 - 72 - LCO is a technique for efficiently computing the outer checksum of an 73 - encapsulated datagram when the inner checksum is due to be offloaded. 74 - The ones-complement sum of a correctly checksummed TCP or UDP packet is 75 - equal to the complement of the sum of the pseudo header, because everything 76 - else gets 'cancelled out' by the checksum field. This is because the sum was 77 - complemented before being written to the checksum field. 78 - More generally, this holds in any case where the 'IP-style' ones complement 79 - checksum is used, and thus any checksum that TX Checksum Offload supports. 80 - That is, if we have set up TX Checksum Offload with a start/offset pair, we 81 - know that after the device has filled in that checksum, the ones 82 - complement sum from csum_start to the end of the packet will be equal to 83 - the complement of whatever value we put in the checksum field beforehand. 84 - This allows us to compute the outer checksum without looking at the payload: 85 - we simply stop summing when we get to csum_start, then add the complement of 86 - the 16-bit word at (csum_start + csum_offset). 87 - Then, when the true inner checksum is filled in (either by hardware or by 88 - skb_checksum_help()), the outer checksum will become correct by virtue of 89 - the arithmetic. 90 - 91 - LCO is performed by the stack when constructing an outer UDP header for an 92 - encapsulation such as VXLAN or GENEVE, in udp_set_csum(). Similarly for 93 - the IPv6 equivalents, in udp6_set_csum(). 94 - It is also performed when constructing an IPv4 GRE header, in 95 - net/ipv4/ip_gre.c:build_header(). It is *not* currently performed when 96 - constructing an IPv6 GRE header; the GRE checksum is computed over the 97 - whole packet in net/ipv6/ip6_gre.c:ip6gre_xmit2(), but it should be 98 - possible to use LCO here as IPv6 GRE still uses an IP-style checksum. 99 - All of the LCO implementations use a helper function lco_csum(), in 100 - include/linux/skbuff.h. 101 - 102 - LCO can safely be used for nested encapsulations; in this case, the outer 103 - encapsulation layer will sum over both its own header and the 'middle' 104 - header. This does mean that the 'middle' header will get summed multiple 105 - times, but there doesn't seem to be a way to avoid that without incurring 106 - bigger costs (e.g. in SKB bloat). 107 - 108 - 109 - RCO: Remote Checksum Offload 110 - ============================ 111 - 112 - RCO is a technique for eliding the inner checksum of an encapsulated 113 - datagram, allowing the outer checksum to be offloaded. It does, however, 114 - involve a change to the encapsulation protocols, which the receiver must 115 - also support. For this reason, it is disabled by default. 116 - RCO is detailed in the following Internet-Drafts: 117 - https://tools.ietf.org/html/draft-herbert-remotecsumoffload-00 118 - https://tools.ietf.org/html/draft-herbert-vxlan-rco-00 119 - In Linux, RCO is implemented individually in each encapsulation protocol, 120 - and most tunnel types have flags controlling its use. For instance, VXLAN 121 - has the flag VXLAN_F_REMCSUM_TX (per struct vxlan_rdst) to indicate that 122 - RCO should be used when transmitting to a given remote destination.
+3
Documentation/networking/index.rst
··· 36 36 alias 37 37 bridge 38 38 snmp_counter 39 + checksum-offloads 40 + segmentation-offloads 41 + scaling 39 42 40 43 .. only:: subproject 41 44
+85 -46
Documentation/networking/scaling.txt Documentation/networking/scaling.rst
··· 1 + .. SPDX-License-Identifier: GPL-2.0 2 + 3 + ===================================== 1 4 Scaling in the Linux Networking Stack 5 + ===================================== 2 6 3 7 4 8 Introduction ··· 14 10 15 11 The following technologies are described: 16 12 17 - RSS: Receive Side Scaling 18 - RPS: Receive Packet Steering 19 - RFS: Receive Flow Steering 20 - Accelerated Receive Flow Steering 21 - XPS: Transmit Packet Steering 13 + - RSS: Receive Side Scaling 14 + - RPS: Receive Packet Steering 15 + - RFS: Receive Flow Steering 16 + - Accelerated Receive Flow Steering 17 + - XPS: Transmit Packet Steering 22 18 23 19 24 20 RSS: Receive Side Scaling ··· 49 45 can be directed to their own receive queue. Such “n-tuple” filters can 50 46 be configured from ethtool (--config-ntuple). 51 47 52 - ==== RSS Configuration 48 + 49 + RSS Configuration 50 + ----------------- 53 51 54 52 The driver for a multi-queue capable NIC typically provides a kernel 55 53 module parameter for specifying the number of hardware queues to ··· 69 63 indirection table could be done to give different queues different 70 64 relative weights. 71 65 72 - == RSS IRQ Configuration 66 + 67 + RSS IRQ Configuration 68 + ~~~~~~~~~~~~~~~~~~~~~ 73 69 74 70 Each receive queue has a separate IRQ associated with it. The NIC triggers 75 71 this to notify a CPU when new packets arrive on the given queue. The ··· 85 77 will be running irqbalance, a daemon that dynamically optimizes IRQ 86 78 assignments and as a result may override any manual settings. 87 79 88 - == Suggested Configuration 80 + 81 + Suggested Configuration 82 + ~~~~~~~~~~~~~~~~~~~~~~~ 89 83 90 84 RSS should be enabled when latency is a concern or whenever receive 91 85 interrupt processing forms a bottleneck. Spreading load between CPUs ··· 115 105 interrupt handler, RPS selects the CPU to perform protocol processing 116 106 above the interrupt handler. This is accomplished by placing the packet 117 107 on the desired CPU’s backlog queue and waking up the CPU for processing. 118 - RPS has some advantages over RSS: 1) it can be used with any NIC, 119 - 2) software filters can easily be added to hash over new protocols, 108 + RPS has some advantages over RSS: 109 + 110 + 1) it can be used with any NIC 111 + 2) software filters can easily be added to hash over new protocols 120 112 3) it does not increase hardware device interrupt rate (although it does 121 - introduce inter-processor interrupts (IPIs)). 113 + introduce inter-processor interrupts (IPIs)) 122 114 123 115 RPS is called during bottom half of the receive interrupt handler, when 124 116 a driver sends a packet up the network stack with netif_rx() or ··· 147 135 processing on the remote CPU, and any queued packets are then processed 148 136 up the networking stack. 149 137 150 - ==== RPS Configuration 138 + 139 + RPS Configuration 140 + ----------------- 151 141 152 142 RPS requires a kernel compiled with the CONFIG_RPS kconfig symbol (on 153 143 by default for SMP). Even when compiled in, RPS remains disabled until 154 144 explicitly configured. The list of CPUs to which RPS may forward traffic 155 - can be configured for each receive queue using a sysfs file entry: 145 + can be configured for each receive queue using a sysfs file entry:: 156 146 157 - /sys/class/net/<dev>/queues/rx-<n>/rps_cpus 147 + /sys/class/net/<dev>/queues/rx-<n>/rps_cpus 158 148 159 149 This file implements a bitmap of CPUs. RPS is disabled when it is zero 160 150 (the default), in which case packets are processed on the interrupting 161 151 CPU. Documentation/IRQ-affinity.txt explains how CPUs are assigned to 162 152 the bitmap. 163 153 164 - == Suggested Configuration 154 + 155 + Suggested Configuration 156 + ~~~~~~~~~~~~~~~~~~~~~~~ 165 157 166 158 For a single queue device, a typical RPS configuration would be to set 167 159 the rps_cpus to the CPUs in the same memory domain of the interrupting ··· 179 163 RPS might be beneficial if the rps_cpus for each queue are the ones that 180 164 share the same memory domain as the interrupting CPU for that queue. 181 165 182 - ==== RPS Flow Limit 166 + 167 + RPS Flow Limit 168 + -------------- 183 169 184 170 RPS scales kernel receive processing across CPUs without introducing 185 171 reordering. The trade-off to sending all packets from the same flow ··· 205 187 the threshold, so flow limit does not sever connections outright: 206 188 even large flows maintain connectivity. 207 189 208 - == Interface 190 + 191 + Interface 192 + ~~~~~~~~~ 209 193 210 194 Flow limit is compiled in by default (CONFIG_NET_FLOW_LIMIT), but not 211 195 turned on. It is implemented for each CPU independently (to avoid lock 212 196 and cache contention) and toggled per CPU by setting the relevant bit 213 197 in sysctl net.core.flow_limit_cpu_bitmap. It exposes the same CPU 214 - bitmap interface as rps_cpus (see above) when called from procfs: 198 + bitmap interface as rps_cpus (see above) when called from procfs:: 215 199 216 - /proc/sys/net/core/flow_limit_cpu_bitmap 200 + /proc/sys/net/core/flow_limit_cpu_bitmap 217 201 218 202 Per-flow rate is calculated by hashing each packet into a hashtable 219 203 bucket and incrementing a per-bucket counter. The hash function is 220 204 the same that selects a CPU in RPS, but as the number of buckets can 221 205 be much larger than the number of CPUs, flow limit has finer-grained 222 206 identification of large flows and fewer false positives. The default 223 - table has 4096 buckets. This value can be modified through sysctl 207 + table has 4096 buckets. This value can be modified through sysctl:: 224 208 225 - net.core.flow_limit_table_len 209 + net.core.flow_limit_table_len 226 210 227 211 The value is only consulted when a new table is allocated. Modifying 228 212 it does not update active tables. 229 213 230 - == Suggested Configuration 214 + 215 + Suggested Configuration 216 + ~~~~~~~~~~~~~~~~~~~~~~~ 231 217 232 218 Flow limit is useful on systems with many concurrent connections, 233 219 where a single connection taking up 50% of a CPU indicates a problem. ··· 302 280 the current CPU is updated to match the desired CPU if one of the 303 281 following is true: 304 282 305 - - The current CPU's queue head counter >= the recorded tail counter 306 - value in rps_dev_flow[i] 307 - - The current CPU is unset (>= nr_cpu_ids) 308 - - The current CPU is offline 283 + - The current CPU's queue head counter >= the recorded tail counter 284 + value in rps_dev_flow[i] 285 + - The current CPU is unset (>= nr_cpu_ids) 286 + - The current CPU is offline 309 287 310 288 After this check, the packet is sent to the (possibly updated) current 311 289 CPU. These rules aim to ensure that a flow only moves to a new CPU when ··· 313 291 packets could arrive later than those about to be processed on the new 314 292 CPU. 315 293 316 - ==== RFS Configuration 294 + 295 + RFS Configuration 296 + ----------------- 317 297 318 298 RFS is only available if the kconfig symbol CONFIG_RPS is enabled (on 319 299 by default for SMP). The functionality remains disabled until explicitly 320 - configured. The number of entries in the global flow table is set through: 300 + configured. The number of entries in the global flow table is set through:: 321 301 322 - /proc/sys/net/core/rps_sock_flow_entries 302 + /proc/sys/net/core/rps_sock_flow_entries 323 303 324 - The number of entries in the per-queue flow table are set through: 304 + The number of entries in the per-queue flow table are set through:: 325 305 326 - /sys/class/net/<dev>/queues/rx-<n>/rps_flow_cnt 306 + /sys/class/net/<dev>/queues/rx-<n>/rps_flow_cnt 327 307 328 - == Suggested Configuration 308 + 309 + Suggested Configuration 310 + ~~~~~~~~~~~~~~~~~~~~~~~ 329 311 330 312 Both of these need to be set before RFS is enabled for a receive queue. 331 313 Values for both are rounded up to the nearest power of two. The ··· 373 347 to populate the map. For each CPU, the corresponding queue in the map is 374 348 set to be one whose processing CPU is closest in cache locality. 375 349 376 - ==== Accelerated RFS Configuration 350 + 351 + Accelerated RFS Configuration 352 + ----------------------------- 377 353 378 354 Accelerated RFS is only available if the kernel is compiled with 379 355 CONFIG_RFS_ACCEL and support is provided by the NIC device and driver. ··· 384 356 configured for each receive queue by the driver, so no additional 385 357 configuration should be necessary. 386 358 387 - == Suggested Configuration 359 + 360 + Suggested Configuration 361 + ~~~~~~~~~~~~~~~~~~~~~~~ 388 362 389 363 This technique should be enabled whenever one wants to use RFS and the 390 364 NIC supports hardware acceleration. 365 + 391 366 392 367 XPS: Transmit Packet Steering 393 368 ============================= ··· 461 430 for instance, sets the flag when all data for a connection has been 462 431 acknowledged. 463 432 464 - ==== XPS Configuration 433 + XPS Configuration 434 + ----------------- 465 435 466 436 XPS is only available if the kconfig symbol CONFIG_XPS is enabled (on by 467 437 default for SMP). The functionality remains disabled until explicitly 468 438 configured. To enable XPS, the bitmap of CPUs/receive-queues that may 469 439 use a transmit queue is configured using the sysfs file entry: 470 440 471 - For selection based on CPUs map: 472 - /sys/class/net/<dev>/queues/tx-<n>/xps_cpus 441 + For selection based on CPUs map:: 473 442 474 - For selection based on receive-queues map: 475 - /sys/class/net/<dev>/queues/tx-<n>/xps_rxqs 443 + /sys/class/net/<dev>/queues/tx-<n>/xps_cpus 476 444 477 - == Suggested Configuration 445 + For selection based on receive-queues map:: 446 + 447 + /sys/class/net/<dev>/queues/tx-<n>/xps_rxqs 448 + 449 + 450 + Suggested Configuration 451 + ~~~~~~~~~~~~~~~~~~~~~~~ 478 452 479 453 For a network device with a single transmission queue, XPS configuration 480 454 has no effect, since there is no choice in this case. In a multi-queue ··· 496 460 user configuration for receive-queue map does not apply, then the transmit 497 461 queue is selected based on the CPUs map. 498 462 499 - Per TX Queue rate limitation: 500 - ============================= 463 + 464 + Per TX Queue rate limitation 465 + ============================ 501 466 502 467 These are rate-limitation mechanisms implemented by HW, where currently 503 - a max-rate attribute is supported, by setting a Mbps value to 468 + a max-rate attribute is supported, by setting a Mbps value to:: 504 469 505 - /sys/class/net/<dev>/queues/tx-<n>/tx_maxrate 470 + /sys/class/net/<dev>/queues/tx-<n>/tx_maxrate 506 471 507 472 A value of zero means disabled, and this is the default. 473 + 508 474 509 475 Further Information 510 476 =================== ··· 518 480 submitted by Ben Hutchings (bwh@kernel.org) 519 481 520 482 Authors: 521 - Tom Herbert (therbert@google.com) 522 - Willem de Bruijn (willemb@google.com) 483 + 484 + - Tom Herbert (therbert@google.com) 485 + - Willem de Bruijn (willemb@google.com)
+31 -17
Documentation/networking/segmentation-offloads.txt Documentation/networking/segmentation-offloads.rst
··· 1 - Segmentation Offloads in the Linux Networking Stack 1 + .. SPDX-License-Identifier: GPL-2.0 2 + 3 + ===================== 4 + Segmentation Offloads 5 + ===================== 6 + 2 7 3 8 Introduction 4 9 ============ ··· 19 14 * Generic Receive Offload - GRO 20 15 * Partial Generic Segmentation Offload - GSO_PARTIAL 21 16 * SCTP accelleration with GSO - GSO_BY_FRAGS 17 + 22 18 23 19 TCP Segmentation Offload 24 20 ======================== ··· 48 42 and we will either increment the IP ID for all frames, or leave it at a 49 43 static value based on driver preference. 50 44 45 + 51 46 UDP Fragmentation Offload 52 47 ========================= 53 48 ··· 60 53 UFO is deprecated: modern kernels will no longer generate UFO skbs, but can 61 54 still receive them from tuntap and similar devices. Offload of UDP-based 62 55 tunnel protocols is still supported. 56 + 63 57 64 58 IPIP, SIT, GRE, UDP Tunnel, and Remote Checksum Offloads 65 59 ======================================================== ··· 79 71 data is normally referred to as the inner headers. Below is the list of 80 72 calls to access the given headers: 81 73 82 - IPIP/SIT Tunnel: 83 - Outer Inner 84 - MAC skb_mac_header 85 - Network skb_network_header skb_inner_network_header 86 - Transport skb_transport_header 74 + IPIP/SIT Tunnel:: 87 75 88 - UDP/GRE Tunnel: 89 - Outer Inner 90 - MAC skb_mac_header skb_inner_mac_header 91 - Network skb_network_header skb_inner_network_header 92 - Transport skb_transport_header skb_inner_transport_header 76 + Outer Inner 77 + MAC skb_mac_header 78 + Network skb_network_header skb_inner_network_header 79 + Transport skb_transport_header 80 + 81 + UDP/GRE Tunnel:: 82 + 83 + Outer Inner 84 + MAC skb_mac_header skb_inner_mac_header 85 + Network skb_network_header skb_inner_network_header 86 + Transport skb_transport_header skb_inner_transport_header 93 87 94 88 In addition to the above tunnel types there are also SKB_GSO_GRE_CSUM and 95 89 SKB_GSO_UDP_TUNNEL_CSUM. These two additional tunnel types reflect the ··· 102 92 header has requested a remote checksum offload. In this case the inner 103 93 headers will be left with a partial checksum and only the outer header 104 94 checksum will be computed. 95 + 105 96 106 97 Generic Segmentation Offload 107 98 ============================ ··· 117 106 offload is required in GSO. Otherwise it becomes possible for a frame to 118 107 be re-routed between devices and end up being unable to be transmitted. 119 108 109 + 120 110 Generic Receive Offload 121 111 ======================= 122 112 ··· 128 116 this is IPv4 ID in the case that the DF bit is set for a given IP header. 129 117 If the value of the IPv4 ID is not sequentially incrementing it will be 130 118 altered so that it is when a frame assembled via GRO is segmented via GSO. 119 + 131 120 132 121 Partial Generic Segmentation Offload 133 122 ==================================== ··· 146 133 is the outer IPv4 ID field. It is up to the device drivers to guarantee 147 134 that the IPv4 ID field is incremented in the case that a given header does 148 135 not have the DF bit set. 136 + 149 137 150 138 SCTP accelleration with GSO 151 139 =========================== ··· 171 157 172 158 There are some helpers to make this easier: 173 159 174 - - skb_is_gso(skb) && skb_is_gso_sctp(skb) is the best way to see if 175 - an skb is an SCTP GSO skb. 160 + - skb_is_gso(skb) && skb_is_gso_sctp(skb) is the best way to see if 161 + an skb is an SCTP GSO skb. 176 162 177 - - For size checks, the skb_gso_validate_*_len family of helpers correctly 178 - considers GSO_BY_FRAGS. 163 + - For size checks, the skb_gso_validate_*_len family of helpers correctly 164 + considers GSO_BY_FRAGS. 179 165 180 - - For manipulating packets, skb_increase_gso_size and skb_decrease_gso_size 181 - will check for GSO_BY_FRAGS and WARN if asked to manipulate these skbs. 166 + - For manipulating packets, skb_increase_gso_size and skb_decrease_gso_size 167 + will check for GSO_BY_FRAGS and WARN if asked to manipulate these skbs. 182 168 183 169 This also affects drivers with the NETIF_F_FRAGLIST & NETIF_F_GSO_SCTP bits 184 170 set. Note also that NETIF_F_GSO_SCTP is included in NETIF_F_GSO_SOFTWARE.
+71 -24
Documentation/process/coding-style.rst
··· 443 443 Although this is not required by the C language, it is preferred in Linux 444 444 because it is a simple way to add valuable information for the reader. 445 445 446 - Do not use the `extern' keyword with function prototypes as this makes 446 + Do not use the ``extern`` keyword with function prototypes as this makes 447 447 lines longer and isn't strictly necessary. 448 448 449 449 ··· 595 595 (* (max steps 1) 596 596 c-basic-offset))) 597 597 598 - (add-hook 'c-mode-common-hook 599 - (lambda () 600 - ;; Add kernel style 601 - (c-add-style 602 - "linux-tabs-only" 603 - '("linux" (c-offsets-alist 604 - (arglist-cont-nonempty 605 - c-lineup-gcc-asm-reg 606 - c-lineup-arglist-tabs-only)))))) 598 + (dir-locals-set-class-variables 599 + 'linux-kernel 600 + '((c-mode . ( 601 + (c-basic-offset . 8) 602 + (c-label-minimum-indentation . 0) 603 + (c-offsets-alist . ( 604 + (arglist-close . c-lineup-arglist-tabs-only) 605 + (arglist-cont-nonempty . 606 + (c-lineup-gcc-asm-reg c-lineup-arglist-tabs-only)) 607 + (arglist-intro . +) 608 + (brace-list-intro . +) 609 + (c . c-lineup-C-comments) 610 + (case-label . 0) 611 + (comment-intro . c-lineup-comment) 612 + (cpp-define-intro . +) 613 + (cpp-macro . -1000) 614 + (cpp-macro-cont . +) 615 + (defun-block-intro . +) 616 + (else-clause . 0) 617 + (func-decl-cont . +) 618 + (inclass . +) 619 + (inher-cont . c-lineup-multi-inher) 620 + (knr-argdecl-intro . 0) 621 + (label . -1000) 622 + (statement . 0) 623 + (statement-block-intro . +) 624 + (statement-case-intro . +) 625 + (statement-cont . +) 626 + (substatement . +) 627 + )) 628 + (indent-tabs-mode . t) 629 + (show-trailing-whitespace . t) 630 + )))) 607 631 608 - (add-hook 'c-mode-hook 609 - (lambda () 610 - (let ((filename (buffer-file-name))) 611 - ;; Enable kernel mode for the appropriate files 612 - (when (and filename 613 - (string-match (expand-file-name "~/src/linux-trees") 614 - filename)) 615 - (setq indent-tabs-mode t) 616 - (setq show-trailing-whitespace t) 617 - (c-set-style "linux-tabs-only"))))) 632 + (dir-locals-set-directory-class 633 + (expand-file-name "~/src/linux-trees") 634 + 'linux-kernel) 618 635 619 636 This will make emacs go better with the kernel coding style for C 620 637 files below ``~/src/linux-trees``. ··· 938 921 NULL or the ERR_PTR mechanism to report failure. 939 922 940 923 941 - 17) Don't re-invent the kernel macros 924 + 17) Using bool 925 + -------------- 926 + 927 + The Linux kernel bool type is an alias for the C99 _Bool type. bool values can 928 + only evaluate to 0 or 1, and implicit or explicit conversion to bool 929 + automatically converts the value to true or false. When using bool types the 930 + !! construction is not needed, which eliminates a class of bugs. 931 + 932 + When working with bool values the true and false definitions should be used 933 + instead of 1 and 0. 934 + 935 + bool function return types and stack variables are always fine to use whenever 936 + appropriate. Use of bool is encouraged to improve readability and is often a 937 + better option than 'int' for storing boolean values. 938 + 939 + Do not use bool if cache line layout or size of the value matters, as its size 940 + and alignment varies based on the compiled architecture. Structures that are 941 + optimized for alignment and size should not use bool. 942 + 943 + If a structure has many true/false values, consider consolidating them into a 944 + bitfield with 1 bit members, or using an appropriate fixed width type, such as 945 + u8. 946 + 947 + Similarly for function arguments, many true/false values can be consolidated 948 + into a single bitwise 'flags' argument and 'flags' can often be a more 949 + readable alternative if the call-sites have naked true/false constants. 950 + 951 + Otherwise limited use of bool in structures and arguments can improve 952 + readability. 953 + 954 + 18) Don't re-invent the kernel macros 942 955 ------------------------------------- 943 956 944 957 The header file include/linux/kernel.h contains a number of macros that ··· 991 944 defined that you shouldn't reproduce in your code. 992 945 993 946 994 - 18) Editor modelines and other cruft 947 + 19) Editor modelines and other cruft 995 948 ------------------------------------ 996 949 997 950 Some editors can interpret configuration information embedded in source files, ··· 1025 978 work correctly. 1026 979 1027 980 1028 - 19) Inline assembly 981 + 20) Inline assembly 1029 982 ------------------- 1030 983 1031 984 In architecture-specific code, you may need to use inline assembly to interface ··· 1057 1010 : /* outputs */ : /* inputs */ : /* clobbers */); 1058 1011 1059 1012 1060 - 20) Conditional Compilation 1013 + 21) Conditional Compilation 1061 1014 --------------------------- 1062 1015 1063 1016 Wherever possible, don't use preprocessor conditionals (#if, #ifdef) in .c
+23 -36
Documentation/process/howto.rst
··· 225 225 self-referential, indexed webpage format. An excellent up-to-date 226 226 repository of the kernel code may be found at: 227 227 228 - http://lxr.free-electrons.com/ 228 + https://elixir.bootlin.com/ 229 229 230 230 231 231 The development process ··· 235 235 main kernel "branches" and lots of different subsystem-specific kernel 236 236 branches. These different branches are: 237 237 238 - - main 4.x kernel tree 239 - - 4.x.y -stable kernel tree 240 - - 4.x -git kernel patches 241 - - subsystem specific kernel trees and patches 242 - - the 4.x -next kernel tree for integration tests 238 + - Linus's mainline tree 239 + - Various stable trees with multiple major numbers 240 + - Subsystem-specific trees 241 + - linux-next integration testing tree 243 242 244 - 4.x kernel tree 245 - ~~~~~~~~~~~~~~~ 243 + Mainline tree 244 + ~~~~~~~~~~~~~ 246 245 247 - 4.x kernels are maintained by Linus Torvalds, and can be found on 248 - https://kernel.org in the pub/linux/kernel/v4.x/ directory. Its development 249 - process is as follows: 246 + Mainline tree are maintained by Linus Torvalds, and can be found at 247 + https://kernel.org or in the repo. Its development process is as follows: 250 248 251 249 - As soon as a new kernel is released a two weeks window is open, 252 250 during this period of time maintainers can submit big diffs to 253 251 Linus, usually the patches that have already been included in the 254 - -next kernel for a few weeks. The preferred way to submit big changes 252 + linux-next for a few weeks. The preferred way to submit big changes 255 253 is using git (the kernel's source management tool, more information 256 254 can be found at https://git-scm.com/) but plain patches are also just 257 255 fine. ··· 276 278 released according to perceived bug status, not according to a 277 279 preconceived timeline."* 278 280 279 - 4.x.y -stable kernel tree 280 - ~~~~~~~~~~~~~~~~~~~~~~~~~ 281 + Various stable trees with multiple major numbers 282 + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 281 283 282 284 Kernels with 3-part versions are -stable kernels. They contain 283 285 relatively small and critical fixes for security problems or significant 284 - regressions discovered in a given 4.x kernel. 286 + regressions discovered in a given major mainline release, with the first 287 + 2-part of version number are the same correspondingly. 285 288 286 289 This is the recommended branch for users who want the most recent stable 287 290 kernel and are not interested in helping test development/experimental 288 291 versions. 289 292 290 - If no 4.x.y kernel is available, then the highest numbered 4.x 291 - kernel is the current stable kernel. 292 - 293 - 4.x.y are maintained by the "stable" team <stable@vger.kernel.org>, and 293 + Stable trees are maintained by the "stable" team <stable@vger.kernel.org>, and 294 294 are released as needs dictate. The normal release period is approximately 295 295 two weeks, but it can be longer if there are no pressing problems. A 296 296 security-related problem, instead, can cause a release to happen almost ··· 298 302 in the kernel tree documents what kinds of changes are acceptable for 299 303 the -stable tree, and how the release process works. 300 304 301 - 4.x -git patches 302 - ~~~~~~~~~~~~~~~~ 303 - 304 - These are daily snapshots of Linus' kernel tree which are managed in a 305 - git repository (hence the name.) These patches are usually released 306 - daily and represent the current state of Linus' tree. They are more 307 - experimental than -rc kernels since they are generated automatically 308 - without even a cursory glance to see if they are sane. 309 - 310 - Subsystem Specific kernel trees and patches 311 - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 305 + Subsystem-specific trees 306 + ~~~~~~~~~~~~~~~~~~~~~~~~ 312 307 313 308 The maintainers of the various kernel subsystems --- and also many 314 309 kernel subsystem developers --- expose their current state of ··· 323 336 accepted, or rejected. Most of these patchwork sites are listed at 324 337 https://patchwork.kernel.org/. 325 338 326 - 4.x -next kernel tree for integration tests 327 - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 339 + linux-next integration testing tree 340 + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 328 341 329 - Before updates from subsystem trees are merged into the mainline 4.x 330 - tree, they need to be integration-tested. For this purpose, a special 342 + Before updates from subsystem trees are merged into the mainline tree, 343 + they need to be integration-tested. For this purpose, a special 331 344 testing repository exists into which virtually all subsystem trees are 332 345 pulled on an almost daily basis: 333 346 334 347 https://git.kernel.org/?p=linux/kernel/git/next/linux-next.git 335 348 336 - This way, the -next kernel gives a summary outlook onto what will be 349 + This way, the linux-next gives a summary outlook onto what will be 337 350 expected to go into the mainline kernel at the next merge period. 338 - Adventurous testers are very welcome to runtime-test the -next kernel. 351 + Adventurous testers are very welcome to runtime-test the linux-next. 339 352 340 353 341 354 Bug Reporting
+1 -1
Documentation/process/kernel-docs.rst
··· 565 565 566 566 * Name: **Cross-Referencing Linux** 567 567 568 - :URL: http://lxr.free-electrons.com/ 568 + :URL: https://elixir.bootlin.com/ 569 569 :Keywords: Browsing source code. 570 570 :Description: Another web-based Linux kernel source code browser. 571 571 Lots of cross references to variables and functions. You can see
+64 -2
Documentation/process/license-rules.rst
··· 62 62 63 63 The SPDX license identifier in kernel files shall be added at the first 64 64 possible line in a file which can contain a comment. For the majority 65 - or files this is the first line, except for scripts which require the 65 + of files this is the first line, except for scripts which require the 66 66 '#!PATH_TO_INTERPRETER' in the first line. For those scripts the SPDX 67 67 identifier goes into the second line. 68 68 ··· 368 368 369 369 370 370 All SPDX license identifiers and exceptions must have a corresponding file 371 - in the LICENSE subdirectories. This is required to allow tool 371 + in the LICENSES subdirectories. This is required to allow tool 372 372 verification (e.g. checkpatch.pl) and to have the licenses ready to read 373 373 and extract right from the source, which is recommended by various FOSS 374 374 organizations, e.g. the `FSFE REUSE initiative <https://reuse.software/>`_. 375 + 376 + _`MODULE_LICENSE` 377 + ----------------- 378 + 379 + Loadable kernel modules also require a MODULE_LICENSE() tag. This tag is 380 + neither a replacement for proper source code license information 381 + (SPDX-License-Identifier) nor in any way relevant for expressing or 382 + determining the exact license under which the source code of the module 383 + is provided. 384 + 385 + The sole purpose of this tag is to provide sufficient information 386 + whether the module is free software or proprietary for the kernel 387 + module loader and for user space tools. 388 + 389 + The valid license strings for MODULE_LICENSE() are: 390 + 391 + ============================= ============================================= 392 + "GPL" Module is licensed under GPL version 2. This 393 + does not express any distinction between 394 + GPL-2.0-only or GPL-2.0-or-later. The exact 395 + license information can only be determined 396 + via the license information in the 397 + corresponding source files. 398 + 399 + "GPL v2" Same as "GPL". It exists for historic 400 + reasons. 401 + 402 + "GPL and additional rights" Historical variant of expressing that the 403 + module source is dual licensed under a 404 + GPL v2 variant and MIT license. Please do 405 + not use in new code. 406 + 407 + "Dual MIT/GPL" The correct way of expressing that the 408 + module is dual licensed under a GPL v2 409 + variant or MIT license choice. 410 + 411 + "Dual BSD/GPL" The module is dual licensed under a GPL v2 412 + variant or BSD license choice. The exact 413 + variant of the BSD license can only be 414 + determined via the license information 415 + in the corresponding source files. 416 + 417 + "Dual MPL/GPL" The module is dual licensed under a GPL v2 418 + variant or Mozilla Public License (MPL) 419 + choice. The exact variant of the MPL 420 + license can only be determined via the 421 + license information in the corresponding 422 + source files. 423 + 424 + "Proprietary" The module is under a proprietary license. 425 + This string is solely for proprietary third 426 + party modules and cannot be used for modules 427 + which have their source code in the kernel 428 + tree. Modules tagged that way are tainting 429 + the kernel with the 'P' flag when loaded and 430 + the kernel module loader refuses to link such 431 + modules against symbols which are exported 432 + with EXPORT_SYMBOL_GPL(). 433 + ============================= ============================================= 434 + 435 + 436 +
+7 -8
Documentation/process/stable-api-nonsense.rst
··· 169 169 nightmare, and trying to keep up with an ever changing kernel interface 170 170 is also a rough job. 171 171 172 - Simple, get your kernel driver into the main kernel tree (remember we 173 - are talking about GPL released drivers here, if your code doesn't fall 174 - under this category, good luck, you are on your own here, you leech 175 - <insert link to leech comment from Andrew and Linus here>.) If your 176 - driver is in the tree, and a kernel interface changes, it will be fixed 177 - up by the person who did the kernel change in the first place. This 178 - ensures that your driver is always buildable, and works over time, with 179 - very little effort on your part. 172 + Simple, get your kernel driver into the main kernel tree (remember we are 173 + talking about drivers released under a GPL-compatible license here, if your 174 + code doesn't fall under this category, good luck, you are on your own here, 175 + you leech). If your driver is in the tree, and a kernel interface changes, 176 + it will be fixed up by the person who did the kernel change in the first 177 + place. This ensures that your driver is always buildable, and works over 178 + time, with very little effort on your part. 180 179 181 180 The very good side effects of having your driver in the main kernel tree 182 181 are:
+6 -3
Documentation/process/stable-kernel-rules.rst
··· 38 38 - If the patch covers files in net/ or drivers/net please follow netdev stable 39 39 submission guidelines as described in 40 40 :ref:`Documentation/networking/netdev-FAQ.rst <netdev-FAQ>` 41 + after first checking the stable networking queue at 42 + https://patchwork.ozlabs.org/bundle/davem/stable/?series=&submitter=&state=*&q=&archive= 43 + to ensure the requested patch is not already queued up. 41 44 - Security patches should not be handled (solely) by the -stable review 42 45 process but should follow the procedures in 43 46 :ref:`Documentation/admin-guide/security-bugs.rst <securitybugs>`. ··· 101 98 102 99 commit <sha1> upstream. 103 100 104 - Additionally, some patches submitted via Option 1 may have additional patch 105 - prerequisites which can be cherry-picked. This can be specified in the following 106 - format in the sign-off area: 101 + Additionally, some patches submitted via :ref:`option_1` may have additional 102 + patch prerequisites which can be cherry-picked. This can be specified in the 103 + following format in the sign-off area: 107 104 108 105 .. code-block:: none 109 106
+4 -2
Documentation/process/submitting-patches.rst
··· 182 182 183 183 If your patch fixes a bug in a specific commit, e.g. you found an issue using 184 184 ``git bisect``, please use the 'Fixes:' tag with the first 12 characters of 185 - the SHA-1 ID, and the one line summary. For example:: 185 + the SHA-1 ID, and the one line summary. Do not split the tag across multiple 186 + lines, tags are exempt from the "wrap at 75 columns" rule in order to simplify 187 + parsing scripts. For example:: 186 188 187 - Fixes: e21d2170f366 ("video: remove unnecessary platform_set_drvdata()") 189 + Fixes: 54a4f0239f2e ("KVM: MMU: make kvm_mmu_zap_page() return the number of pages it actually freed") 188 190 189 191 The following ``git config`` settings can be used to add a pretty format for 190 192 outputting the above style in the ``git log`` or ``git show`` commands::
+174 -6
Documentation/security/LSM-sctp.rst Documentation/security/SCTP.rst
··· 1 + .. SPDX-License-Identifier: GPL-2.0 2 + 3 + ==== 4 + SCTP 5 + ==== 6 + 1 7 SCTP LSM Support 2 8 ================ 9 + 10 + Security Hooks 11 + -------------- 3 12 4 13 For security module support, three SCTP specific hooks have been implemented:: 5 14 ··· 21 12 security_inet_conn_established() 22 13 23 14 The usage of these hooks are described below with the SELinux implementation 24 - described in ``Documentation/security/SELinux-sctp.rst`` 15 + described in the `SCTP SELinux Support`_ chapter. 25 16 26 17 27 18 security_sctp_assoc_request() 28 - ----------------------------- 19 + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 29 20 Passes the ``@ep`` and ``@chunk->skb`` of the association INIT packet to the 30 21 security module. Returns 0 on success, error on failure. 31 22 :: ··· 35 26 36 27 37 28 security_sctp_bind_connect() 38 - ----------------------------- 29 + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 39 30 Passes one or more ipv4/ipv6 addresses to the security module for validation 40 31 based on the ``@optname`` that will result in either a bind or connect 41 32 service as shown in the permission check tables below. ··· 111 102 112 103 113 104 security_sctp_sk_clone() 114 - ------------------------- 105 + ~~~~~~~~~~~~~~~~~~~~~~~~ 115 106 Called whenever a new socket is created by **accept**\(2) 116 107 (i.e. a TCP style socket) or when a socket is 'peeled off' e.g userspace 117 108 calls **sctp_peeloff**\(3). ··· 123 114 124 115 125 116 security_inet_conn_established() 126 - --------------------------------- 117 + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 127 118 Called when a COOKIE ACK is received:: 128 119 129 120 @sk - pointer to sock structure. ··· 131 122 132 123 133 124 Security Hooks used for Association Establishment 134 - ================================================= 125 + ------------------------------------------------- 126 + 135 127 The following diagram shows the use of ``security_sctp_bind_connect()``, 136 128 ``security_sctp_assoc_request()``, ``security_inet_conn_established()`` when 137 129 establishing an association. ··· 183 173 ------------------------------------------------------------------ 184 174 185 175 176 + SCTP SELinux Support 177 + ==================== 178 + 179 + Security Hooks 180 + -------------- 181 + 182 + The `SCTP LSM Support`_ chapter above describes the following SCTP security 183 + hooks with the SELinux specifics expanded below:: 184 + 185 + security_sctp_assoc_request() 186 + security_sctp_bind_connect() 187 + security_sctp_sk_clone() 188 + security_inet_conn_established() 189 + 190 + 191 + security_sctp_assoc_request() 192 + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 193 + Passes the ``@ep`` and ``@chunk->skb`` of the association INIT packet to the 194 + security module. Returns 0 on success, error on failure. 195 + :: 196 + 197 + @ep - pointer to sctp endpoint structure. 198 + @skb - pointer to skbuff of association packet. 199 + 200 + The security module performs the following operations: 201 + IF this is the first association on ``@ep->base.sk``, then set the peer 202 + sid to that in ``@skb``. This will ensure there is only one peer sid 203 + assigned to ``@ep->base.sk`` that may support multiple associations. 204 + 205 + ELSE validate the ``@ep->base.sk peer_sid`` against the ``@skb peer sid`` 206 + to determine whether the association should be allowed or denied. 207 + 208 + Set the sctp ``@ep sid`` to socket's sid (from ``ep->base.sk``) with 209 + MLS portion taken from ``@skb peer sid``. This will be used by SCTP 210 + TCP style sockets and peeled off connections as they cause a new socket 211 + to be generated. 212 + 213 + If IP security options are configured (CIPSO/CALIPSO), then the ip 214 + options are set on the socket. 215 + 216 + 217 + security_sctp_bind_connect() 218 + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 219 + Checks permissions required for ipv4/ipv6 addresses based on the ``@optname`` 220 + as follows:: 221 + 222 + ------------------------------------------------------------------ 223 + | BIND Permission Checks | 224 + | @optname | @address contains | 225 + |----------------------------|-----------------------------------| 226 + | SCTP_SOCKOPT_BINDX_ADD | One or more ipv4 / ipv6 addresses | 227 + | SCTP_PRIMARY_ADDR | Single ipv4 or ipv6 address | 228 + | SCTP_SET_PEER_PRIMARY_ADDR | Single ipv4 or ipv6 address | 229 + ------------------------------------------------------------------ 230 + 231 + ------------------------------------------------------------------ 232 + | CONNECT Permission Checks | 233 + | @optname | @address contains | 234 + |----------------------------|-----------------------------------| 235 + | SCTP_SOCKOPT_CONNECTX | One or more ipv4 / ipv6 addresses | 236 + | SCTP_PARAM_ADD_IP | One or more ipv4 / ipv6 addresses | 237 + | SCTP_SENDMSG_CONNECT | Single ipv4 or ipv6 address | 238 + | SCTP_PARAM_SET_PRIMARY | Single ipv4 or ipv6 address | 239 + ------------------------------------------------------------------ 240 + 241 + 242 + `SCTP LSM Support`_ gives a summary of the ``@optname`` 243 + entries and also describes ASCONF chunk processing when Dynamic Address 244 + Reconfiguration is enabled. 245 + 246 + 247 + security_sctp_sk_clone() 248 + ~~~~~~~~~~~~~~~~~~~~~~~~ 249 + Called whenever a new socket is created by **accept**\(2) (i.e. a TCP style 250 + socket) or when a socket is 'peeled off' e.g userspace calls 251 + **sctp_peeloff**\(3). ``security_sctp_sk_clone()`` will set the new 252 + sockets sid and peer sid to that contained in the ``@ep sid`` and 253 + ``@ep peer sid`` respectively. 254 + :: 255 + 256 + @ep - pointer to current sctp endpoint structure. 257 + @sk - pointer to current sock structure. 258 + @sk - pointer to new sock structure. 259 + 260 + 261 + security_inet_conn_established() 262 + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 263 + Called when a COOKIE ACK is received where it sets the connection's peer sid 264 + to that in ``@skb``:: 265 + 266 + @sk - pointer to sock structure. 267 + @skb - pointer to skbuff of the COOKIE ACK packet. 268 + 269 + 270 + Policy Statements 271 + ----------------- 272 + The following class and permissions to support SCTP are available within the 273 + kernel:: 274 + 275 + class sctp_socket inherits socket { node_bind } 276 + 277 + whenever the following policy capability is enabled:: 278 + 279 + policycap extended_socket_class; 280 + 281 + SELinux SCTP support adds the ``name_connect`` permission for connecting 282 + to a specific port type and the ``association`` permission that is explained 283 + in the section below. 284 + 285 + If userspace tools have been updated, SCTP will support the ``portcon`` 286 + statement as shown in the following example:: 287 + 288 + portcon sctp 1024-1036 system_u:object_r:sctp_ports_t:s0 289 + 290 + 291 + SCTP Peer Labeling 292 + ------------------ 293 + An SCTP socket will only have one peer label assigned to it. This will be 294 + assigned during the establishment of the first association. Any further 295 + associations on this socket will have their packet peer label compared to 296 + the sockets peer label, and only if they are different will the 297 + ``association`` permission be validated. This is validated by checking the 298 + socket peer sid against the received packets peer sid to determine whether 299 + the association should be allowed or denied. 300 + 301 + NOTES: 302 + 1) If peer labeling is not enabled, then the peer context will always be 303 + ``SECINITSID_UNLABELED`` (``unlabeled_t`` in Reference Policy). 304 + 305 + 2) As SCTP can support more than one transport address per endpoint 306 + (multi-homing) on a single socket, it is possible to configure policy 307 + and NetLabel to provide different peer labels for each of these. As the 308 + socket peer label is determined by the first associations transport 309 + address, it is recommended that all peer labels are consistent. 310 + 311 + 3) **getpeercon**\(3) may be used by userspace to retrieve the sockets peer 312 + context. 313 + 314 + 4) While not SCTP specific, be aware when using NetLabel that if a label 315 + is assigned to a specific interface, and that interface 'goes down', 316 + then the NetLabel service will remove the entry. Therefore ensure that 317 + the network startup scripts call **netlabelctl**\(8) to set the required 318 + label (see **netlabel-config**\(8) helper script for details). 319 + 320 + 5) The NetLabel SCTP peer labeling rules apply as discussed in the following 321 + set of posts tagged "netlabel" at: http://www.paul-moore.com/blog/t. 322 + 323 + 6) CIPSO is only supported for IPv4 addressing: ``socket(AF_INET, ...)`` 324 + CALIPSO is only supported for IPv6 addressing: ``socket(AF_INET6, ...)`` 325 + 326 + Note the following when testing CIPSO/CALIPSO: 327 + a) CIPSO will send an ICMP packet if an SCTP packet cannot be 328 + delivered because of an invalid label. 329 + b) CALIPSO does not send an ICMP packet, just silently discards it. 330 + 331 + 7) IPSEC is not supported as RFC 3554 - sctp/ipsec support has not been 332 + implemented in userspace (**racoon**\(8) or **ipsec_pluto**\(8)), 333 + although the kernel supports SCTP/IPSEC.
+4 -1
Documentation/security/LSM.rst
··· 11 11 LSMs suit their requirements. 12 12 13 13 For extensive documentation on the available LSM hook interfaces, please 14 - see ``include/linux/lsm_hooks.h``. 14 + see ``include/linux/lsm_hooks.h`` and associated structures: 15 + 16 + .. kernel-doc:: include/linux/lsm_hooks.h 17 + :internal:
-158
Documentation/security/SELinux-sctp.rst
··· 1 - SCTP SELinux Support 2 - ===================== 3 - 4 - Security Hooks 5 - =============== 6 - 7 - ``Documentation/security/LSM-sctp.rst`` describes the following SCTP security 8 - hooks with the SELinux specifics expanded below:: 9 - 10 - security_sctp_assoc_request() 11 - security_sctp_bind_connect() 12 - security_sctp_sk_clone() 13 - security_inet_conn_established() 14 - 15 - 16 - security_sctp_assoc_request() 17 - ----------------------------- 18 - Passes the ``@ep`` and ``@chunk->skb`` of the association INIT packet to the 19 - security module. Returns 0 on success, error on failure. 20 - :: 21 - 22 - @ep - pointer to sctp endpoint structure. 23 - @skb - pointer to skbuff of association packet. 24 - 25 - The security module performs the following operations: 26 - IF this is the first association on ``@ep->base.sk``, then set the peer 27 - sid to that in ``@skb``. This will ensure there is only one peer sid 28 - assigned to ``@ep->base.sk`` that may support multiple associations. 29 - 30 - ELSE validate the ``@ep->base.sk peer_sid`` against the ``@skb peer sid`` 31 - to determine whether the association should be allowed or denied. 32 - 33 - Set the sctp ``@ep sid`` to socket's sid (from ``ep->base.sk``) with 34 - MLS portion taken from ``@skb peer sid``. This will be used by SCTP 35 - TCP style sockets and peeled off connections as they cause a new socket 36 - to be generated. 37 - 38 - If IP security options are configured (CIPSO/CALIPSO), then the ip 39 - options are set on the socket. 40 - 41 - 42 - security_sctp_bind_connect() 43 - ----------------------------- 44 - Checks permissions required for ipv4/ipv6 addresses based on the ``@optname`` 45 - as follows:: 46 - 47 - ------------------------------------------------------------------ 48 - | BIND Permission Checks | 49 - | @optname | @address contains | 50 - |----------------------------|-----------------------------------| 51 - | SCTP_SOCKOPT_BINDX_ADD | One or more ipv4 / ipv6 addresses | 52 - | SCTP_PRIMARY_ADDR | Single ipv4 or ipv6 address | 53 - | SCTP_SET_PEER_PRIMARY_ADDR | Single ipv4 or ipv6 address | 54 - ------------------------------------------------------------------ 55 - 56 - ------------------------------------------------------------------ 57 - | CONNECT Permission Checks | 58 - | @optname | @address contains | 59 - |----------------------------|-----------------------------------| 60 - | SCTP_SOCKOPT_CONNECTX | One or more ipv4 / ipv6 addresses | 61 - | SCTP_PARAM_ADD_IP | One or more ipv4 / ipv6 addresses | 62 - | SCTP_SENDMSG_CONNECT | Single ipv4 or ipv6 address | 63 - | SCTP_PARAM_SET_PRIMARY | Single ipv4 or ipv6 address | 64 - ------------------------------------------------------------------ 65 - 66 - 67 - ``Documentation/security/LSM-sctp.rst`` gives a summary of the ``@optname`` 68 - entries and also describes ASCONF chunk processing when Dynamic Address 69 - Reconfiguration is enabled. 70 - 71 - 72 - security_sctp_sk_clone() 73 - ------------------------- 74 - Called whenever a new socket is created by **accept**\(2) (i.e. a TCP style 75 - socket) or when a socket is 'peeled off' e.g userspace calls 76 - **sctp_peeloff**\(3). ``security_sctp_sk_clone()`` will set the new 77 - sockets sid and peer sid to that contained in the ``@ep sid`` and 78 - ``@ep peer sid`` respectively. 79 - :: 80 - 81 - @ep - pointer to current sctp endpoint structure. 82 - @sk - pointer to current sock structure. 83 - @sk - pointer to new sock structure. 84 - 85 - 86 - security_inet_conn_established() 87 - --------------------------------- 88 - Called when a COOKIE ACK is received where it sets the connection's peer sid 89 - to that in ``@skb``:: 90 - 91 - @sk - pointer to sock structure. 92 - @skb - pointer to skbuff of the COOKIE ACK packet. 93 - 94 - 95 - Policy Statements 96 - ================== 97 - The following class and permissions to support SCTP are available within the 98 - kernel:: 99 - 100 - class sctp_socket inherits socket { node_bind } 101 - 102 - whenever the following policy capability is enabled:: 103 - 104 - policycap extended_socket_class; 105 - 106 - SELinux SCTP support adds the ``name_connect`` permission for connecting 107 - to a specific port type and the ``association`` permission that is explained 108 - in the section below. 109 - 110 - If userspace tools have been updated, SCTP will support the ``portcon`` 111 - statement as shown in the following example:: 112 - 113 - portcon sctp 1024-1036 system_u:object_r:sctp_ports_t:s0 114 - 115 - 116 - SCTP Peer Labeling 117 - =================== 118 - An SCTP socket will only have one peer label assigned to it. This will be 119 - assigned during the establishment of the first association. Any further 120 - associations on this socket will have their packet peer label compared to 121 - the sockets peer label, and only if they are different will the 122 - ``association`` permission be validated. This is validated by checking the 123 - socket peer sid against the received packets peer sid to determine whether 124 - the association should be allowed or denied. 125 - 126 - NOTES: 127 - 1) If peer labeling is not enabled, then the peer context will always be 128 - ``SECINITSID_UNLABELED`` (``unlabeled_t`` in Reference Policy). 129 - 130 - 2) As SCTP can support more than one transport address per endpoint 131 - (multi-homing) on a single socket, it is possible to configure policy 132 - and NetLabel to provide different peer labels for each of these. As the 133 - socket peer label is determined by the first associations transport 134 - address, it is recommended that all peer labels are consistent. 135 - 136 - 3) **getpeercon**\(3) may be used by userspace to retrieve the sockets peer 137 - context. 138 - 139 - 4) While not SCTP specific, be aware when using NetLabel that if a label 140 - is assigned to a specific interface, and that interface 'goes down', 141 - then the NetLabel service will remove the entry. Therefore ensure that 142 - the network startup scripts call **netlabelctl**\(8) to set the required 143 - label (see **netlabel-config**\(8) helper script for details). 144 - 145 - 5) The NetLabel SCTP peer labeling rules apply as discussed in the following 146 - set of posts tagged "netlabel" at: http://www.paul-moore.com/blog/t. 147 - 148 - 6) CIPSO is only supported for IPv4 addressing: ``socket(AF_INET, ...)`` 149 - CALIPSO is only supported for IPv6 addressing: ``socket(AF_INET6, ...)`` 150 - 151 - Note the following when testing CIPSO/CALIPSO: 152 - a) CIPSO will send an ICMP packet if an SCTP packet cannot be 153 - delivered because of an invalid label. 154 - b) CALIPSO does not send an ICMP packet, just silently discards it. 155 - 156 - 7) IPSEC is not supported as RFC 3554 - sctp/ipsec support has not been 157 - implemented in userspace (**racoon**\(8) or **ipsec_pluto**\(8)), 158 - although the kernel supports SCTP/IPSEC.
+1 -2
Documentation/security/index.rst
··· 9 9 IMA-templates 10 10 keys/index 11 11 LSM 12 - LSM-sctp 13 - SELinux-sctp 12 + SCTP 14 13 self-protection 15 14 tpm/index
+1 -1
Documentation/static-keys.txt
··· 159 159 CPUs being brought in the kernel while the kernel is getting 160 160 patched). Calling the static key API from within a hotplug notifier is 161 161 thus a sure deadlock recipe. In order to still allow use of the 162 - functionnality, the following functions are provided: 162 + functionality, the following functions are provided: 163 163 164 164 static_key_enable_cpuslocked() 165 165 static_key_disable_cpuslocked()
+22 -28
Documentation/sysctl/kernel.txt
··· 95 95 - stop-a [ SPARC only ] 96 96 - sysrq ==> Documentation/admin-guide/sysrq.rst 97 97 - sysctl_writes_strict 98 - - tainted 98 + - tainted ==> Documentation/admin-guide/tainted-kernels.rst 99 99 - threads-max 100 100 - unknown_nmi_panic 101 101 - watchdog ··· 1031 1031 1032 1032 1: kernel stack erasing is enabled (default), it is performed before 1033 1033 returning to the userspace at the end of syscalls. 1034 - 1035 1034 ============================================================== 1036 1035 1037 - tainted: 1036 + tainted 1038 1037 1039 1038 Non-zero if the kernel has been tainted. Numeric values, which can be 1040 1039 ORed together. The letters are seen in "Tainted" line of Oops reports. 1041 1040 1042 - 1 (P): A module with a non-GPL license has been loaded, this 1043 - includes modules with no license. 1044 - Set by modutils >= 2.4.9 and module-init-tools. 1045 - 2 (F): A module was force loaded by insmod -f. 1046 - Set by modutils >= 2.4.9 and module-init-tools. 1047 - 4 (S): Unsafe SMP processors: SMP with CPUs not designed for SMP. 1048 - 8 (R): A module was forcibly unloaded from the system by rmmod -f. 1049 - 16 (M): A hardware machine check error occurred on the system. 1050 - 32 (B): A bad page was discovered on the system. 1051 - 64 (U): The user has asked that the system be marked "tainted". This 1052 - could be because they are running software that directly modifies 1053 - the hardware, or for other reasons. 1054 - 128 (D): The system has died. 1055 - 256 (A): The ACPI DSDT has been overridden with one supplied by the user 1056 - instead of using the one provided by the hardware. 1057 - 512 (W): A kernel warning has occurred. 1058 - 1024 (C): A module from drivers/staging was loaded. 1059 - 2048 (I): The system is working around a severe firmware bug. 1060 - 4096 (O): An out-of-tree module has been loaded. 1061 - 8192 (E): An unsigned module has been loaded in a kernel supporting module 1062 - signature. 1063 - 16384 (L): A soft lockup has previously occurred on the system. 1064 - 32768 (K): The kernel has been live patched. 1065 - 65536 (X): Auxiliary taint, defined and used by for distros. 1066 - 131072 (T): The kernel was built with the struct randomization plugin. 1041 + 1 (P): proprietary module was loaded 1042 + 2 (F): module was force loaded 1043 + 4 (S): SMP kernel oops on an officially SMP incapable processor 1044 + 8 (R): module was force unloaded 1045 + 16 (M): processor reported a Machine Check Exception (MCE) 1046 + 32 (B): bad page referenced or some unexpected page flags 1047 + 64 (U): taint requested by userspace application 1048 + 128 (D): kernel died recently, i.e. there was an OOPS or BUG 1049 + 256 (A): an ACPI table was overridden by user 1050 + 512 (W): kernel issued warning 1051 + 1024 (C): staging driver was loaded 1052 + 2048 (I): workaround for bug in platform firmware applied 1053 + 4096 (O): externally-built ("out-of-tree") module was loaded 1054 + 8192 (E): unsigned module was loaded 1055 + 16384 (L): soft lockup occurred 1056 + 32768 (K): kernel has been live patched 1057 + 65536 (X): Auxiliary taint, defined and used by for distros 1058 + 131072 (T): The kernel was built with the struct randomization plugin 1059 + 1060 + See Documentation/admin-guide/tainted-kernels.rst for more information. 1067 1061 1068 1062 ============================================================== 1069 1063
+1 -1
Documentation/sysctl/vm.txt
··· 237 237 cat (1234): drop_caches: 3 238 238 239 239 These are informational only. They do not mean that anything is wrong 240 - with your system. To disable them, echo 4 (bit 3) into drop_caches. 240 + with your system. To disable them, echo 4 (bit 2) into drop_caches. 241 241 242 242 ============================================================== 243 243
+1 -1
Documentation/timers/highres.txt
··· 231 231 handler has not to deal with an eventually stale jiffy value. 232 232 233 233 The dynamic tick feature provides statistical values which are exported to 234 - userspace via /proc/stats and can be made available for enhanced power 234 + userspace via /proc/stat and can be made available for enhanced power 235 235 management control. 236 236 237 237 The implementation leaves room for further development like full tickless
+2
Documentation/translations/it_IT/doc-guide/sphinx.rst
··· 3 3 .. note:: Per leggere la documentazione originale in inglese: 4 4 :ref:`Documentation/doc-guide/index.rst <doc_guide>` 5 5 6 + .. _it_sphinxdoc: 7 + 6 8 Introduzione 7 9 ============ 8 10
+7 -5
Documentation/translations/it_IT/process/applying-patches.rst
··· 1 1 .. include:: ../disclaimer-ita.rst 2 2 3 3 :Original: :ref:`Documentation/process/applying-patches.rst <applying_patches>` 4 - 4 + :Translator: Federico Vaga <federico.vaga@vaga.pv.it> 5 5 6 6 .. _it_applying_patches: 7 7 8 - Applicare modifiche al kernel Linux 9 - =================================== 8 + Applicare patch al kernel Linux 9 + +++++++++++++++++++++++++++++++ 10 10 11 - .. warning:: 11 + .. note:: 12 12 13 - TODO ancora da tradurre 13 + Questo documento è obsoleto. Nella maggior parte dei casi, piuttosto 14 + che usare ``patch`` manualmente, vorrete usare Git. Per questo motivo 15 + il documento non verrà tradotto.
+485 -2
Documentation/translations/it_IT/process/changes.rst
··· 1 1 .. include:: ../disclaimer-ita.rst 2 2 3 3 :Original: :ref:`Documentation/process/changes.rst <changes>` 4 + :Translator: Federico Vaga <federico.vaga@vaga.pv.it> 4 5 5 6 .. _it_changes: 6 7 7 8 Requisiti minimi per compilare il kernel 8 9 ++++++++++++++++++++++++++++++++++++++++ 9 10 10 - .. warning:: 11 + Introduzione 12 + ============ 11 13 12 - TODO ancora da tradurre 14 + Questo documento fornisce una lista dei software necessari per eseguire i 15 + kernel 4.x. 16 + 17 + Questo documento è basato sul file "Changes" del kernel 2.0.x e quindi le 18 + persone che lo scrissero meritano credito (Jared Mauch, Axel Boldt, 19 + Alessandro Sigala, e tanti altri nella rete). 20 + 21 + Requisiti minimi correnti 22 + ************************* 23 + 24 + Prima di pensare d'avere trovato un baco, aggiornate i seguenti programmi 25 + **almeno** alla versione indicata! Se non siete certi della versione che state 26 + usando, il comando indicato dovrebbe dirvelo. 27 + 28 + Questa lista presume che abbiate già un kernel Linux funzionante. In aggiunta, 29 + non tutti gli strumenti sono necessari ovunque; ovviamente, se non avete un 30 + modem ISDN, per esempio, probabilmente non dovreste preoccuparvi di 31 + isdn4k-utils. 32 + 33 + ====================== ================= ======================================== 34 + Programma Versione minima Comando per verificare la versione 35 + ====================== ================= ======================================== 36 + GNU C 4.6 gcc --version 37 + GNU make 3.81 make --version 38 + binutils 2.20 ld -v 39 + flex 2.5.35 flex --version 40 + bison 2.0 bison --version 41 + util-linux 2.10o fdformat --version 42 + kmod 13 depmod -V 43 + e2fsprogs 1.41.4 e2fsck -V 44 + jfsutils 1.1.3 fsck.jfs -V 45 + reiserfsprogs 3.6.3 reiserfsck -V 46 + xfsprogs 2.6.0 xfs_db -V 47 + squashfs-tools 4.0 mksquashfs -version 48 + btrfs-progs 0.18 btrfsck 49 + pcmciautils 004 pccardctl -V 50 + quota-tools 3.09 quota -V 51 + PPP 2.4.0 pppd --version 52 + isdn4k-utils 3.1pre1 isdnctrl 2>&1|grep version 53 + nfs-utils 1.0.5 showmount --version 54 + procps 3.2.0 ps --version 55 + oprofile 0.9 oprofiled --version 56 + udev 081 udevd --version 57 + grub 0.93 grub --version || grub-install --version 58 + mcelog 0.6 mcelog --version 59 + iptables 1.4.2 iptables -V 60 + openssl & libcrypto 1.0.0 openssl version 61 + bc 1.06.95 bc --version 62 + Sphinx\ [#f1]_ 1.3 sphinx-build --version 63 + ====================== ================= ======================================== 64 + 65 + .. [#f1] Sphinx è necessario solo per produrre la documentazione del Kernel 66 + 67 + Compilazione del kernel 68 + *********************** 69 + 70 + GCC 71 + --- 72 + 73 + La versione necessaria di gcc potrebbe variare a seconda del tipo di CPU nel 74 + vostro calcolatore. 75 + 76 + Make 77 + ---- 78 + 79 + Per compilare il kernel vi servirà GNU make 3.81 o successivo. 80 + 81 + Binutils 82 + -------- 83 + 84 + Il sistema di compilazione, dalla versione 4.13, per la produzione dei passi 85 + intermedi, si è convertito all'uso di *thin archive* (`ar T`) piuttosto che 86 + all'uso del *linking* incrementale (`ld -r`). Questo richiede binutils 2.20 o 87 + successivo. 88 + 89 + pkg-config 90 + ---------- 91 + 92 + Il sistema di compilazione, dalla versione 4.18, richiede pkg-config per 93 + verificare l'esistenza degli strumenti kconfig e per determinare le 94 + impostazioni da usare in 'make {g,x}config'. Precedentemente pkg-config 95 + veniva usato ma non verificato o documentato. 96 + 97 + Flex 98 + ---- 99 + 100 + Dalla versione 4.16, il sistema di compilazione, durante l'esecuzione, genera 101 + un analizzatore lessicale. Questo richiede flex 2.5.35 o successivo. 102 + 103 + Bison 104 + ----- 105 + 106 + Dalla versione 4.16, il sistema di compilazione, durante l'esecuzione, genera 107 + un parsificatore. Questo richiede bison 2.0 o successivo. 108 + 109 + Perl 110 + ---- 111 + 112 + Per compilare il kernel vi servirà perl 5 e i seguenti moduli ``Getopt::Long``, 113 + ``Getopt::Std``, ``File::Basename``, e ``File::Find``. 114 + 115 + BC 116 + -- 117 + 118 + Vi servirà bc per compilare i kernel dal 3.10 in poi. 119 + 120 + OpenSSL 121 + ------- 122 + 123 + Il programma OpenSSL e la libreria crypto vengono usati per la firma dei moduli 124 + e la gestione dei certificati; sono usati per la creazione della chiave e 125 + la generazione della firma. 126 + 127 + Se la firma dei moduli è abilitata, allora vi servirà openssl per compilare il 128 + kernel 3.7 e successivi. Vi serviranno anche i pacchetti di sviluppo di 129 + openssl per compilare il kernel 4.3 o successivi. 130 + 131 + 132 + Strumenti di sistema 133 + ******************** 134 + 135 + Modifiche architetturali 136 + ------------------------ 137 + 138 + DevFS è stato reso obsoleto da udev 139 + (http://www.kernel.org/pub/linux/utils/kernel/hotplug/) 140 + 141 + Il supporto per UID a 32-bit è ora disponibile. Divertitevi! 142 + 143 + La documentazione delle funzioni in Linux è una fase di transizione 144 + verso una documentazione integrata nei sorgenti stessi usando dei commenti 145 + formattati in modo speciale e posizionati vicino alle funzioni che descrivono. 146 + Al fine di arricchire la documentazione, questi commenti possono essere 147 + combinati con i file ReST presenti in Documentation/; questi potranno 148 + poi essere convertiti in formato PostScript, HTML, LaTex, ePUB o PDF. 149 + Per convertire i documenti da ReST al formato che volete, avete bisogno di 150 + Sphinx. 151 + 152 + Util-linux 153 + ---------- 154 + 155 + Le versioni più recenti di util-linux: forniscono il supporto a ``fdisk`` per 156 + dischi di grandi dimensioni; supportano le nuove opzioni di mount; riconoscono 157 + più tipi di partizioni; hanno un fdformat che funziona con i kernel 2.4; 158 + e altre chicche. Probabilmente vorrete aggiornarlo. 159 + 160 + Ksymoops 161 + -------- 162 + 163 + Se l'impensabile succede e il kernel va in oops, potrebbe servirvi lo strumento 164 + ksymoops per decodificarlo, ma nella maggior parte dei casi non vi servirà. 165 + Generalmente è preferibile compilare il kernel con l'opzione ``CONFIG_KALLSYMS`` 166 + cosicché venga prodotto un output più leggibile che può essere usato così com'è 167 + (produce anche un output migliore di ksymoops). Se per qualche motivo il 168 + vostro kernel non è stato compilato con ``CONFIG_KALLSYMS`` e non avete modo di 169 + ricompilarlo e riprodurre l'oops con quell'opzione abilitata, allora potete 170 + usare ksymoops per decodificare l'oops. 171 + 172 + Mkinitrd 173 + -------- 174 + 175 + I cambiamenti della struttura in ``/lib/modules`` necessita l'aggiornamento di 176 + mkinitrd. 177 + 178 + E2fsprogs 179 + --------- 180 + 181 + L'ultima versione di ``e2fsprogs`` corregge diversi bachi in fsck e debugfs. 182 + Ovviamente, aggiornarlo è una buona idea. 183 + 184 + JFSutils 185 + -------- 186 + 187 + Il pacchetto ``jfsutils`` contiene programmi per il file-system JFS. 188 + Sono disponibili i seguenti strumenti: 189 + 190 + - ``fsck.jfs`` - avvia la ripetizione del log delle transizioni, e verifica e 191 + ripara una partizione formattata secondo JFS 192 + 193 + - ``mkfs.jfs`` - crea una partizione formattata secondo JFS 194 + 195 + - sono disponibili altri strumenti per il file-system. 196 + 197 + Reiserfsprogs 198 + ------------- 199 + 200 + Il pacchetto reiserfsprogs dovrebbe essere usato con reiserfs-3.6.x (Linux 201 + kernel 2.4.x). Questo è un pacchetto combinato che contiene versioni 202 + funzionanti di ``mkreiserfs``, ``resize_reiserfs``, ``debugreiserfs`` e 203 + ``reiserfsck``. Questi programmi funzionano sulle piattaforme i386 e alpha. 204 + 205 + Xfsprogs 206 + -------- 207 + 208 + L'ultima versione di ``xfsprogs`` contiene, fra i tanti, i programmi 209 + ``mkfs.xfs``, ``xfs_db`` e ``xfs_repair`` per il file-system XFS. 210 + Dipendono dell'architettura e qualsiasi versione dalla 2.0.0 in poi 211 + dovrebbe funzionare correttamente con la versione corrente del codice 212 + XFS nel kernel (sono raccomandate le versioni 2.6.0 o successive per via 213 + di importanti miglioramenti). 214 + 215 + PCMCIAutils 216 + ----------- 217 + 218 + PCMCIAutils sostituisce ``pcmica-cs``. Serve ad impostare correttamente i 219 + connettori PCMCIA all'avvio del sistema e a caricare i moduli necessari per 220 + i dispositivi a 16-bit se il kernel è stato modularizzato e il sottosistema 221 + hotplug è in uso. 222 + 223 + Quota-tools 224 + ----------- 225 + 226 + Il supporto per uid e gid a 32 bit richiedono l'uso della versione 2 del 227 + formato quota. La versione 3.07 e successive di quota-tools supportano 228 + questo formato. Usate la versione raccomandata nella lista qui sopra o una 229 + successiva. 230 + 231 + Micro codice per Intel IA32 232 + --------------------------- 233 + 234 + Per poter aggiornare il micro codice per Intel IA32, è stato aggiunto un 235 + apposito driver; il driver è accessibile come un normale dispositivo a 236 + caratteri (misc). Se non state usando udev probabilmente sarà necessario 237 + eseguire i seguenti comandi come root prima di poterlo aggiornare:: 238 + 239 + mkdir /dev/cpu 240 + mknod /dev/cpu/microcode c 10 184 241 + chmod 0644 /dev/cpu/microcode 242 + 243 + Probabilmente, vorrete anche il programma microcode_ctl da usare con questo 244 + dispositivo. 245 + 246 + udev 247 + ---- 248 + 249 + ``udev`` è un programma in spazio utente il cui scopo è quello di popolare 250 + dinamicamente la cartella ``/dev`` coi dispositivi effettivamente presenti. 251 + ``udev`` sostituisce le funzionalità base di devfs, consentendo comunque 252 + nomi persistenti per i dispositivi. 253 + 254 + FUSE 255 + ---- 256 + 257 + Serve libfuse 2.4.0 o successiva. Il requisito minimo assoluto è 2.3.0 ma 258 + le opzioni di mount ``direct_io`` e ``kernel_cache`` non funzioneranno. 259 + 260 + 261 + Rete 262 + **** 263 + 264 + Cambiamenti generali 265 + -------------------- 266 + 267 + Se per quanto riguarda la configurazione di rete avete esigenze di un certo 268 + livello dovreste prendere in considerazione l'uso degli strumenti in ip-route2. 269 + 270 + Filtro dei pacchetti / NAT 271 + -------------------------- 272 + 273 + Il codice per filtraggio dei pacchetti e il NAT fanno uso degli stessi 274 + strumenti come nelle versioni del kernel antecedenti la 2.4.x (iptables). 275 + Include ancora moduli di compatibilità per 2.2.x ipchains e 2.0.x ipdwadm. 276 + 277 + PPP 278 + --- 279 + 280 + Il driver per PPP è stato ristrutturato per supportare collegamenti multipli e 281 + per funzionare su diversi livelli. Se usate PPP, aggiornate pppd almeno alla 282 + versione 2.4.0. 283 + 284 + Se non usate udev, dovete avere un file /dev/ppp che può essere creato da root 285 + col seguente comando:: 286 + 287 + mknod /dev/ppp c 108 0 288 + 289 + Isdn4k-utils 290 + ------------ 291 + 292 + Per via della modifica del campo per il numero di telefono, il pacchetto 293 + isdn4k-utils dev'essere ricompilato o (preferibilmente) aggiornato. 294 + 295 + NFS-utils 296 + --------- 297 + 298 + Nei kernel più antichi (2.4 e precedenti), il server NFS doveva essere 299 + informato sui clienti ai quali si voleva fornire accesso via NFS. Questa 300 + informazione veniva passata al kernel quando un cliente montava un file-system 301 + mediante ``mountd``, oppure usando ``exportfs`` all'avvio del sistema. 302 + exportfs prende le informazioni circa i clienti attivi da ``/var/lib/nfs/rmtab``. 303 + 304 + Questo approccio è piuttosto delicato perché dipende dalla correttezza di 305 + rmtab, che non è facile da garantire, in particolare quando si cerca di 306 + implementare un *failover*. Anche quando il sistema funziona bene, ``rmtab`` 307 + ha il problema di accumulare vecchie voci inutilizzate. 308 + 309 + Sui kernel più recenti il kernel ha la possibilità di informare mountd quando 310 + arriva una richiesta da una macchina sconosciuta, e mountd può dare al kernel 311 + le informazioni corrette per l'esportazione. Questo rimuove la dipendenza con 312 + ``rmtab`` e significa che il kernel deve essere al corrente solo dei clienti 313 + attivi. 314 + 315 + Per attivare questa funzionalità, dovete eseguire il seguente comando prima di 316 + usare exportfs o mountd:: 317 + 318 + mount -t nfsd nfsd /proc/fs/nfsd 319 + 320 + Dove possibile, raccomandiamo di proteggere tutti i servizi NFS dall'accesso 321 + via internet mediante un firewall. 322 + 323 + mcelog 324 + ------ 325 + 326 + Quando ``CONFIG_x86_MCE`` è attivo, il programma mcelog processa e registra 327 + gli eventi *machine check*. Gli eventi *machine check* sono errori riportati 328 + dalla CPU. Incoraggiamo l'analisi di questi errori. 329 + 330 + 331 + Documentazione del kernel 332 + ************************* 333 + 334 + Sphinx 335 + ------ 336 + 337 + Per i dettaglio sui requisiti di Sphinx, fate riferimento a :ref:`it_sphinx_install` 338 + in :ref:`Documentation/translations/it_IT/doc-guide/sphinx.rst <it_sphinxdoc>` 339 + 340 + Ottenere software aggiornato 341 + ============================ 342 + 343 + Compilazione del kernel 344 + *********************** 345 + 346 + gcc 347 + --- 348 + 349 + - <ftp://ftp.gnu.org/gnu/gcc/> 350 + 351 + Make 352 + ---- 353 + 354 + - <ftp://ftp.gnu.org/gnu/make/> 355 + 356 + Binutils 357 + -------- 358 + 359 + - <https://www.kernel.org/pub/linux/devel/binutils/> 360 + 361 + Flex 362 + ---- 363 + 364 + - <https://github.com/westes/flex/releases> 365 + 366 + Bison 367 + ----- 368 + 369 + - <ftp://ftp.gnu.org/gnu/bison/> 370 + 371 + OpenSSL 372 + ------- 373 + 374 + - <https://www.openssl.org/> 375 + 376 + Strumenti di sistema 377 + ******************** 378 + 379 + Util-linux 380 + ---------- 381 + 382 + - <https://www.kernel.org/pub/linux/utils/util-linux/> 383 + 384 + Kmod 385 + ---- 386 + 387 + - <https://www.kernel.org/pub/linux/utils/kernel/kmod/> 388 + - <https://git.kernel.org/pub/scm/utils/kernel/kmod/kmod.git> 389 + 390 + Ksymoops 391 + -------- 392 + 393 + - <https://www.kernel.org/pub/linux/utils/kernel/ksymoops/v2.4/> 394 + 395 + Mkinitrd 396 + -------- 397 + 398 + - <https://code.launchpad.net/initrd-tools/main> 399 + 400 + E2fsprogs 401 + --------- 402 + 403 + - <http://prdownloads.sourceforge.net/e2fsprogs/e2fsprogs-1.29.tar.gz> 404 + 405 + JFSutils 406 + -------- 407 + 408 + - <http://jfs.sourceforge.net/> 409 + 410 + Reiserfsprogs 411 + ------------- 412 + 413 + - <http://www.kernel.org/pub/linux/utils/fs/reiserfs/> 414 + 415 + Xfsprogs 416 + -------- 417 + 418 + - <ftp://oss.sgi.com/projects/xfs/> 419 + 420 + Pcmciautils 421 + ----------- 422 + 423 + - <https://www.kernel.org/pub/linux/utils/kernel/pcmcia/> 424 + 425 + Quota-tools 426 + ----------- 427 + 428 + - <http://sourceforge.net/projects/linuxquota/> 429 + 430 + 431 + Microcodice Intel P6 432 + -------------------- 433 + 434 + - <https://downloadcenter.intel.com/> 435 + 436 + udev 437 + ---- 438 + 439 + - <http://www.freedesktop.org/software/systemd/man/udev.html> 440 + 441 + FUSE 442 + ---- 443 + 444 + - <https://github.com/libfuse/libfuse/releases> 445 + 446 + mcelog 447 + ------ 448 + 449 + - <http://www.mcelog.org/> 450 + 451 + Rete 452 + **** 453 + 454 + PPP 455 + --- 456 + 457 + - <ftp://ftp.samba.org/pub/ppp/> 458 + 459 + Isdn4k-utils 460 + ------------ 461 + 462 + - <ftp://ftp.isdn4linux.de/pub/isdn4linux/utils/> 463 + 464 + NFS-utils 465 + --------- 466 + 467 + - <http://sourceforge.net/project/showfiles.php?group_id=14> 468 + 469 + Iptables 470 + -------- 471 + 472 + - <http://www.iptables.org/downloads.html> 473 + 474 + Ip-route2 475 + --------- 476 + 477 + - <https://www.kernel.org/pub/linux/utils/net/iproute2/> 478 + 479 + OProfile 480 + -------- 481 + 482 + - <http://oprofile.sf.net/download/> 483 + 484 + NFS-Utils 485 + --------- 486 + 487 + - <http://nfs.sourceforge.net/> 488 + 489 + Documentazione del kernel 490 + ************************* 491 + 492 + Sphinx 493 + ------ 494 + 495 + - <http://www.sphinx-doc.org/>
+77 -24
Documentation/translations/it_IT/process/coding-style.rst
··· 449 449 perché è un modo semplice per aggiungere informazioni importanti per il 450 450 lettore. 451 451 452 + Non usate la parola chiave ``extern`` coi prototipi di funzione perché 453 + rende le righe più lunghe e non è strettamente necessario. 454 + 452 455 7) Centralizzare il ritorno delle funzioni 453 456 ------------------------------------------ 454 457 ··· 603 600 (* (max steps 1) 604 601 c-basic-offset))) 605 602 606 - (add-hook 'c-mode-common-hook 607 - (lambda () 608 - ;; Add kernel style 609 - (c-add-style 610 - "linux-tabs-only" 611 - '("linux" (c-offsets-alist 612 - (arglist-cont-nonempty 613 - c-lineup-gcc-asm-reg 614 - c-lineup-arglist-tabs-only)))))) 603 + (dir-locals-set-class-variables 604 + 'linux-kernel 605 + '((c-mode . ( 606 + (c-basic-offset . 8) 607 + (c-label-minimum-indentation . 0) 608 + (c-offsets-alist . ( 609 + (arglist-close . c-lineup-arglist-tabs-only) 610 + (arglist-cont-nonempty . 611 + (c-lineup-gcc-asm-reg c-lineup-arglist-tabs-only)) 612 + (arglist-intro . +) 613 + (brace-list-intro . +) 614 + (c . c-lineup-C-comments) 615 + (case-label . 0) 616 + (comment-intro . c-lineup-comment) 617 + (cpp-define-intro . +) 618 + (cpp-macro . -1000) 619 + (cpp-macro-cont . +) 620 + (defun-block-intro . +) 621 + (else-clause . 0) 622 + (func-decl-cont . +) 623 + (inclass . +) 624 + (inher-cont . c-lineup-multi-inher) 625 + (knr-argdecl-intro . 0) 626 + (label . -1000) 627 + (statement . 0) 628 + (statement-block-intro . +) 629 + (statement-case-intro . +) 630 + (statement-cont . +) 631 + (substatement . +) 632 + )) 633 + (indent-tabs-mode . t) 634 + (show-trailing-whitespace . t) 635 + )))) 615 636 616 - (add-hook 'c-mode-hook 617 - (lambda () 618 - (let ((filename (buffer-file-name))) 619 - ;; Enable kernel mode for the appropriate files 620 - (when (and filename 621 - (string-match (expand-file-name "~/src/linux-trees") 622 - filename)) 623 - (setq indent-tabs-mode t) 624 - (setq show-trailing-whitespace t) 625 - (c-set-style "linux-tabs-only"))))) 637 + (dir-locals-set-directory-class 638 + (expand-file-name "~/src/linux-trees") 639 + 'linux-kernel) 626 640 627 641 Questo farà funzionare meglio emacs con lo stile del kernel per i file che 628 642 si trovano nella cartella ``~/src/linux-trees``. ··· 949 929 che ritornano un puntatore; queste utilizzano NULL o ERR_PTR come meccanismo 950 930 di notifica degli errori. 951 931 952 - 17) Non reinventate le macro del kernel 932 + 17) L'uso di bool 933 + ----------------- 934 + 935 + Nel kernel Linux il tipo bool deriva dal tipo _Bool dello standard C99. 936 + Un valore bool può assumere solo i valori 0 o 1, e implicitamente o 937 + esplicitamente la conversione a bool converte i valori in vero (*true*) o 938 + falso (*false*). Quando si usa un tipo bool il costrutto !! non sarà più 939 + necessario, e questo va ad eliminare una certa serie di bachi. 940 + 941 + Quando si usano i valori booleani, dovreste utilizzare le definizioni di true 942 + e false al posto dei valori 1 e 0. 943 + 944 + Per il valore di ritorno delle funzioni e per le variabili sullo stack, l'uso 945 + del tipo bool è sempre appropriato. L'uso di bool viene incoraggiato per 946 + migliorare la leggibilità e spesso è molto meglio di 'int' nella gestione di 947 + valori booleani. 948 + 949 + Non usate bool se per voi sono importanti l'ordine delle righe di cache o 950 + la loro dimensione; la dimensione e l'allineamento cambia a seconda 951 + dell'architettura per la quale è stato compilato. Le strutture che sono state 952 + ottimizzate per l'allineamento o la dimensione non dovrebbero usare bool. 953 + 954 + Se una struttura ha molti valori true/false, considerate l'idea di raggrupparli 955 + in un intero usando campi da 1 bit, oppure usate un tipo dalla larghezza fissa, 956 + come u8. 957 + 958 + Come per gli argomenti delle funzioni, molti valori true/false possono essere 959 + raggruppati in un singolo argomento a bit denominato 'flags'; spesso 'flags' è 960 + un'alternativa molto più leggibile se si hanno valori costanti per true/false. 961 + 962 + Detto ciò, un uso parsimonioso di bool nelle strutture dati e negli argomenti 963 + può migliorare la leggibilità. 964 + 965 + 18) Non reinventate le macro del kernel 953 966 --------------------------------------- 954 967 955 968 Il file di intestazione include/linux/kernel.h contiene un certo numero ··· 1006 953 d'intestazione per scoprire cos'altro è stato definito che non dovreste 1007 954 reinventare nel vostro codice. 1008 955 1009 - 18) Linee di configurazione degli editor e altre schifezze 956 + 19) Linee di configurazione degli editor e altre schifezze 1010 957 ----------------------------------------------------------- 1011 958 1012 959 Alcuni editor possono interpretare dei parametri di configurazione integrati ··· 1040 987 modalità su misura, oppure potrebbero avere qualche altra magia per far 1041 988 funzionare bene l'indentazione. 1042 989 1043 - 19) Inline assembly 1044 - --------------------- 990 + 20) Inline assembly 991 + ------------------- 1045 992 1046 993 Nel codice specifico per un'architettura, potreste aver bisogno di codice 1047 994 *inline assembly* per interfacciarvi col processore o con una funzionalità ··· 1073 1020 "more_magic %reg2, %reg3" 1074 1021 : /* outputs */ : /* inputs */ : /* clobbers */); 1075 1022 1076 - 20) Compilazione sotto condizione 1023 + 21) Compilazione sotto condizione 1077 1024 --------------------------------- 1078 1025 1079 1026 Ovunque sia possibile, non usate le direttive condizionali del preprocessore
+1 -12
Documentation/translations/it_IT/process/howto.rst
··· 234 234 sorgente in un formato autoreferenziale ed indicizzato. Un eccellente ed 235 235 aggiornata fonte di consultazione del codice del kernel la potete trovare qui: 236 236 237 - http://lxr.free-electrons.com/ 237 + https://elixir.bootlin.com/ 238 238 239 239 240 240 Il processo di sviluppo ··· 244 244 245 245 - I sorgenti kernel 4.x 246 246 - I sorgenti stabili del kernel 4.x.y -stable 247 - - Le modifiche in 4.x -git 248 247 - Sorgenti dei sottosistemi del kernel e le loro modifiche 249 248 - Il kernel 4.x -next per test d'integrazione 250 249 ··· 311 312 Il file Documentation/process/stable-kernel-rules.rst (nei sorgenti) documenta 312 313 quali tipologie di modifiche sono accettate per i sorgenti -stable, e come 313 314 avviene il processo di rilascio. 314 - 315 - Le modifiche in 4.x -git 316 - ~~~~~~~~~~~~~~~~~~~~~~~~ 317 - 318 - Queste sono istantanee quotidiane del kernel di Linus e sono gestite in 319 - una repositorio git (da qui il nome). Queste modifiche sono solitamente 320 - rilasciate giornalmente e rappresentano l'attuale stato dei sorgenti di 321 - Linus. Queste sono da considerarsi più sperimentali di un -rc in quanto 322 - generate automaticamente senza nemmeno aver dato una rapida occhiata 323 - per verificarne lo stato. 324 315 325 316 326 317 Sorgenti dei sottosistemi del kernel e le loro patch
+199 -3
Documentation/translations/it_IT/process/stable-api-nonsense.rst
··· 1 1 .. include:: ../disclaimer-ita.rst 2 2 3 3 :Original: :ref:`Documentation/process/stable-api-nonsense.rst <stable_api_nonsense>` 4 - 4 + :Translator: Federico Vaga <federico.vaga@vaga.pv.it> 5 5 6 6 .. _it_stable_api_nonsense: 7 7 8 8 L'interfaccia dei driver per il kernel Linux 9 9 ============================================ 10 10 11 - .. warning:: 11 + (tutte le risposte alle vostre domande e altro) 12 12 13 - TODO ancora da tradurre 13 + Greg Kroah-Hartman <greg@kroah.com> 14 + 15 + Questo è stato scritto per cercare di spiegare perché Linux **non ha 16 + un'interfaccia binaria, e non ha nemmeno un'interfaccia stabile**. 17 + 18 + .. note:: 19 + 20 + Questo articolo parla di interfacce **interne al kernel**, non delle 21 + interfacce verso lo spazio utente. 22 + 23 + L'interfaccia del kernel verso lo spazio utente è quella usata dai 24 + programmi, ovvero le chiamate di sistema. Queste interfacce sono **molto** 25 + stabili nel tempo e non verranno modificate. Ho vecchi programmi che sono 26 + stati compilati su un kernel 0.9 (circa) e tuttora funzionano sulle versioni 27 + 2.6 del kernel. Queste interfacce sono quelle che gli utenti e i 28 + programmatori possono considerare stabili. 29 + 30 + Riepilogo generale 31 + ------------------ 32 + 33 + Pensate di volere un'interfaccia del kernel stabile, ma in realtà non la 34 + volete, e nemmeno sapete di non volerla. Quello che volete è un driver 35 + stabile che funzioni, e questo può essere ottenuto solo se il driver si trova 36 + nei sorgenti del kernel. Ci sono altri vantaggi nell'avere il proprio driver 37 + nei sorgenti del kernel, ognuno dei quali hanno reso Linux un sistema operativo 38 + robusto, stabile e maturo; questi sono anche i motivi per cui avete scelto 39 + Linux. 40 + 41 + Introduzione 42 + ------------ 43 + 44 + Solo le persone un po' strambe vorrebbero scrivere driver per il kernel con 45 + la costante preoccupazione per i cambiamenti alle interfacce interne. Per il 46 + resto del mondo, queste interfacce sono invisibili o non di particolare 47 + interesse. 48 + 49 + Innanzitutto, non tratterò **alcun** problema legale riguardante codice 50 + chiuso, nascosto, avvolto, blocchi binari, o qualsia altra cosa che descrive 51 + driver che non hanno i propri sorgenti rilasciati con licenza GPL. Per favore 52 + fate riferimento ad un avvocato per qualsiasi questione legale, io sono un 53 + programmatore e perciò qui vi parlerò soltanto delle questioni tecniche (non 54 + per essere superficiali sui problemi legali, sono veri e dovete esserne a 55 + conoscenza in ogni circostanza). 56 + 57 + Dunque, ci sono due tematiche principali: interfacce binarie del kernel e 58 + interfacce stabili nei sorgenti. Ognuna dipende dall'altra, ma discuteremo 59 + prima delle cose binarie per toglierle di mezzo. 60 + 61 + Interfaccia binaria del kernel 62 + ------------------------------ 63 + 64 + Supponiamo d'avere un'interfaccia stabile nei sorgenti del kernel, di 65 + conseguenza un'interfaccia binaria dovrebbe essere anche'essa stabile, giusto? 66 + Sbagliato. Prendete in considerazione i seguenti fatti che riguardano il 67 + kernel Linux: 68 + 69 + - A seconda della versione del compilatore C che state utilizzando, diverse 70 + strutture dati del kernel avranno un allineamento diverso, e possibilmente 71 + un modo diverso di includere le funzioni (renderle inline oppure no). 72 + L'organizzazione delle singole funzioni non è poi così importante, ma la 73 + spaziatura (*padding*) nelle strutture dati, invece, lo è. 74 + 75 + - In base alle opzioni che sono state selezionate per generare il kernel, 76 + un certo numero di cose potrebbero succedere: 77 + 78 + - strutture dati differenti potrebbero contenere campi differenti 79 + - alcune funzioni potrebbero non essere implementate (per esempio, 80 + alcuni *lock* spariscono se compilati su sistemi mono-processore) 81 + - la memoria interna del kernel può essere allineata in differenti modi 82 + a seconda delle opzioni di compilazione. 83 + 84 + - Linux funziona su una vasta gamma di architetture di processore. Non esiste 85 + alcuna possibilità che il binario di un driver per un'architettura funzioni 86 + correttamente su un'altra. 87 + 88 + Alcuni di questi problemi possono essere risolti compilando il proprio modulo 89 + con la stessa identica configurazione del kernel, ed usando la stessa versione 90 + del compilatore usato per compilare il kernel. Questo è sufficiente se volete 91 + fornire un modulo per uno specifico rilascio su una specifica distribuzione 92 + Linux. Ma moltiplicate questa singola compilazione per il numero di 93 + distribuzioni Linux e il numero dei rilasci supportati da quest'ultime e vi 94 + troverete rapidamente in un incubo fatto di configurazioni e piattaforme 95 + hardware (differenti processori con differenti opzioni); dunque, anche per il 96 + singolo rilascio di un modulo, dovreste creare differenti versioni dello 97 + stesso. 98 + 99 + Fidatevi, se tenterete questa via, col tempo, diventerete pazzi; l'ho imparato 100 + a mie spese molto tempo fa... 101 + 102 + 103 + Interfaccia stabile nei sorgenti del kernel 104 + ------------------------------------------- 105 + 106 + Se parlate con le persone che cercano di mantenere aggiornato un driver per 107 + Linux ma che non si trova nei sorgenti, allora per queste persone l'argomento 108 + sarà "ostico". 109 + 110 + Lo sviluppo del kernel Linux è continuo e viaggia ad un ritmo sostenuto, e non 111 + rallenta mai. Perciò, gli sviluppatori del kernel trovano bachi nelle 112 + interfacce attuali, o trovano modi migliori per fare le cose. Se le trovano, 113 + allora le correggeranno per migliorarle. In questo frangente, i nomi delle 114 + funzioni potrebbero cambiare, le strutture dati potrebbero diventare più grandi 115 + o più piccole, e gli argomenti delle funzioni potrebbero essere ripensati. 116 + Se questo dovesse succedere, nello stesso momento, tutte le istanze dove questa 117 + interfaccia viene utilizzata verranno corrette, garantendo che tutto continui 118 + a funzionare senza problemi. 119 + 120 + Portiamo ad esempio l'interfaccia interna per il sottosistema USB che ha subito 121 + tre ristrutturazioni nel corso della sua vita. Queste ristrutturazioni furono 122 + fatte per risolvere diversi problemi: 123 + 124 + - È stato fatto un cambiamento da un flusso di dati sincrono ad uno 125 + asincrono. Questo ha ridotto la complessità di molti driver e ha 126 + aumentato la capacità di trasmissione di tutti i driver fino a raggiungere 127 + quasi la velocità massima possibile. 128 + - È stato fatto un cambiamento nell'allocazione dei pacchetti da parte del 129 + sottosistema USB per conto dei driver, cosicché ora i driver devono fornire 130 + più informazioni al sottosistema USB al fine di correggere un certo numero 131 + di stalli. 132 + 133 + Questo è completamente l'opposto di quello che succede in alcuni sistemi 134 + operativi proprietari che hanno dovuto mantenere, nel tempo, il supporto alle 135 + vecchie interfacce USB. I nuovi sviluppatori potrebbero usare accidentalmente 136 + le vecchie interfacce e sviluppare codice nel modo sbagliato, portando, di 137 + conseguenza, all'instabilità del sistema. 138 + 139 + In entrambe gli scenari, gli sviluppatori hanno ritenuto che queste importanti 140 + modifiche erano necessarie, e quindi le hanno fatte con qualche sofferenza. 141 + Se Linux avesse assicurato di mantenere stabile l'interfaccia interna, si 142 + sarebbe dovuto procedere alla creazione di una nuova, e quelle vecchie, e 143 + mal funzionanti, avrebbero dovuto ricevere manutenzione, creando lavoro 144 + aggiuntivo per gli sviluppatori del sottosistema USB. Dato che gli 145 + sviluppatori devono dedicare il proprio tempo a questo genere di lavoro, 146 + chiedergli di dedicarne dell'altro, senza benefici, magari gratuitamente, non 147 + è contemplabile. 148 + 149 + Le problematiche relative alla sicurezza sono molto importanti per Linux. 150 + Quando viene trovato un problema di sicurezza viene corretto in breve tempo. 151 + A volte, per prevenire il problema di sicurezza, si sono dovute cambiare 152 + delle interfacce interne al kernel. Quando è successo, allo stesso tempo, 153 + tutti i driver che usavano quelle interfacce sono stati aggiornati, garantendo 154 + la correzione definitiva del problema senza doversi preoccupare di rivederlo 155 + per sbaglio in futuro. Se non si fossero cambiate le interfacce interne, 156 + sarebbe stato impossibile correggere il problema e garantire che non si sarebbe 157 + più ripetuto. 158 + 159 + Nel tempo le interfacce del kernel subiscono qualche ripulita. Se nessuno 160 + sta più usando un'interfaccia, allora questa verrà rimossa. Questo permette 161 + al kernel di rimanere il più piccolo possibile, e garantisce che tutte le 162 + potenziali interfacce sono state verificate nel limite del possibile (le 163 + interfacce inutilizzate sono impossibili da verificare). 164 + 165 + 166 + Cosa fare 167 + --------- 168 + 169 + Dunque, se avete un driver per il kernel Linux che non si trova nei sorgenti 170 + principali del kernel, come sviluppatori, cosa dovreste fare? Rilasciare un 171 + file binario del driver per ogni versione del kernel e per ogni distribuzione, 172 + è un incubo; inoltre, tenere il passo con tutti i cambiamenti del kernel è un 173 + brutto lavoro. 174 + 175 + Semplicemente, fate sì che il vostro driver per il kernel venga incluso nei 176 + sorgenti principali (ricordatevi, stiamo parlando di driver rilasciati secondo 177 + una licenza compatibile con la GPL; se il vostro codice non ricade in questa 178 + categoria: buona fortuna, arrangiatevi, siete delle sanguisughe) 179 + 180 + Se il vostro driver è nei sorgenti del kernel e un'interfaccia cambia, il 181 + driver verrà corretto immediatamente dalla persona che l'ha modificata. Questo 182 + garantisce che sia sempre possibile compilare il driver, che funzioni, e tutto 183 + con un minimo sforzo da parte vostra. 184 + 185 + Avere il proprio driver nei sorgenti principali del kernel ha i seguenti 186 + vantaggi: 187 + 188 + - La qualità del driver aumenterà e i costi di manutenzione (per lo 189 + sviluppatore originale) diminuiranno. 190 + - Altri sviluppatori aggiungeranno nuove funzionalità al vostro driver. 191 + - Altri persone troveranno e correggeranno bachi nel vostro driver. 192 + - Altri persone troveranno degli aggiustamenti da fare al vostro driver. 193 + - Altri persone aggiorneranno il driver quando è richiesto da un cambiamento 194 + di un'interfaccia. 195 + - Il driver sarà automaticamente reso disponibile in tutte le distribuzioni 196 + Linux senza dover chiedere a nessuna di queste di aggiungerlo. 197 + 198 + Dato che Linux supporta più dispositivi di qualsiasi altro sistema operativo, 199 + e che girano su molti più tipi di processori di qualsiasi altro sistema 200 + operativo; ciò dimostra che questo modello di sviluppo qualcosa di giusto, 201 + dopo tutto, lo fa :) 202 + 203 + 204 + 205 + ------ 206 + 207 + Dei ringraziamenti vanno a Randy Dunlap, Andrew Morton, David Brownell, 208 + Hanna Linder, Robert Love, e Nishanth Aravamudan per la loro revisione 209 + e per i loro commenti sulle prime bozze di questo articolo.
+123 -4
Documentation/translations/it_IT/process/submit-checklist.rst
··· 1 1 .. include:: ../disclaimer-ita.rst 2 2 3 3 :Original: :ref:`Documentation/process/submit-checklist.rst <submitchecklist>` 4 + :Translator: Federico Vaga <federico.vaga@vaga.pv.it> 4 5 5 6 .. _it_submitchecklist: 6 7 7 - Lista delle cose da fare per inviare una modifica al kernel Linux 8 - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 8 + Lista delle verifiche da fare prima di inviare una patch per il kernel Linux 9 + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 9 10 10 - .. warning:: 11 + Qui troverete una lista di cose che uno sviluppatore dovrebbe fare per 12 + vedere le proprie patch accettate più rapidamente. 11 13 12 - TODO ancora da tradurre 14 + Tutti questi punti integrano la documentazione fornita riguardo alla 15 + sottomissione delle patch, in particolare 16 + :ref:`Documentation/translations/it_IT/process/submitting-patches.rst <it_submittingpatches>`. 17 + 18 + 1) Se state usando delle funzionalità del kernel allora includete (#include) 19 + i file che le dichiarano/definiscono. Non dipendente dal fatto che un file 20 + d'intestazione include anche quelli usati da voi. 21 + 22 + 2) Compilazione pulita: 23 + 24 + a) con le opzioni ``CONFIG`` negli stati ``=y``, ``=m`` e ``=n``. Nessun 25 + avviso/errore di ``gcc`` e nessun avviso/errore dal linker. 26 + 27 + b) con ``allnoconfig``, ``allmodconfig`` 28 + 29 + c) quando si usa ``O=builddir`` 30 + 31 + 3) Compilare per diverse architetture di processore usando strumenti per 32 + la cross-compilazione o altri. 33 + 34 + 4) Una buona architettura per la verifica della cross-compilazione è la ppc64 35 + perché tende ad usare ``unsigned long`` per le quantità a 64-bit. 36 + 37 + 5) Controllate lo stile del codice della vostra patch secondo le direttive 38 + scritte in :ref:`Documentation/translations/it_IT/process/coding-style.rst <it_codingstyle>`. 39 + Prima dell'invio della patch, usate il verificatore di stile 40 + (``script/checkpatch.pl``) per scovare le violazioni più semplici. 41 + Dovreste essere in grado di giustificare tutte le violazioni rimanenti nella 42 + vostra patch. 43 + 44 + 6) Le opzioni ``CONFIG``, nuove o modificate, non scombussolano il menu 45 + di configurazione e sono preimpostate come disabilitate a meno che non 46 + soddisfino i criteri descritti in ``Documentation/kbuild/kconfig-language.txt`` 47 + alla punto "Voci di menu: valori predefiniti". 48 + 49 + 7) Tutte le nuove opzioni ``Kconfig`` hanno un messaggio di aiuto. 50 + 51 + 8) La patch è stata accuratamente revisionata rispetto alle più importanti 52 + configurazioni ``Kconfig``. Questo è molto difficile da fare 53 + correttamente - un buono lavoro di testa sarà utile. 54 + 55 + 9) Verificare con sparse. 56 + 57 + 10) Usare ``make checkstack`` e ``make namespacecheck`` e correggere tutti i 58 + problemi rilevati. 59 + 60 + .. note:: 61 + 62 + ``checkstack`` non evidenzia esplicitamente i problemi, ma una funzione 63 + che usa più di 512 byte sullo stack è una buona candidata per una 64 + correzione. 65 + 66 + 11) Includete commenti :ref:`kernel-doc <kernel_doc>` per documentare API 67 + globali del kernel. Usate ``make htmldocs`` o ``make pdfdocs`` per 68 + verificare i commenti :ref:`kernel-doc <kernel_doc>` ed eventualmente 69 + correggerli. 70 + 71 + 12) La patch è stata verificata con le seguenti opzioni abilitate 72 + contemporaneamente: ``CONFIG_PREEMPT``, ``CONFIG_DEBUG_PREEMPT``, 73 + ``CONFIG_DEBUG_SLAB``, ``CONFIG_DEBUG_PAGEALLOC``, ``CONFIG_DEBUG_MUTEXES``, 74 + ``CONFIG_DEBUG_SPINLOCK``, ``CONFIG_DEBUG_ATOMIC_SLEEP``, 75 + ``CONFIG_PROVE_RCU`` e ``CONFIG_DEBUG_OBJECTS_RCU_HEAD``. 76 + 77 + 13) La patch è stata compilata e verificata in esecuzione con, e senza, 78 + le opzioni ``CONFIG_SMP`` e ``CONFIG_PREEMPT``. 79 + 80 + 14) Se la patch ha effetti sull'IO dei dischi, eccetera: allora dev'essere 81 + verificata con, e senza, l'opzione ``CONFIG_LBDAF``. 82 + 83 + 15) Tutti i percorsi del codice sono stati verificati con tutte le funzionalità 84 + di lockdep abilitate. 85 + 86 + 16) Tutti i nuovi elementi in ``/proc`` sono documentati in ``Documentation/``. 87 + 88 + 17) Tutti i nuovi parametri d'avvio del kernel sono documentati in 89 + ``Documentation/admin-guide/kernel-parameters.rst``. 90 + 91 + 18) Tutti i nuovi parametri dei moduli sono documentati con ``MODULE_PARM_DESC()``. 92 + 93 + 19) Tutte le nuove interfacce verso lo spazio utente sono documentate in 94 + ``Documentation/ABI/``. Leggete ``Documentation/ABI/README`` per maggiori 95 + informazioni. Le patch che modificano le interfacce utente dovrebbero 96 + essere inviate in copia anche a linux-api@vger.kernel.org. 97 + 98 + 20) Verifica che il kernel passi con successo ``make headers_check`` 99 + 100 + 21) La patch è stata verificata con l'iniezione di fallimenti in slab e 101 + nell'allocazione di pagine. Vedere ``Documentation/fault-injection/``. 102 + 103 + Se il nuovo codice è corposo, potrebbe essere opportuno aggiungere 104 + l'iniezione di fallimenti specifici per il sottosistema. 105 + 106 + 22) Il nuovo codice è stato compilato con ``gcc -W`` (usate 107 + ``make EXTRA_CFLAGS=-W``). Questo genererà molti avvisi, ma è ottimo 108 + per scovare bachi come "warning: comparison between signed and unsigned". 109 + 110 + 23) La patch è stata verificata dopo essere stata inclusa nella serie di patch 111 + -mm; questo al fine di assicurarsi che continui a funzionare assieme a 112 + tutte le altre patch in coda e i vari cambiamenti nei sottosistemi VM, VFS 113 + e altri. 114 + 115 + 24) Tutte le barriere di sincronizzazione {per esempio, ``barrier()``, 116 + ``rmb()``, ``wmb()``} devono essere accompagnate da un commento nei 117 + sorgenti che ne spieghi la logica: cosa fanno e perché. 118 + 119 + 25) Se la patch aggiunge nuove chiamate ioctl, allora aggiornate 120 + ``Documentation/ioctl/ioctl-number.txt``. 121 + 122 + 26) Se il codice che avete modificato dipende o usa una qualsiasi interfaccia o 123 + funzionalità del kernel che è associata a uno dei seguenti simboli 124 + ``Kconfig``, allora verificate che il kernel compili con diverse 125 + configurazioni dove i simboli sono disabilitati e/o ``=m`` (se c'è la 126 + possibilità) [non tutti contemporaneamente, solo diverse combinazioni 127 + casuali]: 128 + 129 + ``CONFIG_SMP``, ``CONFIG_SYSFS``, ``CONFIG_PROC_FS``, ``CONFIG_INPUT``, 130 + ``CONFIG_PCI``, ``CONFIG_BLOCK``, ``CONFIG_PM``, ``CONFIG_MAGIC_SYSRQ``, 131 + ``CONFIG_NET``, ``CONFIG_INET=n`` (ma l'ultimo con ``CONFIG_NET=y``).
+6 -2
Documentation/translations/it_IT/process/submitting-drivers.rst
··· 1 1 .. include:: ../disclaimer-ita.rst 2 2 3 3 :Original: :ref:`Documentation/process/submitting-drivers.rst <submittingdrivers>` 4 + :Translator: Federico Vaga <federico.vaga@vaga.pv.it> 4 5 5 6 .. _it_submittingdrivers: 6 7 7 8 Sottomettere driver per il kernel Linux 8 9 ======================================= 9 10 10 - .. warning:: 11 + .. note:: 11 12 12 - TODO ancora da tradurre 13 + Questo documento è vecchio e negli ultimi anni non è stato più aggiornato; 14 + dovrebbe essere aggiornato, o forse meglio, rimosso. La maggior parte di 15 + quello che viene detto qui può essere trovato anche negli altri documenti 16 + dedicati allo sviluppo. Per questo motivo il documento non verrà tradotto.
+858 -4
Documentation/translations/it_IT/process/submitting-patches.rst
··· 1 1 .. include:: ../disclaimer-ita.rst 2 2 3 3 :Original: :ref:`Documentation/process/submitting-patches.rst <submittingpatches>` 4 - 4 + :Translator: Federico Vaga <federico.vaga@vaga.pv.it> 5 5 6 6 .. _it_submittingpatches: 7 7 8 - Sottomettere modifiche: la guida essenziale per vedere il vostro codice nel kernel 9 - ================================================================================== 8 + Inviare patch: la guida essenziale per vedere il vostro codice nel kernel 9 + ========================================================================= 10 + 11 + Una persona o un'azienda che volesse inviare una patch al kernel potrebbe 12 + sentirsi scoraggiata dal processo di sottomissione, specialmente quando manca 13 + una certa familiarità col "sistema". Questo testo è una raccolta di 14 + suggerimenti che aumenteranno significativamente le probabilità di vedere le 15 + vostre patch accettate. 16 + 17 + Questo documento contiene un vasto numero di suggerimenti concisi. Per 18 + maggiori dettagli su come funziona il processo di sviluppo del kernel leggete 19 + :ref:`Documentation/translations/it_IT/process <it_development_process_main>`. 20 + Leggete anche :ref:`Documentation/translations/it_IT/process/submit-checklist.rst <it_submitchecklist>` 21 + per una lista di punti da verificare prima di inviare del codice. Se state 22 + inviando un driver, allora leggete anche :ref:`Documentation/translations/it_IT/process/submitting-drivers.rst <it_submittingdrivers>`; 23 + per delle patch relative alle associazioni per Device Tree leggete 24 + Documentation/devicetree/bindings/submitting-patches.txt. 25 + 26 + Molti di questi passi descrivono il comportamento di base del sistema di 27 + controllo di versione ``git``; se utilizzate ``git`` per preparare le vostre 28 + patch molto del lavoro più ripetitivo lo troverete già fatto per voi, tuttavia 29 + dovete preparare e documentare un certo numero di patch. Generalmente, l'uso 30 + di ``git`` renderà la vostra vita di sviluppatore del kernel più facile. 31 + 32 + 0) Ottenere i sorgenti attuali 33 + ------------------------------ 34 + 35 + Se non avete un repositorio coi sorgenti del kernel più recenti, allora usate 36 + ``git`` per ottenerli. Vorrete iniziare col repositorio principale che può 37 + essere recuperato col comando:: 38 + 39 + git clone git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git 40 + 41 + Notate, comunque, che potreste non voler sviluppare direttamente coi sorgenti 42 + principali del kernel. La maggior parte dei manutentori hanno i propri 43 + sorgenti e desiderano che le patch siano preparate basandosi su di essi. 44 + Guardate l'elemento **T:** per un determinato sottosistema nel file MAINTANERS 45 + che troverete nei sorgenti, o semplicemente chiedete al manutentore nel caso 46 + in cui i sorgenti da usare non siano elencati il quel file. 47 + 48 + Esiste ancora la possibilità di scaricare un rilascio del kernel come archivio 49 + tar (come descritto in una delle prossime sezioni), ma questa è la via più 50 + complicata per sviluppare per il kernel. 51 + 52 + 1) ``diff -up`` 53 + --------------- 54 + 55 + Se dovete produrre le vostre patch a mano, usate ``diff -up`` o ``diff -uprN`` 56 + per crearle. Git produce di base le patch in questo formato; se state 57 + usando ``git``, potete saltare interamente questa sezione. 58 + 59 + Tutte le modifiche al kernel Linux avvengono mediate patch, come descritte 60 + in :manpage:`diff(1)`. Quando create la vostra patch, assicuratevi di 61 + crearla nel formato "unified diff", come l'argomento ``-u`` di 62 + :manpage:`diff(1)`. 63 + Inoltre, per favore usate l'argomento ``-p`` per mostrare la funzione C 64 + alla quale si riferiscono le diverse modifiche - questo rende il risultato 65 + di ``diff`` molto più facile da leggere. Le patch dovrebbero essere basate 66 + sulla radice dei sorgenti del kernel, e non sulle sue sottocartelle. 67 + 68 + Per creare una patch per un singolo file, spesso è sufficiente fare:: 69 + 70 + SRCTREE= linux 71 + MYFILE= drivers/net/mydriver.c 72 + 73 + cd $SRCTREE 74 + cp $MYFILE $MYFILE.orig 75 + vi $MYFILE # make your change 76 + cd .. 77 + diff -up $SRCTREE/$MYFILE{.orig,} > /tmp/patch 78 + 79 + Per creare una patch per molteplici file, dovreste spacchettare i sorgenti 80 + "vergini", o comunque non modificati, e fare un ``diff`` coi vostri. 81 + Per esempio:: 82 + 83 + MYSRC= /devel/linux 84 + 85 + tar xvfz linux-3.19.tar.gz 86 + mv linux-3.19 linux-3.19-vanilla 87 + diff -uprN -X linux-3.19-vanilla/Documentation/dontdiff \ 88 + linux-3.19-vanilla $MYSRC > /tmp/patch 89 + 90 + ``dontdiff`` è una lista di file che sono generati durante il processo di 91 + compilazione del kernel; questi dovrebbero essere ignorati in qualsiasi 92 + patch generata con :manpage:`diff(1)`. 93 + 94 + Assicuratevi che la vostra patch non includa file che non ne fanno veramente 95 + parte. Al fine di verificarne la correttezza, assicuratevi anche di 96 + revisionare la vostra patch -dopo- averla generata con :manpage:`diff(1)`. 97 + 98 + Se le vostre modifiche producono molte differenze, allora dovrete dividerle 99 + in patch indipendenti che modificano le cose in passi logici; leggete 100 + :ref:`split_changes`. Questo faciliterà la revisione da parte degli altri 101 + sviluppatori, il che è molto importante se volete che la patch venga accettata. 102 + 103 + Se state utilizzando ``git``, ``git rebase -i`` può aiutarvi nel procedimento. 104 + Se non usate ``git``, un'alternativa popolare è ``quilt`` 105 + <http://savannah.nongnu.org/projects/quilt>. 106 + 107 + .. _it_describe_changes: 108 + 109 + 2) Descrivete le vostre modifiche 110 + --------------------------------- 111 + 112 + Descrivete il vostro problema. Esiste sempre un problema che via ha spinto 113 + ha fare il vostro lavoro, che sia la correzione di un baco da una riga o una 114 + nuova funzionalità da 5000 righe di codice. Convincete i revisori che vale 115 + la pena risolvere il vostro problema e che ha senso continuare a leggere oltre 116 + al primo paragrafo. 117 + 118 + Descrivete ciò che sarà visibile agli utenti. Chiari incidenti nel sistema 119 + e blocchi sono abbastanza convincenti, ma non tutti i bachi sono così evidenti. 120 + Anche se il problema è stato scoperto durante la revisione del codice, 121 + descrivete l'impatto che questo avrà sugli utenti. Tenete presente che 122 + la maggior parte delle installazioni Linux usa un kernel che arriva dai 123 + sorgenti stabili o dai sorgenti di una distribuzione particolare che prende 124 + singolarmente le patch dai sorgenti principali; quindi, includete tutte 125 + le informazioni che possono essere utili a capire le vostre modifiche: 126 + le circostanze che causano il problema, estratti da dmesg, descrizioni di 127 + un incidente di sistema, prestazioni di una regressione, picchi di latenza, 128 + blocchi, eccetera. 129 + 130 + Quantificare le ottimizzazioni e i compromessi. Se affermate di aver 131 + migliorato le prestazioni, il consumo di memoria, l'impatto sollo stack, 132 + o la dimensione del file binario, includete dei numeri a supporto della 133 + vostra dichiarazione. Ma ricordatevi di descrivere anche eventuali costi 134 + che non sono ovvi. Solitamente le ottimizzazioni non sono gratuite, ma sono 135 + un compromesso fra l'uso di CPU, la memoria e la leggibilità; o, quando si 136 + parla di ipotesi euristiche, fra differenti carichi. Descrivete i lati 137 + negativi che vi aspettate dall'ottimizzazione cosicché i revisori possano 138 + valutare i costi e i benefici. 139 + 140 + Una volta che il problema è chiaro, descrivete come lo risolvete andando 141 + nel dettaglio tecnico. È molto importante che descriviate la modifica 142 + in un inglese semplice cosicché i revisori possano verificare che il codice si 143 + comporti come descritto. 144 + 145 + I manutentori vi saranno grati se scrivete la descrizione della patch in un 146 + formato che sia compatibile con il gestore dei sorgenti usato dal kernel, 147 + ``git``, come un "commit log". Leggete :ref:`it_explicit_in_reply_to`. 148 + 149 + Risolvete solo un problema per patch. Se la vostra descrizione inizia ad 150 + essere lunga, potrebbe essere un segno che la vostra patch necessita d'essere 151 + divisa. Leggete :ref:`split_changes`. 152 + 153 + Quando inviate o rinviate una patch o una serie, includete la descrizione 154 + completa delle modifiche e la loro giustificazione. Non limitatevi a dire che 155 + questa è la versione N della patch (o serie). Non aspettatevi che i 156 + manutentori di un sottosistema vadano a cercare le versioni precedenti per 157 + cercare la descrizione da aggiungere. In pratica, la patch (o serie) e la sua 158 + descrizione devono essere un'unica cosa. Questo aiuta i manutentori e i 159 + revisori. Probabilmente, alcuni revisori non hanno nemmeno ricevuto o visto 160 + le versioni precedenti della patch. 161 + 162 + Descrivete le vostro modifiche usando l'imperativo, per esempio "make xyzzy 163 + do frotz" piuttosto che "[This patch] makes xyzzy do frotz" or "[I] changed 164 + xyzzy to do frotz", come se steste dando ordini al codice di cambiare il suo 165 + comportamento. 166 + 167 + Se la patch corregge un baco conosciuto, fare riferimento a quel baco inserendo 168 + il suo numero o il suo URL. Se la patch è la conseguenza di una discussione 169 + su una lista di discussione, allora fornite l'URL all'archivio di quella 170 + discussione; usate i collegamenti a https://lkml.kernel.org/ con il 171 + ``Message-Id``, in questo modo vi assicurerete che il collegamento non diventi 172 + invalido nel tempo. 173 + 174 + Tuttavia, cercate di rendere la vostra spiegazione comprensibile anche senza 175 + far riferimento a fonti esterne. In aggiunta ai collegamenti a bachi e liste 176 + di discussione, riassumente i punti più importanti della discussione che hanno 177 + portato alla creazione della patch. 178 + 179 + Se volete far riferimento a uno specifico commit, non usate solo 180 + l'identificativo SHA-1. Per cortesia, aggiungete anche la breve riga 181 + riassuntiva del commit per rendere la chiaro ai revisori l'oggetto. 182 + Per esempio:: 183 + 184 + Commit e21d2170f36602ae2708 ("video: remove unnecessary 185 + platform_set_drvdata()") removed the unnecessary 186 + platform_set_drvdata(), but left the variable "dev" unused, 187 + delete it. 188 + 189 + Dovreste anche assicurarvi di usare almeno i primi 12 caratteri 190 + dell'identificativo SHA-1. Il repositorio del kernel ha *molti* oggetti e 191 + questo rende possibile la collisione fra due identificativi con pochi 192 + caratteri. Tenete ben presente che anche se oggi non ci sono collisioni con il 193 + vostro identificativo a 6 caratteri, potrebbero essercene fra 5 anni da oggi. 194 + 195 + Se la vostra patch corregge un baco in un commit specifico, per esempio avete 196 + trovato un problema usando ``git bisect``, per favore usate l'etichetta 197 + 'Fixes:' indicando i primi 12 caratteri dell'identificativo SHA-1 seguiti 198 + dalla riga riassuntiva. Per esempio:: 199 + 200 + Fixes: e21d2170f366 ("video: remove unnecessary platform_set_drvdata()") 201 + 202 + La seguente configurazione di ``git config`` può essere usata per formattare 203 + i risultati dei comandi ``git log`` o ``git show`` come nell'esempio 204 + precedente:: 205 + 206 + [core] 207 + abbrev = 12 208 + [pretty] 209 + fixes = Fixes: %h (\"%s\") 210 + 211 + .. _it_split_changes: 212 + 213 + 3) Separate le vostre modifiche 214 + ------------------------------- 215 + 216 + Separate ogni **cambiamento logico** in patch distinte. 217 + 218 + Per esempio, se i vostri cambiamenti per un singolo driver includono 219 + sia delle correzioni di bachi che miglioramenti alle prestazioni, 220 + allora separateli in due o più patch. Se i vostri cambiamenti includono 221 + un aggiornamento dell'API e un nuovo driver che lo sfrutta, allora separateli 222 + in due patch. 223 + 224 + D'altro canto, se fate una singola modifica su più file, raggruppate tutte 225 + queste modifiche in una singola patch. Dunque, un singolo cambiamento logico 226 + è contenuto in una sola patch. 227 + 228 + Il punto da ricordare è che ogni modifica dovrebbe fare delle modifiche 229 + che siano facilmente comprensibili e che possano essere verificate dai revisori. 230 + Ogni patch dovrebbe essere giustificabile di per sé. 231 + 232 + Se al fine di ottenere un cambiamento completo una patch dipende da un'altra, 233 + va bene. Semplicemente scrivete una nota nella descrizione della patch per 234 + farlo presente: **"this patch depends on patch X"**. 235 + 236 + Quando dividete i vostri cambiamenti in una serie di patch, prestate 237 + particolare attenzione alla verifica di ogni patch della serie; per ognuna 238 + il kernel deve compilare ed essere eseguito correttamente. Gli sviluppatori 239 + che usano ``git bisect`` per scovare i problemi potrebbero finire nel mezzo 240 + della vostra serie in un punto qualsiasi; non vi saranno grati se nel mezzo 241 + avete introdotto dei bachi. 242 + 243 + Se non potete condensare la vostra serie di patch in una più piccola, allora 244 + pubblicatene una quindicina alla volta e aspettate che vengano revisionate 245 + ed integrate. 246 + 247 + 248 + 4) Verificate lo stile delle vostre modifiche 249 + --------------------------------------------- 250 + 251 + Controllate che la vostra patch non violi lo stile del codice, maggiori 252 + dettagli sono disponibili in :ref:`Documentation/translations/it_IT/process/coding-style.rst <it_codingstyle>`. 253 + Non farlo porta semplicemente a una perdita di tempo da parte dei revisori e 254 + voi vedrete la vostra patch rifiutata, probabilmente senza nemmeno essere stata 255 + letta. 256 + 257 + Un'eccezione importante si ha quando del codice viene spostato da un file 258 + ad un altro -- in questo caso non dovreste modificare il codice spostato 259 + per nessun motivo, almeno non nella patch che lo sposta. Questo separa 260 + chiaramente l'azione di spostare il codice e il vostro cambiamento. 261 + Questo aiuta enormemente la revisione delle vere differenze e permette agli 262 + strumenti di tenere meglio la traccia della storia del codice. 263 + 264 + Prima di inviare una patch, verificatene lo stile usando l'apposito 265 + verificatore (scripts/checkpatch.pl). Da notare, comunque, che il verificator 266 + di stile dovrebbe essere visto come una guida, non come un sostituto al 267 + giudizio umano. Se il vostro codice è migliore nonostante una violazione 268 + dello stile, probabilmente è meglio lasciarlo com'è. 269 + 270 + Il verificatore ha tre diversi livelli di severità: 271 + - ERROR: le cose sono molto probabilmente sbagliate 272 + - WARNING: le cose necessitano d'essere revisionate con attenzione 273 + - CHECK: le cose necessitano di un pensierino 274 + 275 + Dovreste essere in grado di giustificare tutte le eventuali violazioni rimaste 276 + nella vostra patch. 277 + 278 + 279 + 5) Selezionate i destinatari della vostra patch 280 + ----------------------------------------------- 281 + 282 + Dovreste sempre inviare una copia della patch ai manutentori dei sottosistemi 283 + interessati dalle modifiche; date un'occhiata al file MAINTAINERS e alla storia 284 + delle revisioni per scoprire chi si occupa del codice. Lo script 285 + scripts/get_maintainer.pl può esservi d'aiuto. Se non riuscite a trovare un 286 + manutentore per il sottosistema su cui state lavorando, allora Andrew Morton 287 + (akpm@linux-foundation.org) sarà la vostra ultima possibilità. 288 + 289 + Normalmente, dovreste anche scegliere una lista di discussione a cui inviare 290 + la vostra serie di patch. La lista di discussione linux-kernel@vger.kernel.org 291 + è proprio l'ultima spiaggia, il volume di email su questa lista fa si che 292 + diversi sviluppatori non la seguano. Guardate nel file MAINTAINERS per trovare 293 + la lista di discussione dedicata ad un sottosistema; probabilmente lì la vostra 294 + patch riceverà molta più attenzione. Tuttavia, per favore, non spammate le 295 + liste di discussione che non sono interessate al vostro lavoro. 296 + 297 + Molte delle liste di discussione relative al kernel vengono ospitate su 298 + vger.kernel.org; potete trovare un loro elenco alla pagina 299 + http://vger.kernel.org/vger-lists.html. Tuttavia, ci sono altre liste di 300 + discussione ospitate altrove. 301 + 302 + Non inviate più di 15 patch alla volta sulle liste di discussione vger!!! 303 + 304 + L'ultimo giudizio sull'integrazione delle modifiche accettate spetta a 305 + Linux Torvalds. Il suo indirizzo e-mail è <torvalds@linux-foundation.org>. 306 + Riceve moltissime e-mail, e, a questo punto, solo poche patch passano 307 + direttamente attraverso il suo giudizio; quindi, dovreste fare del vostro 308 + meglio per -evitare di- inviargli e-mail. 309 + 310 + Se avete una patch che corregge un baco di sicurezza che potrebbe essere 311 + sfruttato, inviatela a security@kernel.org. Per bachi importanti, un breve 312 + embargo potrebbe essere preso in considerazione per dare il tempo alle 313 + distribuzioni di prendere la patch e renderla disponibile ai loro utenti; 314 + in questo caso, ovviamente, la patch non dovrebbe essere inviata su alcuna 315 + lista di discussione pubblica. 316 + 317 + Patch che correggono bachi importanti su un kernel già rilasciato, dovrebbero 318 + essere inviate ai manutentori dei kernel stabili aggiungendo la seguente riga:: 319 + 320 + Cc: stable@vger.kernel.org 321 + 322 + nella vostra patch, nell'area dedicata alle firme (notate, NON come destinatario 323 + delle e-mail). In aggiunta a questo file, dovreste leggere anche 324 + :ref:`Documentation/translations/it_IT/process/stable-kernel-rules.rst <it_stable_kernel_rules>` 325 + 326 + Tuttavia, notate, che alcuni manutentori di sottosistema preferiscono avere 327 + l'ultima parola su quali patch dovrebbero essere aggiunte ai kernel stabili. 328 + La rete di manutentori, in particolare, non vorrebbe vedere i singoli 329 + sviluppatori aggiungere alle loro patch delle righe come quella sopracitata. 330 + 331 + Se le modifiche hanno effetti sull'interfaccia con lo spazio utente, per favore 332 + inviate una patch per le pagine man ai manutentori di suddette pagine (elencati 333 + nel file MAINTAINERS), o almeno una notifica circa la vostra modifica, 334 + cosicché l'informazione possa trovare la sua strada nel manuale. Le modifiche 335 + all'API dello spazio utente dovrebbero essere inviate in copia anche a 336 + linux-api@vger.kernel.org. 337 + 338 + Per le piccole patch potreste aggiungere in CC l'indirizzo 339 + *Trivial Patch Monkey trivial@kernel.org* che ha lo scopo di raccogliere 340 + le patch "banali". Date uno sguardo al file MAINTAINERS per vedere chi 341 + è l'attuale amministratore. 342 + 343 + Le patch banali devono rientrare in una delle seguenti categorie: 344 + 345 + - errori grammaticali nella documentazione 346 + - errori grammaticali negli errori che potrebbero rompere :manpage:`grep(1)` 347 + - correzione di avvisi di compilazione (riempirsi di avvisi inutili è negativo) 348 + - correzione di errori di compilazione (solo se correggono qualcosa sul serio) 349 + - rimozione di funzioni/macro deprecate 350 + - sostituzione di codice non potabile con uno portabile (anche in codice 351 + specifico per un'architettura, dato che le persone copiano, fintanto che 352 + la modifica sia banale) 353 + - qualsiasi modifica dell'autore/manutentore di un file (in pratica 354 + "patch monkey" in modalità ritrasmissione) 355 + 356 + 357 + 6) Niente: MIME, links, compressione, allegati. Solo puro testo 358 + ---------------------------------------------------------------- 359 + 360 + Linus e gli altri sviluppatori del kernel devono poter commentare 361 + le modifiche che sottomettete. Per uno sviluppatore è importante 362 + essere in grado di "citare" le vostre modifiche, usando normali 363 + programmi di posta elettronica, cosicché sia possibile commentare 364 + una porzione specifica del vostro codice. 365 + 366 + Per questa ragione tutte le patch devono essere inviate via e-mail 367 + come testo. 10 368 11 369 .. warning:: 12 370 13 - TODO ancora da tradurre 371 + Se decidete di copiare ed incollare la patch nel corpo dell'e-mail, state 372 + attenti che il vostro programma non corrompa il contenuto con andate 373 + a capo automatiche. 374 + 375 + La patch non deve essere un allegato MIME, compresso o meno. Molti 376 + dei più popolari programmi di posta elettronica non trasmettono un allegato 377 + MIME come puro testo, e questo rende impossibile commentare il vostro codice. 378 + Inoltre, un allegato MIME rende l'attività di Linus più laboriosa, diminuendo 379 + così la possibilità che il vostro allegato-MIME venga accettato. 380 + 381 + Eccezione: se il vostro servizio di posta storpia le patch, allora qualcuno 382 + potrebbe chiedervi di rinviarle come allegato MIME. 383 + 384 + Leggete :ref:`Documentation/translations/it_IT/process/email-clients.rst <it_email_clients>` 385 + per dei suggerimenti sulla configurazione del programmi di posta elettronica 386 + per l'invio di patch intatte. 387 + 388 + 7) Dimensione delle e-mail 389 + -------------------------- 390 + 391 + Le grosse modifiche non sono adatte ad una lista di discussione, e nemmeno 392 + per alcuni manutentori. Se la vostra patch, non compressa, eccede i 300 kB 393 + di spazio, allora caricatela in una spazio accessibile su internet fornendo 394 + l'URL (collegamento) ad essa. Ma notate che se la vostra patch eccede i 300 kB 395 + è quasi certo che necessiti comunque di essere spezzettata. 396 + 397 + 8) Rispondere ai commenti di revisione 398 + -------------------------------------- 399 + 400 + Quasi certamente i revisori vi invieranno dei commenti su come migliorare 401 + la vostra patch. Dovete rispondere a questi commenti; ignorare i revisori 402 + è un ottimo modo per essere ignorati. Riscontri o domande che non conducono 403 + ad una modifica del codice quasi certamente dovrebbero portare ad un commento 404 + nel changelog cosicché il prossimo revisore potrà meglio comprendere cosa stia 405 + accadendo. 406 + 407 + Assicuratevi di dire ai revisori quali cambiamenti state facendo e di 408 + ringraziarli per il loro tempo. Revisionare codice è un lavoro faticoso e che 409 + richiede molto tempo, e a volte i revisori diventano burberi. Tuttavia, anche 410 + in questo caso, rispondete con educazione e concentratevi sul problema che 411 + hanno evidenziato. 412 + 413 + 9) Non scoraggiatevi - o impazientitevi 414 + --------------------------------------- 415 + 416 + Dopo che avete inviato le vostre modifiche, siate pazienti e aspettate. 417 + I revisori sono persone occupate e potrebbero non ricevere la vostra patch 418 + immediatamente. 419 + 420 + Un tempo, le patch erano solite scomparire nel vuoto senza alcun commento, 421 + ma ora il processo di sviluppo funziona meglio. Dovreste ricevere commenti 422 + in una settimana o poco più; se questo non dovesse accadere, assicuratevi di 423 + aver inviato le patch correttamente. Aspettate almeno una settimana prima di 424 + rinviare le modifiche o sollecitare i revisori - probabilmente anche di più 425 + durante la finestra d'integrazione. 426 + 427 + 10) Aggiungete PATCH nell'oggetto 428 + --------------------------------- 429 + 430 + Dato l'alto volume di e-mail per Linus, e la lista linux-kernel, è prassi 431 + prefiggere il vostro oggetto con [PATCH]. Questo permette a Linus e agli 432 + altri sviluppatori del kernel di distinguere facilmente le patch dalle altre 433 + discussioni. 434 + 435 + 436 + 11) Firmate il vostro lavoro - Il certificato d'origine dello sviluppatore 437 + -------------------------------------------------------------------------- 438 + 439 + Per migliorare la tracciabilità su "chi ha fatto cosa", specialmente per 440 + quelle patch che per raggiungere lo stadio finale passano attraverso 441 + diversi livelli di manutentori, abbiamo introdotto la procedura di "firma" 442 + delle patch che vengono inviate per e-mail. 443 + 444 + La firma è una semplice riga alla fine della descrizione della patch che 445 + certifica che l'avete scritta voi o che avete il diritto di pubblicarla 446 + come patch open-source. Le regole sono abbastanza semplici: se potete 447 + certificare quanto segue: 448 + 449 + Il certificato d'origine dello sviluppatore 1.1 450 + ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 451 + 452 + Contribuendo a questo progetto, io certifico che: 453 + 454 + (a) Il contributo è stato creato interamente, o in parte, da me e che 455 + ho il diritto di inviarlo in accordo con la licenza open-source 456 + indicata nel file; oppure 457 + 458 + (b) Il contributo è basato su un lavoro precedente che, nei limiti 459 + della mia conoscenza, è coperto da un'appropriata licenza 460 + open-source che mi da il diritto di modificarlo e inviarlo, 461 + le cui modifiche sono interamente o in parte mie, in accordo con 462 + la licenza open-source (a meno che non abbia il permesso di usare 463 + un'altra licenza) indicata nel file; oppure 464 + 465 + (c) Il contributo mi è stato fornito direttamente da qualcuno che 466 + ha certificato (a), (b) o (c) e non l'ho modificata. 467 + 468 + (d) Capisco e concordo col fatto che questo progetto e i suoi 469 + contributi sono pubblici e che un registro dei contributi (incluse 470 + tutte le informazioni personali che invio con essi, inclusa la mia 471 + firma) verrà mantenuto indefinitamente e che possa essere 472 + ridistribuito in accordo con questo progetto o le licenze 473 + open-source coinvolte. 474 + 475 + poi dovete solo aggiungere una riga che dice:: 476 + 477 + Signed-off-by: Random J Developer <random@developer.example.org> 478 + 479 + usando il vostro vero nome (spiacenti, non si accettano pseudonimi o 480 + contributi anonimi). 481 + 482 + Alcune persone aggiungono delle etichette alla fine. Per ora queste verranno 483 + ignorate, ma potete farlo per meglio identificare procedure aziendali interne o 484 + per aggiungere dettagli circa la firma. 485 + 486 + Se siete un manutentore di un sottosistema o di un ramo, qualche volta dovrete 487 + modificare leggermente le patch che avete ricevuto al fine di poterle 488 + integrare; questo perché il codice non è esattamente lo stesso nei vostri 489 + sorgenti e in quelli dei vostri contributori. Se rispettate rigidamente la 490 + regola (c), dovreste chiedere al mittente di rifare la patch, ma questo è 491 + controproducente e una totale perdita di tempo ed energia. La regola (b) 492 + vi permette di correggere il codice, ma poi diventa davvero maleducato cambiare 493 + la patch di qualcuno e addossargli la responsabilità per i vostri bachi. 494 + Per risolvere questo problema dovreste aggiungere una riga, fra l'ultimo 495 + Signed-off-by e il vostro, che spiega la vostra modifica. Nonostante non ci 496 + sia nulla di obbligatorio, un modo efficace è quello di indicare il vostro 497 + nome o indirizzo email fra parentesi quadre, seguito da una breve descrizione; 498 + questo renderà abbastanza visibile chi è responsabile per le modifiche 499 + dell'ultimo minuto. Per esempio:: 500 + 501 + Signed-off-by: Random J Developer <random@developer.example.org> 502 + [lucky@maintainer.example.org: struct foo moved from foo.c to foo.h] 503 + Signed-off-by: Lucky K Maintainer <lucky@maintainer.example.org> 504 + 505 + Questa pratica è particolarmente utile se siete i manutentori di un ramo 506 + stabile ma al contempo volete dare credito agli autori, tracciare e integrare 507 + le modifiche, e proteggere i mittenti dalle lamentele. Notate che in nessuna 508 + circostanza è permessa la modifica dell'identità dell'autore (l'intestazione 509 + From), dato che è quella che appare nei changelog. 510 + 511 + Un appunto speciale per chi porta il codice su vecchie versioni. Sembra che 512 + sia comune l'utile pratica di inserire un'indicazione circa l'origine della 513 + patch all'inizio del messaggio di commit (appena dopo la riga dell'oggetto) 514 + al fine di migliorare la tracciabilità. Per esempio, questo è quello che si 515 + vede nel rilascio stabile 3.x-stable:: 516 + 517 + Date: Tue Oct 7 07:26:38 2014 -0400 518 + 519 + libata: Un-break ATA blacklist 520 + 521 + commit 1c40279960bcd7d52dbdf1d466b20d24b99176c8 upstream. 522 + 523 + E qui quello che potrebbe vedersi su un kernel più vecchio dove la patch è 524 + stata applicata:: 525 + 526 + Date: Tue May 13 22:12:27 2008 +0200 527 + 528 + wireless, airo: waitbusy() won't delay 529 + 530 + [backport of 2.6 commit b7acbdfbd1f277c1eb23f344f899cfa4cd0bf36a] 531 + 532 + Qualunque sia il formato, questa informazione fornisce un importante aiuto 533 + alle persone che vogliono seguire i vostri sorgenti, e quelle che cercano 534 + dei bachi. 535 + 536 + 537 + 12) Quando utilizzare Acked-by:, Cc:, e Co-developed-by: 538 + -------------------------------------------------------- 539 + 540 + L'etichetta Signed-off-by: indica che il firmatario è stato coinvolto nello 541 + sviluppo della patch, o che era nel suo percorso di consegna. 542 + 543 + Se una persona non è direttamente coinvolta con la preparazione o gestione 544 + della patch ma desidera firmare e mettere agli atti la loro approvazione, 545 + allora queste persone possono chiedere di aggiungere al changelog della patch 546 + una riga Acked-by:. 547 + 548 + Acked-by: viene spesso utilizzato dai manutentori del sottosistema in oggetto 549 + quando quello stesso manutentore non ha contribuito né trasmesso la patch. 550 + 551 + Acked-by: non è formale come Signed-off-by:. Questo indica che la persona ha 552 + revisionato la patch e l'ha trovata accettabile. Per cui, a volte, chi 553 + integra le patch convertirà un "sì, mi sembra che vada bene" in un Acked-by: 554 + (ma tenete presente che solitamente è meglio chiedere esplicitamente). 555 + 556 + Acked-by: non indica l'accettazione di un'intera patch. Per esempio, quando 557 + una patch ha effetti su diversi sottosistemi e ha un Acked-by: da un 558 + manutentore di uno di questi, significa che il manutentore accetta quella 559 + parte di codice relativa al sottosistema che mantiene. Qui dovremmo essere 560 + giudiziosi. Quando si hanno dei dubbi si dovrebbe far riferimento alla 561 + discussione originale negli archivi della lista di discussione. 562 + 563 + Se una persona ha avuto l'opportunità di commentare la patch, ma non lo ha 564 + fatto, potete aggiungere l'etichetta ``Cc:`` alla patch. Questa è l'unica 565 + etichetta che può essere aggiunta senza che la persona in questione faccia 566 + alcunché - ma dovrebbe indicare che la persona ha ricevuto una copia della 567 + patch. Questa etichetta documenta che terzi potenzialmente interessati sono 568 + stati inclusi nella discussione. 569 + 570 + L'etichetta Co-developed-by: indica che la patch è stata scritta dall'autore in 571 + collaborazione con un altro sviluppatore. Qualche volta questo è utile quando 572 + più persone lavorano sulla stessa patch. Notate, questa persona deve avere 573 + nella patch anche una riga Signed-off-by:. 574 + 575 + 576 + 13) Utilizzare Reported-by:, Tested-by:, Reviewed-by:, Suggested-by: e Fixes: 577 + ----------------------------------------------------------------------------- 578 + 579 + L'etichetta Reported-by da credito alle persone che trovano e riportano i bachi 580 + e si spera che questo possa ispirarli ad aiutarci nuovamente in futuro. 581 + Rammentate che se il baco è stato riportato in privato, dovrete chiedere il 582 + permesso prima di poter utilizzare l'etichetta Reported-by. 583 + 584 + L'etichetta Tested-by: indica che la patch è stata verificata con successo 585 + (su un qualche sistema) dalla persona citata. Questa etichetta informa i 586 + manutentori che qualche verifica è stata fatta, fornisce un mezzo per trovare 587 + persone che possano verificare il codice in futuro, e garantisce che queste 588 + stesse persone ricevano credito per il loro lavoro. 589 + 590 + Reviewd-by:, invece, indica che la patch è stata revisionata ed è stata 591 + considerata accettabile in accordo con la dichiarazione dei revisori: 592 + 593 + Dichiarazione di svista dei revisori 594 + ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 595 + 596 + Offrendo la mia etichetta Reviewed-by, dichiaro quanto segue: 597 + 598 + (a) Ho effettuato una revisione tecnica di questa patch per valutarne 599 + l'adeguatezza ai fini dell'inclusione nel ramo principale del 600 + kernel. 601 + 602 + (b) Tutti i problemi e le domande riguardanti la patch sono stati 603 + comunicati al mittente. Sono soddisfatto dalle risposte 604 + del mittente. 605 + 606 + (c) Nonostante ci potrebbero essere cose migliorabili in queste 607 + sottomissione, credo che sia, in questo momento, (1) una modifica 608 + di interesse per il kernel, e (2) libera da problemi che 609 + potrebbero metterne in discussione l'integrazione. 610 + 611 + (d) Nonostante abbia revisionato la patch e creda che vada bene, 612 + non garantisco (se non specificato altrimenti) che questa 613 + otterrà quello che promette o funzionerà correttamente in tutte 614 + le possibili situazioni. 615 + 616 + L'etichetta Reviewed-by è la dichiarazione di un parere sulla bontà di 617 + una modifica che si ritiene appropriata e senza alcun problema tecnico 618 + importante. Qualsiasi revisore interessato (quelli che lo hanno fatto) 619 + possono offrire il proprio Reviewed-by per la patch. Questa etichetta serve 620 + a dare credito ai revisori e a informare i manutentori sul livello di revisione 621 + che è stato fatto sulla patch. L'etichetta Reviewd-by, quando fornita da 622 + revisori conosciuti per la loro conoscenza sulla materia in oggetto e per la 623 + loro serietà nella revisione, accrescerà le probabilità che la vostra patch 624 + venga integrate nel kernel. 625 + 626 + L'etichetta Suggested-by: indica che l'idea della patch è stata suggerita 627 + dalla persona nominata e le da credito. Tenete a mente che questa etichetta 628 + non dovrebbe essere aggiunta senza un permesso esplicito, specialmente se 629 + l'idea non è stata pubblicata in un forum pubblico. Detto ciò, dando credito 630 + a chi ci fornisce delle idee, si spera di poterli ispirare ad aiutarci 631 + nuovamente in futuro. 632 + 633 + L'etichetta Fixes: indica che la patch corregge un problema in un commit 634 + precedente. Serve a chiarire l'origine di un baco, il che aiuta la revisione 635 + del baco stesso. Questa etichetta è di aiuto anche per i manutentori dei 636 + kernel stabili al fine di capire quale kernel deve ricevere la correzione. 637 + Questo è il modo suggerito per indicare che un baco è stato corretto nella 638 + patch. Per maggiori dettagli leggete :ref:`it_describe_changes` 639 + 640 + 641 + 14) Il formato canonico delle patch 642 + ----------------------------------- 643 + 644 + Questa sezione descrive il formato che dovrebbe essere usato per le patch. 645 + Notate che se state usando un repositorio ``git`` per salvare le vostre patch 646 + potere usare il comando ``git format-patch`` per ottenere patch nel formato 647 + appropriato. Lo strumento non crea il testo necessario, per cui, leggete 648 + le seguenti istruzioni. 649 + 650 + L'oggetto di una patch canonica è la riga:: 651 + 652 + Subject: [PATCH 001/123] subsystem: summary phrase 653 + 654 + Il corpo di una patch canonica contiene i seguenti elementi: 655 + 656 + - Una riga ``from`` che specifica l'autore della patch, seguita 657 + da una riga vuota (necessaria soltanto se la persona che invia la 658 + patch non ne è l'autore). 659 + 660 + - Il corpo della spiegazione, con linee non più lunghe di 75 caratteri, 661 + che verrà copiato permanentemente nel changelog per descrivere la patch. 662 + 663 + - Una riga vuota 664 + 665 + - Le righe ``Signed-off-by:``, descritte in precedenza, che finiranno 666 + anch'esse nel changelog. 667 + 668 + - Una linea di demarcazione contenente semplicemente ``---``. 669 + 670 + - Qualsiasi altro commento che non deve finire nel changelog. 671 + 672 + - Le effettive modifiche al codice (il prodotto di ``diff``). 673 + 674 + Il formato usato per l'oggetto permette ai programmi di posta di usarlo 675 + per ordinare le patch alfabeticamente - tutti i programmi di posta hanno 676 + questa funzionalità - dato che al numero sequenziale si antepongono degli zeri; 677 + in questo modo l'ordine numerico ed alfabetico coincidono. 678 + 679 + Il ``subsystem`` nell'oggetto dell'email dovrebbe identificare l'area 680 + o il sottosistema modificato dalla patch. 681 + 682 + La ``summary phrase`` nell'oggetto dell'email dovrebbe descrivere brevemente 683 + il contenuto della patch. La ``summary phrase`` non dovrebbe essere un nome 684 + di file. Non utilizzate la stessa ``summary phrase`` per tutte le patch in 685 + una serie (dove una ``serie di patch`` è una sequenza ordinata di diverse 686 + patch correlate). 687 + 688 + Ricordatevi che la ``summary phrase`` della vostra email diventerà un 689 + identificatore globale ed unico per quella patch. Si propaga fino al 690 + changelog ``git``. La ``summary phrase`` potrà essere usata in futuro 691 + dagli sviluppatori per riferirsi a quella patch. Le persone vorranno 692 + cercare la ``summary phrase`` su internet per leggere le discussioni che la 693 + riguardano. Potrebbe anche essere l'unica cosa che le persone vedranno 694 + quando, in due o tre mesi, riguarderanno centinaia di patch usando strumenti 695 + come ``gitk`` o ``git log --oneline``. 696 + 697 + Per queste ragioni, dovrebbe essere lunga fra i 70 e i 75 caratteri, e deve 698 + descrivere sia cosa viene modificato, sia il perché sia necessario. Essere 699 + brevi e descrittivi è una bella sfida, ma questo è quello che fa un riassunto 700 + ben scritto. 701 + 702 + La ``summary phrase`` può avere un'etichetta (*tag*) di prefisso racchiusa fra 703 + le parentesi quadre "Subject: [PATCH <tag>...] <summary phrase>". 704 + Le etichette non verranno considerate come parte della frase riassuntiva, ma 705 + indicano come la patch dovrebbe essere trattata. Fra le etichette più comuni 706 + ci sono quelle di versione che vengono usate quando una patch è stata inviata 707 + più volte (per esempio, "v1, v2, v3"); oppure "RFC" per indicare che si 708 + attendono dei commenti (*Request For Comments*). Se ci sono quattro patch 709 + nella serie, queste dovrebbero essere enumerate così: 1/4, 2/4, 3/4, 4/4. 710 + Questo assicura che gli sviluppatori capiranno l'ordine in cui le patch 711 + dovrebbero essere applicate, e per tracciare quelle che hanno revisionate o 712 + che hanno applicato. 713 + 714 + Un paio di esempi di oggetti:: 715 + 716 + Subject: [PATCH 2/5] ext2: improve scalability of bitmap searching 717 + Subject: [PATCH v2 01/27] x86: fix eflags tracking 718 + 719 + La riga ``from`` dev'essere la prima nel corpo del messaggio ed è nel 720 + formato: 721 + 722 + From: Original Author <author@example.com> 723 + 724 + La riga ``from`` indica chi verrà accreditato nel changelog permanente come 725 + l'autore della patch. Se la riga ``from`` è mancante, allora per determinare 726 + l'autore da inserire nel changelog verrà usata la riga ``From`` 727 + nell'intestazione dell'email. 728 + 729 + Il corpo della spiegazione verrà incluso nel changelog permanente, per cui 730 + deve aver senso per un lettore esperto che è ha dimenticato i dettagli della 731 + discussione che hanno portato alla patch. L'inclusione di informazioni 732 + sui problemi oggetto dalla patch (messaggi del kernel, messaggi di oops, 733 + eccetera) è particolarmente utile per le persone che potrebbero cercare fra 734 + i messaggi di log per la patch che li tratta. Se la patch corregge un errore 735 + di compilazione, non sarà necessario includere proprio _tutto_ quello che 736 + è uscito dal compilatore; aggiungete solo quello che è necessario per far si 737 + che la vostra patch venga trovata. Come nella ``summary phrase``, è importante 738 + essere sia brevi che descrittivi. 739 + 740 + La linea di demarcazione ``---`` serve essenzialmente a segnare dove finisce 741 + il messaggio di changelog. 742 + 743 + Aggiungere il ``diffstat`` dopo ``---`` è un buon uso di questo spazio, per 744 + mostrare i file che sono cambiati, e il numero di file aggiunto o rimossi. 745 + Un ``diffstat`` è particolarmente utile per le patch grandi. Altri commenti 746 + che sono importanti solo per i manutentori, quindi inadatti al changelog 747 + permanente, dovrebbero essere messi qui. Un buon esempio per questo tipo 748 + di commenti potrebbe essere quello di descrivere le differenze fra le versioni 749 + della patch. 750 + 751 + Se includete un ``diffstat`` dopo ``---``, usate le opzioni ``-p 1 -w70`` 752 + cosicché i nomi dei file elencati non occupino troppo spazio (facilmente 753 + rientreranno negli 80 caratteri, magari con qualche indentazione). 754 + (``git`` genera di base dei diffstat adatti). 755 + 756 + Maggiori dettagli sul formato delle patch nei riferimenti qui di seguito. 757 + 758 + .. _it_explicit_in_reply_to: 759 + 760 + 15) Usare esplicitamente In-Reply-To nell'intestazione 761 + ------------------------------------------------------ 762 + 763 + Aggiungere manualmente In-Reply-To: nell'intestazione dell'e-mail 764 + potrebbe essere d'aiuto per associare una patch ad una discussione 765 + precedente, per esempio per collegare la correzione di un baco con l'e-mail 766 + che lo riportava. Tuttavia, per serie di patch multiple è generalmente 767 + sconsigliato l'uso di In-Reply-To: per collegare precedenti versioni. 768 + In questo modo versioni multiple di una patch non diventeranno un'ingestibile 769 + giungla di riferimenti all'interno dei programmi di posta. Se un collegamento 770 + è utile, potete usare https://lkml.kernel.org/ per ottenere i collegamenti 771 + ad una versione precedente di una serie di patch (per esempio, potete usarlo 772 + per l'email introduttiva alla serie). 773 + 774 + 16) Inviare richieste ``git pull`` 775 + ---------------------------------- 776 + 777 + Se avete una serie di patch, potrebbe essere più conveniente per un manutentore 778 + tirarle dentro al repositorio del sottosistema attraverso l'operazione 779 + ``git pull``. Comunque, tenete presente che prendere patch da uno sviluppatore 780 + in questo modo richiede un livello di fiducia più alto rispetto a prenderle da 781 + una lista di discussione. Di conseguenza, molti manutentori sono riluttanti 782 + ad accettare richieste di *pull*, specialmente dagli sviluppatori nuovi e 783 + quindi sconosciuti. Se siete in dubbio, potete fare una richiesta di *pull* 784 + come messaggio introduttivo ad una normale pubblicazione di patch, così 785 + il manutentore avrà la possibilità di scegliere come integrarle. 786 + 787 + Una richiesta di *pull* dovrebbe avere nell'oggetto [GIT] o [PULL]. 788 + La richiesta stessa dovrebbe includere il nome del repositorio e quello del 789 + ramo su una singola riga; dovrebbe essere più o meno così:: 790 + 791 + Please pull from 792 + 793 + git://jdelvare.pck.nerim.net/jdelvare-2.6 i2c-for-linus 794 + 795 + to get these changes: 796 + 797 + Una richiesta di *pull* dovrebbe includere anche un messaggio generico 798 + che dica cos'è incluso, una lista delle patch usando ``git shortlog``, e una 799 + panoramica sugli effetti della serie di patch con ``diffstat``. Il modo più 800 + semplice per ottenere tutte queste informazioni è, ovviamente, quello di 801 + lasciar fare tutto a ``git`` con il comando ``git request-pull``. 802 + 803 + Alcuni manutentori (incluso Linus) vogliono vedere le richieste di *pull* 804 + da commit firmati con GPG; questo fornisce una maggiore garanzia sul fatto 805 + che siate stati proprio voi a fare la richiesta. In assenza di tale etichetta 806 + firmata Linus, in particolare, non prenderà alcuna patch da siti pubblici come 807 + GitHub. 808 + 809 + Il primo passo verso la creazione di questa etichetta firmata è quello di 810 + creare una chiave GNUPG ed averla fatta firmare da uno o più sviluppatori 811 + principali del kernel. Questo potrebbe essere difficile per i nuovi 812 + sviluppatori, ma non ci sono altre vie. Andare alle conferenze potrebbe 813 + essere un buon modo per trovare sviluppatori che possano firmare la vostra 814 + chiave. 815 + 816 + Una volta che avete preparato la vostra serie di patch in ``git``, e volete che 817 + qualcuno le prenda, create una etichetta firmata col comando ``git tag -s``. 818 + Questo creerà una nuova etichetta che identifica l'ultimo commit della serie 819 + contenente una firma creata con la vostra chiave privata. Avrete anche 820 + l'opportunità di aggiungere un messaggio di changelog all'etichetta; questo è 821 + il posto ideale per descrivere gli effetti della richiesta di *pull*. 822 + 823 + Se i sorgenti da cui il manutentore prenderà le patch non sono gli stessi del 824 + repositorio su cui state lavorando, allora non dimenticatevi di caricare 825 + l'etichetta firmata anche sui sorgenti pubblici. 826 + 827 + Quando generate una richiesta di *pull*, usate l'etichetta firmata come 828 + obiettivo. Un comando come il seguente farà il suo dovere:: 829 + 830 + git request-pull master git://my.public.tree/linux.git my-signed-tag 831 + 832 + 833 + Riferimenti 834 + ----------- 835 + 836 + Andrew Morton, "La patch perfetta" (tpp). 837 + <http://www.ozlabs.org/~akpm/stuff/tpp.txt> 838 + 839 + Jeff Garzik, "Formato per la sottomissione di patch per il kernel Linux" 840 + <http://linux.yyz.us/patch-format.html> 841 + 842 + Greg Kroah-Hartman, "Come scocciare un manutentore di un sottosistema" 843 + <http://www.kroah.com/log/linux/maintainer.html> 844 + 845 + <http://www.kroah.com/log/linux/maintainer-02.html> 846 + 847 + <http://www.kroah.com/log/linux/maintainer-03.html> 848 + 849 + <http://www.kroah.com/log/linux/maintainer-04.html> 850 + 851 + <http://www.kroah.com/log/linux/maintainer-05.html> 852 + 853 + <http://www.kroah.com/log/linux/maintainer-06.html> 854 + 855 + No!!!! Basta gigantesche bombe patch alle persone sulla lista linux-kernel@vger.kernel.org! 856 + <https://lkml.org/lkml/2005/7/11/336> 857 + 858 + Kernel Documentation/translations/it_IT/process/coding-style.rst: 859 + :ref:`Documentation/translations/it_IT/process/coding-style.rst <it_codingstyle>` 860 + 861 + E-mail di Linus Torvalds sul formato canonico di una patch: 862 + <http://lkml.org/lkml/2005/4/7/183> 863 + 864 + Andi Kleen, "Su come sottomettere patch del kernel" 865 + Alcune strategie su come sottomettere modifiche toste o controverse. 866 + 867 + http://halobates.de/on-submitting-patches.pdf
+1 -11
Documentation/translations/ja_JP/howto.rst
··· 245 245 できます。この最新の素晴しいカーネルコードのリポジトリは以下で見つかり 246 246 ます - 247 247 248 - http://lxr.free-electrons.com/ 248 + https://elixir.bootlin.com/ 249 249 250 250 開発プロセス 251 251 ------------ ··· 256 256 257 257 - メインの 4.x カーネルツリー 258 258 - 4.x.y -stable カーネルツリー 259 - - 4.x -git カーネルパッチ 260 259 - サブシステム毎のカーネルツリーとパッチ 261 260 - 統合テストのための 4.x -next カーネルツリー 262 261 ··· 317 318 Documentation/process/stable-kernel-rules.rst ファイルにはどのような種 318 319 類の変更が -stable ツリーに受け入れ可能か、またリリースプロセスがどう 319 320 動くかが記述されています。 320 - 321 - 4.x -git パッチ 322 - ~~~~~~~~~~~~~~~ 323 - 324 - git リポジトリで管理されているLinus のカーネルツリーの毎日のスナップ 325 - ショットがあります。(だから -git という名前がついています)。これらのパッ 326 - チはおおむね毎日リリースされており、Linus のツリーの現状を表します。こ 327 - れは -rc カーネルと比べて、パッチが大丈夫かどうかも確認しないで自動的 328 - に生成されるので、より実験的です。 329 321 330 322 サブシステム毎のカーネルツリーとパッチ 331 323 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+18 -38
Documentation/translations/ko_KR/howto.rst
··· 77 77 78 78 리눅스 커널 소스 코드는 GPL로 배포(release)되었다. 소스트리의 메인 79 79 디렉토리에 있는 라이센스에 관하여 상세하게 쓰여 있는 COPYING이라는 80 - 파일을 봐라. 여러분이 라이센스에 관한 더 깊은 문제를 가지고 있다면 81 - 리눅스 커널 메일링 리스트에 묻지말고 변호사와 연락하라. 메일링 82 - 리스트들에 있는 사람들은 변호사가 아니기 때문에 법적 문제에 관하여 83 - 그들의 말에 의지해서는 안된다. 80 + 파일을 봐라. 리눅스 커널 라이센싱 규칙과 소스 코드 안의 `SPDX 81 + <https://spdx.org/>`_ 식별자 사용법은 82 + :ref:`Documentation/process/license-rules.rst <kernel_licensing>` 에 설명되어 83 + 있다. 여러분이 라이센스에 관한 더 깊은 문제를 가지고 있다면 리눅스 커널 메일링 84 + 리스트에 묻지말고 변호사와 연락하라. 메일링 리스트들에 있는 사람들은 변호사가 85 + 아니기 때문에 법적 문제에 관하여 그들의 말에 의지해서는 안된다. 84 86 85 87 GPL에 관한 잦은 질문들과 답변들은 다음을 참조하라. 86 88 ··· 101 99 102 100 다음은 커널 소스 트리에 있는 읽어야 할 파일들의 리스트이다. 103 101 104 - README 102 + :ref:`Documentation/admin-guide/README.rst <readme>` 105 103 이 파일은 리눅스 커널에 관하여 간단한 배경 설명과 커널을 설정하고 106 104 빌드하기 위해 필요한 것을 설명한다. 커널에 입문하는 사람들은 여기서 107 105 시작해야 한다. ··· 222 220 가지고 있지 않다면 다음에 무엇을 해야할지에 관한 방향을 배울 수 있을 223 221 것이다. 224 222 225 - 여러분들이 이미 커널 트리에 반영하길 원하는 코드 묶음을 가지고 있지만 226 - 올바른 포맷으로 포장하는데 도움이 필요하다면 그러한 문제를 돕기 위해 227 - 만들어진 kernel-mentors 프로젝트가 있다. 그곳은 메일링 리스트이며 228 - 다음에서 참조할 수 있다. 229 - 230 - https://selenic.com/mailman/listinfo/kernel-mentors 231 - 232 223 리눅스 커널 코드에 실제 변경을 하기 전에 반드시 그 코드가 어떻게 233 224 동작하는지 이해하고 있어야 한다. 코드를 분석하기 위하여 특정한 툴의 234 225 도움을 빌려서라도 코드를 직접 읽는 것보다 좋은 것은 없다(대부분의 ··· 230 235 소스코드를 인덱스된 웹 페이지들의 형태로 보여준다. 최신의 멋진 커널 231 236 코드 저장소는 다음을 통하여 참조할 수 있다. 232 237 233 - http://lxr.free-electrons.com/ 238 + https://elixir.bootlin.com/ 234 239 235 240 236 241 개발 프로세스 ··· 242 247 243 248 - main 4.x 커널 트리 244 249 - 4.x.y - 안정된 커널 트리 245 - - 4.x -git 커널 패치들 246 250 - 서브시스템을 위한 커널 트리들과 패치들 247 251 - 4.x - 통합 테스트를 위한 next 커널 트리 248 252 ··· 297 303 4.x.y는 "stable" 팀<stable@vger.kernel.org>에 의해 관리되며 거의 매번 격주로 298 304 배포된다. 299 305 300 - 커널 트리 문서들 내에 Documentation/process/stable-kernel-rules.rst 파일은 어떤 301 - 종류의 변경들이 -stable 트리로 들어왔는지와 배포 프로세스가 어떻게 302 - 진행되는지를 설명한다. 303 - 304 - 4.x -git 패치들 305 - ~~~~~~~~~~~~~~~ 306 - 307 - git 저장소(그러므로 -git이라는 이름이 붙음)에는 날마다 관리되는 Linus의 308 - 커널 트리의 snapshot 들이 있다. 이 패치들은 일반적으로 날마다 배포되며 309 - Linus의 트리의 현재 상태를 나타낸다. 이 패치들은 정상적인지 조금도 310 - 살펴보지 않고 자동적으로 생성된 것이므로 -rc 커널들 보다도 더 실험적이다. 306 + 커널 트리 문서들 내의 :ref:`Documentation/process/stable-kernel-rules.rst <stable_kernel_rules>` 307 + 파일은 어떤 종류의 변경들이 -stable 트리로 들어왔는지와 308 + 배포 프로세스가 어떻게 진행되는지를 설명한다. 311 309 312 310 서브시스템 커널 트리들과 패치들 313 311 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ··· 346 360 347 361 https://bugzilla.kernel.org/page.cgi?id=faq.html 348 362 349 - 메인 커널 소스 디렉토리에 있는 admin-guide/reporting-bugs.rst 파일은 커널 버그라고 생각되는 350 - 것을 보고하는 방법에 관한 좋은 템플릿이며 문제를 추적하기 위해서 커널 351 - 개발자들이 필요로 하는 정보가 무엇들인지를 상세히 설명하고 있다. 363 + 메인 커널 소스 디렉토리에 있는 :ref:`admin-guide/reporting-bugs.rst <reportingbugs>` 364 + 파일은 커널 버그라고 생각되는 것을 보고하는 방법에 관한 좋은 템플릿이며 문제를 365 + 추적하기 위해서 커널 개발자들이 필요로 하는 정보가 무엇들인지를 상세히 설명하고 366 + 있다. 352 367 353 368 354 369 버그 리포트들의 관리 ··· 364 377 다른 사람들의 버그들을 수정하기 위하여 시간을 낭비하지 않기 때문이다. 365 378 366 379 이미 보고된 버그 리포트들을 가지고 작업하기 위해서 https://bugzilla.kernel.org 367 - 를 참조하라. 여러분이 앞으로 생겨날 버그 리포트들의 조언자가 되길 원한다면 368 - bugme-new 메일링 리스트나(새로운 버그 리포트들만이 이곳에서 메일로 전해진다) 369 - bugme-janitor 메일링 리스트(bugzilla에 모든 변화들이 여기서 메일로 전해진다) 370 - 에 등록하면 된다. 371 - 372 - https://lists.linux-foundation.org/mailman/listinfo/bugme-new 373 - 374 - https://lists.linux-foundation.org/mailman/listinfo/bugme-janitors 375 - 380 + 를 참조하라. 376 381 377 382 378 383 메일링 리스트들 ··· 409 430 "John 커널해커는 작성했다...."를 유지하며 여러분들의 의견을 그 메일의 윗부분에 410 431 작성하지 말고 각 인용한 단락들 사이에 넣어라. 411 432 412 - 여러분들이 패치들을 메일에 넣는다면 그것들은 Documentation/process/submitting-patches.rst에 433 + 여러분들이 패치들을 메일에 넣는다면 그것들은 434 + :ref:`Documentation/process/submitting-patches.rst <submittingpatches>` 에 413 435 나와있는데로 명백히(plain) 읽을 수 있는 텍스트여야 한다. 커널 개발자들은 414 436 첨부파일이나 압축된 패치들을 원하지 않는다. 그들은 여러분들의 패치의 415 437 각 라인 단위로 코멘트를 하길 원하며 압축하거나 첨부하지 않고 보내는 것이
-9
Documentation/translations/zh_CN/HOWTO
··· 192 192 些分支包括: 193 193 - 2.6.x主内核源码树 194 194 - 2.6.x.y -stable内核源码树 195 - - 2.6.x -git内核补丁集 196 195 - 2.6.x -mm内核补丁集 197 196 - 子系统相关的内核源码树和补丁集 198 197 ··· 237 238 238 239 内核源码中的Documentation/process/stable-kernel-rules.rst文件具体描述了可被稳定 239 240 版内核接受的修改类型以及发布的流程。 240 - 241 - 242 - 2.6.x -git补丁集 243 - ---------------- 244 - Linus的内核源码树的每日快照,这个源码树是由git工具管理的(由此得名)。这 245 - 些补丁通常每天更新以反映Linus的源码树的最新状态。它们比-rc版本的内核源码 246 - 树更具试验性质,因为这个补丁集是全自动生成的,没有任何人来确认其是否真正 247 - 健全。 248 241 249 242 250 243 2.6.x -mm补丁集
+36 -19
Documentation/translations/zh_CN/coding-style.rst
··· 535 535 (* (max steps 1) 536 536 c-basic-offset))) 537 537 538 - (add-hook 'c-mode-common-hook 539 - (lambda () 540 - ;; Add kernel style 541 - (c-add-style 542 - "linux-tabs-only" 543 - '("linux" (c-offsets-alist 544 - (arglist-cont-nonempty 545 - c-lineup-gcc-asm-reg 546 - c-lineup-arglist-tabs-only)))))) 538 + (dir-locals-set-class-variables 539 + 'linux-kernel 540 + '((c-mode . ( 541 + (c-basic-offset . 8) 542 + (c-label-minimum-indentation . 0) 543 + (c-offsets-alist . ( 544 + (arglist-close . c-lineup-arglist-tabs-only) 545 + (arglist-cont-nonempty . 546 + (c-lineup-gcc-asm-reg c-lineup-arglist-tabs-only)) 547 + (arglist-intro . +) 548 + (brace-list-intro . +) 549 + (c . c-lineup-C-comments) 550 + (case-label . 0) 551 + (comment-intro . c-lineup-comment) 552 + (cpp-define-intro . +) 553 + (cpp-macro . -1000) 554 + (cpp-macro-cont . +) 555 + (defun-block-intro . +) 556 + (else-clause . 0) 557 + (func-decl-cont . +) 558 + (inclass . +) 559 + (inher-cont . c-lineup-multi-inher) 560 + (knr-argdecl-intro . 0) 561 + (label . -1000) 562 + (statement . 0) 563 + (statement-block-intro . +) 564 + (statement-case-intro . +) 565 + (statement-cont . +) 566 + (substatement . +) 567 + )) 568 + (indent-tabs-mode . t) 569 + (show-trailing-whitespace . t) 570 + )))) 547 571 548 - (add-hook 'c-mode-hook 549 - (lambda () 550 - (let ((filename (buffer-file-name))) 551 - ;; Enable kernel mode for the appropriate files 552 - (when (and filename 553 - (string-match (expand-file-name "~/src/linux-trees") 554 - filename)) 555 - (setq indent-tabs-mode t) 556 - (setq show-trailing-whitespace t) 557 - (c-set-style "linux-tabs-only"))))) 572 + (dir-locals-set-directory-class 573 + (expand-file-name "~/src/linux-trees") 574 + 'linux-kernel) 558 575 559 576 这会让 emacs 在 ``~/src/linux-trees`` 下的 C 源文件获得更好的内核代码风格。 560 577
+1 -1
Documentation/vm/index.rst
··· 4 4 5 5 This is a collection of documents about the Linux memory management (mm) 6 6 subsystem. If you are looking for advice on simply allocating memory, 7 - see the :ref:`memory-allocation`. 7 + see the :ref:`memory_allocation`. 8 8 9 9 User guides for MM features 10 10 ===========================
+2 -2
Documentation/vm/slub.rst
··· 66 66 to only enable debugging on the dentry cache. You may use an asterisk at the 67 67 end of the slab name, in order to cover all slabs with the same prefix. For 68 68 example, here's how you can poison the dentry cache as well as all kmalloc 69 - slabs: 69 + slabs:: 70 70 71 71 slub_debug=P,kmalloc-*,dentry 72 72 ··· 141 141 (list_lock) where contention may occur. 142 142 143 143 ``slub_min_order`` 144 - specifies a minim order of slabs. A similar effect like 144 + specifies a minimum order of slabs. A similar effect like 145 145 ``slub_min_objects``. 146 146 147 147 ``slub_max_order``
+18
LICENSES/exceptions/GCC-exception-2.0
··· 1 + SPDX-Exception-Identifier: GCC-exception-2.0 2 + SPDX-URL: https://spdx.org/licenses/GCC-exception-2.0.html 3 + SPDX-Licenses: GPL-2.0, GPL-2.0+, GPL-2.0-only, GPL-2.0-or-later 4 + Usage-Guide: 5 + This exception is used together with one of the above SPDX-Licenses to 6 + allow linking the compiled version of code to non GPL compliant code. 7 + To use this exception add it with the keyword WITH to one of the 8 + identifiers in the SPDX-Licenses tag: 9 + SPDX-License-Identifier: <SPDX-License> WITH GCC-exception-2.0 10 + License-Text: 11 + 12 + In addition to the permissions in the GNU Library General Public License, 13 + the Free Software Foundation gives you unlimited permission to link the 14 + compiled version of this file into combinations with other programs, and to 15 + distribute those programs without any restriction coming from the use of 16 + this file. (The General Public License restrictions do apply in other 17 + respects; for example, they cover modification of the file, and 18 + distribution when not linked into another program.)
+17 -1
include/linux/module.h
··· 172 172 * The following license idents are currently accepted as indicating free 173 173 * software modules 174 174 * 175 - * "GPL" [GNU Public License v2 or later] 175 + * "GPL" [GNU Public License v2] 176 176 * "GPL v2" [GNU Public License v2] 177 177 * "GPL and additional rights" [GNU Public License v2 rights and more] 178 178 * "Dual BSD/GPL" [GNU Public License v2 ··· 185 185 * The following other idents are available 186 186 * 187 187 * "Proprietary" [Non free products] 188 + * 189 + * Both "GPL v2" and "GPL" (the latter also in dual licensed strings) are 190 + * merely stating that the module is licensed under the GPL v2, but are not 191 + * telling whether "GPL v2 only" or "GPL v2 or later". The reason why there 192 + * are two variants is a historic and failed attempt to convey more 193 + * information in the MODULE_LICENSE string. For module loading the 194 + * "only/or later" distinction is completely irrelevant and does neither 195 + * replace the proper license identifiers in the corresponding source file 196 + * nor amends them in any way. The sole purpose is to make the 197 + * 'Proprietary' flagging work and to refuse to bind symbols which are 198 + * exported with EXPORT_SYMBOL_GPL when a non free module is loaded. 199 + * 200 + * In the same way "BSD" is not a clear license information. It merely 201 + * states, that the module is licensed under one of the compatible BSD 202 + * license variants. The detailed and correct license information is again 203 + * to be found in the corresponding source files. 188 204 * 189 205 * There are dual licensed components, but when running with Linux it is the 190 206 * GPL that is relevant so this is a non issue. Similarly LGPL linked with GPL
+1 -1
include/linux/skbuff.h
··· 4323 4323 /* Local Checksum Offload. 4324 4324 * Compute outer checksum based on the assumption that the 4325 4325 * inner checksum will be offloaded later. 4326 - * See Documentation/networking/checksum-offloads.txt for 4326 + * See Documentation/networking/checksum-offloads.rst for 4327 4327 * explanation of how this works. 4328 4328 * Fill in outer checksum adjustment (e.g. with sum of outer 4329 4329 * pseudo-header) before calling.
+7
samples/Kconfig
··· 147 147 Specifically it does *not* include any legacy vga stuff. 148 148 Device looks a lot like "qemu -device secondary-vga". 149 149 150 + config SAMPLE_ANDROID_BINDERFS 151 + bool "Build Android binderfs example" 152 + depends on CONFIG_ANDROID_BINDERFS 153 + help 154 + Builds a sample program to illustrate the use of the Android binderfs 155 + filesystem. 156 + 150 157 config SAMPLE_STATX 151 158 bool "Build example extended-stat using code" 152 159 depends on BROKEN
+1 -1
samples/Makefile
··· 3 3 obj-$(CONFIG_SAMPLES) += kobject/ kprobes/ trace_events/ livepatch/ \ 4 4 hw_breakpoint/ kfifo/ kdb/ hidraw/ rpmsg/ seccomp/ \ 5 5 configfs/ connector/ v4l/ trace_printk/ \ 6 - vfio-mdev/ statx/ qmi/ 6 + vfio-mdev/ statx/ qmi/ binderfs/
+1
samples/binderfs/Makefile
··· 1 + obj-$(CONFIG_SAMPLE_ANDROID_BINDERFS) += binderfs_example.o
+83
samples/binderfs/binderfs_example.c
··· 1 + // SPDX-License-Identifier: GPL-2.0 2 + 3 + #define _GNU_SOURCE 4 + #include <errno.h> 5 + #include <fcntl.h> 6 + #include <sched.h> 7 + #include <stdio.h> 8 + #include <stdlib.h> 9 + #include <string.h> 10 + #include <sys/ioctl.h> 11 + #include <sys/mount.h> 12 + #include <sys/stat.h> 13 + #include <sys/types.h> 14 + #include <unistd.h> 15 + #include <linux/android/binder.h> 16 + #include <linux/android/binderfs.h> 17 + 18 + int main(int argc, char *argv[]) 19 + { 20 + int fd, ret, saved_errno; 21 + size_t len; 22 + struct binderfs_device device = { 0 }; 23 + 24 + ret = unshare(CLONE_NEWNS); 25 + if (ret < 0) { 26 + fprintf(stderr, "%s - Failed to unshare mount namespace\n", 27 + strerror(errno)); 28 + exit(EXIT_FAILURE); 29 + } 30 + 31 + ret = mount(NULL, "/", NULL, MS_REC | MS_PRIVATE, 0); 32 + if (ret < 0) { 33 + fprintf(stderr, "%s - Failed to mount / as private\n", 34 + strerror(errno)); 35 + exit(EXIT_FAILURE); 36 + } 37 + 38 + ret = mkdir("/dev/binderfs", 0755); 39 + if (ret < 0 && errno != EEXIST) { 40 + fprintf(stderr, "%s - Failed to create binderfs mountpoint\n", 41 + strerror(errno)); 42 + exit(EXIT_FAILURE); 43 + } 44 + 45 + ret = mount(NULL, "/dev/binderfs", "binder", 0, 0); 46 + if (ret < 0) { 47 + fprintf(stderr, "%s - Failed to mount binderfs\n", 48 + strerror(errno)); 49 + exit(EXIT_FAILURE); 50 + } 51 + 52 + memcpy(device.name, "my-binder", strlen("my-binder")); 53 + 54 + fd = open("/dev/binderfs/binder-control", O_RDONLY | O_CLOEXEC); 55 + if (fd < 0) { 56 + fprintf(stderr, "%s - Failed to open binder-control device\n", 57 + strerror(errno)); 58 + exit(EXIT_FAILURE); 59 + } 60 + 61 + ret = ioctl(fd, BINDER_CTL_ADD, &device); 62 + saved_errno = errno; 63 + close(fd); 64 + errno = saved_errno; 65 + if (ret < 0) { 66 + fprintf(stderr, "%s - Failed to allocate new binder device\n", 67 + strerror(errno)); 68 + exit(EXIT_FAILURE); 69 + } 70 + 71 + printf("Allocated new binder device with major %d, minor %d, and name %s\n", 72 + device.major, device.minor, device.name); 73 + 74 + ret = unlink("/dev/binderfs/my-binder"); 75 + if (ret < 0) { 76 + fprintf(stderr, "%s - Failed to delete binder device\n", 77 + strerror(errno)); 78 + exit(EXIT_FAILURE); 79 + } 80 + 81 + /* Cleanup happens when the mount namespace dies. */ 82 + exit(EXIT_SUCCESS); 83 + }
-13
scripts/checkpatch.pl
··· 6396 6396 } 6397 6397 } 6398 6398 6399 - # check for bool bitfields 6400 - if ($sline =~ /^.\s+bool\s*$Ident\s*:\s*\d+\s*;/) { 6401 - WARN("BOOL_BITFIELD", 6402 - "Avoid using bool as bitfield. Prefer bool bitfields as unsigned int or u<8|16|32>\n" . $herecurr); 6403 - } 6404 - 6405 - # check for bool use in .h files 6406 - if ($realfile =~ /\.h$/ && 6407 - $sline =~ /^.\s+bool\s*$Ident\s*(?::\s*d+\s*)?;/) { 6408 - CHK("BOOL_MEMBER", 6409 - "Avoid using bool structure members because of possible alignment issues - see: https://lkml.org/lkml/2017/11/21/384\n" . $herecurr); 6410 - } 6411 - 6412 6399 # check for semaphores initialized locked 6413 6400 if ($line =~ /^.\s*sema_init.+,\W?0\W?\)/) { 6414 6401 WARN("CONSIDER_COMPLETION",
+1 -1
scripts/kernel-doc
··· 1474 1474 if (!defined $parameterdescs{$param} && $param !~ /^#/) { 1475 1475 $parameterdescs{$param} = $undescribed; 1476 1476 1477 - if (show_warnings($type, $declaration_name)) { 1477 + if (show_warnings($type, $declaration_name) && $param !~ /\./) { 1478 1478 print STDERR 1479 1479 "${file}:$.: warning: Function parameter or member '$param' not described in '$declaration_name'\n"; 1480 1480 ++$warnings;
+7 -1
scripts/spdxcheck.py
··· 175 175 self.lines_checked += 1 176 176 if line.find("SPDX-License-Identifier:") < 0: 177 177 continue 178 - expr = line.split(':')[1].replace('*/', '').strip() 178 + expr = line.split(':')[1].strip() 179 + # Remove trailing comment closure 180 + if line.strip().endswith('*/'): 181 + expr = expr.rstrip('*/').strip() 182 + # Special case for SH magic boot code files 183 + if line.startswith('LIST \"'): 184 + expr = expr.rstrip('\"').strip() 179 185 self.parse(expr) 180 186 self.spdx_valid += 1 181 187 #
+1 -1
security/selinux/hooks.c
··· 4472 4472 } 4473 4473 4474 4474 /* This supports connect(2) and SCTP connect services such as sctp_connectx(3) 4475 - * and sctp_sendmsg(3) as described in Documentation/security/LSM-sctp.rst 4475 + * and sctp_sendmsg(3) as described in Documentation/security/SCTP.rst 4476 4476 */ 4477 4477 static int selinux_socket_connect_helper(struct socket *sock, 4478 4478 struct sockaddr *address, int addrlen)
+8 -6
tools/Makefile
··· 12 12 @echo ' acpi - ACPI tools' 13 13 @echo ' cgroup - cgroup tools' 14 14 @echo ' cpupower - a tool for all things x86 CPU power' 15 + @echo ' debugging - tools for debugging' 15 16 @echo ' firewire - the userspace part of nosy, an IEEE-1394 traffic sniffer' 16 17 @echo ' firmware - Firmware tools' 17 18 @echo ' freefall - laptop accelerometer program for disk protection' ··· 62 61 cpupower: FORCE 63 62 $(call descend,power/$@) 64 63 65 - cgroup firewire hv guest spi usb virtio vm bpf iio gpio objtool leds wmi pci firmware: FORCE 64 + cgroup firewire hv guest spi usb virtio vm bpf iio gpio objtool leds wmi pci firmware debugging: FORCE 66 65 $(call descend,$@) 67 66 68 67 liblockdep: FORCE ··· 97 96 all: acpi cgroup cpupower gpio hv firewire liblockdep \ 98 97 perf selftests spi turbostat usb \ 99 98 virtio vm bpf x86_energy_perf_policy \ 100 - tmon freefall iio objtool kvm_stat wmi pci 99 + tmon freefall iio objtool kvm_stat wmi \ 100 + pci debugging 101 101 102 102 acpi_install: 103 103 $(call descend,power/$(@:_install=),install) ··· 106 104 cpupower_install: 107 105 $(call descend,power/$(@:_install=),install) 108 106 109 - cgroup_install firewire_install gpio_install hv_install iio_install perf_install spi_install usb_install virtio_install vm_install bpf_install objtool_install wmi_install pci_install: 107 + cgroup_install firewire_install gpio_install hv_install iio_install perf_install spi_install usb_install virtio_install vm_install bpf_install objtool_install wmi_install pci_install debugging_install: 110 108 $(call descend,$(@:_install=),install) 111 109 112 110 liblockdep_install: ··· 132 130 perf_install selftests_install turbostat_install usb_install \ 133 131 virtio_install vm_install bpf_install x86_energy_perf_policy_install \ 134 132 tmon_install freefall_install objtool_install kvm_stat_install \ 135 - wmi_install pci_install 133 + wmi_install pci_install debugging_install 136 134 137 135 acpi_clean: 138 136 $(call descend,power/acpi,clean) ··· 140 138 cpupower_clean: 141 139 $(call descend,power/cpupower,clean) 142 140 143 - cgroup_clean hv_clean firewire_clean spi_clean usb_clean virtio_clean vm_clean wmi_clean bpf_clean iio_clean gpio_clean objtool_clean leds_clean pci_clean firmware_clean: 141 + cgroup_clean hv_clean firewire_clean spi_clean usb_clean virtio_clean vm_clean wmi_clean bpf_clean iio_clean gpio_clean objtool_clean leds_clean pci_clean firmware_clean debugging_clean: 144 142 $(call descend,$(@:_clean=),clean) 145 143 146 144 liblockdep_clean: ··· 178 176 perf_clean selftests_clean turbostat_clean spi_clean usb_clean virtio_clean \ 179 177 vm_clean bpf_clean iio_clean x86_energy_perf_policy_clean tmon_clean \ 180 178 freefall_clean build_clean libbpf_clean libsubcmd_clean liblockdep_clean \ 181 - gpio_clean objtool_clean leds_clean wmi_clean pci_clean firmware_clean 179 + gpio_clean objtool_clean leds_clean wmi_clean pci_clean firmware_clean debugging_clean 182 180 183 181 .PHONY: FORCE
+16
tools/debugging/Makefile
··· 1 + # SPDX-License-Identifier: GPL-2.0 2 + # Makefile for debugging tools 3 + 4 + PREFIX ?= /usr 5 + BINDIR ?= bin 6 + INSTALL ?= install 7 + 8 + TARGET = kernel-chktaint 9 + 10 + all: $(TARGET) 11 + 12 + clean: 13 + 14 + install: kernel-chktaint 15 + $(INSTALL) -D -m 755 $(TARGET) $(DESTDIR)$(PREFIX)/$(BINDIR)/$(TARGET) 16 +
+202
tools/debugging/kernel-chktaint
··· 1 + #! /bin/sh 2 + # SPDX-License-Identifier: GPL-2.0 3 + # 4 + # Randy Dunlap <rdunlap@infradead.org>, 2018 5 + # Thorsten Leemhuis <linux@leemhuis.info>, 2018 6 + 7 + usage() 8 + { 9 + cat <<EOF 10 + usage: ${0##*/} 11 + ${0##*/} <int> 12 + 13 + Call without parameters to decode /proc/sys/kernel/tainted. 14 + 15 + Call with a positive integer as parameter to decode a value you 16 + retrieved from /proc/sys/kernel/tainted on another system. 17 + 18 + EOF 19 + } 20 + 21 + if [ "$1"x != "x" ]; then 22 + if [ "$1"x == "--helpx" ] || [ "$1"x == "-hx" ] ; then 23 + usage 24 + exit 1 25 + elif [ $1 -ge 0 ] 2>/dev/null ; then 26 + taint=$1 27 + else 28 + echo "Error: Parameter '$1' not a positive interger. Aborting." >&2 29 + exit 1 30 + fi 31 + else 32 + TAINTFILE="/proc/sys/kernel/tainted" 33 + if [ ! -r $TAINTFILE ]; then 34 + echo "No file: $TAINTFILE" 35 + exit 36 + fi 37 + 38 + taint=`cat $TAINTFILE` 39 + fi 40 + 41 + if [ $taint -eq 0 ]; then 42 + echo "Kernel not Tainted" 43 + exit 44 + else 45 + echo "Kernel is \"tainted\" for the following reasons:" 46 + fi 47 + 48 + T=$taint 49 + out= 50 + 51 + addout() { 52 + out=$out$1 53 + } 54 + 55 + if [ `expr $T % 2` -eq 0 ]; then 56 + addout "G" 57 + else 58 + addout "P" 59 + echo " * proprietary module was loaded (#0)" 60 + fi 61 + 62 + T=`expr $T / 2` 63 + if [ `expr $T % 2` -eq 0 ]; then 64 + addout " " 65 + else 66 + addout "F" 67 + echo " * module was force loaded (#1)" 68 + fi 69 + 70 + T=`expr $T / 2` 71 + if [ `expr $T % 2` -eq 0 ]; then 72 + addout " " 73 + else 74 + addout "S" 75 + echo " * SMP kernel oops on an officially SMP incapable processor (#2)" 76 + fi 77 + 78 + T=`expr $T / 2` 79 + if [ `expr $T % 2` -eq 0 ]; then 80 + addout " " 81 + else 82 + addout "R" 83 + echo " * module was force unloaded (#3)" 84 + fi 85 + 86 + T=`expr $T / 2` 87 + if [ `expr $T % 2` -eq 0 ]; then 88 + addout " " 89 + else 90 + addout "M" 91 + echo " * processor reported a Machine Check Exception (MCE) (#4)" 92 + fi 93 + 94 + T=`expr $T / 2` 95 + if [ `expr $T % 2` -eq 0 ]; then 96 + addout " " 97 + else 98 + addout "B" 99 + echo " * bad page referenced or some unexpected page flags (#5)" 100 + fi 101 + 102 + T=`expr $T / 2` 103 + if [ `expr $T % 2` -eq 0 ]; then 104 + addout " " 105 + else 106 + addout "U" 107 + echo " * taint requested by userspace application (#6)" 108 + fi 109 + 110 + T=`expr $T / 2` 111 + if [ `expr $T % 2` -eq 0 ]; then 112 + addout " " 113 + else 114 + addout "D" 115 + echo " * kernel died recently, i.e. there was an OOPS or BUG (#7)" 116 + fi 117 + 118 + T=`expr $T / 2` 119 + if [ `expr $T % 2` -eq 0 ]; then 120 + addout " " 121 + else 122 + addout "A" 123 + echo " * an ACPI table was overridden by user (#8)" 124 + fi 125 + 126 + T=`expr $T / 2` 127 + if [ `expr $T % 2` -eq 0 ]; then 128 + addout " " 129 + else 130 + addout "W" 131 + echo " * kernel issued warning (#9)" 132 + fi 133 + 134 + T=`expr $T / 2` 135 + if [ `expr $T % 2` -eq 0 ]; then 136 + addout " " 137 + else 138 + addout "C" 139 + echo " * staging driver was loaded (#10)" 140 + fi 141 + 142 + T=`expr $T / 2` 143 + if [ `expr $T % 2` -eq 0 ]; then 144 + addout " " 145 + else 146 + addout "I" 147 + echo " * workaround for bug in platform firmware applied (#11)" 148 + fi 149 + 150 + T=`expr $T / 2` 151 + if [ `expr $T % 2` -eq 0 ]; then 152 + addout " " 153 + else 154 + addout "O" 155 + echo " * externally-built ('out-of-tree') module was loaded (#12)" 156 + fi 157 + 158 + T=`expr $T / 2` 159 + if [ `expr $T % 2` -eq 0 ]; then 160 + addout " " 161 + else 162 + addout "E" 163 + echo " * unsigned module was loaded (#13)" 164 + fi 165 + 166 + T=`expr $T / 2` 167 + if [ `expr $T % 2` -eq 0 ]; then 168 + addout " " 169 + else 170 + addout "L" 171 + echo " * soft lockup occurred (#14)" 172 + fi 173 + 174 + T=`expr $T / 2` 175 + if [ `expr $T % 2` -eq 0 ]; then 176 + addout " " 177 + else 178 + addout "K" 179 + echo " * kernel has been live patched (#15)" 180 + fi 181 + 182 + T=`expr $T / 2` 183 + if [ `expr $T % 2` -eq 0 ]; then 184 + addout " " 185 + else 186 + addout "X" 187 + echo " * auxiliary taint, defined for and used by distros (#16)" 188 + 189 + fi 190 + T=`expr $T / 2` 191 + if [ `expr $T % 2` -eq 0 ]; then 192 + addout " " 193 + else 194 + addout "T" 195 + echo " * kernel was built with the struct randomization plugin (#17)" 196 + fi 197 + 198 + echo "For a more detailed explanation of the various taint flags see" 199 + echo " Documentation/admin-guide/tainted-kernels.rst in the the Linux kernel sources" 200 + echo " or https://kernel.org/doc/html/latest/admin-guide/tainted-kernels.html" 201 + echo "Raw taint value as int/string: $taint/'$out'" 202 + #EOF#