Age | Commit message (Collapse) | Author |
|
- Widen some types. Why did I use unsigned long? I guess this
code predates the decision to support biarch.
- Since I have made the types wider fix the statements that
print those types out.
Signed-off-by: Eric W. Biederman <ebiederm@xmission.com>
Signed-off-by: Simon Horman <horms@verge.net.au>
|
|
Don't print uncondintionally print an error message about
KCORE_ELF_HEADERS_SIZE being wrong when the elf headers
are truncated when build_mem_phdrs fails because there
are other reasons we could be truncated (like an
actual damaged elf file).
Instead only print an error message when either probe_debug
is true or we are skipping the total file size checks for
some reason. When we do print an error message limit the
message to the fact that we are truncated and how many
bytes we have and how many bytes we need. The context
of the failure should be able to provide the rest of
the information.
For now add a comment in crashdump-x86_64.c to direct people
to KCORE_ELF_HEADERS_SIZE so that if someone finds the
code things can be adjusted.
Signed-off-by: Eric W. Biederman <ebiederm@xmission.com>
Signed-off-by: Simon Horman <horms@verge.net.au>
|
|
- Pass the acpi memap to the kernel.
- Port the fix from x86_64 to not truncate the elf
note segment to 16K, to keep large machines happy.
Signed-off-by: Eric W. Biederman <ebiederm@xmission.com>
Signed-off-by: Simon Horman <horms@verge.net.au>
|
|
o Put the debug code under #ifdef DEBUG instead of #if 0.
o Do this to match the x86_64 code.
Signed-off-by: Eric W. Biederman <ebiederm@xmission.com>
Signed-off-by: Simon Horman <horms@verge.net.au>
|
|
Build a version of get_crash_memory_ranges that works the same
on both x86_64 and x86. Reorder the calls in load_crashdump_segments
so we have the architectures low memory limit when we call
get_crash_memory_ranges.
Signed-off-by: Eric W. Biederman <ebiederm@xmission.com>
Signed-off-by: Simon Horman <horms@verge.net.au>
|
|
Unify the 32bit and the 64bit crashdump headers. Rename
arch specific defintions to arch specific names to be clear.
Update users of the renamed constants.
Signed-off-by: Eric W. Biederman <ebiederm@xmission.com>
Signed-off-by: Simon Horman <horms@verge.net.au>
|
|
In preparation for merging crashdump-x86 and crashdump-x86_64
move elf_info onto the stack and start filling it out dynamically
as appropriate.
Included in this change is only setting lowmem_limit and get_note_info
when we are generating a core file for a 32bit kernel.
Signed-off-by: Eric W. Biederman <ebiederm@xmission.com>
Signed-off-by: Simon Horman <horms@verge.net.au>
|
|
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>
|
|
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>
|
|
Don't calculate page_offfset in arch_init. Performing the work there
badly messes up biarch support, so move the work into crashdump_x86_64.
Signed-off-by: Eric W. Biederman <ebiederm@xmission.com>
|
|
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>
|
|
Signed-off-by: Eric W. Biederman <ebiederm@xmission.com>
|
|
Move cmdline from just after .bss segment to the just after
the latest segment to avoid segments overlap while loading
crashdump kernel. (new mips vmlinux has additional segments
after .bss).
Signed-off-by: Maxim Uvarov <muvarov@gmail.com>
Signed-off-by: Simon Horman <horms@verge.net.au>
|
|
Required in case if "-mabi=64" option was specified to build 64 bit mips
application, if not compiler tries to link 64 bit binaries with 32 bit
system libraries.
Signed-off-by: Maxim Uvarov <muvarov@gmail.com>
Signed-off-by: Simon Horman <horms@verge.net.au>
|
|
A customer has seen the kexec command exhaust its buffer for the ELF headers
from /proc/kcore. It found 147 program headers, which requires a buffer of
over 8k.
(This overflow was on an SGI UV with an extremely large memory, hence
many ram ranges.)
The default buffer size of 4k is configured in KCORE_ELF_HEADERS_SIZE.
The easy solution would probably be to increase the buffer to 16k.
That is room for 291 entries, on x86_64.
You might want to make the command dynamically enlarge the buffer when
it is found to be too small, but I don't think this command's use of a
little more memory is of concern. So there is probably no reason to
change the program logic in this area.
Diffed against kexec-tools-2.0.2
Signed-off-by: Cliff Wickman <cpw@sgi.com>
Signed-off-by: Simon Horman <horms@verge.net.au>
|
|
We always remove the old entry, and add it back if it is needed
on for the kexec'ed kernel
Signed-off-by: Matthew McClintock <msm@freescale.com>
Signed-off-by: Simon Horman <horms@verge.net.au>
|
|
Currently, we can add a lot of reservations over a small range, this
does a simple check to verify the previous entry is not the same
as the current one and skips it if so
Signed-off-by: Matthew McClintock <msm@freescale.com>
Signed-off-by: Simon Horman <horms@verge.net.au>
|
|
Signed-off-by: Matthew McClintock <msm@freescale.com>
Signed-off-by: Simon Horman <horms@verge.net.au>
|
|
Currently, the device tree is passed as is. You can optionally
update the command line and specifically listed nodes but nothing
is updated automatically.
This patch updates the memreserve regions, memory node, initrd
nodes and attempts to make the device tree look as it should. Some
code is borrowed from the u-boot routines which do similiar things
Also, now if no flat device tree is passed to kexec it will attempt
to rebuild one from the /proc/device-tree file system to use for
the kexec'ed kernel for both uImage and elf formats
[ horms@verge.net.au: kernel_addr is now outside #ifdef WITH_GAMECUBE ]
Signed-off-by: Matthew McClintock <msm@freescale.com>
Signed-off-by: Simon Horman <horms@verge.net.au>
|
|
This fixes --reuseinitrd and --ramdisk option for ppc32 on
uImage-ppc and Elf. It works for normal kexec as well as for
kdump.
When using --reuseinitrd you need to specifify retain_initrd
on the command line. Also, if you are doing kdump you need to make
sure your initrd lives in the crashdump region otherwise the
kdump kernel will not be able to access it. The --ramdisk option
should always work.
[ horms@verge.net.au: minor up-port ]
Signed-off-by: Matthew McClintock <msm@freescale.com>
Signed-off-by: Simon Horman <horms@verge.net.au>
|
|
Use current command line if none given, specifically useful for
when arguments are added causing the use of the current cmdline
to not occur
We also try to load the dtb above the kernel, this is useful for
relocatable kernels where they device tree needs to reside just
above the kernel base address
Set the kernel entry address in the relocatable purgatory code
so we jump to the correct start address if not the default. Useful
for relocatable kernels
[ horms@verge.net.au: moved kernel_addr declaration to outside #ifdef WITH_GAMECUBE ]
Signed-off-by: Matthew McClintock <msm@freescale.com>
Signed-off-by: Simon Horman <horms@verge.net.au>
|
|
Use current command line if none given, specifically useful for
when arguments are added causing the use of the current cmdline
to not occur.
We also try to load the dtb above the kernel, this is useful for
relocatable kernels where they device tree needs to reside just
above the kernel base address.
Only allocate 1 MiB extra for bss space after kernel as it appears
to be more than adequate.
Signed-off-by: Matthew McClintock <msm@freescale.com>
Signed-off-by: Simon Horman <horms@verge.net.au>
|
|
On some actitectures the physical memory can be 64 bits, therefore
the code that reads proc entries needs to take into account it could
read either a 32 bit or 64bit value for the physical addresses.
Signed-off-by: Matthew McClintock <msm@freescale.com>
Signed-off-by: Simon Horman <horms@verge.net.au>
|
|
Booting with uImage-ppc was broken by previous work, this
patch should restore it to working order
Signed-off-by: Matthew McClintock <msm@freescale.com>
Signed-off-by: Simon Horman <horms@verge.net.au>
|
|
The memory ranges derived from /sys/firmware/memmap may overlap, causing
the kexec command to fail to load the crash kernel. The typical failure
reports 'Overlapping memory segments at 0x...'.
The preferred remedy might be to fix the BIOS or the kernel, but given
that they may at times generate overlaps, a check in the kexec command
will prevent crash dumps from being effectively disabled.
Diffed against git.kernel.org/pub/scm/linux/kernel/git/horms/kexec-tools.git
Signed-off-by: Cliff Wickman <cpw@sgi.com>
Signed-off-by: Simon Horman <horms@verge.net.au>
|
|
Signed-off-by: Simon Horman <horms@verge.net.au>
|
|
On SGI UV (x86_64) kexec grumbles about 'Unusable memory' ranges:
Unknown type (%s) while parsing %s. Please "
"report this as bug. Using RANGE_RESERVED now.
uv44-sys:~ # cat /proc/iomem
00000000-00000fff : System RAM
00001000-00005fff : reserved
00006000-0008efff : System RAM
0008f000-0008ffff : ACPI Non-volatile Storage
00090000-0009ffff : System RAM
00100000-75ffcfff : System RAM
01000000-0139dcaf : Kernel code
0139dcb0-0192c12f : Kernel data
01a28000-01cd7777 : Kernel bss
02000000-09ffffff : Crash kernel
75ffd000-76013fff : Unusable memory
76014000-766a6fff : System RAM
766a7000-766d6fff : Unusable memory
...
This patch keeps Unusable memory as another RANGE_RESERVED area, but
without the warning message.
Diffed against git.kernel.org/pub/scm/linux/kernel/git/horms/kexec-tools.git
Signed-off-by: Cliff Wickman <cpw@sgi.com>
Signed-off-by: Simon Horman <horms@verge.net.au>
|
|
The MAX_MEMORY_RANGES of 64 is too small for a very large NUMA machine.
(A 512 processor SGI UV, for example.)
And fix a temporary workaround (hack) in load_crashdump_segments() that
assumes that 16k is sufficient for the size of the crashdump elf header.
This is too small for a machine with a large cpu count. A PT_NOTE is created
in the elf header for each cpu.
Signed-off-by: Cliff Wickman <cpw@sgi.com>
Signed-off-by: Simon Horman <horms@verge.net.au>
|
|
The argument parsing is currently a bit broken as main()'s getopt_long()
knows nothing about either the architecture-specific options or, even
more specifically, the architecture-and-loader-specific options.
This patch introduces new #defines for all architectures,
KEXEC_ALL_OPTIONS and KEXEC_ALL_OPT_STR. These contain all possible
options for a given build, and the getopt_long() passes in main() and
arch_process_options() will now recognise arch- and loader-specific
options; these will not be re-ordered in argv[], there is no confusion
over which argv[] entry is the kernel filename, and using '--opt=foo' and
'--opt foo' both work.
All architectures have command line options (and #define OPT_BLAHs)
consolidated into their include/arch/option.h files. x86_64 builds
parts of i386/ as well, so now both share a single option.h file (with
a symlink).
Signed-off-by: Matt Evans <matt@ozlabs.org>
Signed-off-by: Simon Horman <horms@verge.net.au>
|
|
Implement support for loading dump capture kernels for ARM architecture. ARM
doesn't need any backup memory regions so only elfcore header is allocated from
the top of the reserved memory region. Only zImages are supported.
The dump capture kernel needs to be loaded to physical address corresponding to
the memory region reserved with 'crashkernel=size@start' kernel command line
parameter.
Signed-off-by: Mika Westerberg <ext-mika.1.westerberg@nokia.com>
Signed-off-by: Simon Horman <horms@verge.net.au>
|
|
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>
|
|
This fixes the kexec-build on ppc32 when
the --game-cube option is supplied to ./configure.
It seems to have bit-rotted a little.
Cc: Sebastian Andrzej Siewior <sebastian@breakpoint.cc>
Cc: Maxim Uvarov <muvarov@gmail.com>
Signed-off-by: Simon Horman <horms@verge.net.au>
|
|
add_dyn_reconf_usable_mem_property() iterates over memory spans
in /ibm,dynamic-reconfiguration-memory/ibm,dynamic-memory and intersects
these with usablemem_rgns ranges. In doing so it used an unchecked
fixed-size array which will overrun on machines with lots of LMBs.
This patch removes the fixed-sized arrays from
add_dyn_reconf_usable_mem_property() and add_usable_mem_property(), in lieu of
malloc/realloc/free.
Signed-off-by: Matt Evans <matt@ozlabs.org>
Michael Neuling <mikey@neuling.org>
Signed-off-by: Simon Horman <horms@verge.net.au>
|
|
Signed-off-by: Maxim Uvarov <muvarov@gmail.com>
Signed-off-by: Maxim Uvarov <muvarov@gmail.com>
Signed-off-by: Simon Horman <horms@verge.net.au>
|
|
mips, ppc)
These architectures don't have any architecture-specific options
(note: distinct from loader options, which are more specific), yet
their arch_process_options() functions contain getopts_long() calls
followed by no argument processing. The code doesn't do anything,
so this patch removes it.
Signed-off-by: Matt Evans <matt@ozlabs.org>
Signed-off-by: Simon Horman <horms@verge.net.au>
|
|
Revert this portion of recent MIPS changes as it actually effects the
CFLAGS for all architectures. Moreover I'm somewhat dubious about
defaulting to -Werror for any architecture.
Signed-off-by: Simon Horman <horms@verge.net.au>
|
|
The original fixed address of 0x800000 may be overwritten after the
kernel is decompressed. Assume a maximum decompression ratio of 4
and place initrd right after that, just to be safer.
Signed-off-by: Eric Miao <eric.miao@canonical.com>
Signed-off-by: Simon Horman <horms@verge.net.au>
|
|
ppc64's fs2dt used to use a fixed-size array into which the device tree
was parsed. There was no bounds checking, so with a large device tree other
heap data ended up getting stomped -- SIGSEGV time.
This patch adds a function, 'dt_reserve', to check whether there's enough space
left prior to writing data to the array. If not, the array is realloced.
Signed-off-by: Matt Evans <matt@ozlabs.org>
Ack-by: Michael Neuling <mikey@neuling.org>
Signed-off-by: Simon Horman <horms@verge.net.au>
|
|
6adc05c6e3fdbc8b9f5d915af78ca05d0a09cb17 "some kexec MIPS
improvements" broke pp64 as it turned on -Werror for all archs.
This fixes the warning and hence ppc64 building.
Signed-off-by: Michael Neuling <mikey@neuling.org>
Signed-off-by: Simon Horman <horms@verge.net.au>
|
|
|
|
The now generic probe function is more complete than the currently used.
It seems that ARM's and SH's uImage are always uncompressed so it might
be good to check for this.
Cc: Paul Mundt <lethal@linux-sh.org>
Cc: Marc Andre Tanner <mat@brain-dump.org>
Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
|
|
The check and uncompress code could be split and recycled by other arch.
Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
|
|
Signed-off-by: Ameya Palande <ameya.palande@nokia.com>
Signed-off-by: Simon Horman <horms@verge.net.au>
|
|
Signed-off-by: Ameya Palande <ameya.palande@nokia.com>
Signed-off-by: Simon Horman <horms@verge.net.au>
|
|
This patch fixes following warning:
kexec/firmware_memmap.c: In function ‘parse_numeric_sysfs’:
kexec/firmware_memmap.c:70: error: ignoring return value of ‘fgets’, declared
with attribute warn_unused_result
kexec/firmware_memmap.c: In function ‘parse_string_sysfs’:
kexec/firmware_memmap.c:103: error: ignoring return value of ‘fgets’, declared
with attribute warn_unused_result
Difference between v1 and v2: Less indentation.
Signed-off-by: Ameya Palande <ameya.palande@nokia.com>
Signed-off-by: Simon Horman <horms@verge.net.au>
|
|
Generate the correct crashdump header for x86_64 kernels
when a 32bit kernel is used.
Signed-off-by: Eric W. Biederman <ebiederm@aristanetworks.com>
Signed-off-by: Simon Horman <horms@verge.net.au>
|
|
This moves the computing of our native archtecture earlier so
that load can use it, as arch/i386/crashdump-x86.c has been
trying to.
Signed-off-by: Eric W. Biederman <ebiederm@aristanetworks.com>
Signed-off-by: Simon Horman <horms@verge.net.au>
|
|
When removing the potential leak the logic was flipped which
mean we never reached the case for handling when both parameters
were set.
Signed-off-by: Eric W. Biederman <ebiederm@aristanetworks.com>
Signed-off-by: Simon Horman <horms@verge.net.au>
|
|
- using simple mips* ) in configure.ac to make it compilable on mips2
and mips64
- remove kexec/arch/mips/mips-setup-simple.S which prepares cmdline for
new kernel, it is better to move this work to kernel code. BTW this code was
compilable only on o32 because of t4 is not defined on 64-64 or n32 MIPS ABIs.
- simple put cmdline as string, kernel code should catch cmdline like this
int board_kexec_prepare(struct kimage *image)
{
int i;
char *bootloader = "kexec";
board_boot_desc_ptr->argc = 0;
for(i=0;i<image->nr_segments;i++)
{
printk("segment %d
if (!strncmp(bootloader, (char*)image->segment[i].buf,
strlen(bootloader)))
{
/*
* convert command line string to array
* of parameters (as bootloader does).
*/
int argc = 0, offt;
char *str = (char *)image->segment[i].buf;
char *ptr = strchr(str, ' ');
while (ptr && (ARGV_MAX_ARGS > argc)) {
*ptr = '\0';
if (ptr[1] != ' ') {
offt = (int)(ptr - str + 1);
boot_desc_ptr->argv[argc] =
image->segment[i].mem + offt;
argc++;
}
ptr = strchr(ptr + 1, ' ');
}
boot_desc_ptr->argc = argc;
break;
}
}
Keep it as string make code simple and more readable.
- add crashdump support
- do not redefine syscalls numbers if they defined in system
remove fixups for /proc/iomem. If your board provides wrong /proc/iomem please
fix kernel, or at least you local version of kexec. No need to support it in
main line. At least add option --fake-iomem
- some minor fixes
Signed-off-by: Maxim Uvarov <muvarov@gmail.com>
Signed-off-by: Simon Horman <horms@verge.net.au>
|
|
On PowerPC the uImage usually contains the compressed "final" kernel and
not a tiny wrapper which relocates itself und uncomprosses the final
kernel to its final position. Instead we uncompress the gzip image and
put it the its final position.
Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
|