Re: [PATCH v3 6/9] x86: kdump: use generic interface to simplify crashkernel reservation code

From: Baoquan He
Date: Fri Sep 15 2023 - 09:14:53 EST


On 09/14/23 at 04:12pm, kernel test robot wrote:
> Hi Baoquan,
>
> kernel test robot noticed the following build warnings:
>
> [auto build test WARNING on powerpc/next]
> [also build test WARNING on powerpc/fixes linus/master v6.6-rc1 next-20230914]
> [cannot apply to arm64/for-next/core tip/x86/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/Baoquan-He/crash_core-c-remove-unnecessary-parameter-of-function/20230914-113546
> base: https://git.kernel.org/pub/scm/linux/kernel/git/powerpc/linux.git next
> patch link: https://lore.kernel.org/r/20230914033142.676708-7-bhe%40redhat.com
> patch subject: [PATCH v3 6/9] x86: kdump: use generic interface to simplify crashkernel reservation code
> config: i386-allnoconfig (https://download.01.org/0day-ci/archive/20230914/202309141534.moH4dTcz-lkp@xxxxxxxxx/config)
> compiler: clang version 16.0.4 (https://github.com/llvm/llvm-project.git ae42196bc493ffe877a7e3dff8be32035dea4d07)
> reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20230914/202309141534.moH4dTcz-lkp@xxxxxxxxx/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@xxxxxxxxx>
> | Closes: https://lore.kernel.org/oe-kbuild-all/202309141534.moH4dTcz-lkp@xxxxxxxxx/
>
> All warnings (new ones prefixed by >>):
>
> >> arch/x86/kernel/setup.c:476:15: warning: no previous prototype for function 'crash_low_size_default' [-Wmissing-prototypes]
> unsigned long crash_low_size_default(void)
> ^
> arch/x86/kernel/setup.c:476:1: note: declare 'static' if the function is not intended to be used outside of this translation unit
> unsigned long crash_low_size_default(void)
> ^
> static
> 1 warning generated.

Thanks for reporting this. I can reproduced this warning on x86_64
machine by retrieving the LKP's config and build it with below command:

make ARCH=i386 -j128 W=1 arch/x86/kernel/

I can fix it by moving crash_low_size_default() into arch/x86/include/asm/crash_core.h
and make it as static inline as below draft change.

Hi Andrew,

I should post v4 of the whole series or just v4 of this patch?

[PATCH v3 6/9] x86: kdump: use generic interface to simplify crashkernel reservation code


diff --git a/arch/x86/include/asm/crash_core.h b/arch/x86/include/asm/crash_core.h
index 5fc5e4f94521..76af98f4e801 100644
--- a/arch/x86/include/asm/crash_core.h
+++ b/arch/x86/include/asm/crash_core.h
@@ -18,6 +18,7 @@
* no good way to detect the paging mode of the target kernel which will be
* loaded for dumping.
*/
+extern unsigned long swiotlb_size_or_default(void);

#ifdef CONFIG_X86_32
# define CRASH_ADDR_LOW_MAX SZ_512M
@@ -29,6 +30,13 @@

# define DEFAULT_CRASH_KERNEL_LOW_SIZE crash_low_size_default()

-extern unsigned long crash_low_size_default(void);
+static inline unsigned long crash_low_size_default(void)
+{
+#ifdef CONFIG_X86_64
+ return max(swiotlb_size_or_default() + (8UL << 20), 256UL << 20);
+#else
+ return 0;
+#endif
+}

#endif /* _X86_CRASH_CORE_H */
diff --git a/arch/x86/kernel/setup.c b/arch/x86/kernel/setup.c
index 0acc86587fc0..d7baa567c68e 100644
--- a/arch/x86/kernel/setup.c
+++ b/arch/x86/kernel/setup.c
@@ -470,18 +470,6 @@ static void __init memblock_x86_reserve_range_setup_data(void)
}
}

-/*
- * --------- Crashkernel reservation ------------------------------
- */
-unsigned long crash_low_size_default(void)
-{
-#ifdef CONFIG_X86_64
- return max(swiotlb_size_or_default() + (8UL << 20), 256UL << 20);
-#else
- return 0;
-#endif
-}
-
static void __init arch_reserve_crashkernel(void)
{
unsigned long long crash_base, crash_size, low_size = 0;