Skip to content

Commit d6b0219

Browse files
committed
Merge tag 'mm-nonmm-stable-2025-03-30-18-23' of git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm
Pull non-MM updates from Andrew Morton: - The series "powerpc/crash: use generic crashkernel reservation" from Sourabh Jain changes powerpc's kexec code to use more of the generic layers. - The series "get_maintainer: report subsystem status separately" from Vlastimil Babka makes some long-requested improvements to the get_maintainer output. - The series "ucount: Simplify refcounting with rcuref_t" from Sebastian Siewior cleans up and optimizing the refcounting in the ucount code. - The series "reboot: support runtime configuration of emergency hw_protection action" from Ahmad Fatoum improves the ability for a driver to perform an emergency system shutdown or reboot. - The series "Converge on using secs_to_jiffies() part two" from Easwar Hariharan performs further migrations from msecs_to_jiffies() to secs_to_jiffies(). - The series "lib/interval_tree: add some test cases and cleanup" from Wei Yang permits more userspace testing of kernel library code, adds some more tests and performs some cleanups. - The series "hung_task: Dump the blocking task stacktrace" from Masami Hiramatsu arranges for the hung_task detector to dump the stack of the blocking task and not just that of the blocked task. - The series "resource: Split and use DEFINE_RES*() macros" from Andy Shevchenko provides some cleanups to the resource definition macros. - Plus the usual shower of singleton patches - please see the individual changelogs for details. * tag 'mm-nonmm-stable-2025-03-30-18-23' of git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm: (77 commits) mailmap: consolidate email addresses of Alexander Sverdlin fs/procfs: fix the comment above proc_pid_wchan() relay: use kasprintf() instead of fixed buffer formatting resource: replace open coded variant of DEFINE_RES() resource: replace open coded variants of DEFINE_RES_*_NAMED() resource: replace open coded variant of DEFINE_RES_NAMED_DESC() resource: split DEFINE_RES_NAMED_DESC() out of DEFINE_RES_NAMED() samples: add hung_task detector mutex blocking sample hung_task: show the blocker task if the task is hung on mutex kexec_core: accept unaccepted kexec segments' destination addresses watchdog/perf: optimize bytes copied and remove manual NUL-termination lib/interval_tree: fix the comment of interval_tree_span_iter_next_gap() lib/interval_tree: skip the check before go to the right subtree lib/interval_tree: add test case for span iteration lib/interval_tree: add test case for interval_tree_iter_xxx() helpers lib/rbtree: add random seed lib/rbtree: split tests lib/rbtree: enable userland test suite for rbtree related data structure checkpatch: describe --min-conf-desc-length scripts/gdb/symbols: determine KASLR offset on s390 ...
2 parents eb0ece1 + 434333d commit d6b0219

File tree

107 files changed

+1388
-623
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

107 files changed

+1388
-623
lines changed

.mailmap

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,13 @@ Alexander Lobakin <[email protected]> <[email protected]>
3131
3232
Alexander Mikhalitsyn <[email protected]> <[email protected]>
3333
Alexander Mikhalitsyn <[email protected]> <[email protected]>
34+
Alexander Sverdlin <[email protected]> <[email protected]>
35+
Alexander Sverdlin <[email protected]> <[email protected]>
36+
Alexander Sverdlin <[email protected]> <[email protected]>
37+
Alexander Sverdlin <[email protected]> <[email protected]>
38+
Alexander Sverdlin <[email protected]> <[email protected]>
39+
Alexander Sverdlin <[email protected]> <[email protected]>
40+
Alexander Sverdlin <[email protected]> <[email protected]>
3441
3542
3643
Alexei Avshalom Lazar <[email protected]> <[email protected]>
@@ -153,7 +160,6 @@ Carlos Bilbao <[email protected]> <[email protected]>
153160
154161
155162
156-
157163
158164
159165
@@ -271,6 +277,7 @@ Hamza Mahfooz <[email protected]> <[email protected]>
271277
272278
273279
280+
274281
275282
276283
@@ -305,7 +312,6 @@ Jan Glauber <[email protected]> <[email protected]>
305312
306313
307314
308-
309315
310316
311317
@@ -762,7 +768,6 @@ Vinod Koul <[email protected]> <[email protected]>
762768
763769
764770
765-
766771
767772
768773

Documentation/ABI/testing/sysfs-kernel-reboot

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,3 +30,11 @@ KernelVersion: 5.11
3030
Contact: Matteo Croce <[email protected]>
3131
Description: Don't wait for any other CPUs on reboot and
3232
avoid anything that could hang.
33+
34+
What: /sys/kernel/reboot/hw_protection
35+
Date: April 2025
36+
KernelVersion: 6.15
37+
Contact: Ahmad Fatoum <[email protected]>
38+
Description: Hardware protection action taken on critical events like
39+
overtemperature or imminent voltage loss.
40+
Valid values are: reboot shutdown

Documentation/admin-guide/kernel-parameters.txt

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1954,6 +1954,12 @@
19541954
which allow the hypervisor to 'idle' the guest
19551955
on lock contention.
19561956

1957+
hw_protection= [HW]
1958+
Format: reboot | shutdown
1959+
1960+
Hardware protection action taken on critical events like
1961+
overtemperature or imminent voltage loss.
1962+
19571963
i2c_bus= [HW] Override the default board specific I2C bus speed
19581964
or register an additional I2C bus that is not
19591965
registered from board initialization code.

Documentation/devicetree/bindings/thermal/thermal-zones.yaml

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -82,9 +82,8 @@ patternProperties:
8282
$ref: /schemas/types.yaml#/definitions/string
8383
description: |
8484
The action the OS should perform after the critical temperature is reached.
85-
By default the system will shutdown as a safe action to prevent damage
86-
to the hardware, if the property is not set.
87-
The shutdown action should be always the default and preferred one.
85+
If the property is not set, it is up to the system to select the correct
86+
action. The recommended and preferred default is shutdown.
8887
Choose 'reboot' with care, as the hardware may be in thermal stress,
8988
thus leading to infinite reboots that may cause damage to the hardware.
9089
Make sure the firmware/bootloader will act as the last resort and take

Documentation/driver-api/thermal/sysfs-api.rst

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -413,18 +413,21 @@ This function serves as an arbitrator to set the state of a cooling
413413
device. It sets the cooling device to the deepest cooling state if
414414
possible.
415415

416-
5. thermal_emergency_poweroff
417-
=============================
416+
5. Critical Events
417+
==================
418+
419+
On an event of critical trip temperature crossing, the thermal framework
420+
will trigger a hardware protection power-off (shutdown) or reboot,
421+
depending on configuration.
418422

419-
On an event of critical trip temperature crossing the thermal framework
420-
shuts down the system by calling hw_protection_shutdown(). The
421-
hw_protection_shutdown() first attempts to perform an orderly shutdown
422-
but accepts a delay after which it proceeds doing a forced power-off
423-
or as last resort an emergency_restart.
423+
At first, the kernel will attempt an orderly power-off or reboot, but
424+
accepts a delay after which it proceeds to do a forced power-off or
425+
reboot, respectively. If this fails, ``emergency_restart()`` is invoked
426+
as last resort.
424427

425428
The delay should be carefully profiled so as to give adequate time for
426-
orderly poweroff.
429+
orderly power-off or reboot.
427430

428-
If the delay is set to 0 emergency poweroff will not be supported. So a
429-
carefully profiled non-zero positive value is a must for emergency
430-
poweroff to be triggered.
431+
If the delay is set to 0, the emergency action will not be supported. So a
432+
carefully profiled non-zero positive value is a must for the emergency
433+
action to be triggered.

Documentation/filesystems/proc.rst

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,16 @@ process running on the system, which is named after the process ID (PID).
128128
The link 'self' points to the process reading the file system. Each process
129129
subdirectory has the entries listed in Table 1-1.
130130

131+
A process can read its own information from /proc/PID/* with no extra
132+
permissions. When reading /proc/PID/* information for other processes, reading
133+
process is required to have either CAP_SYS_PTRACE capability with
134+
PTRACE_MODE_READ access permissions, or, alternatively, CAP_PERFMON
135+
capability. This applies to all read-only information like `maps`, `environ`,
136+
`pagemap`, etc. The only exception is `mem` file due to its read-write nature,
137+
which requires CAP_SYS_PTRACE capabilities with more elevated
138+
PTRACE_MODE_ATTACH permissions; CAP_PERFMON capability does not grant access
139+
to /proc/PID/mem for other processes.
140+
131141
Note that an open file descriptor to /proc/<pid> or to any of its
132142
contained files or subdirectories does not prevent <pid> being reused
133143
for some other process in the event that <pid> exits. Operations on

MAINTAINERS

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18802,6 +18802,7 @@ F: mm/percpu*.c
1880218802

1880318803
PER-TASK DELAY ACCOUNTING
1880418804
M: Balbir Singh <[email protected]>
18805+
M: Yang Yang <[email protected]>
1880518806
S: Maintained
1880618807
F: include/linux/delayacct.h
1880718808
F: kernel/delayacct.c
@@ -22153,7 +22154,7 @@ M: Joonsoo Kim <[email protected]>
2215322154
M: Andrew Morton <[email protected]>
2215422155
M: Vlastimil Babka <[email protected]>
2215522156
R: Roman Gushchin <[email protected]>
22156-
R: Hyeonggon Yoo <42.hyeyoo@gmail.com>
22157+
R: Harry Yoo <harry.yoo@oracle.com>
2215722158
2215822159
S: Maintained
2215922160
T: git git://git.kernel.org/pub/scm/linux/kernel/git/vbabka/slab.git

arch/arm64/mm/init.c

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -98,21 +98,19 @@ static void __init arch_reserve_crashkernel(void)
9898
{
9999
unsigned long long low_size = 0;
100100
unsigned long long crash_base, crash_size;
101-
char *cmdline = boot_command_line;
102101
bool high = false;
103102
int ret;
104103

105104
if (!IS_ENABLED(CONFIG_CRASH_RESERVE))
106105
return;
107106

108-
ret = parse_crashkernel(cmdline, memblock_phys_mem_size(),
107+
ret = parse_crashkernel(boot_command_line, memblock_phys_mem_size(),
109108
&crash_size, &crash_base,
110109
&low_size, &high);
111110
if (ret)
112111
return;
113112

114-
reserve_crashkernel_generic(cmdline, crash_size, crash_base,
115-
low_size, high);
113+
reserve_crashkernel_generic(crash_size, crash_base, low_size, high);
116114
}
117115

118116
static phys_addr_t __init max_zone_phys(phys_addr_t zone_limit)

arch/loongarch/kernel/setup.c

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -259,18 +259,17 @@ static void __init arch_reserve_crashkernel(void)
259259
int ret;
260260
unsigned long long low_size = 0;
261261
unsigned long long crash_base, crash_size;
262-
char *cmdline = boot_command_line;
263262
bool high = false;
264263

265264
if (!IS_ENABLED(CONFIG_CRASH_RESERVE))
266265
return;
267266

268-
ret = parse_crashkernel(cmdline, memblock_phys_mem_size(),
267+
ret = parse_crashkernel(boot_command_line, memblock_phys_mem_size(),
269268
&crash_size, &crash_base, &low_size, &high);
270269
if (ret)
271270
return;
272271

273-
reserve_crashkernel_generic(cmdline, crash_size, crash_base, low_size, high);
272+
reserve_crashkernel_generic(crash_size, crash_base, low_size, high);
274273
}
275274

276275
static void __init fdt_setup(void)

arch/powerpc/Kconfig

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -716,6 +716,9 @@ config ARCH_SUPPORTS_CRASH_HOTPLUG
716716
def_bool y
717717
depends on PPC64
718718

719+
config ARCH_HAS_GENERIC_CRASHKERNEL_RESERVATION
720+
def_bool CRASH_RESERVE
721+
719722
config FA_DUMP
720723
bool "Firmware-assisted dump"
721724
depends on CRASH_DUMP && PPC64 && (PPC_RTAS || PPC_POWERNV)
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
/* SPDX-License-Identifier: GPL-2.0 */
2+
#ifndef _ASM_POWERPC_CRASH_RESERVE_H
3+
#define _ASM_POWERPC_CRASH_RESERVE_H
4+
5+
/* crash kernel regions are Page size agliged */
6+
#define CRASH_ALIGN PAGE_SIZE
7+
8+
#endif /* _ASM_POWERPC_CRASH_RESERVE_H */

arch/powerpc/include/asm/kexec.h

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -94,8 +94,10 @@ int arch_kexec_kernel_image_probe(struct kimage *image, void *buf, unsigned long
9494
int arch_kimage_file_post_load_cleanup(struct kimage *image);
9595
#define arch_kimage_file_post_load_cleanup arch_kimage_file_post_load_cleanup
9696

97-
int arch_kexec_locate_mem_hole(struct kexec_buf *kbuf);
98-
#define arch_kexec_locate_mem_hole arch_kexec_locate_mem_hole
97+
int arch_check_excluded_range(struct kimage *image, unsigned long start,
98+
unsigned long end);
99+
#define arch_check_excluded_range arch_check_excluded_range
100+
99101

100102
int load_crashdump_segments_ppc64(struct kimage *image,
101103
struct kexec_buf *kbuf);
@@ -112,9 +114,9 @@ int setup_new_fdt_ppc64(const struct kimage *image, void *fdt, struct crash_mem
112114

113115
#ifdef CONFIG_CRASH_RESERVE
114116
int __init overlaps_crashkernel(unsigned long start, unsigned long size);
115-
extern void reserve_crashkernel(void);
117+
extern void arch_reserve_crashkernel(void);
116118
#else
117-
static inline void reserve_crashkernel(void) {}
119+
static inline void arch_reserve_crashkernel(void) {}
118120
static inline int overlaps_crashkernel(unsigned long start, unsigned long size) { return 0; }
119121
#endif
120122

arch/powerpc/kernel/prom.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -860,7 +860,7 @@ void __init early_init_devtree(void *params)
860860
*/
861861
if (fadump_reserve_mem() == 0)
862862
#endif
863-
reserve_crashkernel();
863+
arch_reserve_crashkernel();
864864
early_reserve_mem();
865865

866866
if (memory_limit > memblock_phys_mem_size())

arch/powerpc/kexec/core.c

Lines changed: 38 additions & 58 deletions
Original file line numberDiff line numberDiff line change
@@ -58,38 +58,20 @@ void machine_kexec(struct kimage *image)
5858
}
5959

6060
#ifdef CONFIG_CRASH_RESERVE
61-
void __init reserve_crashkernel(void)
62-
{
63-
unsigned long long crash_size, crash_base, total_mem_sz;
64-
int ret;
6561

66-
total_mem_sz = memory_limit ? memory_limit : memblock_phys_mem_size();
67-
/* use common parsing */
68-
ret = parse_crashkernel(boot_command_line, total_mem_sz,
69-
&crash_size, &crash_base, NULL, NULL);
70-
if (ret == 0 && crash_size > 0) {
71-
crashk_res.start = crash_base;
72-
crashk_res.end = crash_base + crash_size - 1;
73-
}
74-
75-
if (crashk_res.end == crashk_res.start) {
76-
crashk_res.start = crashk_res.end = 0;
77-
return;
78-
}
79-
80-
/* We might have got these values via the command line or the
81-
* device tree, either way sanitise them now. */
82-
83-
crash_size = resource_size(&crashk_res);
62+
static unsigned long long __init get_crash_base(unsigned long long crash_base)
63+
{
8464

8565
#ifndef CONFIG_NONSTATIC_KERNEL
86-
if (crashk_res.start != KDUMP_KERNELBASE)
66+
if (crash_base != KDUMP_KERNELBASE)
8767
printk("Crash kernel location must be 0x%x\n",
8868
KDUMP_KERNELBASE);
8969

90-
crashk_res.start = KDUMP_KERNELBASE;
70+
return KDUMP_KERNELBASE;
9171
#else
92-
if (!crashk_res.start) {
72+
unsigned long long crash_base_align;
73+
74+
if (!crash_base) {
9375
#ifdef CONFIG_PPC64
9476
/*
9577
* On the LPAR platform place the crash kernel to mid of
@@ -101,53 +83,51 @@ void __init reserve_crashkernel(void)
10183
* kernel starts at 128MB offset on other platforms.
10284
*/
10385
if (firmware_has_feature(FW_FEATURE_LPAR))
104-
crashk_res.start = min_t(u64, ppc64_rma_size / 2, SZ_512M);
86+
crash_base = min_t(u64, ppc64_rma_size / 2, SZ_512M);
10587
else
106-
crashk_res.start = min_t(u64, ppc64_rma_size / 2, SZ_128M);
88+
crash_base = min_t(u64, ppc64_rma_size / 2, SZ_128M);
10789
#else
108-
crashk_res.start = KDUMP_KERNELBASE;
90+
crash_base = KDUMP_KERNELBASE;
10991
#endif
11092
}
11193

112-
crash_base = PAGE_ALIGN(crashk_res.start);
113-
if (crash_base != crashk_res.start) {
114-
printk("Crash kernel base must be aligned to 0x%lx\n",
115-
PAGE_SIZE);
116-
crashk_res.start = crash_base;
117-
}
94+
crash_base_align = PAGE_ALIGN(crash_base);
95+
if (crash_base != crash_base_align)
96+
pr_warn("Crash kernel base must be aligned to 0x%lx\n", PAGE_SIZE);
11897

98+
return crash_base_align;
11999
#endif
120-
crash_size = PAGE_ALIGN(crash_size);
121-
crashk_res.end = crashk_res.start + crash_size - 1;
100+
}
122101

123-
/* The crash region must not overlap the current kernel */
124-
if (overlaps_crashkernel(__pa(_stext), _end - _stext)) {
125-
printk(KERN_WARNING
126-
"Crash kernel can not overlap current kernel\n");
127-
crashk_res.start = crashk_res.end = 0;
102+
void __init arch_reserve_crashkernel(void)
103+
{
104+
unsigned long long crash_size, crash_base, crash_end;
105+
unsigned long long kernel_start, kernel_size;
106+
unsigned long long total_mem_sz;
107+
int ret;
108+
109+
total_mem_sz = memory_limit ? memory_limit : memblock_phys_mem_size();
110+
111+
/* use common parsing */
112+
ret = parse_crashkernel(boot_command_line, total_mem_sz, &crash_size,
113+
&crash_base, NULL, NULL);
114+
115+
if (ret)
128116
return;
129-
}
130117

131-
/* Crash kernel trumps memory limit */
132-
if (memory_limit && memory_limit <= crashk_res.end) {
133-
memory_limit = crashk_res.end + 1;
134-
total_mem_sz = memory_limit;
135-
printk("Adjusted memory limit for crashkernel, now 0x%llx\n",
136-
memory_limit);
137-
}
118+
crash_base = get_crash_base(crash_base);
119+
crash_end = crash_base + crash_size - 1;
138120

139-
printk(KERN_INFO "Reserving %ldMB of memory at %ldMB "
140-
"for crashkernel (System RAM: %ldMB)\n",
141-
(unsigned long)(crash_size >> 20),
142-
(unsigned long)(crashk_res.start >> 20),
143-
(unsigned long)(total_mem_sz >> 20));
121+
kernel_start = __pa(_stext);
122+
kernel_size = _end - _stext;
144123

145-
if (!memblock_is_region_memory(crashk_res.start, crash_size) ||
146-
memblock_reserve(crashk_res.start, crash_size)) {
147-
pr_err("Failed to reserve memory for crashkernel!\n");
148-
crashk_res.start = crashk_res.end = 0;
124+
/* The crash region must not overlap the current kernel */
125+
if ((kernel_start + kernel_size > crash_base) && (kernel_start <= crash_end)) {
126+
pr_warn("Crash kernel can not overlap current kernel\n");
149127
return;
150128
}
129+
130+
reserve_crashkernel_generic(crash_size, crash_base, 0, false);
151131
}
152132

153133
int __init overlaps_crashkernel(unsigned long start, unsigned long size)

0 commit comments

Comments
 (0)