From: Ivan Khoronzhuk <ikhoronz@cisco.com>
To: linux-mips@vger.kernel.org, tsbogend@alpha.franken.de,
linux-kernel@vger.kernel.org
Cc: yangtiezhu@loongson.cn, rppt@kernel.org,
ivan.khoronzhuk@gmail.com, Ivan Khoronzhuk <ikhoronz@cisco.com>
Subject: [PATCH] mips: kernel: setup: fix crash kernel resource allocation
Date: Sat, 6 Feb 2021 12:59:40 +0000 [thread overview]
Message-ID: <20210206125940.111766-1-ikhoronz@cisco.com> (raw)
In order to avoid crash kernel corruption, its memory is reserved
early in memblock and as result, in time when resources are inited
it's not present in memblock.memory, so crash kernel memory is out
of ranges listed with for_each_mem_range(). To avoid it and still
keep memory reserved lets reseve it out of loop by inserting it in
iomem_resource.
Fixes: a94e4f24ec83 ("MIPS: init: Drop boot_mem_map")
Signed-off-by: Ivan Khoronzhuk <ikhoronz@cisco.com>
---
Based on linux-next/master
arch/mips/kernel/setup.c | 8 +++++---
1 file changed, 5 insertions(+), 3 deletions(-)
diff --git a/arch/mips/kernel/setup.c b/arch/mips/kernel/setup.c
index 3785c72bc3bc..25e376ef2f2a 100644
--- a/arch/mips/kernel/setup.c
+++ b/arch/mips/kernel/setup.c
@@ -473,14 +473,15 @@ static void __init mips_parse_crashkernel(void)
crashk_res.end = crash_base + crash_size - 1;
}
-static void __init request_crashkernel(struct resource *res)
+static void __init request_crashkernel(void)
{
int ret;
if (crashk_res.start == crashk_res.end)
return;
- ret = request_resource(res, &crashk_res);
+ /* The crashk resource shoud be located in normal mem */
+ ret = insert_resource(&iomem_resource, &crashk_res);
if (!ret)
pr_info("Reserving %ldMB of memory at %ldMB for crashkernel\n",
(unsigned long)(resource_size(&crashk_res) >> 20),
@@ -734,8 +735,9 @@ static void __init resource_init(void)
request_resource(res, &code_resource);
request_resource(res, &data_resource);
request_resource(res, &bss_resource);
- request_crashkernel(res);
}
+
+ request_crashkernel();
}
#ifdef CONFIG_SMP
--
2.23.1
next reply other threads:[~2021-02-06 13:09 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-02-06 12:59 Ivan Khoronzhuk [this message]
2021-02-07 3:19 ` [PATCH] mips: kernel: setup: fix crash kernel resource allocation Jinyang He
2021-02-08 13:17 ` Ivan Khoronzhuk
2021-02-07 9:18 ` Mike Rapoport
2021-02-08 13:29 ` Ivan Khoronzhuk
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=20210206125940.111766-1-ikhoronz@cisco.com \
--to=ikhoronz@cisco.com \
--cc=ivan.khoronzhuk@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mips@vger.kernel.org \
--cc=rppt@kernel.org \
--cc=tsbogend@alpha.franken.de \
--cc=yangtiezhu@loongson.cn \
/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