Skip to content

Commit c80e42a

Browse files
committed
Merge tag 'docs-5.10-2' of git://git.lwn.net/linux
Pull documentation fixes from Jonathan Corbet: "A handful of late-arriving documentation fixes" * tag 'docs-5.10-2' of git://git.lwn.net/linux: docs: Add two missing entries in vm sysctl index docs/vm: trivial fixes to several spelling mistakes docs: submitting-patches: describe preserving review/test tags Documentation: Chinese translation of Documentation/arm64/hugetlbpage.rst Documentation: x86: fix a missing word in x86_64/mm.rst. docs: driver-api: remove a duplicated index entry docs: lkdtm: Modernize and improve details docs: deprecated.rst: Expand str*cpy() replacement notes docs/cpu-load: format the example code.
2 parents a5e5c27 + 62af696 commit c80e42a

14 files changed

Lines changed: 154 additions & 77 deletions

File tree

Documentation/admin-guide/cpu-load.rst

Lines changed: 33 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -61,43 +61,46 @@ will lead to quite erratic information inside ``/proc/stat``::
6161

6262
static volatile sig_atomic_t stop;
6363

64-
static void sighandler (int signr)
64+
static void sighandler(int signr)
6565
{
66-
(void) signr;
67-
stop = 1;
66+
(void) signr;
67+
stop = 1;
6868
}
69+
6970
static unsigned long hog (unsigned long niters)
7071
{
71-
stop = 0;
72-
while (!stop && --niters);
73-
return niters;
72+
stop = 0;
73+
while (!stop && --niters);
74+
return niters;
7475
}
76+
7577
int main (void)
7678
{
77-
int i;
78-
struct itimerval it = { .it_interval = { .tv_sec = 0, .tv_usec = 1 },
79-
.it_value = { .tv_sec = 0, .tv_usec = 1 } };
80-
sigset_t set;
81-
unsigned long v[HIST];
82-
double tmp = 0.0;
83-
unsigned long n;
84-
signal (SIGALRM, &sighandler);
85-
setitimer (ITIMER_REAL, &it, NULL);
86-
87-
hog (ULONG_MAX);
88-
for (i = 0; i < HIST; ++i) v[i] = ULONG_MAX - hog (ULONG_MAX);
89-
for (i = 0; i < HIST; ++i) tmp += v[i];
90-
tmp /= HIST;
91-
n = tmp - (tmp / 3.0);
92-
93-
sigemptyset (&set);
94-
sigaddset (&set, SIGALRM);
95-
96-
for (;;) {
97-
hog (n);
98-
sigwait (&set, &i);
99-
}
100-
return 0;
79+
int i;
80+
struct itimerval it = {
81+
.it_interval = { .tv_sec = 0, .tv_usec = 1 },
82+
.it_value = { .tv_sec = 0, .tv_usec = 1 } };
83+
sigset_t set;
84+
unsigned long v[HIST];
85+
double tmp = 0.0;
86+
unsigned long n;
87+
signal(SIGALRM, &sighandler);
88+
setitimer(ITIMER_REAL, &it, NULL);
89+
90+
hog (ULONG_MAX);
91+
for (i = 0; i < HIST; ++i) v[i] = ULONG_MAX - hog(ULONG_MAX);
92+
for (i = 0; i < HIST; ++i) tmp += v[i];
93+
tmp /= HIST;
94+
n = tmp - (tmp / 3.0);
95+
96+
sigemptyset(&set);
97+
sigaddset(&set, SIGALRM);
98+
99+
for (;;) {
100+
hog(n);
101+
sigwait(&set, &i);
102+
}
103+
return 0;
101104
}
102105

103106

Documentation/admin-guide/sysctl/vm.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ Currently, these files are in /proc/sys/vm:
2727
- admin_reserve_kbytes
2828
- block_dump
2929
- compact_memory
30+
- compaction_proactiveness
3031
- compact_unevictable_allowed
3132
- dirty_background_bytes
3233
- dirty_background_ratio
@@ -37,6 +38,7 @@ Currently, these files are in /proc/sys/vm:
3738
- dirty_writeback_centisecs
3839
- drop_caches
3940
- extfrag_threshold
41+
- highmem_is_dirtyable
4042
- hugetlb_shm_group
4143
- laptop_mode
4244
- legacy_va_layout

Documentation/arm64/hugetlbpage.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
.. _hugetlbpage_index:
2+
13
====================
24
HugeTLBpage on ARM64
35
====================

Documentation/driver-api/index.rst

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,6 @@ available subsections can be seen below.
7777
console
7878
dcdbas
7979
eisa
80-
ipmb
8180
isa
8281
isapnp
8382
io-mapping
Lines changed: 33 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,48 +1,58 @@
1-
===============
2-
Provoke crashes
3-
===============
1+
.. SPDX-License-Identifier: GPL-2.0
42
5-
The lkdtm module provides an interface to crash or injure the kernel at
6-
predefined crashpoints to evaluate the reliability of crash dumps obtained
7-
using different dumping solutions. The module uses KPROBEs to instrument
8-
crashing points, but can also crash the kernel directly without KRPOBE
9-
support.
3+
============================================================
4+
Provoking crashes with Linux Kernel Dump Test Module (LKDTM)
5+
============================================================
106

7+
The lkdtm module provides an interface to disrupt (and usually crash)
8+
the kernel at predefined code locations to evaluate the reliability of
9+
the kernel's exception handling and to test crash dumps obtained using
10+
different dumping solutions. The module uses KPROBEs to instrument the
11+
trigger location, but can also trigger the kernel directly without KPROBE
12+
support via debugfs.
1113

12-
You can provide the way either through module arguments when inserting
13-
the module, or through a debugfs interface.
14+
You can select the location of the trigger ("crash point name") and the
15+
type of action ("crash point type") either through module arguments when
16+
inserting the module, or through the debugfs interface.
1417

1518
Usage::
1619

1720
insmod lkdtm.ko [recur_count={>0}] cpoint_name=<> cpoint_type=<>
1821
[cpoint_count={>0}]
1922

2023
recur_count
21-
Recursion level for the stack overflow test. Default is 10.
24+
Recursion level for the stack overflow test. By default this is
25+
dynamically calculated based on kernel configuration, with the
26+
goal of being just large enough to exhaust the kernel stack. The
27+
value can be seen at `/sys/module/lkdtm/parameters/recur_count`.
2228

2329
cpoint_name
24-
Crash point where the kernel is to be crashed. It can be
30+
Where in the kernel to trigger the action. It can be
2531
one of INT_HARDWARE_ENTRY, INT_HW_IRQ_EN, INT_TASKLET_ENTRY,
2632
FS_DEVRW, MEM_SWAPOUT, TIMERADD, SCSI_DISPATCH_CMD,
27-
IDE_CORE_CP, DIRECT
33+
IDE_CORE_CP, or DIRECT
2834

2935
cpoint_type
3036
Indicates the action to be taken on hitting the crash point.
31-
It can be one of PANIC, BUG, EXCEPTION, LOOP, OVERFLOW,
32-
CORRUPT_STACK, UNALIGNED_LOAD_STORE_WRITE, OVERWRITE_ALLOCATION,
33-
WRITE_AFTER_FREE,
37+
These are numerous, and best queried directly from debugfs. Some
38+
of the common ones are PANIC, BUG, EXCEPTION, LOOP, and OVERFLOW.
39+
See the contents of `/sys/kernel/debug/provoke-crash/DIRECT` for
40+
a complete list.
3441

3542
cpoint_count
3643
Indicates the number of times the crash point is to be hit
37-
to trigger an action. The default is 10.
44+
before triggering the action. The default is 10 (except for
45+
DIRECT, which always fires immediately).
3846

3947
You can also induce failures by mounting debugfs and writing the type to
40-
<mountpoint>/provoke-crash/<crashpoint>. E.g.::
48+
<debugfs>/provoke-crash/<crashpoint>. E.g.::
4149

42-
mount -t debugfs debugfs /mnt
43-
echo EXCEPTION > /mnt/provoke-crash/INT_HARDWARE_ENTRY
50+
mount -t debugfs debugfs /sys/kernel/debug
51+
echo EXCEPTION > /sys/kernel/debug/provoke-crash/INT_HARDWARE_ENTRY
4452

53+
The special file `DIRECT` will induce the action directly without KPROBE
54+
instrumentation. This mode is the only one available when the module is
55+
built for a kernel without KPROBEs support::
4556

46-
A special file is `DIRECT` which will induce the crash directly without
47-
KPROBE instrumentation. This mode is the only one available when the module
48-
is built on a kernel without KPROBEs support.
57+
# Instead of having a BUG kill your shell, have it kill "cat":
58+
cat <(echo WRITE_RO) >/sys/kernel/debug/provoke-crash/DIRECT

Documentation/process/deprecated.rst

Lines changed: 26 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -106,23 +106,29 @@ NUL or newline terminated.
106106

107107
strcpy()
108108
--------
109-
strcpy() performs no bounds checking on the destination
110-
buffer. This could result in linear overflows beyond the
111-
end of the buffer, leading to all kinds of misbehaviors. While
112-
`CONFIG_FORTIFY_SOURCE=y` and various compiler flags help reduce the
113-
risk of using this function, there is no good reason to add new uses of
114-
this function. The safe replacement is strscpy().
109+
strcpy() performs no bounds checking on the destination buffer. This
110+
could result in linear overflows beyond the end of the buffer, leading to
111+
all kinds of misbehaviors. While `CONFIG_FORTIFY_SOURCE=y` and various
112+
compiler flags help reduce the risk of using this function, there is
113+
no good reason to add new uses of this function. The safe replacement
114+
is strscpy(), though care must be given to any cases where the return
115+
value of strcpy() was used, since strscpy() does not return a pointer to
116+
the destination, but rather a count of non-NUL bytes copied (or negative
117+
errno when it truncates).
115118

116119
strncpy() on NUL-terminated strings
117120
-----------------------------------
118-
Use of strncpy() does not guarantee that the destination buffer
119-
will be NUL terminated. This can lead to various linear read overflows
120-
and other misbehavior due to the missing termination. It also NUL-pads the
121-
destination buffer if the source contents are shorter than the destination
122-
buffer size, which may be a needless performance penalty for callers using
123-
only NUL-terminated strings. The safe replacement is strscpy().
124-
(Users of strscpy() still needing NUL-padding should instead
125-
use strscpy_pad().)
121+
Use of strncpy() does not guarantee that the destination buffer will
122+
be NUL terminated. This can lead to various linear read overflows and
123+
other misbehavior due to the missing termination. It also NUL-pads
124+
the destination buffer if the source contents are shorter than the
125+
destination buffer size, which may be a needless performance penalty
126+
for callers using only NUL-terminated strings. The safe replacement is
127+
strscpy(), though care must be given to any cases where the return value
128+
of strncpy() was used, since strscpy() does not return a pointer to the
129+
destination, but rather a count of non-NUL bytes copied (or negative
130+
errno when it truncates). Any cases still needing NUL-padding should
131+
instead use strscpy_pad().
126132

127133
If a caller is using non-NUL-terminated strings, strncpy() can
128134
still be used, but destinations should be marked with the `__nonstring
@@ -131,10 +137,12 @@ attribute to avoid future compiler warnings.
131137

132138
strlcpy()
133139
---------
134-
strlcpy() reads the entire source buffer first, possibly exceeding
135-
the given limit of bytes to copy. This is inefficient and can lead to
136-
linear read overflows if a source string is not NUL-terminated. The
137-
safe replacement is strscpy().
140+
strlcpy() reads the entire source buffer first (since the return value
141+
is meant to match that of strlen()). This read may exceed the destination
142+
size limit. This is both inefficient and can lead to linear read overflows
143+
if a source string is not NUL-terminated. The safe replacement is strscpy(),
144+
though care must be given to any cases where the return value of strlcpy()
145+
is used, since strscpy() will return negative errno values when it truncates.
138146

139147
%p format specifier
140148
-------------------

Documentation/process/submitting-patches.rst

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -527,6 +527,13 @@ done on the patch. Reviewed-by: tags, when supplied by reviewers known to
527527
understand the subject area and to perform thorough reviews, will normally
528528
increase the likelihood of your patch getting into the kernel.
529529

530+
Both Tested-by and Reviewed-by tags, once received on mailing list from tester
531+
or reviewer, should be added by author to the applicable patches when sending
532+
next versions. However if the patch has changed substantially in following
533+
version, these tags might not be applicable anymore and thus should be removed.
534+
Usually removal of someone's Tested-by or Reviewed-by tags should be mentioned
535+
in the patch changelog (after the '---' separator).
536+
530537
A Suggested-by: tag indicates that the patch idea is suggested by the person
531538
named and ensures credit to the person for the idea. Please note that this
532539
tag should not be added without the reporter's permission, especially if the
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
.. include:: ../disclaimer-zh_CN.rst
2+
3+
:Original: :ref:`Documentation/arm64/hugetlbpage.rst <hugetlbpage_index>`
4+
5+
Translator: Bailu Lin <bailu.lin@vivo.com>
6+
7+
=====================
8+
ARM64中的 HugeTLBpage
9+
=====================
10+
11+
大页依靠有效利用 TLBs 来提高地址翻译的性能。这取决于以下
12+
两点 -
13+
14+
- 大页的大小
15+
- TLBs 支持的条目大小
16+
17+
ARM64 接口支持2种大页方式。
18+
19+
1) pud/pmd 级别的块映射
20+
-----------------------
21+
22+
这是常规大页,他们的 pmd 或 pud 页面表条目指向一个内存块。
23+
不管 TLB 中支持的条目大小如何,块映射可以减少翻译大页地址
24+
所需遍历的页表深度。
25+
26+
2) 使用连续位
27+
-------------
28+
29+
架构中转换页表条目(D4.5.3, ARM DDI 0487C.a)中提供一个连续
30+
位告诉 MMU 这个条目是一个连续条目集的一员,它可以被缓存在单
31+
个 TLB 条目中。
32+
33+
在 Linux 中连续位用来增加 pmd 和 pte(最后一级)级别映射的大
34+
小。受支持的连续页表条目数量因页面大小和页表级别而异。
35+
36+
37+
支持以下大页尺寸配置 -
38+
39+
====== ======== ==== ======== ===
40+
- CONT PTE PMD CONT PMD PUD
41+
====== ======== ==== ======== ===
42+
4K: 64K 2M 32M 1G
43+
16K: 2M 32M 1G
44+
64K: 2M 512M 16G
45+
====== ======== ==== ======== ===

Documentation/translations/zh_CN/arm64/index.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,3 +14,4 @@ ARM64 架构
1414
:maxdepth: 2
1515

1616
amu
17+
hugetlbpage

Documentation/vm/mmu_notifier.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ they are write protected for COW (other case of B apply too).
8989

9090
So here because at time N+2 the clear page table entry was not pair with a
9191
notification to invalidate the secondary TLB, the device see the new value for
92-
addrB before seing the new value for addrA. This break total memory ordering
92+
addrB before seeing the new value for addrA. This break total memory ordering
9393
for the device.
9494

9595
When changing a pte to write protect or to point to a new write protected page

0 commit comments

Comments
 (0)