Received: by 2002:a05:6358:11c7:b0:104:8066:f915 with SMTP id i7csp2819643rwl; Mon, 27 Mar 2023 05:53:22 -0700 (PDT) X-Google-Smtp-Source: AKy350bF+cltQLVTPIgyp8Gf4OOd63pbwJJga8sA0j2GRfHxniuDYKAl3dUrcJ9qNkU62edKhWgN X-Received: by 2002:aa7:d291:0:b0:4fb:59bb:ce7c with SMTP id w17-20020aa7d291000000b004fb59bbce7cmr11542888edq.32.1679921602148; Mon, 27 Mar 2023 05:53:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1679921602; cv=none; d=google.com; s=arc-20160816; b=xdb2ohD+dDw3am+FFt7euw0BTiztJJRElTz3PfGO4kfleeBvl/m4mxbiAbs/Ssl6sg zxiynZLhnGEwoa4UFiMF+od7uS9IErlyImTZl4yPgBKHADA65U8Z+c5Iq6owftk8AVAh RBsurbTd+QA/PG2UXLd65q8LT3AnSI7Kuxx1CohqbFP3i68gCDQ1dsxyL9K5UNolv3xT D2LaknBocFQ7yqYS3AtrwI9rctHhV8hFkXl2RSI1vlguPgzWflBbhiG9LXUwjP0aJQ49 jXWnaHPbSR3bL/Ucw/MovHtFLCLoVqPNKGa/NISCILBT7A0X3Wh0J6Kvu/FBG0l8Qjr+ mxYA== 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=guOZyUlCOBMjHQJ+K5yRggiM84gqpOIq0/8pMCd+Ez0=; b=EYBLB2vsxjsGAh7DkNRDgunLp52afc4xuDSh7uQyS0ir2QEKgb6kYmSqZe8mH1rNBv 5wjvui/H72J1rwQWynuis/dAu/OjR57Qrg3vLDl9HeWlikM74FgwJK9P1nHlcflmXkUd iUxI86n9y/Te1DMlxsGnysocSaEtaaoCTzhsePfo7Qn68hmXnoXMINrlMif7EboLmizk tQD0REQHAvOc9caPRwqwd6FlF+Lj56D+mF+Nu50cYtEfdLNa46oswkqRBUPBOcFjYAsi 1T50zcfWgT9CVUS+87CkkHWCD8PKl1W9hOBB5q1DKcYquDLgEvELw2R2spghe57hxtsU GebA== 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 f6-20020a50ee86000000b005021d24b860si7596842edr.626.2023.03.27.05.52.56; Mon, 27 Mar 2023 05:53:22 -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 S229789AbjC0Muu (ORCPT + 99 others); Mon, 27 Mar 2023 08:50:50 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47738 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229452AbjC0Mut (ORCPT ); Mon, 27 Mar 2023 08:50:49 -0400 Received: from szxga01-in.huawei.com (szxga01-in.huawei.com [45.249.212.187]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CF4DF1707; Mon, 27 Mar 2023 05:50:47 -0700 (PDT) Received: from dggpemm500016.china.huawei.com (unknown [172.30.72.55]) by szxga01-in.huawei.com (SkyGuard) with ESMTP id 4PlXdt52LRznZ50; Mon, 27 Mar 2023 20:47:30 +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; Mon, 27 Mar 2023 20:50:44 +0800 Message-ID: <8bf91bee-e51c-90f6-b522-1db4094966f4@huawei.com> Date: Mon, 27 Mar 2023 20:50:33 +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 1/2] riscv: kdump: Implement crashkernel=X,[high,low] Content-Language: en-US To: Simon Horman CC: , , , , , , , , , , , , , , References: <20230320204244.1637821-1-chenjiahao16@huawei.com> <20230320204244.1637821-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,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/20 22:36, Simon Horman wrote: > On Tue, Mar 21, 2023 at 04:42:43AM +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]. >> >> We 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 > Some minor nits, but I don't think there is any need to respin for them. > > Reviewed-by: Simon Horman I will send another version and clean up these by the way, thanks. Chen, Jiahao > > ... > >> diff --git a/arch/riscv/mm/init.c b/arch/riscv/mm/init.c >> index 478d6763a01a..5def2174b243 100644 >> --- a/arch/riscv/mm/init.c >> +++ b/arch/riscv/mm/init.c > ... > >> @@ -1201,16 +1242,25 @@ 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)); > nit: While here, you could drop the space before 'ma32_phys_limit'. > Or perhaps use min_t, which seems appropriate here. > >> if (crash_base == 0) { >> /* Try again without restricting region to 32bit addressible memory */ >> crash_base = memblock_phys_alloc_range(crash_size, PMD_SIZE, >> - search_start, search_end); >> + search_start, search_end); >> if (crash_base == 0) { >> pr_warn("crashkernel: couldn't allocate %lldKB\n", >> crash_size >> 10); >> return; >> } >> + >> + if (!crash_low_size) >> + crash_low_size = DEFAULT_CRASH_KERNEL_LOW_SIZE; >> + } >> + >> + if ((crash_base > dma32_phys_limit - crash_low_size) && >> + crash_low_size && reserve_crashkernel_low(crash_low_size)) { > nit: The line above should be aligned one character to the left > (remove one space in the indent). > >> + memblock_phys_free(crash_base, crash_size); >> + return; >> } >> >> pr_info("crashkernel: reserved 0x%016llx - 0x%016llx (%lld MB)\n", > ...