08 Apr, 2014

1 commit

  • Eliminate the following warning in proc/vmcore.c:

    fs/proc/vmcore.c:1088:6: warning: no previous prototype for `vmcore_cleanup' [-Wmissing-prototypes]

    [akpm@linux-foundation.org: clean up powerpc, remove unneeded EXPORT_SYMBOL]
    Signed-off-by: Rashika Kheria
    Reviewed-by: Josh Triplett
    Cc: Benjamin Herrenschmidt
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Rashika Kheria
     

15 Jan, 2014

1 commit

  • In file included from kernel/crash_dump.c:2:0:
    include/linux/crash_dump.h:22:27: error: unknown type name `pgprot_t'

    when CONFIG_CRASH_DUMP=y

    The error was traced back to commit 9cb218131de1 ("vmcore: introduce
    remap_oldmem_pfn_range()")

    include to get the missing definition

    Signed-off-by: Qais Yousef
    Reviewed-by: James Hogan
    Cc: Michael Holzheu
    Acked-by: Vivek Goyal
    Cc: [3.12+]
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Qais Yousef
     

12 Sep, 2013

2 commits

  • For zfcpdump we can't map the HSA storage because it is only available via
    a read interface. Therefore, for the new vmcore mmap feature we have
    introduce a new mechanism to create mappings on demand.

    This patch introduces a new architecture function remap_oldmem_pfn_range()
    that should be used to create mappings with remap_pfn_range() for oldmem
    areas that can be directly mapped. For zfcpdump this is everything
    besides of the HSA memory. For the areas that are not mapped by
    remap_oldmem_pfn_range() a generic vmcore a new generic vmcore fault
    handler mmap_vmcore_fault() is called.

    This handler works as follows:

    * Get already available or new page from page cache (find_or_create_page)
    * Check if /proc/vmcore page is filled with data (PageUptodate)
    * If yes:
    Return that page
    * If no:
    Fill page using __vmcore_read(), set PageUptodate, and return page

    Signed-off-by: Michael Holzheu
    Acked-by: Vivek Goyal
    Cc: HATAYAMA Daisuke
    Cc: Jan Willeke
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Michael Holzheu
     
  • For s390 we want to use /proc/vmcore for our SCSI stand-alone dump
    (zfcpdump). We have support where the first HSA_SIZE bytes are saved into
    a hypervisor owned memory area (HSA) before the kdump kernel is booted.
    When the kdump kernel starts, it is restricted to use only HSA_SIZE bytes.

    The advantages of this mechanism are:

    * No crashkernel memory has to be defined in the old kernel.
    * Early boot problems (before kexec_load has been done) can be dumped
    * Non-Linux systems can be dumped.

    We modify the s390 copy_oldmem_page() function to read from the HSA memory
    if memory below HSA_SIZE bytes is requested.

    Since we cannot use the kexec tool to load the kernel in this scenario,
    we have to build the ELF header in the 2nd (kdump/new) kernel.

    So with the following patch set we would like to introduce the new
    function that the ELF header for /proc/vmcore can be created in the 2nd
    kernel memory.

    The following steps are done during zfcpdump execution:

    1. Production system crashes
    2. User boots a SCSI disk that has been prepared with the zfcpdump tool
    3. Hypervisor saves CPU state of boot CPU and HSA_SIZE bytes of memory into HSA
    4. Boot loader loads kernel into low memory area
    5. Kernel boots and uses only HSA_SIZE bytes of memory
    6. Kernel saves registers of non-boot CPUs
    7. Kernel does memory detection for dump memory map
    8. Kernel creates ELF header for /proc/vmcore
    9. /proc/vmcore uses this header for initialization
    10. The zfcpdump user space reads /proc/vmcore to write dump to SCSI disk
    - copy_oldmem_page() copies from HSA for memory below HSA_SIZE
    - copy_oldmem_page() copies from real memory for memory above HSA_SIZE

    Currently for s390 we create the ELF core header in the 2nd kernel with a
    small trick. We relocate the addresses in the ELF header in a way that
    for the /proc/vmcore code it seems to be in the 1st kernel (old) memory
    and the read_from_oldmem() returns the correct data. This allows the
    /proc/vmcore code to use the ELF header in the 2nd kernel.

    This patch:

    Exchange the old mechanism with the new and much cleaner function call
    override feature that now offcially allows to create the ELF core header
    in the 2nd kernel.

    To use the new feature the following function have to be defined
    by the architecture backend code to read from new memory:

    * elfcorehdr_alloc: Allocate ELF header
    * elfcorehdr_free: Free the memory of the ELF header
    * elfcorehdr_read: Read from ELF header
    * elfcorehdr_read_notes: Read from ELF notes

    Signed-off-by: Michael Holzheu
    Acked-by: Vivek Goyal
    Cc: HATAYAMA Daisuke
    Cc: Jan Willeke
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Michael Holzheu
     

16 Mar, 2012

1 commit

  • The header includes a lot of stuff, and
    it in turn gets a lot of use just for the basic "struct device"
    which appears so often.

    Clean up the users as follows:

    1) For those headers only needing "struct device" as a pointer
    in fcn args, replace the include with exactly that.

    2) For headers not really using anything from device.h, simply
    delete the include altogether.

    3) For headers relying on getting device.h implicitly before
    being included themselves, now explicitly include device.h

    4) For files in which doing #1 or #2 uncovers an implicit
    dependency on some other header, fix by explicitly adding
    the required header(s).

    Any C files that were implicitly relying on device.h to be
    present have already been dealt with in advance.

    Total removals from #1 and #2: 51. Total additions coming
    from #3: 9. Total other implicit dependencies from #4: 7.

    As of 3.3-rc1, there were 110, so a net removal of 42 gives
    about a 38% reduction in device.h presence in include/*

    Signed-off-by: Paul Gortmaker

    Paul Gortmaker
     

13 Jan, 2012

1 commit

  • Building an ARM target we get the following warnings:

    CC arch/arm/kernel/setup.o
    In file included from arch/arm/kernel/setup.c:39:
    arch/arm/include/asm/elf.h:102:1: warning: "vmcore_elf64_check_arch" redefined
    In file included from arch/arm/kernel/setup.c:24:
    include/linux/crash_dump.h:30:1: warning: this is the location of the previous definition

    Quoting Russell King:

    "linux/crash_dump.h makes no attempt to include asm/elf.h, but it depends
    on stuff in asm/elf.h to determine how stuff inside this file is defined
    at parse time.

    So, if asm/elf.h is included after linux/crash_dump.h or not at all, you
    get a different result from the situation where asm/elf.h is included
    before."

    So add elf.h header to crash_dump.h to avoid this problem.

    The original discussion about this can be found at:
    http://www.spinics.net/lists/arm-kernel/msg154113.html

    Signed-off-by: Fabio Estevam
    Cc: Russell King
    Cc: [3.2.1]
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Fabio Estevam
     

30 Oct, 2011

1 commit

  • Currently only the address of the pre-allocated ELF header is passed with
    the elfcorehdr= kernel parameter. In order to reserve memory for the header
    in the 2nd kernel also the size is required. Current kdump architecture
    backends use different methods to do that, e.g. x86 uses the memmap= kernel
    parameter. On s390 there is no easy way to transfer this information.
    Therefore the elfcorehdr kernel parameter is extended to also pass the size.
    This now can also be used as standard mechanism by all future kdump
    architecture backends.

    The syntax of the kernel parameter is extended as follows:

    elfcorehdr=[size[KMG]@]offset[KMG]

    This change is backward compatible because elfcorehdr=size is still allowed.

    Acked-by: Vivek Goyal
    Acked-by: Andrew Morton
    Signed-off-by: Michael Holzheu
    Signed-off-by: Martin Schwidefsky

    Michael Holzheu
     

27 May, 2011

1 commit

  • The balloon driver in a Xen guest frees guest pages and marks them as
    mmio. When the kernel crashes and the crash kernel attempts to read the
    oldmem via /proc/vmcore a read from ballooned pages will generate 100%
    load in dom0 because Xen asks qemu-dm for the page content. Since the
    reads come in as 8byte requests each ballooned page is tried 512 times.

    With this change a hook can be registered which checks wether the given
    pfn is really ram. The hook has to return a value > 0 for ram pages, a
    value < 0 on error (because the hypercall is not known) and 0 for non-ram
    pages.

    This will reduce the time to read /proc/vmcore. Without this change a
    512M guest with 128M crashkernel region needs 200 seconds to read it, with
    this change it takes just 2 seconds.

    Signed-off-by: Olaf Hering
    Cc: Alexey Dobriyan
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Olaf Hering
     

30 Nov, 2010

1 commit

  • Allow architectures to redefine this macro if needed. This is useful for
    example in architectures where 64-bit ELF vmcores are not supported.
    Specifying zero vmcore_elf64_check_arch() allows compiler to optimize
    away unnecessary parts of parse_crash_elf64_headers().

    We also rename the macro to vmcore_elf64_check_arch() to reflect that it
    is used for 64-bit vmcores only.

    Signed-off-by: Mika Westerberg
    Signed-off-by: Russell King

    Mika Westerberg
     

13 Jul, 2009

1 commit

  • * Remove smp_lock.h from files which don't need it (including some headers!)
    * Add smp_lock.h to files which do need it
    * Make smp_lock.h include conditional in hardirq.h
    It's needed only for one kernel_locked() usage which is under CONFIG_PREEMPT

    This will make hardirq.h inclusion cheaper for every PREEMPT=n config
    (which includes allmodconfig/allyesconfig, BTW)

    Signed-off-by: Alexey Dobriyan
    Signed-off-by: Linus Torvalds

    Alexey Dobriyan
     

23 Oct, 2008

1 commit


20 Oct, 2008

2 commits

  • The usage of elfcorehdr_addr has changed recently such that being set to
    ELFCORE_ADDR_MAX is used by is_kdump_kernel() to indicate if the code is
    executing in a kernel executed as a crash kernel.

    However, arch/ia64/kernel/setup.c:reserve_elfcorehdr will rest
    elfcorehdr_addr to ELFCORE_ADDR_MAX on error, which means any subsequent
    calls to is_kdump_kernel() will return 0, even though they should return
    1.

    Ok, at this point in time there are no subsequent calls, but I think its
    fair to say that there is ample scope for error or at the very least
    confusion.

    This patch add an extra state, ELFCORE_ADDR_ERR, which indicates that
    elfcorehdr_addr was passed on the command line, and thus execution is
    taking place in a crashdump kernel, but vmcore can't be used for some
    reason. This is tested for using is_vmcore_usable() and set using
    vmcore_unusable(). A subsequent patch makes use of this new code.

    To summarise, the states that elfcorehdr_addr can now be in are as follows:

    ELFCORE_ADDR_MAX: not a crashdump kernel
    ELFCORE_ADDR_ERR: crashdump kernel but vmcore is unusable
    any other value: crash dump kernel and vmcore is usable

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

    Simon Horman
     
  • o elfcorehdr_addr is used by not only the code under CONFIG_PROC_VMCORE
    but also by the code which is not inside CONFIG_PROC_VMCORE. For
    example, is_kdump_kernel() is used by powerpc code to determine if
    kernel is booting after a panic then use previous kernel's TCE table.
    So even if CONFIG_PROC_VMCORE is not set in second kernel, one should be
    able to correctly determine that we are booting after a panic and setup
    calgary iommu accordingly.

    o So remove the assumption that elfcorehdr_addr is under
    CONFIG_PROC_VMCORE.

    o Move definition of elfcorehdr_addr to arch dependent crash files.
    (Unfortunately crash dump does not have an arch independent file
    otherwise that would have been the best place).

    o kexec.c is not the right place as one can Have CRASH_DUMP enabled in
    second kernel without KEXEC being enabled.

    o I don't see sh setup code parsing the command line for
    elfcorehdr_addr. I am wondering how does vmcore interface work on sh.
    Anyway, I am atleast defining elfcoredhr_addr so that compilation is not
    broken on sh.

    Signed-off-by: Vivek Goyal
    Acked-by: "Eric W. Biederman"
    Acked-by: Simon Horman
    Acked-by: Paul Mundt
    Cc: Ingo Molnar
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Vivek Goyal
     

26 Jul, 2008

2 commits

  • fix build bug introduced by 95b68dec0d5 "calgary iommu: use the first
    kernels TCE tables in kdump":

    arch/x86/kernel/built-in.o: In function `calgary_iommu_init':
    (.init.text+0x8399): undefined reference to `elfcorehdr_addr'
    arch/x86/kernel/built-in.o: In function `calgary_iommu_init':
    (.init.text+0x856c): undefined reference to `elfcorehdr_addr'
    arch/x86/kernel/built-in.o: In function `detect_calgary':
    (.init.text+0x8c68): undefined reference to `elfcorehdr_addr'
    arch/x86/kernel/built-in.o: In function `detect_calgary':
    (.init.text+0x8d0c): undefined reference to `elfcorehdr_addr'

    make elfcorehdr_addr a generally available symbol.

    Signed-off-by: Ingo Molnar

    Ingo Molnar
     
  • kdump kernel fails to boot with calgary iommu and aacraid driver on a x366
    box. The ongoing dma's of aacraid from the first kernel continue to exist
    until the driver is loaded in the kdump kernel. Calgary is initialized
    prior to aacraid and creation of new tce tables causes wrong dma's to
    occur. Here we try to get the tce tables of the first kernel in kdump
    kernel and use them. While in the kdump kernel we do not allocate new tce
    tables but instead read the base address register contents of calgary
    iommu and use the tables that the registers point to. With these changes
    the kdump kernel and hence aacraid now boots normally.

    Signed-off-by: Chandru Siddalingappa
    Acked-by: Muli Ben-Yehuda
    Cc: Ingo Molnar
    Cc: Thomas Gleixner
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Chandru
     

03 May, 2007

1 commit

  • The specific case I am encountering is kdump under Xen with a 64 bit
    hypervisor and 32 bit kernel/userspace. The dump created is 64 bit due to
    the hypervisor but the dump kernel is 32 bit for maximum compatibility.

    It's possibly less likely to be useful in a purely native scenario but I
    see no reason to disallow it.

    [akpm@linux-foundation.org: build fix]
    Signed-off-by: Ian Campbell
    Signed-off-by: Andi Kleen
    Acked-by: Vivek Goyal
    Cc: Horms
    Cc: Magnus Damm
    Cc: "Eric W. Biederman"
    Cc: Andi Kleen
    Signed-off-by: Andrew Morton

    Ian Campbell
     

29 Mar, 2006

1 commit

  • This is a conversion to make the various file_operations structs in fs/
    const. Basically a regexp job, with a few manual fixups

    The goal is both to increase correctness (harder to accidentally write to
    shared datastructures) and reducing the false sharing of cachelines with
    things that get dirty in .data (while .rodata is nicely read only and thus
    cache clean)

    Signed-off-by: Arjan van de Ven
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Arjan van de Ven
     

26 Jun, 2005

3 commits

  • From: "Vivek Goyal"

    o Support for /proc/vmcore interface. This interface exports elf core image
    either in ELF32 or ELF64 format, depending on the format in which elf headers
    have been stored by crashed kernel.
    o Added support for CONFIG_VMCORE config option.
    o Removed the dependency on /proc/kcore.

    From: "Eric W. Biederman"

    This patch has been refactored to more closely match the prevailing style in
    the affected files. And to clearly indicate the dependency between
    /proc/kcore and proc/vmcore.c

    From: Hariprasad Nellitheertha

    This patch contains the code that provides an ELF format interface to the
    previous kernel's memory post kexec reboot.

    Signed off by Hariprasad Nellitheertha
    Signed-off-by: Eric Biederman
    Signed-off-by: Vivek Goyal
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Vivek Goyal
     
  • This patch adds support for retrieving the address of elf core header if one
    is passed in command line.

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

    Vivek Goyal
     
  • This patch provides the interfaces necessary to read the dump contents,
    treating it as a high memory device.

    Signed off by Hariprasad Nellitheertha
    Signed-off-by: Eric Biederman
    Signed-off-by: Vivek Goyal
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Vivek Goyal