09 May, 2007

1 commit

  • Currently the size of the per-cpu region reserved to save crash notes is
    set by the per-architecture value MAX_NOTE_BYTES. Which in turn is
    currently set to 1024 on all supported architectures.

    While testing ia64 I recently discovered that this value is in fact too
    small. The particular setup I was using actually needs 1172 bytes. This
    lead to very tedious failure mode where the tail of one elf note would
    overwrite the head of another if they ended up being alocated sequentially
    by kmalloc, which was often the case.

    It seems to me that a far better approach is to caclculate the size that
    the area needs to be. This patch does just that.

    If a simpler stop-gap patch for ia64 to be squeezed into 2.6.21(.X) is
    needed then this should be as easy as making MAX_NOTE_BYTES larger in
    arch/asm-ia64/kexec.h. Perhaps 2048 would be a good choice. However, I
    think that the approach in this patch is a much more robust idea.

    Acked-by: Vivek Goyal
    Signed-off-by: Simon Horman
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Simon Horman
     

17 Aug, 2006

1 commit


28 Jun, 2006

2 commits

  • With this patch, kdump uses the firmware soft-reset NMI for two purposes:
    1) Initiate the kdump (take a crash dump) by issuing a soft-reset.
    2) Break a CPU out of a deadlock condition that is detected during kdump
    processing.

    When a soft-reset is initiated each CPU will enter
    system_reset_exception() and set its corresponding bit in the global
    bit-array cpus_in_sr then call die(). When die() finds the CPU's bit set
    in cpu_in_sr crash_kexec() is called to initiate a crash dump. The first
    CPU to enter crash_kexec() is called the "crashing CPU". All other CPUs
    are "secondary CPUs". The secondary CPU's pass through to
    crash_kexec_secondary() and sleep. The crashing CPU waits for all CPUs
    to enter via soft-reset then boots the kdump kernel (see
    crash_soft_reset_check())

    When the system crashes due to a panic or exception, crash_kexec() is
    called by panic() or die(). The crashing CPU sends an IPI to all other
    CPUs to notify them of the pending shutdown. If a CPU is in a deadlock
    or hung state with interrupts disabled, the IPI will not be delivered.
    The result being, that the kdump kernel is not booted. This problem is
    solved with the use of a firmware generated soft-reset. After the
    crashing_cpu has issued the IPI, it waits for 10 sec for all CPUs to
    enter crash_ipi_callback(). A CPU signifies its entry to
    crash_ipi_callback() by setting its corresponding bit in the
    cpus_in_crash bit array. After 10 sec, if one or more CPUs have not set
    their bit in cpus_in_crash we assume that the CPU(s) is deadlocked. The
    operator is then prompted to generate a soft-reset to break the
    deadlock. Each CPU enters the soft reset handler as described above.

    Two conditions must be handled at this point:
    1) The system crashed because the operator generated a soft-reset. See
    2) The system had crashed before the soft-reset was generated ( in the
    case of a Panic or oops).

    The first CPU to enter crash_kexec() uses the state of the kexec_lock to
    determine this state. If kexec_lock is already held then condition 2 is
    true and crash_kexec_secondary() is called, else; this CPU is flagged as
    the crashing CPU, the kexec_lock is acquired and crash_kexec() proceeds
    as described above.

    Each additional CPUs responding to the soft-reset will pass through
    crash_kexec() to kexec_secondary(). All secondary CPUs call
    crash_ipi_callback() readying them self's for the shutdown. When ready
    they clear their bit in cpus_in_sr. The crashing CPU waits in
    kexec_secondary() until all other CPUs have cleared their bits in
    cpus_in_sr. The kexec kernel boot is then started.

    Signed-off-by: Haren Myneni
    Signed-off-by: David Wilder
    Signed-off-by: Paul Mackerras

    David Wilder
     
  • There's no reason kexec_setup() needs to be called explicitly from
    setup_system(), it can just be a regular initcall.

    Signed-off-by: Michael Ellerman
    Signed-off-by: Paul Mackerras

    Michael Ellerman
     

19 May, 2006

2 commits

  • This was missing a quilt ref.

    Signed-off-by: Paul Mackerras

    Michael Ellerman
     
  • We currently do mem= handling in three seperate places. And as benh pointed out
    I wrote two of them. Now that we parse command line parameters earlier we can
    clean this mess up.

    Moving the parsing out of prom_init means the device tree might be allocated
    above the memory limit. If that happens we'd have to move it. As it happens
    we already have logic to do that for kdump, so just genericise it.

    This also means we might have reserved regions above the memory limit, if we
    do the bootmem allocator will blow up, so we have to modify
    lmb_enforce_memory_limit() to truncate the reserves as well.

    Tested on P5 LPAR, iSeries, F50, 44p. Tested moving device tree on P5 and
    44p and F50.

    Signed-off-by: Michael Ellerman
    Signed-off-by: Paul Mackerras

    Michael Ellerman
     

09 Mar, 2006

1 commit

  • While testing kexec and kdump we hit problems where the new kernel would
    freeze or instantly reboot. The easiest way to trigger it was to kexec a
    kernel compiled for CONFIG_M586 on an athlon cpu. Compiling for CONFIG_MK7
    instead would work fine.

    The patch fixes a few problems with the kexec inline asm.

    Signed-off-by: Chris Mason
    Acked-by: "Eric W. Biederman"
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Michael Matz
     

02 Feb, 2006

1 commit

  • - kexec.h is included from assembly code, thus C code must be properly
    protected.

    - (embedded) ppc32 systems use machine_kexec_simple whose declaration
    vanished during a recent powerpc merge change.

    Signed-off-by: Albert Herranz
    Cc:
    Cc: Benjamin Herrenschmidt
    Cc: Paul Mackerras
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Albert Herranz
     

15 Jan, 2006

1 commit

  • - This contains the arch specific changes for the following the
    kdump generic fixes which were already accepted in the upstream.
    . Capturing CPU registers (for the case of 'panic' and invoking
    the dump using 'sysrq-trigger') from a function (stack frame) which will
    be not be available during the kdump boot. Hence, might result in
    invalid stack trace.
    . Dynamically allocating per cpu ELF notes section instead of
    statically for NR_CPUS.

    - Fix the compiler warning in prom_init.c.

    Signed-off-by: Haren Myneni
    Signed-off-by: Paul Mackerras

    Haren Myneni
     

11 Jan, 2006

2 commits

  • )

    From: Vivek Goyal

    crash_setup_regs() is an architecture dependent function which is called in
    architecture independent section. So every architecture supporting kexec
    should at least provide a dummy definition of crash_setup_regs() even if
    crash dumping is not implemented yet, to avoid build failures.

    Signed-off-by: Vivek Goyal
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    akpm@osdl.org
     
  • - In case of system crash, current state of cpu registers is saved in memory
    in elf note format. So far memory for storing elf notes was being allocated
    statically for NR_CPUS.

    - This patch introduces dynamic allocation of memory for storing elf notes.
    It uses alloc_percpu() interface. This should lead to better memory usage.

    - Introduced based on Andi Kleen's and Eric W. Biederman's suggestions.

    - This patch also moves memory allocation for elf notes from architecture
    dependent portion to architecture independent portion. Now crash_notes is
    architecture independent. The whole idea is that size of memory to be
    allocated per cpu (MAX_NOTE_BYTES) can be architecture dependent and
    allocation of this memory can be architecture independent.

    Signed-off-by: Vivek Goyal
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Vivek Goyal
     

09 Jan, 2006

4 commits

  • include/asm-ppc/ had #ifdef __KERNEL__ in all header files that
    are not meant for use by user space, include/asm-powerpc does
    not have this yet.

    This patch gets us a lot closer there. There are a few cases
    where I was not sure, so I left them out. I have verified
    that no CONFIG_* symbols are used outside of __KERNEL__
    any more and that there are no obvious compile errors when
    including any of the headers in user space libraries.

    Signed-off-by: Arnd Bergmann
    Signed-off-by: Paul Mackerras

    Arnd Bergmann
     
  • Signed-off-by: Haren Myneni
    Signed-off-by: Michael Ellerman
    Signed-off-by: Paul Mackerras

    Michael Ellerman
     
  • Implementing the machine_crash_shutdown which will be called by
    crash_kexec (called in case of a panic, sysrq etc.). Disable the
    interrupts, shootdown cpus using debugger IPI and collect regs
    for all CPUs.

    elfcorehdr= specifies the location of elf core header stored by
    the crashed kernel. This command line option will be passed by
    the kexec-tools to capture kernel.

    savemaxmem= specifies the actual memory size that the first kernel
    has and this value will be used for dumping in the capture kernel.
    This command line option will be passed by the kexec-tools to
    capture kernel.

    Signed-off-by: Haren Myneni
    Signed-off-by: Michael Ellerman
    Signed-off-by: Paul Mackerras

    Michael Ellerman
     
  • This patch merges, to some extent, the PPC32 and PPC64 kexec implementations.

    We adopt the PPC32 approach of having ppc_md callbacks for the kexec functions.
    The current PPC64 implementation becomes the "default" implementation for PPC64
    which platforms can select if they need no special treatment.

    I've added these default callbacks to pseries/maple/cell/powermac, this means
    iSeries no longer supports kexec - but it never worked anyway.

    I've renamed PPC32's machine_kexec_simple to default_machine_kexec, inline with
    PPC64. Judging by the comments it might be better named machine_kexec_non_of,
    or something, but at the moment it's the only implementation for PPC32 so it's
    the "default".

    Kexec requires machine_shutdown(), which is in machine_kexec.c on PPC32, but we
    already have in setup-common.c on powerpc. All this does is call
    ppc_md.nvram_sync, which only powermac implements, so instead make
    machine_shutdown a ppc_md member and have it call core99_nvram_sync directly
    on powermac.

    I've also stuck relocate_kernel.S into misc_32.S for powerpc.

    Built for ARCH=ppc, and 32 & 64 bit ARCH=powerpc, with KEXEC=y/n. Booted on
    P5 LPAR and successfully kexec'ed.

    Should apply on top of 493f25ef4087395891c99fcfe2c72e62e293e89f.

    Signed-off-by: Michael Ellerman
    Signed-off-by: Paul Mackerras

    Michael Ellerman
     

14 Nov, 2005

1 commit

  • The userspace kexec-tools need to know the location of the htab on non-lpar
    machines, as well as the end of the kernel. Export via the device tree.

    NB. This patch has been updated to use "linux,x" property names. You may
    need to update your kexec-tools to match.

    Signed-off-by: Michael Ellerman
    Signed-off-by: Paul Mackerras

    Michael Ellerman
     

03 Nov, 2005

1 commit

  • Merge include/asm-ppc/kexec.h and include/asm-ppc64/kexec.h.

    The only thing that's really changed is that we now allocate crash_notes
    properly on PPC32. It's address is exported via sysfs, so it's not correct
    for it to be a pointer.

    I've also removed some of the "we don't use this" comments, because they're
    wrong (or perhaps were referring only to arch code).

    Signed-off-by: Michael Ellerman

    Michael Ellerman