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

Configure Feed

Select the types of activity you want to include in your feed.

crash_core.c: remove unnecessary parameter of function

Patch series "kdump: use generic functions to simplify crashkernel
reservation in arch", v3.

In the current arm64, crashkernel=,high support has been finished after
several rounds of posting and careful reviewing. The code in arm64 which
parses crashkernel kernel parameters firstly, then reserve memory can be a
good example for other ARCH to refer to.

Whereas in x86_64, the code mixing crashkernel parameter parsing and
memory reserving is twisted, and looks messy. Refactoring the code to
make it more readable maintainable is necessary.

Here, firstly abstract the crashkernel parameter parsing code into
parse_crashkernel() to make it be able to parse crashkernel=,high|low.
Then abstract the crashkernel memory reserving code into a generic
function reserve_crashkernel_generic(). Finally, in ARCH which
crashkernel=,high support is needed, a simple arch_reserve_crashkernel()
can be added to call above two functions. This can remove the duplicated
implmentation code in each ARCH, like arm64, x86_64 and riscv.

crashkernel=512M,high
crashkernel=512M,high crashkernel=256M,low
crashkernel=512M,high crashkernel=0M,low
crashkernel=0M,high crashkernel=256M,low
crashkernel=512M
crashkernel=512M@0x4f000000
crashkernel=1G-4G:256M,4G-64G:320M,64G-:576M
crashkernel=0M


This patch (of 9):

In all call sites of __parse_crashkernel(), the parameter 'name' is
hardcoded as "crashkernel=". So remove the unnecessary parameter 'name',
add local varibale 'name' inside __parse_crashkernel() instead.

Link: https://lkml.kernel.org/r/20230914033142.676708-1-bhe@redhat.com
Link: https://lkml.kernel.org/r/20230914033142.676708-2-bhe@redhat.com
Signed-off-by: Baoquan He <bhe@redhat.com>
Reviewed-by: Zhen Lei <thunder.leizhen@huawei.com>
Cc: Catalin Marinas <catalin.marinas@arm.com>
Cc: Chen Jiahao <chenjiahao16@huawei.com>
Cc: Zhen Lei <thunder.leizhen@huawei.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>

authored by

Baoquan He and committed by
Andrew Morton
a6304272 e22c3872

+4 -4
+4 -4
kernel/crash_core.c
··· 248 248 unsigned long long system_ram, 249 249 unsigned long long *crash_size, 250 250 unsigned long long *crash_base, 251 - const char *name, 252 251 const char *suffix) 253 252 { 254 253 char *first_colon, *first_space; 255 254 char *ck_cmdline; 255 + char *name = "crashkernel="; 256 256 257 257 BUG_ON(!crash_size || !crash_base); 258 258 *crash_size = 0; ··· 290 290 unsigned long long *crash_base) 291 291 { 292 292 return __parse_crashkernel(cmdline, system_ram, crash_size, crash_base, 293 - "crashkernel=", NULL); 293 + NULL); 294 294 } 295 295 296 296 int __init parse_crashkernel_high(char *cmdline, ··· 299 299 unsigned long long *crash_base) 300 300 { 301 301 return __parse_crashkernel(cmdline, system_ram, crash_size, crash_base, 302 - "crashkernel=", suffix_tbl[SUFFIX_HIGH]); 302 + suffix_tbl[SUFFIX_HIGH]); 303 303 } 304 304 305 305 int __init parse_crashkernel_low(char *cmdline, ··· 308 308 unsigned long long *crash_base) 309 309 { 310 310 return __parse_crashkernel(cmdline, system_ram, crash_size, crash_base, 311 - "crashkernel=", suffix_tbl[SUFFIX_LOW]); 311 + suffix_tbl[SUFFIX_LOW]); 312 312 } 313 313 314 314 /*