public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Kaihao Bai <carlo.bai@linux.alibaba.com>
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	[thread overview]
Message-ID: <1656934895-12334-2-git-send-email-carlo.bai@linux.alibaba.com> (raw)
In-Reply-To: <1656934895-12334-1-git-send-email-carlo.bai@linux.alibaba.com>

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 <carlo.bai@linux.alibaba.com>
---
 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


  reply	other threads:[~2022-07-04 11:41 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-07-04 11:41 [PATCH 0/2] kexec: accumulate and release the size of crashkernel Kaihao Bai
2022-07-04 11:41 ` Kaihao Bai [this message]
2022-07-04 11:41 ` [PATCH 2/2] kexec: release reserved memory ranges to RAM if crashk_low_res defined Kaihao Bai
2022-07-05  1:56 ` [PATCH 0/2] kexec: accumulate and release the size of crashkernel Baoquan He
2022-07-22 11:37   ` Carlo Bai

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1656934895-12334-2-git-send-email-carlo.bai@linux.alibaba.com \
    --to=carlo.bai@linux.alibaba.com \
    --cc=baolin.wang@linux.alibaba.com \
    --cc=ebiederm@xmission.com \
    --cc=kexec@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox