Received: by 2002:a05:6358:11c7:b0:104:8066:f915 with SMTP id i7csp933767rwl; Fri, 31 Mar 2023 04:40:32 -0700 (PDT) X-Google-Smtp-Source: AKy350apgBlInO7dVrICFHt7p4hO7QCgi7TFfrYR/zJzoGnio3WjbLM7bebGpKm0lO+65twdSn59 X-Received: by 2002:a17:902:7c0d:b0:1a0:7663:731b with SMTP id x13-20020a1709027c0d00b001a07663731bmr23196319pll.5.1680262832461; Fri, 31 Mar 2023 04:40:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1680262832; cv=none; d=google.com; s=arc-20160816; b=aPeIYrVPVb4mEBnlKwVbMdcbtKXyfnJHx5mvGaD3RH8C/rR1tBlwO/COlTHFRdjA+4 AoZ5cRBJHHjEgVWrSW8cbEUGn5fDOtockM+rxwOhDOYiKbEraJiJS98fwNrRVfUvVZBo 5LqX3+9pcH/rsz4C8H4o5iTt7uPXXwThV40MD0gqhnH2b9eUVlLHGQlp9MuEhE6sdBr6 nVjWkUmIFQ3mbWhFk4vOFw+jVy6hC6MqRtaYeC23oP4MB62QkEmlDK7Sik5+bZMxd/lb 1LRpP+7WaO9+Er6Ax5MtDKv/FiwWUC0JeYWm02ooJWn5FxSM5x47ZgsK5loz2Z09s7zF h8KA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:content-language:subject:user-agent:mime-version :date:message-id; bh=KepxW20qfV72arCgtAO3tbxfWapvHzR+072ieNVV8OM=; b=PMdr49CFqXIgaQQ0H8fIOkK2ODe+5TfTuRsryR2FB1S8BGlt5fPju3AZbiqf0JmYai WQNRlWU6EPSnJUWirJD5EUI8J/WezhgTTUt7wQXVWOAophGwy1MuMZk4fGVgt360f9sl N7/tXA2YV9pY4gwIWtoH+shSDptCgk5OpQjEtlCoeQ81OIq4jktPehrixWTQpMbfTNp5 Dyayc4JHYDkkMEaPQvDLx8hkzcyzTz5SX1b2N2dFDYLPFbjtdDIDTHqsPBD46K471HIh z27pxcyE4mZSKNYClGhPjMXODSCzxBJkikJL43rBaB4gn+Kfyp+t0/i92dBn/MlbBr/I JuVw== ARC-Authentication-Results: i=1; mx.google.com; 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=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id kt12-20020a170903088c00b001a247793456si1947412plb.176.2023.03.31.04.40.18; Fri, 31 Mar 2023 04:40:32 -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; 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=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231781AbjCaLgt (ORCPT + 99 others); Fri, 31 Mar 2023 07:36:49 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48318 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229437AbjCaLgs (ORCPT ); Fri, 31 Mar 2023 07:36:48 -0400 Received: from szxga08-in.huawei.com (szxga08-in.huawei.com [45.249.212.255]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B6A83210D; Fri, 31 Mar 2023 04:36:45 -0700 (PDT) Received: from dggpemm500016.china.huawei.com (unknown [172.30.72.54]) by szxga08-in.huawei.com (SkyGuard) with ESMTP id 4PnypX3DWVz17RGV; Fri, 31 Mar 2023 19:33:24 +0800 (CST) Received: from [10.67.108.26] (10.67.108.26) by dggpemm500016.china.huawei.com (7.185.36.25) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.21; Fri, 31 Mar 2023 19:36:42 +0800 Message-ID: Date: Fri, 31 Mar 2023 19:36:42 +0800 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101 Thunderbird/102.9.0 Subject: Re: [PATCH -next v2 1/2] riscv: kdump: Implement crashkernel=X,[high,low] Content-Language: en-US To: Baoquan He CC: , , , , , , , , , , , , , , References: <20230328115150.2700016-1-chenjiahao16@huawei.com> <20230328115150.2700016-2-chenjiahao16@huawei.com> From: "chenjiahao (C)" In-Reply-To: Content-Type: text/plain; charset="UTF-8"; format=flowed Content-Transfer-Encoding: 7bit X-Originating-IP: [10.67.108.26] X-ClientProxiedBy: dggems701-chm.china.huawei.com (10.3.19.178) To dggpemm500016.china.huawei.com (7.185.36.25) X-CFilter-Loop: Reflected X-Spam-Status: No, score=-2.3 required=5.0 tests=NICE_REPLY_A, RCVD_IN_DNSWL_MED,RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_PASS autolearn=unavailable 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 2023/3/31 7:32, Baoquan He wrote: > On 03/30/23 at 09:40pm, chenjiahao (C) wrote: > ...... >> Agreed, I will clean this up later in next version. >>>> + if (ret || !crash_size) >>>> + return; >>>> + >>>> + /* >>>> + * crashkernel=Y,low is valid only when crashkernel=X,high >>>> + * is passed and high memory is reserved successful. >>>> + */ >>>> + ret = parse_crashkernel_low(boot_command_line, 0, &crash_low_size, &crash_base); >>>> + if (ret == -ENOENT) >>>> + crash_low_size = DEFAULT_CRASH_KERNEL_LOW_SIZE; >>>> + else if (ret) >>>> + return; >>>> + >>>> + search_start = dma32_phys_limit; >>>> + } else if (ret || !crash_size) { >>>> + /* Invalid argument value specified */ >>>> return; >>>> + } >>>> crash_size = PAGE_ALIGN(crash_size); >>>> @@ -1201,16 +1246,26 @@ static void __init reserve_crashkernel(void) >>>> */ >>>> crash_base = memblock_phys_alloc_range(crash_size, PMD_SIZE, >>>> search_start, >>>> - min(search_end, (unsigned long) SZ_4G)); >>>> + min(search_end, (unsigned long)dma32_phys_limit)); >>>> if (crash_base == 0) { >>> The above conditional check isn't right. If crashkernel=size@offset >>> specified, the reservation failure won't trigger retry. This seems to be >>> originally introduced by old commit, while this need be fixed firstly. >> Just a little curious about the rule to cope with this specific case. If >> "crashkernel=size@offset" was passed >> >> but reserve failed, should try again to allocate in high memory, regardless >> the specified size@offset, >> >> or just throw a warning and return? Since I noticed the current logic here >> on Arm64 is to check if !fixed_base first > Yeah, we need mark the "crashkernel=size@offset" case and avoid to > retry. Because you won't succeed if memblock has already failed to > reserve an unavailable memory region, retry is meaningless. This has > been done in x86, arm64. Make sense, thanks. Actually, in my previous tests, the result in this case is the same as expectation, i.e. when allocating "crashkernel=size@offset" failed on low memory, it would retry but return on failure. Since the search_end is assigned with offset + size, which is lower than DMA32 limit, the second allocation is definitely invalid. But for sure, to make the code easy to read and eradicate other possible corner cases, I will check if !fixed_base first on retry. >