Received: by 2002:a05:6358:53a8:b0:117:f937:c515 with SMTP id z40csp1259786rwe; Fri, 14 Apr 2023 17:46:28 -0700 (PDT) X-Google-Smtp-Source: AKy350ZSu4ebh8O7l2sGdu9W8y9AdCN9QEVLrhsHqmSIEL9DZpMMM+G29RSQZ/PQ5qL2BoAbjbSq X-Received: by 2002:a05:6a00:1309:b0:63b:5496:7b04 with SMTP id j9-20020a056a00130900b0063b54967b04mr9298042pfu.9.1681519587735; Fri, 14 Apr 2023 17:46:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1681519587; cv=none; d=google.com; s=arc-20160816; b=fGtJotG4ChmvPXVr22Kt20I+DPLI1VDELVBPjqZauWu6UbUNXJ220AhXWxoH6f8kdS gNQNv9xpXY4CRdO6YdJFZlSFWNSxL0m1B0ejTfep6o6gfCX0fQY20BlwwhbWIE3HyJhq z1doZ5HncAvIlKRZrV1xW4SS9L6L/Spt1HxjKeiRAvadBsH30zbxmVmrMQvHndM9Zt8d 4eHQwXX9kk0X8WkQmewX67MoJioY0ZPMl/4CW5+Zo4JGCI/mx6UZjgx5OpwzIg4RGmlT yw7700z5Omx0Amrpz3D2Iju9SBIVJ9gB1vwp8mNVMlKLs227hwqXwxJeA0nFE8Jx3EQm +Mew== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=jLzcmt6yXFfM7kna/P8KGa04zAmCOpl3/oE8xB2gQTc=; b=H2Rzm2236P3nkVjWkS6z8RSTc5ZpCMjLxcv5/ZGhoCfEp+YIBsb+IeG9DPSyS7clEB cM0iTTpPdyAQ8ZgF2J84DF+Bmn0SGwdN3IIEGhzrv2A0TgZjCAFUTsTRwMj5KVGu01Mm 3H2PkpoDbmmUCxDq87V+8Jv18NrCpjwc8a/zx6QmAgIX74pZ3ZlGd6JcFOaqNTXHC7S0 SDgfrD/n7AUKUotVgoND95m+oScW9axq/RtvbmftHuD1HoiyNmROOljQuyDAhTp9DX6+ sKq88eivV76bMoLQoxJtNhobDaPUEvyrFLgvOmvf6H5dFwYXawUKdkpaVmZDHlByiUO2 NxPQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=CIu0Q9Rv; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id p67-20020a625b46000000b0063b57ad9891si4520414pfb.315.2023.04.14.17.46.16; Fri, 14 Apr 2023 17:46:27 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=CIu0Q9Rv; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229766AbjDOAoT (ORCPT + 99 others); Fri, 14 Apr 2023 20:44:19 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53628 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229773AbjDOAoQ (ORCPT ); Fri, 14 Apr 2023 20:44:16 -0400 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9D19C4EFB for ; Fri, 14 Apr 2023 17:43:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1681519407; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=jLzcmt6yXFfM7kna/P8KGa04zAmCOpl3/oE8xB2gQTc=; b=CIu0Q9Rv/+dselgn5y7vHsNUQsoc6d5dUrq628AOyZCZxCPRq5h6Y0haIRT6UC+vMdACJm VFa9RwF05IubpbLK53vh8d7m9dcsKLUN9MfiyxkxvFJJfx2paX5W1xnvv+tZ5ED4DYjX24 UTMicskF7HW2ncuM1saYFOvV0D0r3mY= Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-581-2cQ0V8l1PEOwMptCbG6fhg-1; Fri, 14 Apr 2023 20:43:24 -0400 X-MC-Unique: 2cQ0V8l1PEOwMptCbG6fhg-1 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id B2B792823815; Sat, 15 Apr 2023 00:43:23 +0000 (UTC) Received: from localhost (ovpn-12-58.pek2.redhat.com [10.72.12.58]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 91CDE1121320; Sat, 15 Apr 2023 00:43:22 +0000 (UTC) Date: Sat, 15 Apr 2023 08:43:17 +0800 From: Baoquan He To: Will Deacon Cc: linux-kernel@vger.kernel.org, catalin.marinas@arm.com, horms@kernel.org, thunder.leizhen@huawei.com, John.p.donnelly@oracle.com, kexec@lists.infradead.org, linux-arm-kernel@lists.infradead.org Subject: Re: [PATCH v5] arm64: kdump: simplify the reservation behaviour of crashkernel=,high Message-ID: References: <20230407022419.19412-1-bhe@redhat.com> <20230414143413.GA27911@willie-the-truck> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20230414143413.GA27911@willie-the-truck> X-Scanned-By: MIMEDefang 3.1 on 10.11.54.3 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_NONE,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 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 --- 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