ia64/xen-unstable

changeset 13421:819e9449db07

[PATCH] kexec/kdump: allow zero start for crashkernel

Some architectures, notably ia64, can automatically place
the crash kernel into an appropriate place if the start
address for crashkernel is specified as zero or omitted.

E.g. crashkernel=256M or crashkernel=256M@0

While xen does not actually have support for ia64 kexec,
I am working on it. And in any case this change should be harmless.
Just a small bit of infastructure that will make things easier in the
future.

This should also be possible on x86, now relocatable kernels
are reloacatble on x86. So once xen moves up to using linux ~2.6.19
it would make sense to look into implementing this.

The patch does 3 things.

* Firstly, parse_crashkernel() is modified to allows the size and start elements of kexec_crash_area
to be set to any value, including zero. Previously if either size or
start were specified as zero, they would both end up as zero.

* Secondly, when kexec_get() is called, if either the size or start
elements of kexec_crash_area are zero, then zero is passed
back to the hypercall caller for both values.

This gives the same behaviour as having parse_crashkernel() set
size and start to zero if either of them are zero, but it allows
architecture sepcific code called between the invocation of
parse_crashkernel() and kexec_get() to modify start (and size if
there was a reason). In particular, this allows the
architecture specific code to find a good start point if 0 is
specified.

* Lastly, it ads an additional check to the x86 setup code.
As this code currently does not know how to deal with a
0 start address, it doesn't reserve memory if start is 0.

This is neccessary as previously if start was specified as zero,
parse_crashkernel() would set size to zero, but that is
no longer the case, so a stronger check is needed.

I would really appreciate it if this patch was merged,
as I don't believe it harms anything, and it does allow
a nice path for moving forwards.

Signed-off-by: Simon Horman <horms@verge.net.au>
author Ian Campbell <ian.campbell@xensource.com>
date Fri Jan 12 16:03:33 2007 +0000 (2007-01-12)
parents c149ffa2fd1a
children e5ded8fe74ad
files xen/arch/x86/setup.c xen/common/kexec.c
line diff
     1.1 --- a/xen/arch/x86/setup.c	Fri Jan 12 15:35:52 2007 +0000
     1.2 +++ b/xen/arch/x86/setup.c	Fri Jan 12 16:03:33 2007 +0000
     1.3 @@ -486,7 +486,7 @@ void __init __start_xen(multiboot_info_t
     1.4  #endif
     1.5      }
     1.6  
     1.7 -    if ( kexec_crash_area.size > 0 )
     1.8 +    if ( kexec_crash_area.size > 0 && kexec_crash_area.start > 0)
     1.9      {
    1.10          unsigned long kdump_start, kdump_size, k;
    1.11  
     2.1 --- a/xen/common/kexec.c	Fri Jan 12 15:35:52 2007 +0000
     2.2 +++ b/xen/common/kexec.c	Fri Jan 12 16:03:33 2007 +0000
     2.3 @@ -51,19 +51,9 @@ xen_kexec_reserve_t kexec_crash_area;
     2.4  
     2.5  static void __init parse_crashkernel(const char *str)
     2.6  {
     2.7 -    unsigned long start, size;
     2.8 -
     2.9 -    size = parse_size_and_unit(str, &str);
    2.10 +    kexec_crash_area.size = parse_size_and_unit(str, &str);
    2.11      if ( *str == '@' )
    2.12 -        start = parse_size_and_unit(str+1, NULL);
    2.13 -    else
    2.14 -        start = 0;
    2.15 -
    2.16 -    if ( start && size )
    2.17 -    {
    2.18 -        kexec_crash_area.start = start;
    2.19 -        kexec_crash_area.size = size;
    2.20 -    }
    2.21 +        kexec_crash_area.start = parse_size_and_unit(str+1, NULL);
    2.22  }
    2.23  custom_param("crashkernel", parse_crashkernel);
    2.24  
    2.25 @@ -158,8 +148,12 @@ static void setup_note(Elf_Note *n, cons
    2.26  
    2.27  static int kexec_get(reserve)(xen_kexec_range_t *range)
    2.28  {
    2.29 -    range->start = kexec_crash_area.start;
    2.30 -    range->size = kexec_crash_area.size;
    2.31 +    if ( kexec_crash_area.size > 0 && kexec_crash_area.start > 0) {
    2.32 +        range->start = kexec_crash_area.start;
    2.33 +        range->size = kexec_crash_area.size;
    2.34 +    }
    2.35 +    else
    2.36 +        range->start = range->size = 0;
    2.37      return 0;
    2.38  }
    2.39