Received: by 2002:a05:6358:11c7:b0:104:8066:f915 with SMTP id i7csp3874579rwl; Mon, 10 Apr 2023 02:26:48 -0700 (PDT) X-Google-Smtp-Source: AKy350bJC/qLHWF+y9DYUeNfKxP3SbmR776NYVFpaHmuxy5wYFOrcDpLPxc1EuPO/qkBlsE1hFJt X-Received: by 2002:a17:907:7d92:b0:94a:5195:7b6c with SMTP id oz18-20020a1709077d9200b0094a51957b6cmr5753580ejc.35.1681118808160; Mon, 10 Apr 2023 02:26:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1681118808; cv=none; d=google.com; s=arc-20160816; b=hAxO+/GsLr2QP8m5eiSrfYAyHZn5y7nEAq+Ck84arye5zbQGcXW9Yene7WA420aQJ1 V4wYRh4vmqISF8J46q70nDAO8DV/uPFd2VdBSsrM1iDg+4qXDL7f477MJFoAC9oJsaGL y+tSnlP2cwr0WJ3/w/H+FUjPjgcr59XgNo5Ntb1aayPDEnQZiyhG8Befgi0bv6uK5HBC xy7PtuKrLYCTD02PKGrGjeG0U+lR3k+3qyVVGhwGV6OAomDTKa/AmSc150wLURw/WEXU BNa9mD0X+9v5Pfvb4d+CjmVbsjcNkGGbpo0EYKUJ9UiYB+kuLnN9FplyWw4JTAE71sp3 uFCQ== 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 :content-language:references:cc:to:subject:user-agent:mime-version :date:message-id; bh=ALLBDpO4WCahen42S9JUiCF0kg2/5Vt/QaVR69/eRLQ=; b=aov4wHHO5j/8pmw24iKBC2HxSGiEJK1tRrFjSrQsujrh3JIwCtj0i/EgOzG5eW5KL/ ibkoH9dKYSseriv6FNs6JXIgbQ4EZhMwhWXPxULOTQAUcpLMJ3w0ptjX50qbD4J8oWfb ebpwxJp3r+dYvydXCcteB1+yw5+KfHqeQUsX4UOZR0Lzj5NZgNNNdYwYknuB9KIXhDjy 05qzxAipfpegpCrkpjo/L7R9XnoY12IH/5atYch974UfVuU32/WrVMSjxO4J78CHCEjk P/eKoOwv4D/OkvyhEIgwQdmv+Z3IDKyhr/DpR8NCDzf7UNl2jSKZl00P7neHL9l4CRMG yXGQ== 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 c4-20020aa7d604000000b005024e71ba26si5428269edr.447.2023.04.10.02.26.23; Mon, 10 Apr 2023 02:26:48 -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 S229660AbjDJJUf (ORCPT + 99 others); Mon, 10 Apr 2023 05:20:35 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46108 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229485AbjDJJUd (ORCPT ); Mon, 10 Apr 2023 05:20:33 -0400 Received: from szxga02-in.huawei.com (szxga02-in.huawei.com [45.249.212.188]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 22F4340CD; Mon, 10 Apr 2023 02:20:32 -0700 (PDT) Received: from dggpemm500016.china.huawei.com (unknown [172.30.72.54]) by szxga02-in.huawei.com (SkyGuard) with ESMTP id 4Pw3J43tTdzSqbK; Mon, 10 Apr 2023 17:16:36 +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.23; Mon, 10 Apr 2023 17:20:29 +0800 Message-ID: <826e8733-2f02-e0db-ee34-a6ae0cadb040@huawei.com> Date: Mon, 10 Apr 2023 17:20:29 +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 v3 1/2] riscv: kdump: Implement crashkernel=X,[high,low] To: Simon Horman CC: , , , , , , , , , , , , , , References: <20230406220206.3067006-1-chenjiahao16@huawei.com> <20230406220206.3067006-2-chenjiahao16@huawei.com> Content-Language: en-US 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: dggems705-chm.china.huawei.com (10.3.19.182) To dggpemm500016.china.huawei.com (7.185.36.25) X-CFilter-Loop: Reflected X-Spam-Status: No, score=-5.5 required=5.0 tests=NICE_REPLY_A, RCVD_IN_DNSWL_MED,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/4/7 20:03, Simon Horman wrote: > On Fri, Apr 07, 2023 at 06:02:05AM +0800, Chen Jiahao wrote: >> On riscv, the current crash kernel allocation logic is trying to >> allocate within 32bit addressible memory region by default, if >> failed, try to allocate without 4G restriction. >> >> In need of saving DMA zone memory while allocating a relatively large >> crash kernel region, allocating the reserved memory top down in >> high memory, without overlapping the DMA zone, is a mature solution. >> Here introduce the parameter option crashkernel=X,[high,low]. >> >> One can reserve the crash kernel from high memory above DMA zone range >> by explicitly passing "crashkernel=X,high"; or reserve a memory range >> below 4G with "crashkernel=X,low". >> >> Signed-off-by: Chen Jiahao > ... > >> @@ -1180,14 +1206,37 @@ static void __init reserve_crashkernel(void) >> return; >> } >> >> - ret = parse_crashkernel(boot_command_line, memblock_phys_mem_size(), >> + ret = parse_crashkernel(cmdline, memblock_phys_mem_size(), >> &crash_size, &crash_base); >> - if (ret || !crash_size) >> + if (ret == -ENOENT) { >> + /* >> + * crashkernel=X,[high,low] can be specified or not, but >> + * invalid value is not allowed. > nit: Perhaps something like this would be easier to correlate with the > code that follows: > > /* Fallback to crashkernel=X,[high,low] */ > Agreed, this would be more concise and accurate. >> + */ >> + ret = parse_crashkernel_high(cmdline, 0, &crash_size, &crash_base); >> + if (ret || !crash_size) >> + return; >> + >> + /* >> + * crashkernel=Y,low is valid only when crashkernel=X,high >> + * is passed and high memory is reserved successful. > nit: s/successful/successfully/ I will fix above nits and resend another version later, thanks. >> + */ >> + ret = parse_crashkernel_low(cmdline, 0, &crash_low_size, &crash_base); >> + if (ret == -ENOENT) >> + crash_low_size = DEFAULT_CRASH_KERNEL_LOW_SIZE; >> + else if (ret) >> + return; >> + >> + search_start = search_low_max; >> + } else if (ret || !crash_size) { >> + /* Invalid argument value specified */ >> return; >> + } > ...