summaryrefslogtreecommitdiff
path: root/kexec/crashdump-elf.c
AgeCommit message (Collapse)Author
2015-09-25fix kexec load hang in case crash notes addr read failureDave Young
While readng crash note, count_cpu variable will be never decreased in case any failure to read the sysfs file. The issue was found during I test CONFIG_KEXEC_FILE only kernel option. crash_notes are exported to sysfs only for CONFIG_KEXEC. In latest kernel we can configure kernel with CONFIG_KEXEC_FILE only in Kconfig. In this case, if you run a kernel with kexec_file only but do not specify "-s" in kexec-tools arguments, then kexec-tools will hang there. Though "-s" is mandatory for kexec_file_load, kexec should still fail out instead of hanging. Fixing the problem by always decreasing count_cpu in the for loop. Signed-off-by: Dave Young <dyoung@redhat.com> Signed-off-by: Simon Horman <horms@verge.net.au>
2014-06-05Enumerate all /sys/devices/system/cpu/cpuN when they are discontiguousTakao Indoh
There is a case that the number of /sys/devices/system/cpu/cpuN is not contiguous, for example after cpu hot removing. This patch fixes so that all /sys/devices/system/cpu/cpuN is handled when they are discontiguous. Signed-off-by: Takao Indoh <indou.takao@jp.fujitsu.com> Reviewed-by: Zhang Yanfei <zhangyanfei@cn.fujitsu.com> Acked-by: WANG Chao <chaowang@redhat.com> Signed-off-by: Simon Horman <horms@verge.net.au>
2013-03-15kexec: use _ALIGN* to make the logic clearZhang Yanfei
By replacing all the explicit align opertion with marco _ALIGN*, the code logic could more clear. Signed-off-by: Zhang Yanfei <zhangyanfei@cn.fujitsu.com> Signed-off-by: Simon Horman <horms@verge.net.au>
2012-07-06kexec-tools: Read always one vmcoreinfo fileDaniel Kiper
vmcoreinfo file could exists under /sys/kernel (valid on baremetal only) and/or under /sys/hypervisor (valid when Xen dom0 is running). Read only one of them. It means that only one PT_NOTE will be always created. Remove extra code for second PT_NOTE creation. Signed-off-by: Daniel Kiper <daniel.kiper@oracle.com> Signed-off-by: Simon Horman <horms@verge.net.au>
2011-04-27kexec: remove duplicated backup_src_start field from struct crash_elf_infoAmerigo Wang
Vivek pointed out that we have duplicated ->backup_src_start in struct crash_elf_info and struct kexec_info. This patch removes the ->backup_src_start and ->backup_src_end from struct crash_elf_info. I tested it on both i686 and ppc64, and used a test case from Dave Anderson to confirm the backup region is correct on i686. Signed-off-by: WANG Cong <amwang@redhat.com> Cc: 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-05-19kexec: introduce phys_to_virt() functionMika Westerberg
This function is used by ELF crashdump code which prepares crash memory headers for the dump capture kernel. Most architecture can use default version which just adds PAGE_OFFSET to the virtual address but some architectures might need some special handling. Signed-off-by: Mika Westerberg <ext-mika.1.westerberg@nokia.com> Signed-off-by: Simon Horman <horms@verge.net.au>
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-12Fix build warningsGeoff Levand
Fix these 64 bit build warnings: kexec/firmware_memmap.c:241: warning: format '%d' expects type 'int', but argument 3 has type 'size_t' kexec/crashdump-elf.c:160: warning: format '%llx' expects type 'long long unsigned int', but argument 4 has type 'Elf64_Off' kexec/crashdump-elf.c:160: warning: format '%llx' expects type 'long long unsigned int', but argument 5 has type 'Elf64_Addr' kexec/crashdump-elf.c:160: warning: format '%llx' expects type 'long long unsigned int', but argument 6 has type 'Elf64_Addr' kexec/crashdump-elf.c:160: warning: format '%llx' expects type 'long long unsigned int', but argument 7 has type 'Elf64_Xword' kexec/crashdump-elf.c:160: warning: format '%llx' expects type 'long long unsigned int', but argument 8 has type 'Elf64_Xword' Tested on PS3 (ppc64) with 32 and 64 bit builds. Signed-off-by: Geoff Levand <geoffrey.levand@am.sony.com> Signed-off-by: Simon Horman <horms@verge.net.au>
2008-05-28Use 'long long' for printf() format string and ELF64 numbers.Bernhard Walle
Since 'long long' is 64 bit wide on almost any platform, especially on 32 bit platforms (like i386) while 'long' is only 64 bit on 64 bit platforms but 32 bit on 32 bit platforms. Thus, 'long long' is more suited and fixes compiler warnings like kexec/crashdump-elf.c:160: warning: format '%lx' expects type \ 'long unsigned int', but argument 4 has type 'Elf64_Off' kexec/crashdump-elf.c:160: warning: format '%lx' expects type \ 'long unsigned int', but argument 5 has type 'Elf64_Addr' ... kexec/crashdump-elf.c:248: warning: format '%lx' expects type \ 'long unsigned int', but argument 8 has type 'Elf64_Xword' Tested on i686-pc-linux-gnu. Signed-off-by: Bernhard Walle <bwalle@suse.de> Signed-off-by: Simon Horman <horms@verge.net.au>
2008-04-02extract vmcoreinfo from /proc/vmcore for XenItsuro ODA
This patch is for kexec-tools-testing-20080324. Signed-off-by: Simon Horman <horms@verge.net.au>
2007-10-18Pass vmcoreinfo's address and sizeKen'ichi Ohmichi
The patch is for kexec-tools-testing-20070330. (http://www.kernel.org/pub/linux/kernel/people/horms/kexec-tools/) The kexec command gets the address and size of the vmcoreinfo data from /sys/kernel/vmcoreinfo, and passes them to the second kernel through ELF header of /proc/vmcore. When the second kernel is booting, the kernel gets them from the ELF header and creates vmcoreinfo's PT_NOTE segment into /proc/vmcore. Signed-off-by: Dan Aloni <da-x@monatomic.org> Signed-off-by: Ken'ichi Ohmichi <oomichi@mxs.nes.nec.co.jp> 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-09use dprintfSimon Horman
Use the new fprintf macro where possible Cc: Geoff Levand <geoffrey.levand@am.sony.com> Signed-off-by: Simon Horman <horms@verge.net.au>
2007-03-19Set crash dump ELF header e_machine field based on underlying hypervisor ↵Ian Campbell
architecture. This is necessary when running Xen with a 64 bit hypervisor and 32 bit domain 0 since the CPU crash notes will be 64 bit. Detecting the hypervisor archiecture requires libxenctrl and therefore this support is optional and disabled by default. Signed-off-by: Ian Campbell <ian.campbell@xensource.com> Acked-by: Magnus Damm <magnus@valinux.co.jp> Signed-off-by: Simon Horman <horms@verge.net.au>
2007-02-16Keep alignment comment in elf code and use ELF_CORE_HEADER_ALIGNMagnus Damm
Keep alignment comment in elf code and use ELF_CORE_HEADER_ALIGN This patch puts back and extends the alignment comment in crashdump-elf.c and adds a small check to make sure the arch-specific code aligns properly. Instead of hardcoding 1024 we introduce ELF_CORE_HEADER_ALIGN. The idea behind the alignment requirement is explained here: http://lists.osdl.org/mailman/htdig/fastboot/2006-November/005147.html Signed-off-by: Magnus Damm <magnus@valinux.co.jp> Acked-by: Vivek Goyal <vgoyal@in.ibm.com> Removed trainling whitespace after "kilobytes," Signed-off-by: Simon Horman <horms@verge.net.au>
2007-02-14kexec-tools: load_crashdump_segments(): size should really be an unsigned longSimon Horman
load_crashdump_segments(): size should really be an unsigned long Signed-off-by: Simon Horman <horms@verge.net.au>
2007-02-14kexec-tools: Add alignment parameter to crash_create_XXX_headersSimon Horman
crash_create_XXX_headers assumes that all arhitectures need an alignment of 1024bytes. But on ia64 at least this is not true. This patch adds an alignment parameter to crash_create_XXX_headers, and calls passes a value of 1024 for all architectures except ia64, where EFI_PAGE_SIZE (4096) is passed. If there are problems with alignment on other architectures hopefully this facility will work for them too. Cc: Bernhard Walle <bwalle@suse.de> Cc: Magnus Damm <magnus.damm@gmail.com> Cc: Zou, Nanhai <nanhai.zou@intel.com> Signed-off-by: Simon Horman <horms@verge.net.au> kexec/arch/i386/crashdump-x86.c | 4 ++-- kexec/arch/ia64/crashdump-ia64.c | 5 +++-- kexec/arch/ppc64/crashdump-ppc64.c | 4 ++-- kexec/arch/x86_64/crashdump-x86_64.c | 2 +- kexec/crashdump-elf.c | 11 ++--------- kexec/crashdump.h | 6 ++++-- 6 files changed, 14 insertions(+), 18 deletions(-)
2006-12-21kexec-tool: Use the appropriate format in debug print statementsHorms
Use the appropriate format in debug print statements. This is kind of messy because the same code is compiled with different definitions of the PHDR type. The solution below is the best I can think of at this time. Cc: Magnus Damm <magnus.damm@gmail.com> Cc: Sachin P. Sant <sachinp@in.ibm.com> Signed-off-by: Simon Horman <horms@verge.net.au>
2006-11-27kexec-tools: 1k alignment commentMagnus Damm
kexec-tools: 1k alignment comment This patch adds the 1k alignment comment as suggested by Vivek. Signed-off-by: Magnus Damm <magnus@valinux.co.jp> Signed-off-by: Simon Horman <horms@verge.net.au>
2006-11-27kexec-tools: Introduce crashdump-xen.c and Xen support V2Magnus Damm
kexec-tools: Introduce crashdump-xen.c and Xen support V2 This patch adds the new file crashdump-xen.c that implements Xen support. The Xen support is not complete yet in the sense that a special program header for the hypervisor isn't created. Crash notes for physical cpus are created so basic support is at least provided by this patch. Version 2 of this patch includes a cleaner implementation for crashdump-elf.c together with a bugfix for xen_get_nr_phys_cpus(). Signed-off-by: Magnus Damm <magnus@valinux.co.jp> Removed trailing whitespace Signed-off-by: Simon Horman <horms@verge.net.au>
2006-11-27kexec-tools: Introduce crashdump-elf.c and crash_create_elf32/64_headers() V2Magnus Damm
kexec-tools: Introduce crashdump-elf.c and crash_create_elf32/64_headers() V2 This patch adds the new file crashdump-elf.c that implements a single generic function which is used to create elf headers. The file gets included twice by crash.c to create two functions from the same source. These two functions are named crash_create_elf32_headers() and crash_create_elf64_headers(). The new code differs from prepare_crash_memory_elf32/64_headers() in the sense that both allocation and setup now are done in the same function. This patch only adds the new code, following patches make sure the different architecture-specific files make use of the new code. This version contains a new comment as suggested by Vivek, together with that the alignment now is fixed at 1024 regardless of architecture. The cpu elf note callback code has been slightly reworked to become cleaner. Also, FUNCTION has been renamed to FUNC. Signed-off-by: Magnus Damm <magnus@valinux.co.jp> Removed trainling whitespace Signed-off-by: Simon Horman <horms@verge.net.au>