summaryrefslogtreecommitdiff
path: root/kexec/kexec.h
AgeCommit message (Collapse)Author
2014-03-20cleanup: add dbgprint_mem_range functionWANG Chao
dbgprint_mem_range is used for printing the given memory range under debugging mode. Signed-off-by: WANG Chao <chaowang@redhat.com> Tested-by: Linn Crosetto <linn@hp.com> Signed-off-by: Simon Horman <horms@verge.net.au>
2013-12-13kexec: Let slurp_file_len() return the number of bytes readGeert Uytterhoeven
Add an optional output parameter to slurp_file_len() so it can return the actual number of bytes read. Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org> Acked-by: Dave Young <dyoung@redhat.com> Signed-off-by: Simon Horman <horms@verge.net.au>
2013-11-19kexec/xen: directly load images images into XenDavid Vrabel
Xen 4.4 has an improvided kexec hypercall ABI that allows images to be loaded and executed without any kernel involvement. Use the API provided by libxc to load images when running in a Xen guest. Support for loading images via the kexec_load syscall in non-upstream ("classic") Xen kernels is no longer supported. Signed-off-by: David Vrabel <david.vrabel@citrix.com> Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com> Signed-off-by: Simon Horman <horms@verge.net.au>
2013-10-03kexec: Fix the -? optionGeoff Levand
Add '?' to the short option string. Fixes runtime errors like these: kexec: invalid option -- '?' Signed-off-by: Geoff Levand <geoff@infradead.org> for Huawei, Linaro Signed-off-by: Simon Horman <horms@verge.net.au>
2013-04-30kexec: cleanup: make add_backup_segments staticZhang Yanfei
The function add_backup_segments is only called by my_load and they are in the same file. So unnecessary to export it. Make it static. Signed-off-by: Zhang Yanfei <zhangyanfei@cn.fujitsu.com> Signed-off-by: Simon Horman <horms@verge.net.au>
2013-04-26kdump, x86: Process multiple Crash kernel in /proc/iomemYinghai Lu
Vivek found specical handling crashkernel low in not good. We should extend kexec-tools to handle multiple Crash kernel instead. Extend crash_reserved_mem to array instead and use kexec_iomem_for_each_line directly. After that we can drop crashkernel low. -v2: fix left over calling of parse_iomem_single() found by Vivek. Suggested-by: Vivek Goyal <vgoyal@redhat.com> Signed-off-by: Yinghai Lu <yinghai@kernel.org> Signed-off-by: Simon Horman <horms@verge.net.au>
2013-03-14kexec: add _ALIGN* marcos for align operationZhang Yanfei
This patch imports Macros for align operation: - _ALIGN_UP(addr, size): align addr up on a size boundary - _ALIGN_DOWN(addr, size): align addr down on a size boundary - _ALIGN(addr, size): align addr up on a size boundary Signed-off-by: Zhang Yanfei <zhangyanfei@cn.fujitsu.com> Signed-off-by: Simon Horman <horms@verge.net.au>
2012-12-23die: Use const for fmtSimon Horman
Signed-off-by: Simon Horman <horms@verge.net.au>
2012-09-12fs2dt: Add a generic copy of fs2dtSimon Horman
The motivation for this is to remove duplicated code by sharing the fs2dt between different architectures. The code added by this patch is very close to the code currently used by ppc64, and thus migrating that architecture should not be difficult. The 32bit powerpc code is a little different and thus more care is needed when migrating that architecture to this code. Unfortunately I do not have any powerpc equipment available to test this code. Signed-off-by: Simon Horman <horms@verge.net.au>
2012-06-27Check format string of die()Aleksey Makarov
Use gcc's __attribute__ to check format string. Signed-off-by: Aleksey Makarov <aleksey.makarov@gmail.com> Signed-off-by: Simon Horman <horms@verge.net.au>
2012-03-29Add a descriptive error message for kexec load failureKhalid Aziz
kexec-tools package for debian includes a patch that adds a more descriptive error message when someone tries to laod a crash kernel and didn't remember to boot up with crashkernel= parameter. This patch would be of general interest. This patch was originally written by Alastair McKinstry. Please apply. Signed-off-by: Khalid Aziz <khalid.aziz@hp.com> Signed-off-by: Simon Horman <horms@verge.net.au>
2012-03-15Add generic debug optionCong Wang
Currently the debugging code is under #ifdef DEBUG, which means when we want to debug, we have to re-compile the source code with -DDEBUG. This is not convenient, we want to have a generic --debug option so that we can enable debugging code without re-compiling. This patch moves the arch-specific --debug to generic place and moves code under #ifdef DEBUG to --debug on x86. BTW, the size of kexec binary increases very little after this patch. Signed-off-by: Cong Wang <xiyou.wangcong@gmail.com> Signed-off-by: Simon Horman <horms@verge.net.au>
2011-03-03get the backup area dynamicallyAmerigo Wang
Currently we hard-coded the first 640K area as backup area, however, this is not correct on some system which has reserved memory area in the first 640K: BIOS-e820: 0000000000010000 - 0000000000097000 (usable) BIOS-e820: 0000000000097000 - 00000000000a0000 (reserved) on such system we still mark all the first 640K as usable in capture kernel, this will cause kernel panic. The solution, pointed by Vivek, is that we can get the backup area dynamically by reading /proc/iomem. The reporter has tested this patch and it fixes the problem. Signed-off-by: WANG Cong <amwang@redhat.com> Acked-by: Vivek Goyal <vgoyal@redhat.com> Signed-off-by: Simon Horman <horms@verge.net.au>
2010-09-09crashdump: Move kern_vaddr_start from kexec_info into crash_elf_infoEric W. Biederman
These fields as defined in kexec_info are not biarch safe and beyond that crash_elf_info is the structure for passing this kind of information not kexec_info. So move them in prepartion for properly cleaning up biarch x86 functionality. Signed-off-by: Eric W. Biederman <ebiederm@xmission.com> [ horms@verge.net.au: converted stray elf_info-> to elf_info. ] Signed-off-by: Simon Horman <horms@verge.net.au>
2010-09-08kexec: Kill arch_initEric W. Biederman
The function only had one user, the error checking was wrong, and the functions it performed are best done elsewhere so remove the tempation of a problemenatic hook. Signed-off-by: Eric W. Biederman <ebiederm@xmission.com>
2010-09-08kexec: Move kernel_version into the kexec coreEric W. Biederman
I'm not pleased with the hacks that we use kernel_version for but kernel_version itself is reasonable code and might be needed elsewhere, so move kernel_version into the kexec core. Signed-off-by: Eric W. Biederman <ebiederm@xmission.com>
2010-02-18x86_64: use correct PAGE_OFFSETSimon Horman
This fixes a bug when using gdb with vmcore as explained by Dave Anderson: The kexec/arch/x86_64/crashdump-x86_64.h file contains a stale PAGE_OFFSET value. In 2.6.27 it was changed from 0xffff810000000000UL to 0xffff880000000000UL. This is only a problem when using gdb with the vmlinux/vmcore pair, because gdb relies upon the PT_LOAD segment's p_vaddr values in the ELF header to be correct. Cc: Dave Anderson <anderson@redhat.com> Signed-off-by: Simon Horman <horms@verge.net.au>
2010-02-02Make purgatory a signed char bufferSimon Horman
The consumer of the purgatory buffer, elf_rel_build_load() expects a signed char buffer. Signed-off-by: Simon Horman <horms@verge.net.au>
2010-02-02Mark unused parametersSimon Horman
Signed-off-by: Simon Horman <horms@verge.net.au>
2010-02-02don't leak in concat_cmdlineSimon Horman
Cc: Eric W. Biederman <ebiederm@xmission.com> Signed-off-by: Simon Horman <horms@verge.net.au>
2010-02-02Fix --reuse-cmdline so it is usable.Eric W. Biederman
A colleague of mine implemented kdump and it used --reuse-cmdline with some rather interesting and unexpected results. Update the getopt specification so that --reuse-cmdline does not attempt to take an argument that it will not use. Update the processing of --append so that --reuse-cmdline followed by --append actually appends the parameters specified by --reuse-cmdline. Signed-off-by: Eric W. Biederman <ebiederm@aristanetworks.com>
2008-10-31kexec jump support for kexec-toolsHuang Ying
To support memory backup/restore an option named --load-preserve-context is added to kexec. When it is specified toggether with --mem-max, most segments for crash dump support are loaded, and the memory range between mem_min to mem_max which has no segments loaded are loaded as backup segments. To support jump back from kexeced, options named --load-jump-back-helper and --entry are added to load a helper image with specified entry to jump back. Signed-off-by: Huang Ying <ying.huang@intel.com> Signed-off-by: Simon Horman <horms@verge.net.au>
2008-09-24IA64: do not include uncached memory to vmcoreJay Lan
Currently a memory segment in memory map with attribute of EFI_MEMORY_UC is denoted as "System RAM" in /proc/iomem, while memory of attribute (EFI_MEMORY_WB|EFI_MEMORY_UC) is also labeled the same. The kexec utility then includes uncached memory as part of vmcore. The kdump kernel may MCA when it tries to save the vmcore to a disk. A normal "cached" access can cause MCAs. Since kexec assembled memory ranges with memory tagged as "System RAM", the uncached memory will be excluded if it is labeled differently. Simon, since only IA64 will create "Uncached RAM" label, i do not make changes to other arch. Our HP machine in the lab is dead. I am sorry that i can not test against other IA64 systems (than SGI's). Feedback is very much appreciated. The corresponding kernel patch is needed to test this kexec patch: http://marc.info/?l=linux-ia64&m=122122791230130&w=2 This patch without the kernel patch will have no effect and do no harm. The kernel patch has been commited as "[IA64] kexec fails on systems with blocks of uncached memory". Signed-off-by: Jay Lan <jlan@sgi.com> Signed-off-by: Simon Horman <horms@verge.net.au>
2008-09-05kexec/kexec.h: Bring put/get_unaligned() back from the dead.Paul Mundt
This re-enables the fairly generic put/get_unaligned() routines in kexec.h, while tidying up the variable shadowing clash that results when using it in places like machine_apply_elf_rel(). Needed for SH ELF relocations. IA64 still does its own put_unaligned64(), which should likely also be converted over to using put_unaligned() directly. Signed-off-by: Paul Mundt <lethal@linux-sh.org> Signed-off-by: Simon Horman <horms@verge.net.au>
2008-05-21Factor uname-based native architecture detection into a common function.Jamey Sharp
This code was copy-pasted into every architecture and was basically identical. Besides producing a nice net reduction in code, this factors a portability challenge into a single function that can be easily replaced at build-time. Signed-off-by: Jamey Sharp <jamey@thetovacompany.com> Signed-off-by: Simon Horman <horms@verge.net.au>
2008-05-21Prototype ifdown() in kexec.h, not nested in main().Jamey Sharp
Signed-off-by: Jamey Sharp <jamey@thetovacompany.com> Signed-off-by: Simon Horman <horms@verge.net.au>
2008-05-21Add --reuse-cmdlineBernhard Walle
This patch adds an option "--reuse-cmdline" for people that are lazy in typing --append="$(cat /proc/cmdline)". The advantage of "--reuse-cmdline" is also that it strips off BOOT_IMAGE (since it may not be correct any more) from lilo and other boot loaders, and, more important, the crashkernel option in case a panic kernel is loaded. If you like the option I can also add it for really all architectures. Tested only with x86-bzImage both the kexec and kdump case. Signed-off-by: Bernhard Walle <bwalle@suse.de> Signed-off-by: Simon Horman <horms@verge.net.au>
2008-04-24Replace weak definitions with source filename overriding.Jamey Sharp
This reduces the kexec-tools' demands on the capabilities of the toolchain, and improves standards conformance, without really changing maintenance complexity. Signed-off-by: Jamey Sharp <jamey@thetovacompany.com> Signed-off-by: Simon Horman <horms@verge.net.au>
2008-03-06kexec-tools: mipsel: Remove #ifdef __MIPSEL__ from kexec/kexec.cSimon Horman
On all architectures except mipsel add_buffer() expects add_segment() to work with the virtual address passed. On mipsel it is expected that add_segment() converts the virtual address to a physical address first. add_buffer_virt() is porvided on mipsel for the handful of cases that don't want the address to be converted. This patch maintains that behaviour, but without the need for #ifdef __MIPSEL__ from kexec/kexec.c and much duplicated code. Signed-off-by: Simon Horman <horms@verge.net.au>
2008-03-04kexec-tools: no machine machine to proc_iomem()Simon Horman
Removes the machine parameter to proc_iomem() which is no longer of any use. Signed-off-by: Simon Horman <horms@verge.net.au>
2007-12-19Use config.h for definesJeremy Kerr
Instead of putting a heap of -D directives in CPPFLAGS, use a config.h header. Signed-off-by: Jeremy Kerr <jk@ozlabs.org> Signed-off-by: Simon Horman <horms@verge.net.au>
2007-10-17Allow architectures to specify the location of /proc/iomemSimon Horman
On ia64 XEN it is sometimes neccessary to use an alternate location for the information that is usually provided by /proc/iomem. By having the path returned by a function, which can be overriden on a per-architecture basis, it is possible for ia64 XEN to make use of existing generic code. Hopefully other achitectures can use this infastructure as the need arises. If the machine parameter is zero, then iomem file relating to the currently running kernel should be returned. If the machine parameter is non-zero then iomem file, relating to the underlying hypervisor, should be returned. In the simple case, these will be the same file. Signed-off-by: Simon Horman <horms@verge.net.au> kexec/arch/i386/crashdump-x86.c | 4 ++-- kexec/arch/i386/kexec-x86.c | 2 +- kexec/arch/i386/x86-linux-setup.c | 2 +- kexec/arch/ia64/crashdump-ia64.c | 9 +++++---- kexec/arch/ia64/kexec-elf-ia64.c | 2 +- kexec/arch/ia64/kexec-ia64.c | 5 +++-- kexec/arch/ppc/kexec-ppc.c | 2 +- kexec/arch/s390/kexec-s390.c | 5 +++-- kexec/arch/x86_64/crashdump-x86_64.c | 10 +++++----- kexec/arch/x86_64/kexec-x86_64.c | 2 +- kexec/crashdump-xen.c | 6 ++++-- kexec/kexec-iomem.c | 31 +++++++++++++++++++++++-------- kexec/kexec.h | 6 +++--- 13 files changed, 53 insertions(+), 33 deletions(-) 9079040b40f643cfc9eb3d425dffa0ca8fd573e1
2007-05-25fix kexec-tools optionsManeesh Soni
o value for OPT_REUSE_INITRD clashes with arch specific options which are defined as (OPT_MAX + 1), like --serial option on x86_64. Changed the values so that OPT_REUSE_INITRD is less than OPT_MAX. Signed-off-by: Maneesh Soni <maneesh@in.ibm.com> Acked-by: Michael Neuling <mikey@neuling.org> Signed-off-by: Simon Horman <horms@verge.net.au>
2007-05-10kexec rename dprintf to dbgprintfGeoff Levand
The recently introduce kexec debug routine dprintf clashes with an existing libc symbol. Rename dprintf to dbgprintf. Signed-off-by: Geoff Levand <geoffrey.levand@am.sony.com> Signed-off-by: Simon Horman <horms@verge.net.au>
2007-05-10kexec remove last remaining dfprintfGeoff Levand
Remove the last remaining dfprintf call and remove the dfprintf definition. Signed-off-by: Geoff Levand <geoffrey.levand@am.sony.com> Signed-off-by: Simon Horman <horms@verge.net.au>
2007-05-09kexec debug output improvmentsGeoff Levand
kexec debug output improvments. - Add better type checking for the debug output macro dfprintf(). - Add a convenence macro dprintf(). Signed-off-by: Geoff Levand <geoffrey.levand@am.sony.com> Signed-off-by: Simon Horman <horms@verge.net.au>
2007-05-01kexec: Added generic --reuseinitrd optionMichael Neuling
Adds a generic --reuseinitrd option and performs some sanity checks on it. Can be used with the retain_initrd kernel option. Signed-off-by: Michael Neuling <mikey@neuling.org> Signed-off-by: Simon Horman <horms@verge.net.au>
2007-03-19Move memory range variablesMagnus Damm
Move memory range variables The common kexec code is currently using two global variables to keep track of memory ranges. Other data is kept in a per-instance structure. This mix is of per-instance and global variables is confusing and leads to messy code in general. So let's not. This patch moves the global variables into struct kexec_info and makes sure that structure is passed along where needed. No logic is changed. Signed-off-by: Magnus Damm <magnus@valinux.co.jp> Signed-off-by: Simon Horman <horms@verge.net.au>
2006-11-27kexec-tools: Introduce kexec-iomem.c and /proc/iomem parsing code V2Magnus Damm
kexec-tools: Introduce kexec-iomem.c and /proc/iomem parsing code V2 This patch adds the new file kexec-iomem.c that implements code to parse /proc/iomem line-by-line. The following patches make use of this code - especially the Xen-code that use /proc/iomem to get crash note information. This version renames a function to parse_iomem_single() as suggested by Vivek. We also now export kexec_iomem_for_each_line() in a header file. Signed-off-by: Magnus Damm <magnus@valinux.co.jp> Removed trailing whitespace Signed-off-by: Simon Horman <horms@verge.net.au>
2006-11-08kexec-tools: Introduce dfprintf macro for debugging statementsVivek Goyal
o Add dprintf() macro to put debugging statements in the code. Signed-off-by: Vivek Goyal <vgoyal@in.ibm.com> Signed-off-by: Simon Horman <horms@verge.net.au>
2006-10-13Check for crashkernel memory reservationMohan Kumar M
Check whether memory for crashkernel is reserved by calling arch dependent functions. The patch also creates dummy functions in ppc, ia64 and s390 architectures, so that the build process will not break. The function "is_crashkernel_mem_reserved" needs to be implemented on ppc, ia64 and s390 architectures. Signed-off-by: Mohan Kumar M <mohan@in.ibm.com> Signed-off-by: Simon Horman <horms@verge.net.au>
2006-10-06kexec-tools: x86_64 read kernel vaddr and size from /proc/kcoreVivek Goyal
o With relocatable kernel in picture, the kernel text map offset (__START_KERNEL_map) is no longer constant. It depends on where kernel is loaded. o Now /proc/kcore is read to determine the virtual address the kernel is mapped at and /porc/iomem is read for determining the physical address where kernel is loaded at. This information is enough to create to fill virtual address and phy addr info for elf header mapping kernel text and data. o Virtual address for kernel text are needed by gdb as well as crash to retrieve the meaningful data from core file. o This patch requires "elf note memsz" fix in the kernel. Currently that fix is in -mm tree. It will still work with older kernels. It will display the warning messages (/proc/kcore could not be parsed) and hardcode the kernel virtual address and size. Signed-off-by: Vivek Goyal <vgoyal@in.ibm.com> Signed-off-by: Simon Horman <horms@verge.net.au>
2006-07-27kexec-tools: i386 sys interface changes compatibilityVivek Goyal
On Wed, Dec 14, 2005 at 02:50:52PM -0600, Milton Miller wrote: [..] > >>(2) why do you stat the files instead of just trying to open them and > >>check for ENOENT? > >> > >>milton > >> > > > >I wanted to differentiate between two cases. One being sysfs not > >mounted > >and other being file not being present (Due to kernel bug or cpu not > >present), hence used stat(). In case of sysfs not being mounted, we > >simply exit after giving an error message. In other case we continue > >to loop through other cpus and ignore cpu, which is not present. > > > > Ok, but try to open the file first. IF you want to do this diagnostic > after the open fails, that is ok. But don't do this check n times (n = > number of cpus) when the file exists. > I have moved the sysfs mounted check in failure condition. > > > > >On Tue, Dec 13, 2005 at 09:36:26AM -0800, Haren Myneni wrote: > >>Vivek, I believe, we should push this func into arch independent code. > >>Otherwise, we have to copy it for every platform. > >> > > > >We have reworked the patch and moved this code to architecture > >independent > >portion. > > > > > Only the x86 code has the fallback the old name, not the genric code. > Only i386 port of kdump was available when crash_notes was exported through /sys/kernel/crash_notes. Rest of the architectures see new arch- independent percpu crash_notes sysfs interface only. Hence thought no point copying backward compatibility code in generic code. > > Also, there are error paths that do not set the address, others that > zero it. > The error paths which do not set address to zero are non return path. They call die() which inturn calls exit(1) after printing appropriate error messasge. > What happens if the base kernel is too old for kexec-panic, where > neiter file will exist? > In that case kexec will fail much earlier. There will be no reserved memory area for loading second kernel (crashkernel=X&Y) hence attempt to load the second kernel will fail and control will not reach this place at all. Modifed patch appended. Thanks Vivek o This patch moves per cpu interface to retrieve crash_notes address to architecture independent section. (As suggested by Haren) o For i386, kernels older than 2.6.15-rc1-mm2 used to export crash_notes through /sys/kernel/crash_notes. This patch also provides backward compatibility with older kernel versions. o Definition of MAX_NOTE_BYTES moved to architecture independent header file as everybody is using same definition. o Definition of MAX_LINE moved to architecture independent header file. Seems to be a better option than defining it in many C files. Signed-off-by: Maneesh Soni <maneesh@in.ibm.com> Signed-off-by: Vivek Goyal <vgoyal@in.ibm.com> Signed-off-by: Maneesh Soni <maneesh@in.ibm.com>
2006-07-27crashdump backup region handlingVivek Goyal
o This patch adds support for reserving space for backup region. Also adds code in purgatory to copy the first 640K to backup region. o Moved kexec_flags inside kexec_info structure. Signed-off-by: Vivek Goyal <vgoyal@in.ibm.com> Signed-off-by: Maneesh Soni <maneesh@in.ibm.com>
2006-07-27Revert "- First stab at letting the loaders know we have a panic kernel."Eric W. Biederman
A good first attempt but it conflicts with other work :( This reverts commit caa2e42897cb8cb00c7040b9133e8b740809241c.
2006-07-27- First stab at letting the loaders know we have a panic kernel.Eric W. Biederman
2006-07-27kexec-tools-1.101Eric W. Biederman
- Initial import into git - initial nbi image formage support - ppc32 initial register setting fixes. - gzipped multiboot file support