mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Vitaly Mayatskikh <v.mayatskih@gmail.com>
To: linux-kernel@vger.kernel.org
Cc: Thomas Gleixner <tglx@linutronix.de>,
	Ingo Molnar <mingo@redhat.com>, "H. Peter Anvin" <hpa@zytor.com>,
	Vivek Goyal <vgoyal@redhat.com>, Haren Myneni <hbabu@us.ibm.com>,
	Eric Biederman <ebiederm@xmission.com>,
	Neil Horman <nhorman@tuxdriver.com>,
	Cong Wang <amwang@redhat.com>,
	kexec@lists.infradead.org
Subject: [PATCH 4/5] x86: use second memory region for dump-capture kernel
Date: Thu, 22 Apr 2010 18:23:11 +0200	[thread overview]
Message-ID: <1271953392-6324-5-git-send-email-v.mayatskih@gmail.com> (raw)
In-Reply-To: <1271953392-6324-1-git-send-email-v.mayatskih@gmail.com>

This patch adds second memory region support for kexec on x86
platform.

Signed-off-by: Vitaly Mayatskikh <v.mayatskih@gmail.com>
---
 arch/x86/kernel/setup.c |   56 +++++++++++++++++++++++++++++-----------------
 1 files changed, 35 insertions(+), 21 deletions(-)

diff --git a/arch/x86/kernel/setup.c b/arch/x86/kernel/setup.c
index c4851ef..9b395bb 100644
--- a/arch/x86/kernel/setup.c
+++ b/arch/x86/kernel/setup.c
@@ -501,19 +501,11 @@ static inline unsigned long long get_total_mem(void)
 	return total << PAGE_SHIFT;
 }
 
-static void __init reserve_crashkernel(void)
+static int __init reserve_crashkernel_region(char *region_name,
+					     struct resource *crashk,
+					     unsigned long long crash_size,
+					     unsigned long long crash_base)
 {
-	unsigned long long total_mem;
-	unsigned long long crash_size, crash_base;
-	int ret;
-
-	total_mem = get_total_mem();
-
-	ret = parse_crashkernel(boot_command_line, total_mem,
-			&crash_size, &crash_base);
-	if (ret != 0 || crash_size <= 0)
-		return;
-
 	/* 0 means: find the address automatically */
 	if (crash_base <= 0) {
 		const unsigned long long alignment = 16<<20;	/* 16M */
@@ -522,7 +514,7 @@ static void __init reserve_crashkernel(void)
 				 alignment);
 		if (crash_base == -1ULL) {
 			pr_info("crashkernel reservation failed - No suitable area found.\n");
-			return;
+			return -EINVAL;
 		}
 	} else {
 		unsigned long long start;
@@ -531,20 +523,42 @@ static void __init reserve_crashkernel(void)
 				 1<<20);
 		if (start != crash_base) {
 			pr_info("crashkernel reservation failed - memory is in use.\n");
-			return;
+			return -EINVAL;
 		}
 	}
-	reserve_early(crash_base, crash_base + crash_size, "CRASH KERNEL");
+	reserve_early(crash_base, crash_base + crash_size, region_name);
 
 	printk(KERN_INFO "Reserving %ldMB of memory at %ldMB "
-			"for crashkernel (System RAM: %ldMB)\n",
+			"for crashkernel\n",
 			(unsigned long)(crash_size >> 20),
-			(unsigned long)(crash_base >> 20),
-			(unsigned long)(total_mem >> 20));
+			(unsigned long)(crash_base >> 20));
+
+	crashk->start = crash_base;
+	crashk->end   = crash_base + crash_size - 1;
+	insert_resource(&iomem_resource, crashk);
+	return 0;
+}
+
+static void __init reserve_crashkernel(void)
+{
+	unsigned long long total_mem;
+	unsigned long long crash_size, crash_base;
+	unsigned long long crash_size_hi, crash_base_hi;
+	int ret;
+
+	total_mem = get_total_mem();
+
+	ret = parse_crashkernel_ext(boot_command_line, total_mem,
+				    &crash_size, &crash_base,
+				    &crash_size_hi, &crash_base_hi);
+	if (ret != 0 || crash_size <= 0)
+		return;
 
-	crashk_res.start = crash_base;
-	crashk_res.end   = crash_base + crash_size - 1;
-	insert_resource(&iomem_resource, &crashk_res);
+	ret = reserve_crashkernel_region("CRASH KERNEL", &crashk_res,
+					 crash_size, crash_base);
+	if (ret == 0 && crash_size_hi > 0)
+		reserve_crashkernel_region("CRASH HIMEM", &crashk_res_hi,
+					   crash_size_hi, crash_base_hi);
 }
 #else
 static void __init reserve_crashkernel(void)
-- 
1.7.0.1


  parent reply	other threads:[~2010-04-22 16:24 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-04-22 16:23 [PATCH 0/5] Add second memory region for crash kernel Vitaly Mayatskikh
2010-04-22 16:23 ` [PATCH 1/5] Introduce second memory resource " Vitaly Mayatskikh
2010-04-22 16:23 ` [PATCH 2/5] Modify parse_crashkernel* for new syntax Vitaly Mayatskikh
2010-04-22 16:23 ` [PATCH 3/5] Support second memory region in crash_shrink_memory() Vitaly Mayatskikh
2010-04-22 16:23 ` Vitaly Mayatskikh [this message]
2010-04-22 16:23 ` [PATCH 5/5] kexec: update documentation Vitaly Mayatskikh
2010-04-22 22:07 ` [PATCH 0/5] Add second memory region for crash kernel Eric W. Biederman
2010-04-22 22:37   ` H. Peter Anvin
2010-04-22 22:45   ` Vivek Goyal
2010-04-23  0:48     ` Eric W. Biederman
2010-04-23  5:21       ` Cong Wang
2010-04-23  5:42         ` Eric W. Biederman
2010-04-23  6:43           ` Vitaly Mayatskikh
2010-04-23 14:44       ` Vivek Goyal
2010-04-23  7:08     ` Vitaly Mayatskikh

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=1271953392-6324-5-git-send-email-v.mayatskih@gmail.com \
    --to=v.mayatskih@gmail.com \
    --cc=amwang@redhat.com \
    --cc=ebiederm@xmission.com \
    --cc=hbabu@us.ibm.com \
    --cc=hpa@zytor.com \
    --cc=kexec@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@redhat.com \
    --cc=nhorman@tuxdriver.com \
    --cc=tglx@linutronix.de \
    --cc=vgoyal@redhat.com \
    /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

all inboxes | Powered by JetHome®