Skip to content

Commit 1595ff7

Browse files
author
CKI KWF Bot
committed
Merge: Rebase kexec/kdump to the upstream kernel v6.15
MR: https://gitlab.com/redhat/centos-stream/src/kernel/centos-stream-10/-/merge_requests/1639 ``` JIRA: https://issues.redhat.com/browse/RHEL-114162 Upstream Status: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git This is to sync the rhel10.2 kernel to the latest upstream kernel, including bug fixes, cleanup and features. Signed-off-by: Baoquan He <bhe@redhat.com> ``` Approved-by: Rafael Aquini <raquini@redhat.com> Approved-by: John W. Linville <linville@redhat.com> Approved-by: Coiby Xu <coxu@redhat.com> Approved-by: Lianbo Jiang <lijiang@redhat.com> Approved-by: Steve Best <sbest@redhat.com> Approved-by: CKI KWF Bot <cki-ci-bot+kwf-gitlab-com@redhat.com> Merged-by: CKI GitLab Kmaint Pipeline Bot <26919896-cki-kmaint-pipeline-bot@users.noreply.gitlab.com>
2 parents 22891f1 + cbcd814 commit 1595ff7

File tree

54 files changed

+1397
-828
lines changed

Some content is hidden

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

54 files changed

+1397
-828
lines changed

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
@@ -720,6 +720,9 @@ config ARCH_SUPPORTS_CRASH_HOTPLUG
720720
def_bool y
721721
depends on PPC64
722722

723+
config ARCH_HAS_GENERIC_CRASHKERNEL_RESERVATION
724+
def_bool CRASH_RESERVE
725+
723726
config FA_DUMP
724727
bool "Firmware-assisted dump"
725728
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
@@ -95,8 +95,10 @@ int arch_kexec_kernel_image_probe(struct kimage *image, void *buf, unsigned long
9595
int arch_kimage_file_post_load_cleanup(struct kimage *image);
9696
#define arch_kimage_file_post_load_cleanup arch_kimage_file_post_load_cleanup
9797

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

101103
int load_crashdump_segments_ppc64(struct kimage *image,
102104
struct kexec_buf *kbuf);
@@ -113,9 +115,9 @@ int setup_new_fdt_ppc64(const struct kimage *image, void *fdt, struct crash_mem
113115

114116
#ifdef CONFIG_CRASH_RESERVE
115117
int __init overlaps_crashkernel(unsigned long start, unsigned long size);
116-
extern void reserve_crashkernel(void);
118+
extern void arch_reserve_crashkernel(void);
117119
#else
118-
static inline void reserve_crashkernel(void) {}
120+
static inline void arch_reserve_crashkernel(void) {}
119121
static inline int overlaps_crashkernel(unsigned long start, unsigned long size) { return 0; }
120122
#endif
121123

arch/powerpc/kernel/fadump.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -751,7 +751,7 @@ u32 *__init fadump_regs_to_elf_notes(u32 *buf, struct pt_regs *regs)
751751
* prstatus.pr_pid = ????
752752
*/
753753
elf_core_copy_regs(&prstatus.pr_reg, regs);
754-
buf = append_elf_note(buf, CRASH_CORE_NOTE_NAME, NT_PRSTATUS,
754+
buf = append_elf_note(buf, NN_PRSTATUS, NT_PRSTATUS,
755755
&prstatus, sizeof(prstatus));
756756
return buf;
757757
}

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
@@ -80,38 +80,20 @@ void machine_kexec(struct kimage *image)
8080
}
8181

8282
#ifdef CONFIG_CRASH_RESERVE
83-
void __init reserve_crashkernel(void)
84-
{
85-
unsigned long long crash_size, crash_base, total_mem_sz;
86-
int ret;
8783

88-
total_mem_sz = memory_limit ? memory_limit : memblock_phys_mem_size();
89-
/* use common parsing */
90-
ret = parse_crashkernel(boot_command_line, total_mem_sz,
91-
&crash_size, &crash_base, NULL, NULL);
92-
if (ret == 0 && crash_size > 0) {
93-
crashk_res.start = crash_base;
94-
crashk_res.end = crash_base + crash_size - 1;
95-
}
96-
97-
if (crashk_res.end == crashk_res.start) {
98-
crashk_res.start = crashk_res.end = 0;
99-
return;
100-
}
101-
102-
/* We might have got these values via the command line or the
103-
* device tree, either way sanitise them now. */
104-
105-
crash_size = resource_size(&crashk_res);
84+
static unsigned long long __init get_crash_base(unsigned long long crash_base)
85+
{
10686

10787
#ifndef CONFIG_NONSTATIC_KERNEL
108-
if (crashk_res.start != KDUMP_KERNELBASE)
88+
if (crash_base != KDUMP_KERNELBASE)
10989
printk("Crash kernel location must be 0x%x\n",
11090
KDUMP_KERNELBASE);
11191

112-
crashk_res.start = KDUMP_KERNELBASE;
92+
return KDUMP_KERNELBASE;
11393
#else
114-
if (!crashk_res.start) {
94+
unsigned long long crash_base_align;
95+
96+
if (!crash_base) {
11597
#ifdef CONFIG_PPC64
11698
/*
11799
* On the LPAR platform place the crash kernel to mid of
@@ -123,53 +105,51 @@ void __init reserve_crashkernel(void)
123105
* kernel starts at 128MB offset on other platforms.
124106
*/
125107
if (firmware_has_feature(FW_FEATURE_LPAR))
126-
crashk_res.start = min_t(u64, ppc64_rma_size / 2, SZ_512M);
108+
crash_base = min_t(u64, ppc64_rma_size / 2, SZ_512M);
127109
else
128-
crashk_res.start = min_t(u64, ppc64_rma_size / 2, SZ_128M);
110+
crash_base = min_t(u64, ppc64_rma_size / 2, SZ_128M);
129111
#else
130-
crashk_res.start = KDUMP_KERNELBASE;
112+
crash_base = KDUMP_KERNELBASE;
131113
#endif
132114
}
133115

134-
crash_base = PAGE_ALIGN(crashk_res.start);
135-
if (crash_base != crashk_res.start) {
136-
printk("Crash kernel base must be aligned to 0x%lx\n",
137-
PAGE_SIZE);
138-
crashk_res.start = crash_base;
139-
}
116+
crash_base_align = PAGE_ALIGN(crash_base);
117+
if (crash_base != crash_base_align)
118+
pr_warn("Crash kernel base must be aligned to 0x%lx\n", PAGE_SIZE);
140119

120+
return crash_base_align;
141121
#endif
142-
crash_size = PAGE_ALIGN(crash_size);
143-
crashk_res.end = crashk_res.start + crash_size - 1;
122+
}
144123

145-
/* The crash region must not overlap the current kernel */
146-
if (overlaps_crashkernel(__pa(_stext), _end - _stext)) {
147-
printk(KERN_WARNING
148-
"Crash kernel can not overlap current kernel\n");
149-
crashk_res.start = crashk_res.end = 0;
124+
void __init arch_reserve_crashkernel(void)
125+
{
126+
unsigned long long crash_size, crash_base, crash_end;
127+
unsigned long long kernel_start, kernel_size;
128+
unsigned long long total_mem_sz;
129+
int ret;
130+
131+
total_mem_sz = memory_limit ? memory_limit : memblock_phys_mem_size();
132+
133+
/* use common parsing */
134+
ret = parse_crashkernel(boot_command_line, total_mem_sz, &crash_size,
135+
&crash_base, NULL, NULL);
136+
137+
if (ret)
150138
return;
151-
}
152139

153-
/* Crash kernel trumps memory limit */
154-
if (memory_limit && memory_limit <= crashk_res.end) {
155-
memory_limit = crashk_res.end + 1;
156-
total_mem_sz = memory_limit;
157-
printk("Adjusted memory limit for crashkernel, now 0x%llx\n",
158-
memory_limit);
159-
}
140+
crash_base = get_crash_base(crash_base);
141+
crash_end = crash_base + crash_size - 1;
160142

161-
printk(KERN_INFO "Reserving %ldMB of memory at %ldMB "
162-
"for crashkernel (System RAM: %ldMB)\n",
163-
(unsigned long)(crash_size >> 20),
164-
(unsigned long)(crashk_res.start >> 20),
165-
(unsigned long)(total_mem_sz >> 20));
143+
kernel_start = __pa(_stext);
144+
kernel_size = _end - _stext;
166145

167-
if (!memblock_is_region_memory(crashk_res.start, crash_size) ||
168-
memblock_reserve(crashk_res.start, crash_size)) {
169-
pr_err("Failed to reserve memory for crashkernel!\n");
170-
crashk_res.start = crashk_res.end = 0;
146+
/* The crash region must not overlap the current kernel */
147+
if ((kernel_start + kernel_size > crash_base) && (kernel_start <= crash_end)) {
148+
pr_warn("Crash kernel can not overlap current kernel\n");
171149
return;
172150
}
151+
152+
reserve_crashkernel_generic(crash_size, crash_base, 0, false);
173153
}
174154

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

0 commit comments

Comments
 (0)