All of lore.kernel.org
 help / color / mirror / Atom feed
* [patch] crashkernel allocation failure #2
@ 2007-06-22  9:46 Gerd Hoffmann
  2007-06-25 18:26 ` Keir Fraser
  0 siblings, 1 reply; 3+ messages in thread
From: Gerd Hoffmann @ 2007-06-22  9:46 UTC (permalink / raw)
  To: Xen Development Mailing List

[-- Attachment #1: Type: text/plain, Size: 780 bytes --]

    Hi,

Reserving the crashkernel area fails on x86_64 machines with more than 
one GB of main memory.  The reason for this is that xen maps the 
complete physical memory.  For memory above 1G (which is covered by the 
initial boot mappings) additional page tables are allocated, which 
happed to be taken from the crashkernel area.  Bummer.

The attached patch fixes that by taking care that the boot allocater 
doesn't give out pages from the crash kernel area.  It does also take 
care that the crash kernel area doesn't overlap with the xen heap and 
moves crash kernel area it if needed.

A side effect of the second change is that you can specify just 
"crashkernel=64m" and have it moved to the right place just above the 
xen heap automagically.

please apply,

    Gerd

[-- Attachment #2: xen-crashkernel-2.patch --]
[-- Type: text/x-patch, Size: 1533 bytes --]

--- xen/arch/x86/setup.c.debug	2007-06-21 15:31:00.000000000 +0200
+++ xen/arch/x86/setup.c	2007-06-22 10:13:39.000000000 +0200
@@ -460,6 +460,11 @@
 
     /* Initialise boot-time allocator with all RAM situated after modules. */
     xenheap_phys_start = init_boot_allocator(__pa(&_end));
+    if (kexec_crash_area.size > 0 && kexec_crash_area.start < xenheap_phys_end) {
+	printk("Moving crashkernel start: %ldm -> %ldm\n",
+	       kexec_crash_area.start >> 20, xenheap_phys_end >> 20);
+	kexec_crash_area.start = xenheap_phys_end;
+    }
     nr_pages = 0;
     for ( i = 0; i < e820.nr_map; i++ )
     {
--- xen/common/page_alloc.c.debug	2007-06-21 15:31:00.000000000 +0200
+++ xen/common/page_alloc.c	2007-06-22 10:12:33.000000000 +0200
@@ -36,6 +36,7 @@
 #include <xen/perfc.h>
 #include <xen/numa.h>
 #include <xen/nodemask.h>
+#include <xen/kexec.h>
 #include <asm/page.h>
 
 /*
@@ -262,9 +263,16 @@
     unsigned long nr_pfns, unsigned long pfn_align)
 {
     unsigned long pg, i;
+    unsigned long start_mfn = first_valid_mfn;
+    unsigned long kexec_end = \
+	(kexec_crash_area.start + kexec_crash_area.size) >> PAGE_SHIFT;
+
+    /* make sure we don't give out pages from the crashkernel area */
+    if (start_mfn < kexec_end)
+	start_mfn = kexec_end;
 
     /* Search forwards to obtain lowest available range. */
-    for ( pg = first_valid_mfn & ~(pfn_align - 1);
+    for ( pg = start_mfn & ~(pfn_align - 1);
           (pg + nr_pfns) <= max_page;
           pg = (pg + i + pfn_align) & ~(pfn_align - 1) )
     {

[-- Attachment #3: Type: text/plain, Size: 138 bytes --]

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xensource.com
http://lists.xensource.com/xen-devel

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [patch] crashkernel allocation failure #2
  2007-06-22  9:46 [patch] crashkernel allocation failure #2 Gerd Hoffmann
@ 2007-06-25 18:26 ` Keir Fraser
  2007-06-26  6:54   ` Gerd Hoffmann
  0 siblings, 1 reply; 3+ messages in thread
From: Keir Fraser @ 2007-06-25 18:26 UTC (permalink / raw)
  To: Gerd Hoffmann, Xen Development Mailing List

On 22/6/07 10:46, "Gerd Hoffmann" <kraxel@redhat.com> wrote:

> A side effect of the second change is that you can specify just
> "crashkernel=64m" and have it moved to the right place just above the
> xen heap automagically.

Does this really work in practice (i.e., is the crashkernel relocatable)?

 -- Keir

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [patch] crashkernel allocation failure #2
  2007-06-25 18:26 ` Keir Fraser
@ 2007-06-26  6:54   ` Gerd Hoffmann
  0 siblings, 0 replies; 3+ messages in thread
From: Gerd Hoffmann @ 2007-06-26  6:54 UTC (permalink / raw)
  To: Keir Fraser; +Cc: Xen Development Mailing List

Keir Fraser wrote:
> On 22/6/07 10:46, "Gerd Hoffmann" <kraxel@redhat.com> wrote:
> 
>> A side effect of the second change is that you can specify just
>> "crashkernel=64m" and have it moved to the right place just above the
>> xen heap automagically.
> 
> Does this really work in practice (i.e., is the crashkernel relocatable)?

Patches floating around for quite some time, i386 is mainline already. 
Not fully sure about x86_64, but I think it they are merged too.  So any 
recent mainline kernel as crash kernel should do (and a separate crash 
kernel isn't needed too).

Also with the default xenheap size the crashkernel ends up at @16m, 
which is a common location for pre-relocation crash kernels, so it 
should work with older kernels just fine too.  Of course you still have 
the option to explicitly specify the location ...

cheers,
   Gerd

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2007-06-26  6:54 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-06-22  9:46 [patch] crashkernel allocation failure #2 Gerd Hoffmann
2007-06-25 18:26 ` Keir Fraser
2007-06-26  6:54   ` Gerd Hoffmann

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.