Received: by 2002:ad5:4acb:0:0:0:0:0 with SMTP id n11csp26275imw; Mon, 4 Jul 2022 04:42:52 -0700 (PDT) X-Google-Smtp-Source: AGRyM1uf0VGcMFoiCmV0T0WAjPNJ0OAcBsBKnOEv3bJ+lroffaufrJADjXwyNTU+F3vkf9y+057h X-Received: by 2002:a17:903:1c7:b0:16a:2762:88d1 with SMTP id e7-20020a17090301c700b0016a276288d1mr36032154plh.76.1656934972345; Mon, 04 Jul 2022 04:42:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1656934972; cv=none; d=google.com; s=arc-20160816; b=rQlijXgskHxiPZyXaud183oXjRQRanMuPXEw/kPS/sdywAvG8bzExRbqu9RN59NtBy rekrHMvd+ognr0to65KlaWTVWj5bWk3ffePX/U87VHQIZIR52bqeXFBK8VouXb/HU9xn L488QivPttyzZ8Qs3HXMENf9oQeoFFD4EC/UbJfSItj4ftHpNUn4uON4IGDRO+s8HW7U YvIl48MPHqX6XYBLe+Br/BtHXwK/Vb8ZDRfaoEu6KP078hj7Rb1Xobi/10XMLB9mEY9M JV6MjQ290tzTqYpOEF8fymCgjiO77q8MvXLKQ09ttBNuKPZo2fUdAXRyYTkIEM3TZOuP 4NFA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:references:in-reply-to:message-id:date:subject :cc:to:from; bh=gVkU9y0HvLD681GDsqBpaug5W/DGp0FQXOhYYf2QqvI=; b=rIZJYDi6XZT/r0DJwcMAbexMD3ep9U0Lyp+9Qt4XyFYxUEjm3TO3HUomvuzcdTVFqm tA/up1hSoTinlaKhaVJ06i0/Snr1x21ceW3Xsx+GFFLknUAmxzXgDGrWncgW0xGzFtHW TqtkHGmsTKCiS3BHju3nZXk7GY+1T6NO5L2WhuSJ2CqhH+J+byTZ4Yj2vkYMIqlG3ITh j/R7LMTpSOeBCTybg+8CS2DenC8LvDamMLC2EDRco3pNReUTOeYMYq6b1XrJuAH4opGM NlEwiCCq+j29vWAHFYaUkJ9APLkF1LHHsj14bvvSpLrigTs16M9r7f0cZ1Ca1SF3uKX+ ocwQ== 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 s38-20020a056a0017a600b0051826918034si13052880pfg.1.2022.07.04.04.42.40; Mon, 04 Jul 2022 04:42:52 -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 S232520AbiGDLlr (ORCPT + 99 others); Mon, 4 Jul 2022 07:41:47 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52994 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232909AbiGDLlp (ORCPT ); Mon, 4 Jul 2022 07:41:45 -0400 Received: from out30-131.freemail.mail.aliyun.com (out30-131.freemail.mail.aliyun.com [115.124.30.131]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9471391 for ; Mon, 4 Jul 2022 04:41:44 -0700 (PDT) X-Alimail-AntiSpam: AC=PASS;BC=-1|-1;BR=01201311R911e4;CH=green;DM=||false|;DS=||;FP=0|-1|-1|-1|0|-1|-1|-1;HT=ay29a033018046049;MF=carlo.bai@linux.alibaba.com;NM=1;PH=DS;RN=5;SR=0;TI=SMTPD_---0VILd0lZ_1656934899; Received: from localhost(mailfrom:carlo.bai@linux.alibaba.com fp:SMTPD_---0VILd0lZ_1656934899) by smtp.aliyun-inc.com; Mon, 04 Jul 2022 19:41:42 +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 1/2] kexec: accumulate kexec_crash_size if crashk_low_res defined Date: Mon, 4 Jul 2022 19:41:34 +0800 Message-Id: <1656934895-12334-2-git-send-email-carlo.bai@linux.alibaba.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1656934895-12334-1-git-send-email-carlo.bai@linux.alibaba.com> References: <1656934895-12334-1-git-send-email-carlo.bai@linux.alibaba.com> 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. But the value of /sys/kernel/kexec_crash_size only calculates the size of crashk_res size is not calculated. To ensure the consistency of /sys/kernel/kexec_crash_size, when crashk_low_res is defined, its size needs to be accumulated to kexec_crash_size. Signed-off-by: Kaihao Bai --- kernel/kexec_core.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/kernel/kexec_core.c b/kernel/kexec_core.c index 4d34c78..137f6eb 100644 --- a/kernel/kexec_core.c +++ b/kernel/kexec_core.c @@ -1016,6 +1016,8 @@ size_t crash_get_memory_size(void) mutex_lock(&kexec_mutex); if (crashk_res.end != crashk_res.start) size = resource_size(&crashk_res); + if (crashk_low_res.end != crashk_low_res.start) + size += resource_size(&crashk_low_res); mutex_unlock(&kexec_mutex); return size; } -- 1.8.3.1