* [PATCH 3/8] pseries: phyp dump: reserve-release proof-of-concept
@ 2008-01-08 0:19 Manish Ahuja
2008-01-08 0:26 ` Arnd Bergmann
0 siblings, 1 reply; 8+ messages in thread
From: Manish Ahuja @ 2008-01-08 0:19 UTC (permalink / raw)
To: linuxppc-dev; +Cc: mahuja, linasvepstas, lkessler, strosake
Initial patch for reserving memory in early boot, and freeing it later.
If the previous boot had ended with a crash, the reserved memory would contain
a copy of the crashed kernel data.
Signed-off-by: Manish Ahuja <mahuja@us.ibm.com>
Signed-off-by: Linas Vepstas <linas@austin.ibm.com>
----
arch/powerpc/kernel/prom.c | 33 +++++++++++++
arch/powerpc/platforms/pseries/Makefile | 1
arch/powerpc/platforms/pseries/phyp_dump.c | 71 +++++++++++++++++++++++++++++
include/asm-powerpc/phyp_dump.h | 32 +++++++++++++
4 files changed, 137 insertions(+)
Index: linux-2.6.24-rc2-git4/include/asm-powerpc/phyp_dump.h
===================================================================
--- /dev/null 1970-01-01 00:00:00.000000000 +0000
+++ linux-2.6.24-rc2-git4/include/asm-powerpc/phyp_dump.h 2007-11-19 17:44:21.000000000 -0600
@@ -0,0 +1,32 @@
+/*
+ * Hypervisor-assisted dump
+ *
+ * Linas Vepstas, Manish Ahuja 2007
+ * Copyright (c) 2007 IBM Corp.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version
+ * 2 of the License, or (at your option) any later version.
+ */
+
+#ifndef _PPC64_PHYP_DUMP_H
+#define _PPC64_PHYP_DUMP_H
+
+#ifdef CONFIG_PHYP_DUMP
+
+/* The RMR region will be saved for later dumping
+ * whenever the kernel crashes. Set this to 256MB. */
+#define PHYP_DUMP_RMR_START 0x0
+#define PHYP_DUMP_RMR_END (1UL<<28)
+
+struct phyp_dump {
+ /* Memory that is reserved during very early boot. */
+ unsigned long init_reserve_start;
+ unsigned long init_reserve_size;
+};
+
+extern struct phyp_dump *phyp_dump_info;
+
+#endif /* CONFIG_PHYP_DUMP */
+#endif /* _PPC64_PHYP_DUMP_H */
Index: linux-2.6.24-rc2-git4/arch/powerpc/platforms/pseries/phyp_dump.c
===================================================================
--- /dev/null 1970-01-01 00:00:00.000000000 +0000
+++ linux-2.6.24-rc2-git4/arch/powerpc/platforms/pseries/phyp_dump.c 2007-11-19 19:07:49.000000000 -0600
@@ -0,0 +1,71 @@
+/*
+ * Hypervisor-assisted dump
+ *
+ * Linas Vepstas, Manish Ahuja 2007
+ * Copyrhgit (c) 2007 IBM Corp.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version
+ * 2 of the License, or (at your option) any later version.
+ *
+ */
+
+#include <linux/init.h>
+#include <linux/mm.h>
+#include <linux/pfn.h>
+#include <linux/swap.h>
+
+#include <asm/page.h>
+#include <asm/phyp_dump.h>
+
+/* Global, used to communicate data between early boot and late boot */
+static struct phyp_dump phyp_dump_global;
+struct phyp_dump *phyp_dump_info = &phyp_dump_global;
+
+/**
+ * release_memory_range -- release memory previously lmb_reserved
+ * @start_pfn: starting physical frame number
+ * @nr_pages: number of pages to free.
+ *
+ * This routine will release memory that had been previously
+ * lmb_reserved in early boot. The released memory becomes
+ * available for genreal use.
+ */
+static void
+release_memory_range(unsigned long start_pfn, unsigned long nr_pages)
+{
+ struct page *rpage;
+ unsigned long end_pfn;
+ long i;
+
+ end_pfn = start_pfn + nr_pages;
+
+ for (i=start_pfn; i <= end_pfn; i++) {
+ rpage = pfn_to_page(i);
+ if (PageReserved(rpage)) {
+ ClearPageReserved(rpage);
+ init_page_count(rpage);
+ __free_page(rpage);
+ totalram_pages++;
+ }
+ }
+}
+
+static int __init phyp_dump_setup(void)
+{
+ unsigned long start_pfn, nr_pages;
+
+ /* If no memory was reserved in early boot, there is nothing to do */
+ if (phyp_dump_info->init_reserve_size == 0)
+ return 0;
+
+ /* Release memory that was reserved in early boot */
+ start_pfn = PFN_DOWN(phyp_dump_info->init_reserve_start);
+ nr_pages = PFN_DOWN(phyp_dump_info->init_reserve_size);
+ release_memory_range(start_pfn, nr_pages);
+
+ return 0;
+}
+
+subsys_initcall(phyp_dump_setup);
Index: linux-2.6.24-rc2-git4/arch/powerpc/platforms/pseries/Makefile
===================================================================
--- linux-2.6.24-rc2-git4.orig/arch/powerpc/platforms/pseries/Makefile 2007-11-19 17:43:52.000000000 -0600
+++ linux-2.6.24-rc2-git4/arch/powerpc/platforms/pseries/Makefile 2007-11-19 17:44:21.000000000 -0600
@@ -18,3 +18,4 @@ obj-$(CONFIG_HOTPLUG_CPU) += hotplug-cpu
obj-$(CONFIG_HVC_CONSOLE) += hvconsole.o
obj-$(CONFIG_HVCS) += hvcserver.o
obj-$(CONFIG_HCALL_STATS) += hvCall_inst.o
+obj-$(CONFIG_PHYP_DUMP) += phyp_dump.o
Index: linux-2.6.24-rc2-git4/arch/powerpc/kernel/prom.c
===================================================================
--- linux-2.6.24-rc2-git4.orig/arch/powerpc/kernel/prom.c 2007-11-19 17:43:52.000000000 -0600
+++ linux-2.6.24-rc2-git4/arch/powerpc/kernel/prom.c 2007-11-19 17:44:21.000000000 -0600
@@ -51,6 +51,7 @@
#include <asm/machdep.h>
#include <asm/pSeries_reconfig.h>
#include <asm/pci-bridge.h>
+#include <asm/phyp_dump.h>
#include <asm/kexec.h>
#ifdef DEBUG
@@ -1011,6 +1012,37 @@ static void __init early_reserve_mem(voi
#endif
}
+#ifdef CONFIG_PHYP_DUMP
+
+/**
+ * reserve_crashed_mem() - reserve all not-yet-dumped mmemory
+ *
+ * This routine will reserve almost all of the memory in the
+ * system, except for a few hundred megabytes used to boot the
+ * new kernel. As the reserved memory is dumped to the dump
+ * device (by userland tools), it will be freed and made available.
+ */
+static void __init reserve_crashed_mem(void)
+{
+ unsigned long crashed_base, crashed_size;
+
+ /* Reserve *everything* above the RMR. We'll free this real soon. */
+ crashed_base = PHYP_DUMP_RMR_END;
+ crashed_size = lmb_end_of_DRAM() - crashed_base;
+
+ /* XXX crashed_ram_end is wrong, since it may be beyond
+ * the memory_limit, it will need to be adjusted. */
+ lmb_reserve(crashed_base, crashed_size);
+
+ phyp_dump_info->init_reserve_start = crashed_base;
+ phyp_dump_info->init_reserve_size = crashed_size;
+}
+
+#else
+static inline void __init reserve_crashed_mem(void) {}
+#endif /* CONFIG_PHYP_DUMP */
+
+
void __init early_init_devtree(void *params)
{
DBG(" -> early_init_devtree(%p)\n", params);
@@ -1043,6 +1075,7 @@ void __init early_init_devtree(void *par
reserve_kdump_trampoline();
reserve_crashkernel();
early_reserve_mem();
+ reserve_crashed_mem();
lmb_enforce_memory_limit(memory_limit);
lmb_analyze();
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH 3/8] pseries: phyp dump: reserve-release proof-of-concept
2008-01-08 0:19 [PATCH 3/8] pseries: phyp dump: reserve-release proof-of-concept Manish Ahuja
@ 2008-01-08 0:26 ` Arnd Bergmann
2008-01-08 0:49 ` Linas Vepstas
2008-01-08 0:50 ` Manish Ahuja
0 siblings, 2 replies; 8+ messages in thread
From: Arnd Bergmann @ 2008-01-08 0:26 UTC (permalink / raw)
To: linuxppc-dev; +Cc: mahuja, lkessler, linasvepstas, strosake
On Tuesday 08 January 2008, Manish Ahuja wrote:
> Initial patch for reserving memory in early boot, and freeing it later.
> If the previous boot had ended with a crash, the reserved memory would contain
> a copy of the crashed kernel data.
>
> Signed-off-by: Manish Ahuja <mahuja@us.ibm.com>
> Signed-off-by: Linas Vepstas <linas@austin.ibm.com>
I think the signed-off-by chain needs to be modified. The way it appears,
you handled the patch first, then sent it to Linas, who forwarded it
to whoever will take the patches from the list.
This obviously isn't true, since you are actually the one who is sending
out the patches. Moreover, I believe that the linas@austin.ibm.com
address is now dead, and shouldn't be used for this any more.
So, depending on which of you two wrote the majority of a patch, I think
it should be either
| Signed-off-by: Manish Ahuja <mahuja@us.ibm.com>
| Acked-by: Linas Vepstas <linasvepstas@gmail.com>
or
| From: Linas Vepstas <linasvepstas@gmail.com>
| Signed-off-by: Manish Ahuja <mahuja@us.ibm.com>
Arnd <><
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH 3/8] pseries: phyp dump: reserve-release proof-of-concept
2008-01-08 0:26 ` Arnd Bergmann
@ 2008-01-08 0:49 ` Linas Vepstas
2008-01-08 1:13 ` Michael Ellerman
2008-01-08 0:50 ` Manish Ahuja
1 sibling, 1 reply; 8+ messages in thread
From: Linas Vepstas @ 2008-01-08 0:49 UTC (permalink / raw)
To: Arnd Bergmann; +Cc: mahuja, linuxppc-dev, lkessler, strosake
On 07/01/2008, Arnd Bergmann <arnd@arndb.de> wrote:
> On Tuesday 08 January 2008, Manish Ahuja wrote:
>
> > Initial patch for reserving memory in early boot, and freeing it later.
> > If the previous boot had ended with a crash, the reserved memory would contain
> > a copy of the crashed kernel data.
> >
> > Signed-off-by: Manish Ahuja <mahuja@us.ibm.com>
> > Signed-off-by: Linas Vepstas <linas@austin.ibm.com>
>
> I think the signed-off-by chain needs to be modified. The way it appears,
> you handled the patch first, then sent it to Linas, who forwarded it
> to whoever will take the patches from the list.
Well,
-- there was dual authorship. I remangled the patches while Manish wrote
code & tested. And I'd mailed them out the first time around, so you could
say I forwarded after heavy editing.
> This obviously isn't true, since you are actually the one who is sending
> out the patches. Moreover, I believe that the linas@austin.ibm.com
> address is now dead, and shouldn't be used for this any more.
Hmm. I wanted to indicate that the work was done while I was at IBM;
clearly, no one is going through git and changing old, expired email
addrs, and so submission based on the old addr seemed appropriate.
I'm taking the Signed-off-by line as a quasi-legal thing: a fancy ID string,
identifying the author(s), rather than a new way to manage email
address books.
> So, depending on which of you two wrote the majority of a patch, I think
> it should be either
I'm not sure there was a clear majority. I think Manish did more work
in general, but we hacked this together side by side. I got him to create
working tested code; I busted it up into individual, clean, documented,
mailing-list ready chunks.
--linas
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH 3/8] pseries: phyp dump: reserve-release proof-of-concept
2008-01-08 0:49 ` Linas Vepstas
@ 2008-01-08 1:13 ` Michael Ellerman
0 siblings, 0 replies; 8+ messages in thread
From: Michael Ellerman @ 2008-01-08 1:13 UTC (permalink / raw)
To: linasvepstas; +Cc: mahuja, linuxppc-dev, lkessler, strosake, Arnd Bergmann
[-- Attachment #1: Type: text/plain, Size: 1945 bytes --]
On Mon, 2008-01-07 at 18:49 -0600, Linas Vepstas wrote:
> On 07/01/2008, Arnd Bergmann <arnd@arndb.de> wrote:
> > On Tuesday 08 January 2008, Manish Ahuja wrote:
> >
> > > Initial patch for reserving memory in early boot, and freeing it later.
> > > If the previous boot had ended with a crash, the reserved memory would contain
> > > a copy of the crashed kernel data.
> > >
> > > Signed-off-by: Manish Ahuja <mahuja@us.ibm.com>
> > > Signed-off-by: Linas Vepstas <linas@austin.ibm.com>
> >
> > I think the signed-off-by chain needs to be modified. The way it appears,
> > you handled the patch first, then sent it to Linas, who forwarded it
> > to whoever will take the patches from the list.
> > This obviously isn't true, since you are actually the one who is sending
> > out the patches. Moreover, I believe that the linas@austin.ibm.com
> > address is now dead, and shouldn't be used for this any more.
>
> Hmm. I wanted to indicate that the work was done while I was at IBM;
> clearly, no one is going through git and changing old, expired email
> addrs, and so submission based on the old addr seemed appropriate.
>
> I'm taking the Signed-off-by line as a quasi-legal thing: a fancy ID string,
> identifying the author(s), rather than a new way to manage email
> address books.
No one's changing the git history (you can't), but it seems silly to
submit a patch with an address that is already dead. There is a general
expectation that if/when someone finds a bug in the code they can email
the signed-off-by addresses and get a real person.
As far as indicating it was written at IBM, that should be covered by
the copyright notices.
cheers
--
Michael Ellerman
OzLabs, IBM Australia Development Lab
wwweb: http://michael.ellerman.id.au
phone: +61 2 6212 1183 (tie line 70 21183)
We do not inherit the earth from our ancestors,
we borrow it from our children. - S.M.A.R.T Person
[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 189 bytes --]
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH 3/8] pseries: phyp dump: reserve-release proof-of-concept
2008-01-08 0:26 ` Arnd Bergmann
2008-01-08 0:49 ` Linas Vepstas
@ 2008-01-08 0:50 ` Manish Ahuja
1 sibling, 0 replies; 8+ messages in thread
From: Manish Ahuja @ 2008-01-08 0:50 UTC (permalink / raw)
To: Arnd Bergmann; +Cc: mahuja, linuxppc-dev, linasvepstas, lkessler, strosake
Arnd,
Sorry this patch ended up out of sequence. I reposted it properly again in the other thread.
We did talk about using gmail address, but Linas was more comfortable using this as this is
where he was, when we did this. Hence the use of Austin address with gmail being on the cc list.
I am sure he will chime in with more details about it when he gets the opportunity.
Thanks,
Manish
Arnd Bergmann wrote:
> On Tuesday 08 January 2008, Manish Ahuja wrote:
>
>> Initial patch for reserving memory in early boot, and freeing it later.
>> If the previous boot had ended with a crash, the reserved memory would contain
>> a copy of the crashed kernel data.
>>
>> Signed-off-by: Manish Ahuja <mahuja@us.ibm.com>
>> Signed-off-by: Linas Vepstas <linas@austin.ibm.com>
>
> I think the signed-off-by chain needs to be modified. The way it appears,
> you handled the patch first, then sent it to Linas, who forwarded it
> to whoever will take the patches from the list.
>
> This obviously isn't true, since you are actually the one who is sending
> out the patches. Moreover, I believe that the linas@austin.ibm.com
> address is now dead, and shouldn't be used for this any more.
>
> So, depending on which of you two wrote the majority of a patch, I think
> it should be either
>
> | Signed-off-by: Manish Ahuja <mahuja@us.ibm.com>
> | Acked-by: Linas Vepstas <linasvepstas@gmail.com>
>
> or
>
> | From: Linas Vepstas <linasvepstas@gmail.com>
> | Signed-off-by: Manish Ahuja <mahuja@us.ibm.com>
>
> Arnd <><
^ permalink raw reply [flat|nested] 8+ messages in thread
* [PATCH 0/8] pseries: phyp dump: hypervisor-assisted dump
@ 2008-01-07 23:45 Manish Ahuja
2008-01-08 0:25 ` [PATCH 3/8] pseries: phyp dump: reserve-release proof-of-concept Manish Ahuja
0 siblings, 1 reply; 8+ messages in thread
From: Manish Ahuja @ 2008-01-07 23:45 UTC (permalink / raw)
To: linuxppc-dev; +Cc: mahuja, linasvepstas, lkessler, strosake
The following series of patches implement a basic framework
for hypervisor-assisted dump. The very first patch provides
documentation explaining what this is :-) . Yes, its supposed
to be an improvement over kdump.
The patches mostly work; a list of open issues / todo list
is included in the documentation. It also appears that
the not-yet-released firmware versions this was tested
on are still, ahem, incomplete; this work is also pending.
-- Linas & Manish
^ permalink raw reply [flat|nested] 8+ messages in thread
* [PATCH 3/8] pseries: phyp dump: reserve-release proof-of-concept
2008-01-07 23:45 [PATCH 0/8] pseries: phyp dump: hypervisor-assisted dump Manish Ahuja
@ 2008-01-08 0:25 ` Manish Ahuja
2008-01-08 3:16 ` Stephen Rothwell
2008-01-16 4:21 ` Paul Mackerras
0 siblings, 2 replies; 8+ messages in thread
From: Manish Ahuja @ 2008-01-08 0:25 UTC (permalink / raw)
To: linuxppc-dev; +Cc: mahuja, linasvepstas, lkessler, strosake
Initial patch for reserving memory in early boot, and freeing it later.
If the previous boot had ended with a crash, the reserved memory would contain
a copy of the crashed kernel data.
Signed-off-by: Manish Ahuja <mahuja@us.ibm.com>
Signed-off-by: Linas Vepstas <linas@austin.ibm.com>
----
arch/powerpc/kernel/prom.c | 33 +++++++++++++
arch/powerpc/platforms/pseries/Makefile | 1
arch/powerpc/platforms/pseries/phyp_dump.c | 71 +++++++++++++++++++++++++++++
include/asm-powerpc/phyp_dump.h | 32 +++++++++++++
4 files changed, 137 insertions(+)
Index: linux-2.6.24-rc2-git4/include/asm-powerpc/phyp_dump.h
===================================================================
--- /dev/null 1970-01-01 00:00:00.000000000 +0000
+++ linux-2.6.24-rc2-git4/include/asm-powerpc/phyp_dump.h 2007-11-19 17:44:21.000000000 -0600
@@ -0,0 +1,32 @@
+/*
+ * Hypervisor-assisted dump
+ *
+ * Linas Vepstas, Manish Ahuja 2007
+ * Copyright (c) 2007 IBM Corp.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version
+ * 2 of the License, or (at your option) any later version.
+ */
+
+#ifndef _PPC64_PHYP_DUMP_H
+#define _PPC64_PHYP_DUMP_H
+
+#ifdef CONFIG_PHYP_DUMP
+
+/* The RMR region will be saved for later dumping
+ * whenever the kernel crashes. Set this to 256MB. */
+#define PHYP_DUMP_RMR_START 0x0
+#define PHYP_DUMP_RMR_END (1UL<<28)
+
+struct phyp_dump {
+ /* Memory that is reserved during very early boot. */
+ unsigned long init_reserve_start;
+ unsigned long init_reserve_size;
+};
+
+extern struct phyp_dump *phyp_dump_info;
+
+#endif /* CONFIG_PHYP_DUMP */
+#endif /* _PPC64_PHYP_DUMP_H */
Index: linux-2.6.24-rc2-git4/arch/powerpc/platforms/pseries/phyp_dump.c
===================================================================
--- /dev/null 1970-01-01 00:00:00.000000000 +0000
+++ linux-2.6.24-rc2-git4/arch/powerpc/platforms/pseries/phyp_dump.c 2007-11-19 19:07:49.000000000 -0600
@@ -0,0 +1,71 @@
+/*
+ * Hypervisor-assisted dump
+ *
+ * Linas Vepstas, Manish Ahuja 2007
+ * Copyrhgit (c) 2007 IBM Corp.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version
+ * 2 of the License, or (at your option) any later version.
+ *
+ */
+
+#include <linux/init.h>
+#include <linux/mm.h>
+#include <linux/pfn.h>
+#include <linux/swap.h>
+
+#include <asm/page.h>
+#include <asm/phyp_dump.h>
+
+/* Global, used to communicate data between early boot and late boot */
+static struct phyp_dump phyp_dump_global;
+struct phyp_dump *phyp_dump_info = &phyp_dump_global;
+
+/**
+ * release_memory_range -- release memory previously lmb_reserved
+ * @start_pfn: starting physical frame number
+ * @nr_pages: number of pages to free.
+ *
+ * This routine will release memory that had been previously
+ * lmb_reserved in early boot. The released memory becomes
+ * available for genreal use.
+ */
+static void
+release_memory_range(unsigned long start_pfn, unsigned long nr_pages)
+{
+ struct page *rpage;
+ unsigned long end_pfn;
+ long i;
+
+ end_pfn = start_pfn + nr_pages;
+
+ for (i=start_pfn; i <= end_pfn; i++) {
+ rpage = pfn_to_page(i);
+ if (PageReserved(rpage)) {
+ ClearPageReserved(rpage);
+ init_page_count(rpage);
+ __free_page(rpage);
+ totalram_pages++;
+ }
+ }
+}
+
+static int __init phyp_dump_setup(void)
+{
+ unsigned long start_pfn, nr_pages;
+
+ /* If no memory was reserved in early boot, there is nothing to do */
+ if (phyp_dump_info->init_reserve_size == 0)
+ return 0;
+
+ /* Release memory that was reserved in early boot */
+ start_pfn = PFN_DOWN(phyp_dump_info->init_reserve_start);
+ nr_pages = PFN_DOWN(phyp_dump_info->init_reserve_size);
+ release_memory_range(start_pfn, nr_pages);
+
+ return 0;
+}
+
+subsys_initcall(phyp_dump_setup);
Index: linux-2.6.24-rc2-git4/arch/powerpc/platforms/pseries/Makefile
===================================================================
--- linux-2.6.24-rc2-git4.orig/arch/powerpc/platforms/pseries/Makefile 2007-11-19 17:43:52.000000000 -0600
+++ linux-2.6.24-rc2-git4/arch/powerpc/platforms/pseries/Makefile 2007-11-19 17:44:21.000000000 -0600
@@ -18,3 +18,4 @@ obj-$(CONFIG_HOTPLUG_CPU) += hotplug-cpu
obj-$(CONFIG_HVC_CONSOLE) += hvconsole.o
obj-$(CONFIG_HVCS) += hvcserver.o
obj-$(CONFIG_HCALL_STATS) += hvCall_inst.o
+obj-$(CONFIG_PHYP_DUMP) += phyp_dump.o
Index: linux-2.6.24-rc2-git4/arch/powerpc/kernel/prom.c
===================================================================
--- linux-2.6.24-rc2-git4.orig/arch/powerpc/kernel/prom.c 2007-11-19 17:43:52.000000000 -0600
+++ linux-2.6.24-rc2-git4/arch/powerpc/kernel/prom.c 2007-11-19 17:44:21.000000000 -0600
@@ -51,6 +51,7 @@
#include <asm/machdep.h>
#include <asm/pSeries_reconfig.h>
#include <asm/pci-bridge.h>
+#include <asm/phyp_dump.h>
#include <asm/kexec.h>
#ifdef DEBUG
@@ -1011,6 +1012,37 @@ static void __init early_reserve_mem(voi
#endif
}
+#ifdef CONFIG_PHYP_DUMP
+
+/**
+ * reserve_crashed_mem() - reserve all not-yet-dumped mmemory
+ *
+ * This routine will reserve almost all of the memory in the
+ * system, except for a few hundred megabytes used to boot the
+ * new kernel. As the reserved memory is dumped to the dump
+ * device (by userland tools), it will be freed and made available.
+ */
+static void __init reserve_crashed_mem(void)
+{
+ unsigned long crashed_base, crashed_size;
+
+ /* Reserve *everything* above the RMR. We'll free this real soon. */
+ crashed_base = PHYP_DUMP_RMR_END;
+ crashed_size = lmb_end_of_DRAM() - crashed_base;
+
+ /* XXX crashed_ram_end is wrong, since it may be beyond
+ * the memory_limit, it will need to be adjusted. */
+ lmb_reserve(crashed_base, crashed_size);
+
+ phyp_dump_info->init_reserve_start = crashed_base;
+ phyp_dump_info->init_reserve_size = crashed_size;
+}
+
+#else
+static inline void __init reserve_crashed_mem(void) {}
+#endif /* CONFIG_PHYP_DUMP */
+
+
void __init early_init_devtree(void *params)
{
DBG(" -> early_init_devtree(%p)\n", params);
@@ -1043,6 +1075,7 @@ void __init early_init_devtree(void *par
reserve_kdump_trampoline();
reserve_crashkernel();
early_reserve_mem();
+ reserve_crashed_mem();
lmb_enforce_memory_limit(memory_limit);
lmb_analyze();
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH 3/8] pseries: phyp dump: reserve-release proof-of-concept
2008-01-08 0:25 ` [PATCH 3/8] pseries: phyp dump: reserve-release proof-of-concept Manish Ahuja
@ 2008-01-08 3:16 ` Stephen Rothwell
2008-01-16 4:21 ` Paul Mackerras
1 sibling, 0 replies; 8+ messages in thread
From: Stephen Rothwell @ 2008-01-08 3:16 UTC (permalink / raw)
To: Manish Ahuja; +Cc: mahuja, linuxppc-dev, linasvepstas, lkessler, strosake
[-- Attachment #1: Type: text/plain, Size: 1771 bytes --]
Hi Manish,
Just some trivial things ...
On Mon, 07 Jan 2008 18:25:31 -0600 Manish Ahuja <ahuja@austin.ibm.com> wrote:
>
>
> +++ linux-2.6.24-rc2-git4/include/asm-powerpc/phyp_dump.h 2007-11-19 17:44:21.000000000 -0600
> +#ifndef _PPC64_PHYP_DUMP_H
We more usually use _ASM_POWERPC_PHYP_DUMP_H
> +#define _PPC64_PHYP_DUMP_H
> +
> +#ifdef CONFIG_PHYP_DUMP
Do these things really need protecting by this CONFIG variable? i.e. does
anything change depending on the visibility of these various symbols?
> +++ linux-2.6.24-rc2-git4/arch/powerpc/platforms/pseries/phyp_dump.c 2007-11-19 19:07:49.000000000 -0600
> @@ -0,0 +1,71 @@
> +/*
> + * Hypervisor-assisted dump
> + *
> + * Linas Vepstas, Manish Ahuja 2007
> + * Copyrhgit (c) 2007 IBM Corp.
^^^^^^^^^
typo. and you should really be using '©' in new copyright notices (or
nothing).
> +/**
> + * release_memory_range -- release memory previously lmb_reserved
> + * @start_pfn: starting physical frame number
> + * @nr_pages: number of pages to free.
> + *
> + * This routine will release memory that had been previously
> + * lmb_reserved in early boot. The released memory becomes
> + * available for genreal use.
^^^^^^^
typo.
> +release_memory_range(unsigned long start_pfn, unsigned long nr_pages)
> +{
> + struct page *rpage;
> + unsigned long end_pfn;
> + long i;
> +
> + end_pfn = start_pfn + nr_pages;
> +
> + for (i=start_pfn; i <= end_pfn; i++) {
spaces around '='
> +static int __init phyp_dump_setup(void)
> +{
> +}
> +
> +subsys_initcall(phyp_dump_setup);
Normally we don't leave a blank line here.
--
Cheers,
Stephen Rothwell sfr@canb.auug.org.au
http://www.canb.auug.org.au/~sfr/
[-- Attachment #2: Type: application/pgp-signature, Size: 189 bytes --]
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH 3/8] pseries: phyp dump: reserve-release proof-of-concept
2008-01-08 0:25 ` [PATCH 3/8] pseries: phyp dump: reserve-release proof-of-concept Manish Ahuja
2008-01-08 3:16 ` Stephen Rothwell
@ 2008-01-16 4:21 ` Paul Mackerras
1 sibling, 0 replies; 8+ messages in thread
From: Paul Mackerras @ 2008-01-16 4:21 UTC (permalink / raw)
To: Manish Ahuja; +Cc: mahuja, linuxppc-dev, linasvepstas, lkessler, strosake
Manish Ahuja writes:
> Initial patch for reserving memory in early boot, and freeing it later.
> If the previous boot had ended with a crash, the reserved memory would contain
> a copy of the crashed kernel data.
The main problem I see here is that if this option is turned on, the
kernel now has only 256MB of memory from early boot until
subsys_initcalls are done -- on any machine, and whether or not there
is actually a dump. That means, for instance, that a machine running
bare-metal (such as a G5) might not be able to allocate the hash table
for the MMU. Also, any allocations made during that time won't be
able to be node-local.
So it will be necessary to read the flattened device tree early on to
see whether or not there is a dump, so that we don't reserve most of
memory in the cases where there isn't a dump.
Paul.
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2008-01-16 4:21 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-01-08 0:19 [PATCH 3/8] pseries: phyp dump: reserve-release proof-of-concept Manish Ahuja
2008-01-08 0:26 ` Arnd Bergmann
2008-01-08 0:49 ` Linas Vepstas
2008-01-08 1:13 ` Michael Ellerman
2008-01-08 0:50 ` Manish Ahuja
-- strict thread matches above, loose matches on Subject: below --
2008-01-07 23:45 [PATCH 0/8] pseries: phyp dump: hypervisor-assisted dump Manish Ahuja
2008-01-08 0:25 ` [PATCH 3/8] pseries: phyp dump: reserve-release proof-of-concept Manish Ahuja
2008-01-08 3:16 ` Stephen Rothwell
2008-01-16 4:21 ` Paul Mackerras
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).