public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Vivek Goyal <vgoyal@in.ibm.com>
To: linux kernel mailing list <linux-kernel@vger.kernel.org>,
	Morton Andrew Morton <akpm@osdl.org>,
	Fastboot mailing list <fastboot@lists.osdl.org>
Cc: ak@suse.de, "Eric W. Biederman" <ebiederm@xmission.com>
Subject: [PATCH 5/10] kdump:  x86_64 add memmmap command line option
Date: Thu, 17 Nov 2005 18:54:37 +0530	[thread overview]
Message-ID: <20051117132437.GI3981@in.ibm.com> (raw)
In-Reply-To: <20051117132315.GH3981@in.ibm.com>



o This patch introduces the memmap option for x86_64 similar to i386.

o memmap=exactmap enables setting of an exact E820 memory map, as 
  specified by the user.

Changes in this version:

o Used e820_end_of_ram() to find the max_pfn as suggested by
  Andi kleen.

o removed PFN_UP & PFN_DOWN macros

o Printing the user defined map also.

Signed-off-by:Murali M Chakravarthy <muralim@in.ibm.com>
Signed-off-by:Hariprasad Nellitheertha<nharipra@gmail.com>
Signed-off-by: Vivek Goyal <vgoyal@in.ibm.com>
---

 linux-2.6.15-rc1-1M-dynamic-root/Documentation/kernel-parameters.txt |    2 
 linux-2.6.15-rc1-1M-dynamic-root/arch/x86_64/kernel/e820.c           |   21 +++++++
 linux-2.6.15-rc1-1M-dynamic-root/arch/x86_64/kernel/setup.c          |   27 ++++++++++
 linux-2.6.15-rc1-1M-dynamic-root/include/asm-x86_64/e820.h           |    1 
 4 files changed, 50 insertions(+), 1 deletion(-)

diff -puN arch/x86_64/kernel/e820.c~x86_64-memmap-command-line-option arch/x86_64/kernel/e820.c
--- linux-2.6.15-rc1-1M-dynamic/arch/x86_64/kernel/e820.c~x86_64-memmap-command-line-option	2005-11-17 11:10:58.000000000 +0530
+++ linux-2.6.15-rc1-1M-dynamic-root/arch/x86_64/kernel/e820.c	2005-11-17 11:10:58.000000000 +0530
@@ -560,6 +560,27 @@ void __init parse_memopt(char *p, char *
 	end_user_pfn >>= PAGE_SHIFT;	
 } 
 
+void __init parse_memmapopt(char *p, char **from)
+{
+	unsigned long long start_at, mem_size;
+
+	mem_size = memparse(p, from);
+	p = *from;
+	if (*p == '@') {
+		start_at = memparse(p+1, from);
+		add_memory_region(start_at, mem_size, E820_RAM);
+	} else if (*p == '#') {
+		start_at = memparse(p+1, from);
+		add_memory_region(start_at, mem_size, E820_ACPI);
+	} else if (*p == '$') {
+		start_at = memparse(p+1, from);
+		add_memory_region(start_at, mem_size, E820_RESERVED);
+	} else {
+		end_user_pfn = (mem_size >> PAGE_SHIFT);
+	}
+	p = *from;
+}
+
 unsigned long pci_mem_start = 0xaeedbabe;
 
 /*
diff -puN arch/x86_64/kernel/setup.c~x86_64-memmap-command-line-option arch/x86_64/kernel/setup.c
--- linux-2.6.15-rc1-1M-dynamic/arch/x86_64/kernel/setup.c~x86_64-memmap-command-line-option	2005-11-17 11:10:58.000000000 +0530
+++ linux-2.6.15-rc1-1M-dynamic-root/arch/x86_64/kernel/setup.c	2005-11-17 12:00:35.000000000 +0530
@@ -274,6 +274,7 @@ static __init void parse_cmdline_early (
 {
 	char c = ' ', *to = command_line, *from = COMMAND_LINE;
 	int len = 0;
+	int userdef = 0;
 
 	/* Save unparsed command line copy for /proc/cmdline */
 	memcpy(saved_command_line, COMMAND_LINE, COMMAND_LINE_SIZE);
@@ -356,6 +357,28 @@ static __init void parse_cmdline_early (
 		if (!memcmp(from, "mem=", 4))
 			parse_memopt(from+4, &from); 
 
+		if (!memcmp(from, "memmap=", 7)) {
+			/* exactmap option is for used defined memory */
+			if (!memcmp(from+7, "exactmap", 8)) {
+#ifdef CONFIG_CRASH_DUMP
+				/* If we are doing a crash dump, we
+				 * still need to know the real mem
+				 * size before original memory map is
+				 * reset.
+				 */
+				saved_max_pfn = e820_end_of_ram();
+#endif
+				from += 8+7;
+				end_pfn_map = 0;
+				e820.nr_map = 0;
+				userdef = 1;
+			}
+			else {
+				parse_memmapopt(from+7, &from);
+				userdef = 1;
+			}
+		}
+
 #ifdef CONFIG_NUMA
 		if (!memcmp(from, "numa=", 5))
 			numa_setup(from+5); 
@@ -402,6 +425,10 @@ static __init void parse_cmdline_early (
 			break;
 		*(to++) = c;
 	}
+	if (userdef) {
+		printk(KERN_INFO "user-defined physical RAM map:\n");
+		e820_print_map("user");
+	}
 	*to = '\0';
 	*cmdline_p = command_line;
 }
diff -puN Documentation/kernel-parameters.txt~x86_64-memmap-command-line-option Documentation/kernel-parameters.txt
--- linux-2.6.15-rc1-1M-dynamic/Documentation/kernel-parameters.txt~x86_64-memmap-command-line-option	2005-11-17 11:10:58.000000000 +0530
+++ linux-2.6.15-rc1-1M-dynamic-root/Documentation/kernel-parameters.txt	2005-11-17 12:00:35.000000000 +0530
@@ -824,7 +824,7 @@ running once the system is up.
 	mem=nopentium	[BUGS=IA-32] Disable usage of 4MB pages for kernel
 			memory.
 
-	memmap=exactmap	[KNL,IA-32] Enable setting of an exact
+	memmap=exactmap	[KNL,IA-32,X86_64] Enable setting of an exact
 			E820 memory map, as specified by the user.
 			Such memmap=exactmap lines can be constructed based on
 			BIOS output or other requirements. See the memmap=nn@ss
diff -puN include/asm-x86_64/e820.h~x86_64-memmap-command-line-option include/asm-x86_64/e820.h
--- linux-2.6.15-rc1-1M-dynamic/include/asm-x86_64/e820.h~x86_64-memmap-command-line-option	2005-11-17 11:10:58.000000000 +0530
+++ linux-2.6.15-rc1-1M-dynamic-root/include/asm-x86_64/e820.h	2005-11-17 11:10:58.000000000 +0530
@@ -55,6 +55,7 @@ extern unsigned long e820_hole_size(unsi
 				    unsigned long end_pfn);
 
 extern void __init parse_memopt(char *p, char **end);
+extern void __init parse_memmapopt(char *p, char **end);
 
 extern struct e820map e820;
 #endif/*!__ASSEMBLY__*/
_

  reply	other threads:[~2005-11-17 13:24 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-11-17 13:13 [PATCH 0/10] Kdump Update i386/x86_64 Vivek Goyal
2005-11-17 13:18 ` [PATCH 1/10] kdump: i386 save ss esp bug fix Vivek Goyal
2005-11-17 13:20   ` [PATCH 2/10] kdump: dynamic per cpu allocation of memory for saving cpu registers Vivek Goyal
2005-11-17 13:21     ` [PATCH 3/10] kdump: export per cpu crash notes pointer through sysfs Vivek Goyal
2005-11-17 13:23       ` [PATCH 4/10] kdump: save registers early (inline functions) Vivek Goyal
2005-11-17 13:24         ` Vivek Goyal [this message]
2005-11-17 13:25           ` [PATCH 6/10] kdump: x86_64 add elfcorehdr command line option Vivek Goyal
2005-11-17 13:26             ` [PATCH 7/10] kdump: x86_64 kexec on panic Vivek Goyal
2005-11-17 13:28               ` [PATCH 8/10] kdump: x86_64 save cpu registers upon crash Vivek Goyal
2005-11-17 13:29                 ` [PATCH 9/10] kdump: read previous kernel's memory Vivek Goyal
2005-11-17 13:30                   ` [PATCH 10/10] kexec: increase max segment limit Vivek Goyal
2005-11-17 22:20                   ` [PATCH 9/10] kdump: read previous kernel's memory Andrew Morton
2005-11-17 23:14                     ` Eric W. Biederman
2005-11-23 14:04                     ` [Fastboot] " Rachita Kothiyal
2005-11-18  0:47                 ` [PATCH 8/10] kdump: x86_64 save cpu registers upon crash Haren Myneni
2005-11-18 21:52                 ` Eric W. Biederman
2005-11-19  4:35                   ` Vivek Goyal
2005-11-17 22:07       ` [PATCH 3/10] kdump: export per cpu crash notes pointer through sysfs Andrew Morton
2005-11-18 12:33         ` Vivek Goyal
2005-11-17 22:01     ` [PATCH 2/10] kdump: dynamic per cpu allocation of memory for saving cpu registers Andrew Morton
2005-11-18  3:37       ` Vivek Goyal
2005-11-18 12:32       ` Vivek Goyal

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=20051117132437.GI3981@in.ibm.com \
    --to=vgoyal@in.ibm.com \
    --cc=ak@suse.de \
    --cc=akpm@osdl.org \
    --cc=ebiederm@xmission.com \
    --cc=fastboot@lists.osdl.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