Hi Jiri,
kernel test robot noticed the following build warnings:
[auto build test WARNING on powerpc/next]
[also build test WARNING on powerpc/fixes s390/features linus/master v6.7-rc2 next-20231124]
[cannot apply to tip/x86/core arm64/for-next/core]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]
url: https://github.com/intel-lab-lkp/linux/commits/Jiri-Bohac/kdump-implement-reserve_crashkernel_cma/20231125-082724
base: https://git.kernel.org/pub/scm/linux/kernel/git/powerpc/linux.git next
patch link: https://lore.kernel.org/r/ZWEAPXiCCgAf1WrY%40dwarf.suse.cz
patch subject: [PATCH 1/4] kdump: add crashkernel cma suffix
config: alpha-randconfig-r081-20231125 (https://download.01.org/0day-ci/archive/20231125/202311251303.71yrbT6l-lkp@intel.com/config)
compiler: alpha-linux-gcc (GCC) 13.2.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20231125/202311251303.71yrbT6l-lkp@intel.com/reproduce)
If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202311251303.71yrbT6l-lkp@intel.com/
All warnings (new ones prefixed by >>):
kernel/crash_core.c: In function 'parse_crashkernel':
>> kernel/crash_core.c:319:28: warning: unused variable 'cma_base' [-Wunused-variable]
319 | unsigned long long cma_base;
| ^~~~~~~~
vim +/cma_base +319 kernel/crash_core.c
302
303 /*
304 * That function is the entry point for command line parsing and should be
305 * called from the arch-specific code.
306 *
307 * If crashkernel=,high|low is supported on architecture, non-NULL values
308 * should be passed to parameters 'low_size' and 'high'.
309 */
310 int __init parse_crashkernel(char *cmdline,
311 unsigned long long system_ram,
312 unsigned long long *crash_size,
313 unsigned long long *crash_base,
314 unsigned long long *low_size,
315 unsigned long long *cma_size,
316 bool *high)
317 {
318 int ret;
> 319 unsigned long long cma_base;
320
321 /* crashkernel=X[@offset] */
322 ret = __parse_crashkernel(cmdline, system_ram, crash_size,
323 crash_base, NULL);
324 #ifdef CONFIG_ARCH_HAS_GENERIC_CRASHKERNEL_RESERVATION
325 /*
326 * If non-NULL 'high' passed in and no normal crashkernel
327 * setting detected, try parsing crashkernel=,high|low.
328 */
329 if (high && ret == -ENOENT) {
330 ret = __parse_crashkernel(cmdline, 0, crash_size,
331 crash_base, suffix_tbl[SUFFIX_HIGH]);
332 if (ret || !*crash_size)
333 return -EINVAL;
334
335 /*
336 * crashkernel=Y,low can be specified or not, but invalid value
337 * is not allowed.
338 */
339 ret = __parse_crashkernel(cmdline, 0, low_size,
340 crash_base, suffix_tbl[SUFFIX_LOW]);
341 if (ret == -ENOENT) {
342 *low_size = DEFAULT_CRASH_KERNEL_LOW_SIZE;
343 ret = 0;
344 } else if (ret) {
345 return ret;
346 }
347
348 *high = true;
349 }
350
351 /*
352 * optional CMA reservation
353 * cma_base is ignored
354 */
355 if (cma_size)
356 __parse_crashkernel(cmdline, 0, cma_size,
357 &cma_base, suffix_tbl[SUFFIX_CMA]);
358 #endif
359 if (!*crash_size)
360 ret = -EINVAL;
361
362 return ret;
363 }
364
@@ -1010,7 +1010,7 @@ static void __init reserve_crashkernel(void)
total_mem = get_total_mem();
ret = parse_crashkernel(boot_command_line, total_mem,
&crash_size, &crash_base,
- NULL, NULL);
+ NULL, NULL, NULL);
/* invalid value specified or crashkernel=0 */
if (ret || !crash_size)
return;
@@ -105,7 +105,7 @@ static void __init arch_reserve_crashkernel(void)
ret = parse_crashkernel(cmdline, memblock_phys_mem_size(),
&crash_size, &crash_base,
- &low_size, &high);
+ &low_size, NULL, &high);
if (ret)
return;
@@ -266,7 +266,7 @@ static void __init arch_parse_crashkernel(void)
total_mem = memblock_phys_mem_size();
ret = parse_crashkernel(boot_command_line, total_mem,
&crash_size, &crash_base,
- NULL, NULL);
+ NULL, NULL, NULL);
if (ret < 0 || crash_size <= 0)
return;
@@ -456,7 +456,7 @@ static void __init mips_parse_crashkernel(void)
total_mem = memblock_phys_mem_size();
ret = parse_crashkernel(boot_command_line, total_mem,
&crash_size, &crash_base,
- NULL, NULL);
+ NULL, NULL, NULL);
if (ret != 0 || crash_size <= 0)
return;
@@ -313,7 +313,7 @@ static __init u64 fadump_calculate_reserve_size(void)
* memory at a predefined offset.
*/
ret = parse_crashkernel(boot_command_line, memblock_phys_mem_size(),
- &size, &base, NULL, NULL);
+ &size, &base, NULL, NULL, NULL);
if (ret == 0 && size > 0) {
unsigned long max_size;
@@ -112,7 +112,7 @@ void __init reserve_crashkernel(void)
total_mem_sz = memory_limit ? memory_limit : memblock_phys_mem_size();
/* use common parsing */
ret = parse_crashkernel(boot_command_line, total_mem_sz,
- &crash_size, &crash_base, NULL, NULL);
+ &crash_size, &crash_base, NULL, NULL, NULL);
if (ret == 0 && crash_size > 0) {
crashk_res.start = crash_base;
crashk_res.end = crash_base + crash_size - 1;
@@ -178,7 +178,7 @@ static void __init get_crash_kernel(void *fdt, unsigned long size)
int ret;
ret = parse_crashkernel(boot_command_line, size, &crash_size,
- &crash_base, NULL, NULL);
+ &crash_base, NULL, NULL, NULL);
if (ret != 0 || crash_size == 0)
return;
if (crash_base == 0)
@@ -1355,7 +1355,7 @@ static void __init arch_reserve_crashkernel(void)
ret = parse_crashkernel(cmdline, memblock_phys_mem_size(),
&crash_size, &crash_base,
- &low_size, &high);
+ &low_size, NULL, &high);
if (ret)
return;
@@ -619,7 +619,7 @@ static void __init reserve_crashkernel(void)
int rc;
rc = parse_crashkernel(boot_command_line, ident_map_size,
- &crash_size, &crash_base, NULL, NULL);
+ &crash_size, &crash_base, NULL, NULL, NULL);
crash_base = ALIGN(crash_base, KEXEC_CRASH_MEM_ALIGN);
crash_size = ALIGN(crash_size, KEXEC_CRASH_MEM_ALIGN);
@@ -154,7 +154,7 @@ void __init reserve_crashkernel(void)
int ret;
ret = parse_crashkernel(boot_command_line, memblock_phys_mem_size(),
- &crash_size, &crash_base, NULL, NULL);
+ &crash_size, &crash_base, NULL, NULL, NULL);
if (ret == 0 && crash_size > 0) {
crashk_res.start = crash_base;
crashk_res.end = crash_base + crash_size - 1;
@@ -478,7 +478,7 @@ static void __init arch_reserve_crashkernel(void)
ret = parse_crashkernel(cmdline, memblock_phys_mem_size(),
&crash_size, &crash_base,
- &low_size, &high);
+ &low_size, NULL, &high);
if (ret)
return;
@@ -95,7 +95,8 @@ void final_note(Elf_Word *buf);
int __init parse_crashkernel(char *cmdline, unsigned long long system_ram,
unsigned long long *crash_size, unsigned long long *crash_base,
- unsigned long long *low_size, bool *high);
+ unsigned long long *low_size, unsigned long long *cma_size,
+ bool *high);
#ifdef CONFIG_ARCH_HAS_GENERIC_CRASHKERNEL_RESERVATION
#ifndef DEFAULT_CRASH_KERNEL_LOW_SIZE
@@ -184,11 +184,13 @@ static int __init parse_crashkernel_simple(char *cmdline,
#define SUFFIX_HIGH 0
#define SUFFIX_LOW 1
-#define SUFFIX_NULL 2
+#define SUFFIX_CMA 2
+#define SUFFIX_NULL 3
static __initdata char *suffix_tbl[] = {
- [SUFFIX_HIGH] = ",high",
- [SUFFIX_LOW] = ",low",
- [SUFFIX_NULL] = NULL,
+ [SUFFIX_HIGH] = ",high",
+ [SUFFIX_LOW] = ",low",
+ [SUFFIX_CMA] = ",cma",
+ [SUFFIX_NULL] = NULL,
};
/*
@@ -310,9 +312,11 @@ int __init parse_crashkernel(char *cmdline,
unsigned long long *crash_size,
unsigned long long *crash_base,
unsigned long long *low_size,
+ unsigned long long *cma_size,
bool *high)
{
int ret;
+ unsigned long long cma_base;
/* crashkernel=X[@offset] */
ret = __parse_crashkernel(cmdline, system_ram, crash_size,
@@ -343,6 +347,14 @@ int __init parse_crashkernel(char *cmdline,
*high = true;
}
+
+ /*
+ * optional CMA reservation
+ * cma_base is ignored
+ */
+ if (cma_size)
+ __parse_crashkernel(cmdline, 0, cma_size,
+ &cma_base, suffix_tbl[SUFFIX_CMA]);
#endif
if (!*crash_size)
ret = -EINVAL;