Age | Commit message (Collapse) | Author |
|
We need to use 64-bit file IO when mapping system memory and the core
dump file as we may be running on a LPAE system, otherwise we risk
mapping memory we shouldn't, and causing a kernel oops:
Unhandled fault: asynchronous external abort (0x211) at 0x00000000
pgd = edd2c740
[00000000] *pgd=82ec98003, *pmd=82dcd2003, *pte=00000000
Acked-by: Baoquan He <bhe@redhat.com>
Signed-off-by: Russell King <rmk@arm.linux.org.uk>
Signed-off-by: Simon Horman <horms@verge.net.au>
|
|
setup_dtb_prop looks like a generic function that can find and add any
nodes, which need not be top-level in the DT. In practice though, the
function is only used for the top-level /chosen node, and it can't add
nodes for which the parent doesn't exist.
So far, so good - but for adding a new node to the DT, the parent offset
need be passed to fdt_add_subnode. Currently in setup_dtb_prop the
parent offset is unknown, and instead a bogus error code is passed to
fdt_add_subnode.
Fix that by adding the parent offset as an extra function argument to
setup_dtb_prop, and change the handling of the /chosen node to operate
on a relative path plus (zero) offset instead of an absolute path. This
aligns setup_dtb_prop to the libfdt API, where functions commonly
operate with a parent offset plus child node name.
Signed-off-by: Nikolaus Schulz <nikolaus.schulz@avionic-design.de>
Signed-off-by: Simon Horman <horms@verge.net.au>
|
|
Add very basic support for booting an android image. The ramdisk and
command line from the image are only used if none has been given on
the command line.
Signed-off-by: Alban Bedel <alban.bedel@avionic-design.de>
Signed-off-by: Simon Horman <horms@verge.net.au>
|
|
When looking for a hole to put the initrd in the error check used the
wrong variable.
Signed-off-by: Alban Bedel <alban.bedel@avionic-design.de>
Signed-off-by: Simon Horman <horms@verge.net.au>
|
|
gcc leaves .toc byte aligned, relying on the linker to align the section.
* kexec/arch/ppc64/kexec-elf-rel-ppc64.c (machine_verify_elf_rel):
Fudge alignment of .toc section.
Signed-off-by: Alan Modra <amodra@gmail.com>
Signed-off-by: Anton Blanchard <anton@samba.org>
Tested-by: Dave Young <dyoung@redhat.com>
Signed-off-by: Simon Horman <horms@verge.net.au>
|
|
The PowerPC64 ELF ABIv2 has the concept of global and local symbols
and information on this is encoded in sym->st_other. When doing a
R_PPC64_REL24 branch we want to hit the local entry point, so adjust
it as necessary.
Signed-off-by: Anton Blanchard <anton@samba.org>
Tested-by: Dave Young <dyoung@redhat.com>
Signed-off-by: Simon Horman <horms@verge.net.au>
|
|
On PowerPC64 ABIv2 we need to look at the symbol to determine
if it has a local entry point. Pass struct mem_sym into
machine_apply_elf_rel() so we can.
Signed-off-by: Anton Blanchard <anton@samba.org>
Tested-by: Dave Young <dyoung@redhat.com>
Signed-off-by: Simon Horman <horms@verge.net.au>
|
|
Reported-by: Freeman Zhang <zhezhang@redhat.com>
Signed-off-by: Simon Horman <horms@verge.net.au>
|
|
It needs to know this because the SMP release mechanism for Freescale
book3e is different from when booting with normal hardware. In theory
we could simulate the normal spin table mechanism, but not (easily) at
the addresses U-Boot put in the device tree -- so there'd need to be
even more communication between the kernel and kexec to set that up.
Signed-off-by: Scott Wood <scottwood@freescale.com>
Acked-by: Michael Ellerman <mpe@ellerman.id.au>
Signed-off-by: Simon Horman <horms@verge.net.au>
|
|
This reverts commit 8a1aa35a1077b42bc2a2afb05d24b637e1edf2a1.
|
|
Crash kernel region size is available via sysfs on Linux running on
bare metal. However, this does not work when Linux runs as Xen dom0.
In this case Xen crash kernel region size should be established using
__HYPERVISOR_kexec_op hypercall (Linux kernel kexec functionality does
not make a lot of sense in Xen dom0). Sadly hypercalls are not easily
accessible using shell scripts or something like that. Potentially we
can check "xl dmesg" output for crashkernel option but this is not nice.
So, let's add this functionality, for Linux running on bare metal and
as Xen dom0, to kexec-tools. This way kdump scripts may establish crash
kernel region size in one way regardless of platform. All burden of
platform detection lies on kexec-tools.
Figure (and unit) displayed by this new kexec-tools functionality is
the same as one taken from /sys/kernel/kexec_crash_size.
This functionality is available on x86 platform only. If idea is acceptable
then I can prepare patches for other platforms (if it is possible and make
sense) and repost them as fully flagged patch series.
Signed-off-by: Daniel Kiper <daniel.kiper@oracle.com>
Signed-off-by: Simon Horman <horms@verge.net.au>
|
|
It appears that (older?) revisions of xenctl.h define
all of the E820_* values used in kexec-x86-common.c except
E820_PMAM and E820_PMEM. This results in a build failure when
building against libxenctl.
Avoid this problem by providing local definitions of those values.
It seems reasonable to do so in the kexec-x86-common.c as
currently that is the only source file that uses the values in question.
Fixes: 56a12abc1df1 ("kexec: fix mmap return code handling")
Cc: Michael Holzheu <holzheu@linux.vnet.ibm.com>
Cc: Petr Tesarik <ptesarik@suse.com>
Cc: Baoquan He <bhe@redhat.com>
Signed-off-by: Simon Horman <horms@verge.net.au>
|
|
Previously when sorting the device tree directory entries, if both
device tree entries contained the '@' character then comparison was
made based on the length of the strings.
This did not work in all cases and could result in odd orderings.
This patch modifies the comparison function for the case when both
strings contain the '@' character.
First a lexical comparison is made between the prefix portions of the
strings *before* the '@' character.
Next, if the prefixes are equal, the lengths of the suffixes *after*
the '@' character are compared. This preserves the intent of the
original code.
Next, if the suffix lengths are equal, a lexical comparison of the
suffixes is made.
This is still not strictly correct, as ideally the portion after the
'@' should be compared numerically. However, determining what base to
use for all case is difficult.
Signed-off-by: Curt Brune <curt@cumulusnetworks.com>
Signed-off-by: Simon Horman <horms@verge.net.au>
|
|
Latest linux kernel will create /sys/firmware/fdt file. It will be convenient
to use it in case one does not specify --atags and --dtb options.
Signed-off-by: Dave Young <dyoung@redhat.com>
Signed-off-by: Simon Horman <horms@verge.net.au>
|
|
booting a non-devicetree kernel from a devicetree kernel failed,
since the memory layout wasn't passed.
Signed-off-by: Andreas Fenkart <andreas.fenkart@dev.digitalstrom.org>
Signed-off-by: Simon Horman <horms@verge.net.au>
|
|
The slurp_fd() function allocates memory and uses the read() system call.
This results in double memory consumption for image and initrd:
1) Memory allocated in user space by the kexec tool
2) Memory allocated in kernel by the kexec() system call
The following illustrates the use case that we have on s390x:
1) Boot a 4 GB Linux system
2) Copy kernel and 1,5 GB ramdisk from external source into tmpfs (ram)
3) Use kexec to boot kernel with ramdisk
Therefore for kexec runtime we need:
1,5 GB (tmpfs) + 1,5 GB (kexec malloc) + 1,5 GB (kernel memory) = 4,5 GB
This patch introduces slurp_file_mmap() which for "normal" files uses
mmap() instead of malloc()/read(). This reduces the runtime memory
consumption of the kexec tool as follows:
1,5 GB (tmpfs) + 1,5 GB (kernel memory) = 3 GB
Signed-off-by: Michael Holzheu <holzheu@linux.vnet.ibm.com>
Reviewed-by: Dave Young <dyoung@redhat.com>
Signed-off-by: Simon Horman <horms@verge.net.au>
|
|
When createing fdt from /proc/device-tree, if there's local --command-line
option provided but there's no root= specified, kexec-tools will copy the root=
param from 1st kernel cmdline by default. In case one want kexec boot without
root= it will be impossible.
Thus add the new option so that one can provide --dt-no-old-root for above
mentioned case.
Reported-by: Jan Stodola <jstodola@redhat.com>
Signed-off-by: Dave Young <dyoung@redhat.com>
Signed-off-by: Simon Horman <horms@verge.net.au>
|
|
When createing fdt from /proc/device-tree, if there's local --command-line
option provided but there's no root= specified, kexec-tools will copy the root=
param from 1st kernel cmdline by default. In case one want kexec boot without
root= it will be impossible.
Thus add the new option so that one can provide --dt-no-old-root for above
mentioned case.
Signed-off-by: Dave Young <dyoung@redhat.com>
Signed-off-by: Simon Horman <horms@verge.net.au>
|
|
Produce a warning-free build on ppc64 (at least, when built as 64-bit
userspace -- if a 64-bit binary for ppc64 is a requirement, why is -m64
set only on purgatory?). Mostly unused (or write-only) variable
warnings, but also one nasty one where reserve() was used without a
prototype, causing long long arguments to be passed as int.
Signed-off-by: Scott Wood <scottwood@freescale.com>
Signed-off-by: Simon Horman <horms@verge.net.au>
|
|
kexec-tools build fails on my laptop with RHEL7.1 installed:
gcc -g -O2 -fno-strict-aliasing -Wall -Wstrict-prototypes -I./include -I./util_lib/include -Iinclude/ -I./kexec/arch/x86_64/include -c -MD -o kexec/arch/i386/kexec-x86-common.o kexec/arch/i386/kexec-x86-common.c
In file included from kexec/arch/i386/kexec-x86-common.c:36:0:
kexec/arch/i386/../../kexec.h:19:2: error: #error BYTE_ORDER not defined
#error BYTE_ORDER not defined
^
kexec/arch/i386/../../kexec.h:23:2: error: #error LITTLE_ENDIAN not defined
#error LITTLE_ENDIAN not defined
^
kexec/arch/i386/../../kexec.h:27:2: error: #error BIG_ENDIAN not defined
#error BIG_ENDIAN not defined
^
In file included from kexec/arch/i386/kexec-x86-common.c:37:0:
kexec/arch/i386/../../kexec-syscall.h: In function ‘kexec_load’:
kexec/arch/i386/../../kexec-syscall.h:74:2: warning: implicit declaration of function ‘syscall’ [-Wimplicit-function-declaration]
return (long) syscall(__NR_kexec_load, entry, nr_segments, segments, flags);
^
make: *** [kexec/arch/i386/kexec-x86-common.o] Error 1
The build error was introduced by below commit:
commit c9c21cc107dcc9b6053e39ead1069e03717513f9
Author: Baoquan He <bhe@redhat.com>
Date: Thu Aug 6 19:10:55 2015 +0800
kexec: use _DEFAULT_SOURCE instead to remove compiling warning
Now compiling will print warning like below. Change code as it suggested.
# warning "_BSD_SOURCE and _SVID_SOURCE are deprecated, use _DEFAULT_SOURCE"
^
See manpage: http://man7.org/linux/man-pages/man7/feature_test_macros.7.html
_BSD_SOURCE has been deprecated since glibc 2.20, To allow code that requires
_BSD_SOURCE in glibc 2.19 and earlier and _DEFAULT_SOURCE in glibc 2.20 and
later to compile without warnings, define both _BSD_SOURCE and _DEFAULT_SOURCE.
Thus fix it by adding back _BSD_SOURCE along with _DEFAULT_SOURCE.
Signed-off-by: Dave Young <dyoung@redhat.com>
Signed-off-by: Simon Horman <horms@verge.net.au>
|
|
There may be more than one crash kernel regions on x86. Currently,
kexec-tools picks the largest one. If high reservation is smaller
than low, it will try to load panic kernel low. However, the kexec
syscall checks that target address is within crashk_res boundaries,
so attempts to load crash kernel low result in -EADDRNOTAVAIL, and
kexec prints out this error message:
kexec_load failed: Cannot assign requested address
Looking at the logic in arch/x86/kernel/setup.c, there are only two
possible layouts:
1. crashk_res is below 4G, and there is only one region,
2. crashk_res is above 4G, and crashk_low_res is below 4G
In either case, kexec-tools must pick the highest region.
Changelog:
* v3: rename function to get_crash_kernel_load_range
* v2: remove unnecessary local variables
Signed-off-by: Petr Tesarik <ptesarik@suse.com>
Signed-off-by: Simon Horman <horms@verge.net.au>
|
|
Kernel add E820_PRAM or E820_PMEM type for NVDIMM memory device.
Now support them in kexec too.
Reported-by: Toshi Kani <toshi.kani@hp.com>
Tested-by: Toshi Kani <toshi.kani@hp.com>
Signed-off-by: Baoquan He <bhe@redhat.com>
Signed-off-by: Simon Horman <horms@verge.net.au>
|
|
Now compiling will print warning like below. Change code as it suggested.
# warning "_BSD_SOURCE and _SVID_SOURCE are deprecated, use _DEFAULT_SOURCE"
^
Signed-off-by: Baoquan He <bhe@redhat.com>
Signed-off-by: Simon Horman <horms@verge.net.au>
|
|
This reverts commit 5edcbfd1368e84fce913ceeeca7b712c524dc20d.
Yinghai Lu has reported on the kexec mailing list that this causes
the following problem when using kexec load with kexec built on
openSUSE 13.1 64bit.
overflow in relocation type R_X86_64_32 val 21dffc020
|
|
Summary of changes,
configure.ac: Add test for detect x32 ABI.
purgatory/arch/x86_64/Makefile: Not use mcmodel large when
x32 ABI is set.
kexec/arch/x86_64/kexec-elf-rel-x86_64.c: When x32 ABI is set
use ELFCLASS32 instead of ELFCLASS64.
kexec/kexec-syscall.h: Add correct syscall number for x32 ABI.
Signed-off-by: Aníbal Limón <anibal.limon@linux.intel.com>
Signed-off-by: Mariano Lopez <mariano.lopez@linux.intel.com>
Signed-off-by: Simon Horman <horms@verge.net.au>
|
|
gcc 4.9.1 tells me this variable is set but unused
Signed-off-by: Simon Horman <horms@verge.net.au>
|
|
Commit 4362bfac changes params for kexec_iomem_for_each_line from
'unsigned long' to 'unsigned long long'.
This patch fixes forgotten changes for sh and x86 archs.
Bug causes incorrect parsing of memory ranges.
Signed-off-by: Roman Pen <r.peniaev@gmail.com>
Cc: kexec@lists.infradead.org
Signed-off-by: Simon Horman <horms@verge.net.au>
|
|
kexec/arch/i386/kexec-elf-x86.c:97:6: warning: variable
‘modified_cmdline_len’ set but not used [-Wunused-but-set-variable]
int modified_cmdline_len;
Signed-off-by: Ameya Palande <2ameya@gmail.com>
Signed-off-by: Simon Horman <horms@verge.net.au>
|
|
kexec/arch/i386/kexec-bzImage.c:111:8: warning: variable
‘kernel_version’ set but not used [-Wunused-but-set-variable]
Signed-off-by: Ameya Palande <2ameya@gmail.com>
Signed-off-by: Simon Horman <horms@verge.net.au>
|
|
Fixes the following compilation warning.
kexec/arch/mips/crashdump-mips.c:151:6: warning: unused variable 'i' [-Wunused-variable]
Signed-off-by: Yousong Zhou <yszhou4tech@gmail.com>
Signed-off-by: Simon Horman <horms@verge.net.au>
|
|
Fixes the following warning.
kexec/arch/mips/kexec-elf-mips.c:161:16: warning: assignment makes integer from pointer without a cast [enabled by default]
Signed-off-by: Yousong Zhou <yszhou4tech@gmail.com>
Signed-off-by: Simon Horman <horms@verge.net.au>
|
|
Signed-off-by: Yousong Zhou <yszhou4tech@gmail.com>
Signed-off-by: Simon Horman <horms@verge.net.au>
|
|
If "--command-line" option is not specified, then kexec segfaults while
dereferencing NULL command line string pointer. While we are at it, also
fix indentation and use '{' and '}' consistently.
Signed-off-by: Ameya Palande <2ameya@gmail.com>
Signed-off-by: Simon Horman <horms@verge.net.au>
|
|
In ppc64 loading, it will print the segment information. This is not
wanted since other Archs don't have this. People even think there's
something wrong. So erase it to make it be consistent with other Archs.
And if people really want to check these info, they can specify "-d"
option. They are printed in print_segments() too.
Signed-off-by: Baoquan He <bhe@redhat.com>
Signed-off-by: Simon Horman <horms@verge.net.au>
|
|
Signed-off-by: Andreas Schwab <schwab@linux-m68k.org>
Signed-off-by: Simon Horman <horms@verge.net.au>
|
|
The ELF header created among the loading of the kdump kernel should be
flagged using the current endianess and not always as big endian.
Without this patch the data exposed in /proc/vmcore are not readable when
running in LE mode.
Signed-off-by: Laurent Dufour <ldufour@linux.vnet.ibm.com>
Signed-off-by: Simon Horman <horms@verge.net.au>
|
|
Hi,
This is v2 of the patch. Since v1, I moved syscall implemented check littler
earlier in the function as per the feedback.
Now a new kexec syscall (kexec_file_load()) has been merged in upstream
kernel. This system call takes file descriptors of kernel and initramfs
as input (as opposed to list of segments to be loaded). This new system
call allows for signature verification of the kernel being loaded.
One use of signature verification of kernel is secureboot systems where
we want to allow kexec into a kernel only if it is validly signed by
a key system trusts.
This patch provides and option --kexec-file-syscall (-s), to force use of
new system call for kexec. Default is to continue to use old syscall.
Currently only bzImage64 on x86_64 can be loaded using this system call.
As kernel adds support for more arches and for more image types, kexec-tools
can be modified accordingly.
Signed-off-by: Vivek Goyal <vgoyal@redhat.com>
Acked-by: Baoquan He <bhe@redhat.com>
Signed-off-by: Simon Horman <horms@verge.net.au>
|
|
When loading dtb on arm platform, we may need change strings in dtb
in function setup_dtb_prop. If length of new string is larger than that
of the old one. We should extend the dtb by "FDT_TAGALIGN"ed size.
If not, kexec may fail to load the capture kernel.
Signed-off-by: Liu Hua <sdu.liu@huawei.com>
Signed-off-by: Simon Horman <horms@verge.net.au>
|
|
Kernel commit e6a6928c3ea1d0195ed75a091e345696b916c09b changed the way the
device tree is processed in the kernel. Now version 2 is no more supported.
This patch move the version of the device tree generated in ppc64
environment from 2 to 17, allowing to kexec kernel 3.16.
In addition, automates the define of NEED_STRUCTURE_BLOCK_EXTRA_PAD which
should not be set for DT version 16 and above.
Signed-off-by: Laurent Dufour <ldufour@linux.vnet.ibm.com>
Signed-off-by: Simon Horman <horms@verge.net.au>
|
|
For 32-bit ARM systems with CONFIG_ARM_LPAE=y, when kexec utility
loads the crash kernel. 32-bit elf header is not enough if the
physical address exceeds 4G.
This patch checkes whether the largest physical address of the system
exceeds 4G. If so, kexec creates 64-bit elf header.Otherwise it
creates 32-bit elf header.
Signed-off-by: Wei Jitao <weijitao@huawei.com>
Signed-off-by: Liu Hua <sdu.liu@huawei.com>
Signed-off-by: Simon Horman <horms@verge.net.au>
|
|
Since "start" and "end" in kexec_iomem_for_each_line
are unsigned long long, this patch makes "callback"s
accept unsigned-long-long-type parameters.
Signed-off-by: Wei Jitao <weijitao@huawei.com>
Signed-off-by: Liu Hua <sdu.liu@huawei.com>
Signed-off-by: Simon Horman <horms@verge.net.au>
|
|
If kernel does not export efi runtime maps it means 1:1 mapping does not
work or user explictly boot with efi=old_map. In this case efi setup code
will failback to noefi boot, but for kdump case we still need pass extra
acpi_rsdp cmdline.
Thus adding a check in kdump path.
Signed-off-by: Dave Young <dyoung@redhat.com>
Signed-off-by: Simon Horman <horms@verge.net.au>
|
|
When KALLSYMS is disabled or /proc is not mounted, this patch allows
--page-offset cmdline option for user to setup correct page_offset.
Signed-off-by: Wang Nan <wangnan0@huawei.com>
Signed-off-by: Simon Horman <horms@verge.net.au>
|
|
ARM kernel can be compiled with CONFIG_VMSPLIT_1G, CONFIG_VMSPLIT_2G or
CONFIG_VMSPLIT_3G. This patch dynamically detects PAGE_OFFSET according
to _stext symbol from /proc/kallsyms.
Signed-off-by: Wang Nan <wangnan0@huawei.com>
Signed-off-by: Simon Horman <horms@verge.net.au>
|
|
There's one more '-' in arch_usage, thus
s/pass--memmap-cmdline/pass-memmap-cmdline
Signed-off-by: Dave Young <dyoung@redhat.com>
Signed-off-by: Simon Horman <horms@verge.net.au>
|
|
For kernel boot with efi=old_map or some quirked machines like SGI UV
they use old ioremap instead of 1:1 mapping. But kexec efi support
depends on the 1:1 mapping thus we need to switch to use the old way
There's a kernel patch for exporting the efi flags so we can check the memory
mapping method. But user may want to explictly disable efi boot for unknown
reasons.
So here add a new arch option '--noefi' for this case.
Signed-off-by: Dave Young <dyoung@redhat.com>
Signed-off-by: Simon Horman <horms@verge.net.au>
|
|
In kdump path, now we store all the 2nd kernel memory ranges in
memmap_p. We could use just cmdline_add_memmap() to add all types of
memory ranges to 2nd kernel cmdline.
So clean up here, merge cmdline_add_memmap_acpi() into
cmdline_add_memmap().
Signed-off-by: WANG Chao <chaowang@redhat.com>
Acked-by: Dave Young <dyoung@redhat.com>
Signed-off-by: Simon Horman <horms@verge.net.au>
|
|
OPAL based system exports reserved memory ranges through /proc/device-tree
for the regions that are reserved by OPAL firmware. Traverse
/proc/device-tree/reserved-ranges and add them to exclude_ranges[] and
reserve them.
Signed-off-by: Mahesh Salgaonkar <mahesh@linux.vnet.ibm.com>
Signed-off-by: Simon Horman <horms@verge.net.au>
|
|
On PowerNV platform, OPAL region is overlapped with crashkernel, need to
create ELF Program header for the overlapped memory. The changes are
similar to the way RTAS region was handled.
Signed-off-by: Mahesh Salgaonkar <mahesh@linux.vnet.ibm.com>
Signed-off-by: Simon Horman <horms@verge.net.au>
|
|
This patch memset modified_cmdline after it alloced.
Without this patch, the header of command line always contains random
value like following example:
kernel: 0x765fd008 kernel_size: 0x23b610
memory range: [0x60000000 - 0x6fffffff] (256M)
memory range: [0x78000000 - 0x9fffffff] (640M)
...
kernel command line: "°¥氥䐶# elfcorehdr=0x77f00000 mem=130048K"
Signed-off-by: Wang Nan <wangnan0@huawei.com>
Cc: Geng Hui <hui.geng@huawei.com>
Signed-off-by: Simon Horman <horms@verge.net.au>
|