[PATCH] Only reset e820 once, even with multiple memmap=exactmap params

Thomas Renninger
2013-01-08T16:47:29Z

On Tuesday, January 08, 2013 04:04:56 AM Yinghai Lu wrote:
> On Mon, Jan 7, 2013 at 4:42 PM, Thomas Renninger <trenn@suse.de> wrote:
> > memmap=256M$3584M
>
> may need to change to:
>
> memmap=256M\$\$3584M
The problem is (beside the special char $) that
memmap=exactmap boot param resets all e820 maps every time the
parameter is processed.
And:
/sbin/kexec -p xy --append="..." --initrd yx
seem to magically add (append):
memmap=exactmap memmap=640K@0K memmap=392556K@115328K elfcorehdr=507884K memmap=252K#3099760K

therefore all memmap= I try to pass are voided out by:
memmap=exactmap
which is always added by kexec after my params.

I could come around with attached patch and passing:
/sbin/kexec -p xy --append='... memmap=exactmap memmap=256M$3584M' --initrd yx

Now mmconfig is working in kdump kernel.
This would mean mmconfig is broken by design in kexec?

Only way to fix this I can think of is to export
mmconfig area through /sys (../kernel/debug/mmconfig?, possibly
already in X$Y format?) in the productive kernel and make kexec add it
like the other memmap= params automatically.

I'll attach the output in a separate mail.

Thomas

---

x86 e820: Do not reset e820 map twice, even if memmap=exactmap is passed as boot param several times

This is needed to be able to explicitly pass (debug) e820
modifications through kexec via memmap=.
Otherwise those get voided by kexec appending memmap=exactmap always
after the user defined boot parameters.

Signed-off-by: Thomas Renninger <trenn@suse.de>

linux-2.6_t/arch/x86/kernel/e820.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)

Index: git/linux-2.6_t/arch/x86/kernel/e820.c
===================================================================
--- git.orig/linux-2.6_t/arch/x86/kernel/e820.c
+++ git/linux-2.6_t/arch/x86/kernel/e820.c
@@ -845,7 +845,9 @@ static int __init parse_memmap_opt(char

if (!strncmp(p, "exactmap", 8)) {
#ifdef CONFIG_CRASH_DUMP
- /*
+ /* memmap=exactmap passed twice, do not reset tables again */
+ if (saved_max_pfn)
+ return 0; /*
* If we are doing a crash dump, we still need to know
* the real mem size before original memory map is
* reset.