Received: by 2002:ad5:4acb:0:0:0:0:0 with SMTP id n11csp25994imw; Mon, 4 Jul 2022 04:42:34 -0700 (PDT) X-Google-Smtp-Source: AGRyM1tbYwLQZbFYHQy1BhE+MwzyLLE9226z1gIpvZbQbwfrr/4qiC2RH50TsMG8Lfo3GdnkSRC0 X-Received: by 2002:a05:6a00:b94:b0:525:930f:57ff with SMTP id g20-20020a056a000b9400b00525930f57ffmr36243907pfj.72.1656934953830; Mon, 04 Jul 2022 04:42:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1656934953; cv=none; d=google.com; s=arc-20160816; b=jLni2eTb9xw47sdJAB2NmxsKZsG15JKCWkN5T714b4kNTaSTTkf0J+jAOygfes3CB+ f/AQvIz6jbdnsf115Kbg1S75ljZRUiq24G6PHYO6jtDrlbUsG0d9rAF+z3W2Kuxi3E/2 13HuLwVg0FGtROovZBFyR4c4QDmEjB+91cY1D0C5WOGx2TEQJ8AggUzqRcQ1N2yaHyEF 92KnBMV8v224I+5RV+Lv7I0r8kfkKxN6P2N5vDJJZ1bCBIvX/WHdj0if/M5agBWEn1XO WPBgOtP533OvlraDUbpeZ5CBuQTFYJQ9H4zZjXLXqaRsf3fET6e0/hLVmai5xV/hTbxm MaKQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:message-id:date:subject:cc:to:from; bh=NygrMbbrvyenlLJD8BrAMbz+E8pp+bzA1fNXWNQ4ZMg=; b=rWU++oNBk5YmwVKwEAiCnLXSQJX+NWhuSJDNCvnh1eNoklyjqpFovCDFfpSyhJWwpF mgJ2wpzt2fz7vHgMbWvb1ygBrSE6MsZjjWRl0+kTFNzYsFhqRrECaZdU6l9nrrXeTuFm 6TcyrXHi54zG6ZMBcr9KDDRe0FkTN0pzX20Q4OyHWZOQJwzQ2zwmJ8f37R5He4G/CmG+ HbbZKbWNekm/wAjW1ocFqezezuPrbTMuk1oyWItMlozIpm5FiiEWLmDhwE2zSDZoCAsX ggjILnAQc3/YzQ8tgOy4TEsJ/XKPFLmADzU9pmzoEvI4yGjlqId7F+x7DY87FRNod5T1 ksfA== 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=NONE sp=NONE dis=NONE) header.from=alibaba.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id iy20-20020a170903131400b0016be703438fsi1960081plb.543.2022.07.04.04.42.22; Mon, 04 Jul 2022 04:42:33 -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=NONE sp=NONE dis=NONE) header.from=alibaba.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231787AbiGDLlo (ORCPT + 99 others); Mon, 4 Jul 2022 07:41:44 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52970 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229643AbiGDLlm (ORCPT ); Mon, 4 Jul 2022 07:41:42 -0400 Received: from out30-54.freemail.mail.aliyun.com (out30-54.freemail.mail.aliyun.com [115.124.30.54]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 60F96199 for ; Mon, 4 Jul 2022 04:41:41 -0700 (PDT) X-Alimail-AntiSpam: AC=PASS;BC=-1|-1;BR=01201311R181e4;CH=green;DM=||false|;DS=||;FP=0|-1|-1|-1|0|-1|-1|-1;HT=ay29a033018046051;MF=carlo.bai@linux.alibaba.com;NM=1;PH=DS;RN=5;SR=0;TI=SMTPD_---0VILSmoj_1656934895; Received: from localhost(mailfrom:carlo.bai@linux.alibaba.com fp:SMTPD_---0VILSmoj_1656934895) by smtp.aliyun-inc.com; Mon, 04 Jul 2022 19:41:38 +0800 From: Kaihao Bai To: ebiederm@xmission.com Cc: kexec@lists.infradead.org, linux-kernel@vger.kernel.org, baolin.wang@linux.alibaba.com, carlo.bai@linux.alibaba.com Subject: [PATCH 0/2] kexec: accumulate and release the size of crashkernel Date: Mon, 4 Jul 2022 19:41:33 +0800 Message-Id: <1656934895-12334-1-git-send-email-carlo.bai@linux.alibaba.com> X-Mailer: git-send-email 1.8.3.1 X-Spam-Status: No, score=-9.9 required=5.0 tests=BAYES_00, ENV_AND_HDR_SPF_MATCH,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE,UNPARSEABLE_RELAY,USER_IN_DEF_SPF_WL 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 Currently x86 and arm64 support to reserve low memory range for crashkernel. When crashkernel=Y,low is defined, the main kernel would reserve another memblock (instead of crashkernel=X,high, which stored in crashk_res) for crashkernel and store it in crashk_low_res. The implementations of get_crash_size and crash_shrink_size do not consider the extra reserved memory range if it exists. Thus, firstly accumulate this range on the size of crashkernel and export the size by /sys/kernel/kexec_crash_size. If getting the input of /sys/kernel/kexec_crash_size, both reserved ranges might be released if the new size is smaller than current size. The order of release is (crashk_res -> crashk_low_res). Only if the new size defined by the user is smaller than the size of low memory range, continue to release the reserved low memory range after completely releasing the high memory range. Kaihao Bai (2): kexec: accumulate kexec_crash_size if crashk_low_res defined kexec: release reserved memory ranges to RAM if crashk_low_res defined kernel/kexec_core.c | 77 ++++++++++++++++++++++++++++++++++++++++------------- 1 file changed, 58 insertions(+), 19 deletions(-) -- 1.8.3.1