[PATCH v5] arm64: kdump: simplify the reservation behaviour of crashkernel=,high
Baoquan He
bhe at redhat.com
Fri Apr 14 17:43:17 PDT 2023
On 04/14/23 at 03:34pm, Will Deacon wrote:
> Hi,
>
> On Fri, Apr 07, 2023 at 10:24:19AM +0800, Baoquan He wrote:
> > On arm64, reservation for 'crashkernel=xM,high' is taken by searching for
> > suitable memory region top down. If the 'xM' of crashkernel high memory
> > is reserved from high memory successfully, it will try to reserve
> > crashkernel low memory later accoringly. Otherwise, it will try to search
> > low memory area for the 'xM' suitable region. Please see the details in
> > Documentation/admin-guide/kernel-parameters.txt.
>
> [...]
>
> > arch/arm64/mm/init.c | 44 ++++++++++++++++++++++++++++++++++----------
> > 1 file changed, 34 insertions(+), 10 deletions(-)
>
> I tried to apply this, but smatch is unhappy with the result:
>
> | arch/arm64/mm/init.c:153 reserve_crashkernel() error: uninitialized symbol 'search_base'.
>
> I _think_ this is a false positive, but I must say that the control flow
> in reserve_crashkernel() is extremely hard to follow so I couldn't be
> sure. If the static checker is struggling, then so will humans!
>
> Ideally, this would all be restructured to make it easier to follow,
> but in the short term we need something to squash the warning.
Sorry for that, I didn't run static checker. We should do initialization
as below to fix the warning. Below code can be added into this v5 patch,
or I can post v6 with Catalin's Reviewed-by tag.
Yes, about restructuring, I can think about it later. The added corner
cases handling specific for arm64 makes the flow a little harder to
flow. I will consider if adding document in arm64 is better.
>From 3575571ab9614c31f30933148a8693924a30321c Mon Sep 17 00:00:00 2001
From: Baoquan He <bhe at redhat.com>
Date: Sat, 15 Apr 2023 08:35:08 +0800
Subject: [PATCH] arm64: kdump: fix warning reported by static checker
Content-type: text/plain
Signed-off-by: Baoquan He <bhe at redhat.com>
---
arch/arm64/mm/init.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/arch/arm64/mm/init.c b/arch/arm64/mm/init.c
index 13750b0548da..bfc117cefcd5 100644
--- a/arch/arm64/mm/init.c
+++ b/arch/arm64/mm/init.c
@@ -128,9 +128,9 @@ static int __init reserve_crashkernel_low(unsigned long long low_size)
*/
static void __init reserve_crashkernel(void)
{
- unsigned long long crash_base, crash_size, search_base;
+ unsigned long long crash_low_size = 0, search_base = 0;
unsigned long long crash_max = CRASH_ADDR_LOW_MAX;
- unsigned long long crash_low_size = 0;
+ unsigned long long crash_base, crash_size;
char *cmdline = boot_command_line;
bool fixed_base = false;
bool high = false;
--
2.34.1
More information about the kexec
mailing list