OBS User unknown 2008-10-08 16:20:30 +00:00 committed by Git OBS Bridge
parent 10674efb2f
commit fdd79db572
8 changed files with 435 additions and 1 deletions

View File

@ -0,0 +1,53 @@
From c1d13f4bd287f48c5fce02c3916b132f618c40fb Mon Sep 17 00:00:00 2001
From: Geoff Levand <geoffrey.levand@am.sony.com>
Date: Wed, 10 Sep 2008 18:40:42 -0700
Subject: [PATCH] Fix build warnings
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>
Acked-by: Bernhard Walle <bwalle@suse.de>
---
kexec/crashdump-elf.c | 8 ++++++--
kexec/firmware_memmap.c | 2 +-
2 files changed, 7 insertions(+), 3 deletions(-)
--- a/kexec/crashdump-elf.c
+++ b/kexec/crashdump-elf.c
@@ -8,8 +8,12 @@
do { \
dbgprintf("%s: p_type = %u, p_offset = 0x%llx p_paddr = 0x%llx " \
"p_vaddr = 0x%llx p_filesz = 0x%llx p_memsz = 0x%llx\n", \
- (prefix), (phdr)->p_type, (phdr)->p_offset, (phdr)->p_paddr, \
- (phdr)->p_vaddr, (phdr)->p_filesz, (phdr)->p_memsz); \
+ (prefix), (phdr)->p_type, \
+ (unsigned long long)((phdr)->p_offset), \
+ (unsigned long long)((phdr)->p_paddr), \
+ (unsigned long long)((phdr)->p_vaddr), \
+ (unsigned long long)((phdr)->p_filesz), \
+ (unsigned long long)((phdr)->p_memsz)); \
} while(0)
#else
#define dbgprintf_phdr(prefix, phdr) \
--- a/kexec/firmware_memmap.c
+++ b/kexec/firmware_memmap.c
@@ -239,7 +239,7 @@ int get_firmware_memmap_ranges(struct me
/* array overflow check */
if ((size_t)i >= *ranges) {
fprintf(stderr, "The firmware provides more entries "
- "allowed (%d). Please report that as bug.\n",
+ "allowed (%zd). Please report that as bug.\n",
*ranges);
goto error;
}

46
kexec-tools-ia64-PA.diff Normal file
View File

@ -0,0 +1,46 @@
From 4bd67d530f92313fd66bb462d96e3995b8e08af3 Mon Sep 17 00:00:00 2001
From: Bjorn Helgaas <bjorn.helgaas@hp.com>
Date: Mon, 6 Oct 2008 09:24:03 -0600
Subject: [PATCH] ia64: make PA() work for both physical identity-mapped virtual addresses
The EFI Runtime Services Table contains pointers to ia64 function
descriptors. On existing, pre-Tiano, firmware, SetVirtualAddressMap()
converts *all* these pointers from physical to virtual. On Tiano-based
firmware, the pointer to the SetVirtualAddressMap() function descriptor
is not converted, so it remains a physical pointer.
The ia64 kexec purgatory patches the SetVirtualAddressMap() function
descriptor so that when the new kernel calls SetVirtualAddressMap(), it
never reaches firmware. Instead, it calls a dummy function that just
returns success.
Purgatory runs in physical mode, so it must convert the pointer from the
RuntimeServicesTable to a physical address. This patch makes that
conversion work both for old firmware (where the pointer is an identity-
mapped virtual address) and new Tiano firmware (where the pointer is a
physical address).
Without this patch, kexec on Tiano firmware causes an MCA because
ia64_env_setup() subtracts PAGE_OFFSET from a physical address and ends
up with an invalid physical address. Referencing that address causes
the MCA.
Signed-off-by: Bjorn Helgaas <bjorn.helgaas@hp.com>
Signed-off-by: Simon Horman <horms@verge.net.au>
Acked-by: Bernhard Walle <bwalle@suse.de>
---
purgatory/arch/ia64/purgatory-ia64.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
--- a/purgatory/arch/ia64/purgatory-ia64.c
+++ b/purgatory/arch/ia64/purgatory-ia64.c
@@ -147,7 +147,7 @@ setup_arch(void)
inline unsigned long PA(unsigned long addr)
{
- return addr - PAGE_OFFSET;
+ return addr & 0x0fffffffffffffffLL;
}
void

View File

@ -0,0 +1,51 @@
Date: Wed, 8 Oct 2008 17:49:41 +1100
From: Simon Horman <horms@verge.net.au>
To: linux-ia64@vger.kernel.org, kexec@lists.infradead.org
Cc: Jay Lan <jlan@sgi.com>, "Luck, Tony" <tony.luck@intel.com>,
Bernhard Walle <bwalle@suse.de>
Subject: [patch] ia64: Order of operations bug in PT_LOAD segment reader
This bug was discovered by Jay Lan and he also proposed this fix, however
thee is some discussion about what if any related changes should be made at
the same time.
The bug comes about because the break statment was never executed because
the if clause would bever be true because the if clause will never be true
because & has higher precedence than !=.
My position on this is that with the if logic fixed, as per this patch, the
break statment and the rest of the while() loop makes sense and should work
as intended.
As I understand it, Jay's position is that the code should be simplified,
after all it never worked as intended.
There is a related kernel bug that lead Jay to discover this problem.
The kernel bug has been resolved by Tony Luck and was
included in Linus's tree between 2.6.27-rc8 and 2.6.27-rc9 as
"[IA64] Put the space for cpu0 per-cpu area into .data section".
Now that the kernel bug is out of the way, I am providing this patch to
continue discussion on what to do on the kexec-tools side of things. I do
not intend to apply this patch until there is some conclusion in the
discussion between Jay and myself.
Cc: Jay Lan <jlan@sgi.com>
Signed-off-by: Simon Horman <horms@verge.net.au>
Acked-by: Bernhard Walle <bwalle@suse.de>
---
kexec/arch/ia64/crashdump-ia64.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
--- a/kexec/arch/ia64/crashdump-ia64.c
+++ b/kexec/arch/ia64/crashdump-ia64.c
@@ -91,7 +91,7 @@ static void add_loaded_segments_info(str
if (phdr->p_type != PT_LOAD)
break;
if (loaded_segments[loaded_segments_num].end !=
- phdr->p_paddr & ~(ELF_PAGE_SIZE-1))
+ (phdr->p_paddr & ~(ELF_PAGE_SIZE-1)))
break;
loaded_segments[loaded_segments_num].end +=
(phdr->p_memsz + ELF_PAGE_SIZE - 1) &

View File

@ -0,0 +1,93 @@
From c466edd86b31a9d34cde3db24b093223108627d2 Mon Sep 17 00:00:00 2001
From: Jay Lan <jlan@sgi.com>
Date: Fri, 12 Sep 2008 13:10:34 -0700
Subject: [PATCH] IA64: do not include uncached memory to vmcore
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>
Acked-by: Bernhard Walle <bwalle@suse.de>
---
kexec/arch/ia64/crashdump-ia64.c | 5 ++++-
kexec/arch/ia64/kexec-ia64.c | 5 ++++-
kexec/firmware_memmap.c | 2 ++
kexec/kexec.h | 1 +
4 files changed, 11 insertions(+), 2 deletions(-)
--- a/kexec/arch/ia64/crashdump-ia64.c
+++ b/kexec/arch/ia64/crashdump-ia64.c
@@ -192,8 +192,11 @@ static int get_crash_memory_ranges(struc
kernel_code_start = start;
kernel_code_end = end;
continue;
- }else
+ } else if (memcmp(str, "Uncached RAM\n", 13) == 0) {
+ type = RANGE_UNCACHED;
+ } else {
continue;
+ }
crash_memory_range[memory_ranges].start = start;
crash_memory_range[memory_ranges].end = end;
crash_memory_range[memory_ranges].type = type;
--- a/kexec/arch/ia64/kexec-ia64.c
+++ b/kexec/arch/ia64/kexec-ia64.c
@@ -139,8 +139,11 @@ int get_memory_ranges(struct memory_rang
memory_ranges = split_range(memory_ranges, start, end);
saved_efi_memmap_size = end - start;
continue;
- } else
+ } else if (memcmp(str, "Uncached RAM\n", 13) == 0) {
+ type = RANGE_UNCACHED;
+ } else {
continue;
+ }
/*
* Check if this memory range can be coalesced with
* the previous range
--- a/kexec/firmware_memmap.c
+++ b/kexec/firmware_memmap.c
@@ -158,6 +158,8 @@ static int parse_memmap_entry(const char
range->type = RANGE_RESERVED;
else if (strcmp(type, "ACPI Non-volatile Storage") == 0)
range->type = RANGE_ACPI_NVS;
+ else if (strcmp(type, "Uncached RAM") == 0)
+ range->type = RANGE_UNCACHED;
else {
fprintf(stderr, "Unknown type (%s) while parsing %s. Please "
"report this as bug. Using RANGE_RESERVED now.\n",
--- a/kexec/kexec.h
+++ b/kexec/kexec.h
@@ -110,6 +110,7 @@ struct memory_range {
#define RANGE_RESERVED 1
#define RANGE_ACPI 2
#define RANGE_ACPI_NVS 3
+#define RANGE_UNCACHED 4
};
struct kexec_info {

View File

@ -0,0 +1,28 @@
From 93792363d3455459c7af7c646c0a1d1238c772fb Mon Sep 17 00:00:00 2001
From: Maxim Shchetynin <maxim@de.ibm.com>
Date: Wed, 27 Aug 2008 10:04:56 +0200
Subject: [PATCH] Let kexec work on IBM QS2x blade servers
Hello,
please have a look at the following patch. This patch allows kexec to work
on IBM QS2x blades. Would it be possible to apply this patch to a next
kexec version?
Signed-off-by: Maxim Shchetynin <maxim@de.ibm.com>
Signed-off-by: Simon Horman <horms@verge.net.au>
---
kexec/arch/ppc64/kexec-elf-rel-ppc64.c | 1 +
1 file changed, 1 insertion(+)
--- a/kexec/arch/ppc64/kexec-elf-rel-ppc64.c
+++ b/kexec/arch/ppc64/kexec-elf-rel-ppc64.c
@@ -56,6 +56,7 @@ void machine_apply_elf_rel(struct mem_eh
break;
case R_PPC64_ADDR64:
+ case R_PPC64_REL64:
/* Simply set it */
*(uint64_t *)location = value;
break;

View File

@ -0,0 +1,129 @@
From b422925d35151caa65471c0f0d774727bde4a347 Mon Sep 17 00:00:00 2001
From: Geoff Levand <geoffrey.levand@am.sony.com>
Date: Wed, 10 Sep 2008 18:40:46 -0700
Subject: [PATCH] Fix ppc64 build warnings
Fix these ppc64 32 bit build warnings:
kexec/arch/ppc64/kexec-zImage-ppc64.c: In function 'zImage_ppc64_load':
kexec/arch/ppc64/kexec-zImage-ppc64.c:164: warning: cast to pointer from integer of different size
kexec/arch/ppc64/kexec-elf-ppc64.c: In function 'elf_ppc64_load':
kexec/arch/ppc64/kexec-elf-ppc64.c:121: warning: integer constant is too large for 'unsigned long' type
kexec/arch/ppc64/kexec-elf-ppc64.c:237: warning: cast from pointer to integer of different size
kexec/arch/ppc64/kexec-elf-ppc64.c:276: warning: cast from pointer to integer of different size
kexec/arch/ppc64/kexec-elf-ppc64.c:283: warning: cast from pointer to integer of different size
kexec/arch/ppc64/kexec-elf-ppc64.c:287: warning: cast from pointer to integer of different size
kexec/arch/ppc64/kexec-elf-ppc64.c:341: warning: format '%lx' expects type 'long unsigned int', but argument 3 has type 'uint64_t'
kexec/arch/ppc64/kexec-elf-ppc64.c:352: warning: format '%ld' expects type 'long int', but argument 5 has type 'size_t'
kexec/arch/ppc64/crashdump-ppc64.c:45: warning: integer constant is too large for 'long' type
kexec/arch/ppc64/crashdump-ppc64.c:46: warning: integer constant is too large for 'long' type
kexec/arch/ppc64/crashdump-ppc64.c:56: warning: integer constant is too large for 'long' type
kexec/arch/ppc64/crashdump-ppc64.c:57: warning: integer constant is too large for 'long' type
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>
Acked-by: Bernhard Walle <bwalle@suse.de>
---
kexec/arch/ppc64/crashdump-ppc64.h | 4 ++--
kexec/arch/ppc64/kexec-elf-ppc64.c | 26 ++++++++++++++------------
kexec/arch/ppc64/kexec-zImage-ppc64.c | 2 +-
3 files changed, 17 insertions(+), 15 deletions(-)
--- a/kexec/arch/ppc64/crashdump-ppc64.h
+++ b/kexec/arch/ppc64/crashdump-ppc64.h
@@ -6,9 +6,9 @@ int load_crashdump_segments(struct kexec
uint64_t max_addr, unsigned long min_base);
void add_usable_mem_rgns(unsigned long long base, unsigned long long size);
-#define PAGE_OFFSET 0xC000000000000000
+#define PAGE_OFFSET 0xC000000000000000ULL
#define KERNELBASE PAGE_OFFSET
-#define VMALLOCBASE 0xD000000000000000
+#define VMALLOCBASE 0xD000000000000000ULL
#define __pa(x) ((unsigned long)(x)-PAGE_OFFSET)
#define MAXMEM (-KERNELBASE-VMALLOCBASE)
--- a/kexec/arch/ppc64/kexec-elf-ppc64.c
+++ b/kexec/arch/ppc64/kexec-elf-ppc64.c
@@ -118,7 +118,7 @@ int elf_ppc64_load(int argc, char **argv
cmdline = 0;
ramdisk = 0;
devicetreeblob = 0;
- max_addr = 0xFFFFFFFFFFFFFFFFUL;
+ max_addr = 0xFFFFFFFFFFFFFFFFULL;
hole_addr = 0;
while ((opt = getopt_long(argc, argv, short_options,
@@ -233,7 +233,7 @@ int elf_ppc64_load(int argc, char **argv
}
seg_buf = (unsigned char *)slurp_file(ramdisk, &seg_size);
add_buffer(info, seg_buf, seg_size, seg_size, 0, 0, max_addr, 1);
- hole_addr = (uint64_t)
+ hole_addr = (uintptr_t)
info->segment[info->nr_segments-1].mem;
initrd_base = hole_addr;
initrd_size = (uint64_t)
@@ -272,7 +272,7 @@ int elf_ppc64_load(int argc, char **argv
while (*rsvmap_ptr || *(rsvmap_ptr+1))
rsvmap_ptr += 2;
rsvmap_ptr -= 2;
- *rsvmap_ptr = (uint64_t)(
+ *rsvmap_ptr = (uintptr_t)(
info->segment[(info->nr_segments)-1].mem);
rsvmap_ptr++;
*rsvmap_ptr = (uint64_t)bb_ptr->totalsize;
@@ -280,11 +280,11 @@ int elf_ppc64_load(int argc, char **argv
nr_segments = info->nr_segments;
/* Set kernel */
- my_kernel = (uint64_t)info->segment[0].mem;
+ my_kernel = (uintptr_t)info->segment[0].mem;
elf_rel_set_symbol(&info->rhdr, "kernel", &my_kernel, sizeof(my_kernel));
/* Set dt_offset */
- my_dt_offset = (uint64_t)info->segment[nr_segments-1].mem;
+ my_dt_offset = (uintptr_t)info->segment[nr_segments-1].mem;
elf_rel_set_symbol(&info->rhdr, "dt_offset", &my_dt_offset,
sizeof(my_dt_offset));
@@ -338,17 +338,19 @@ int elf_ppc64_load(int argc, char **argv
sizeof(toc_addr));
fprintf(stderr, "info->entry is %p\n", info->entry);
- fprintf(stderr, "kernel is %lx\n", my_kernel);
- fprintf(stderr, "dt_offset is %lx\n", my_dt_offset);
+ fprintf(stderr, "kernel is %llx\n", (unsigned long long)my_kernel);
+ fprintf(stderr, "dt_offset is %llx\n",
+ (unsigned long long)my_dt_offset);
fprintf(stderr, "panic_kernel is %x\n", my_panic_kernel);
- fprintf(stderr, "backup_start is %lx\n", my_backup_start);
- fprintf(stderr, "stack is %lx\n", my_stack);
- fprintf(stderr, "toc_addr is %lx\n", toc_addr);
- fprintf(stderr, "purgatory size is %lu\n", purgatory_size);
+ fprintf(stderr, "backup_start is %llx\n",
+ (unsigned long long)my_backup_start);
+ fprintf(stderr, "stack is %llx\n", (unsigned long long)my_stack);
+ fprintf(stderr, "toc_addr is %llx\n", (unsigned long long)toc_addr);
+ fprintf(stderr, "purgatory size is %zu\n", purgatory_size);
#endif
for (i = 0; i < nr_segments; i++)
- fprintf(stderr, "segment[%d].mem:%p memsz:%ld\n", i,
+ fprintf(stderr, "segment[%d].mem:%p memsz:%zu\n", i,
info->segment[i].mem, info->segment[i].memsz);
return 0;
--- a/kexec/arch/ppc64/kexec-zImage-ppc64.c
+++ b/kexec/arch/ppc64/kexec-zImage-ppc64.c
@@ -161,7 +161,7 @@ int zImage_ppc64_load(FILE *file, int ar
segment->mem = (void *) load_loc;
segment->memsz = memsize;
segment->bufsz = filesize;
- *ret_entry = (void *)((uint64_t)elf.e_entry);
+ *ret_entry = (void *)(uintptr_t)elf.e_entry;
*ret_nr_segments = i - 1;
free(ph);
return 0;

View File

@ -1,3 +1,17 @@
-------------------------------------------------------------------
Wed Oct 08 16:57:28 CEST 2008 - bwalle@suse.de
- IA64: Order of operations bug in PT_LOAD segment reader.
-------------------------------------------------------------------
Wed Oct 08 16:29:33 CEST 2008 - bwalle@suse.de
- ia64: Do not include uncached memory to vmcore.
- ia64: Make PA() work for both physical identity-mapped virtual
addresses.
- PPC64: Let kexec work on IBM QS2x blade servers
- Fix build warnings.
-------------------------------------------------------------------
Mon Oct 06 17:32:56 CEST 2008 - bwalle@suse.de

View File

@ -29,11 +29,17 @@ PreReq: %insserv_prereq %fillup_prereq
AutoReqProv: on
Summary: Tools for fast kernel loading
Version: 2.0.0
Release: 36
Release: 37
Source: %{name}-%{version}.tar.bz2
Source1: kexec-bootloader
Source2: kexec-bootloader.8.txt
Source3: kexec.init
Patch0: %{name}-ia64-uncached-memory.diff
Patch1: %{name}-ia64-PA.diff
Patch2: %{name}-build-warnings.diff
Patch3: %{name}-ppc64-build-warnings.diff
Patch4: %{name}-ppc64-IBM-QS2x-blades.diff
Patch5: %{name}-ia64-kdump-PT_LOAD-order.diff
Url: http://ftp.kernel.org/pub/linux/kernel/people/horms/kexec-tools/
BuildRoot: %{_tmppath}/%{name}-%{version}-build
BuildRequires: zlib-devel
@ -60,6 +66,12 @@ Authors:
%prep
%setup -q -n kexec-tools-%{version}
%patch0 -p1
%patch1 -p1
%patch2 -p1
%patch3 -p1
%patch4 -p1
%patch5 -p1
%build
%{?suse_update_config -f}
@ -126,6 +138,14 @@ install -m 0755 kexec.init ${RPM_BUILD_ROOT}/etc/init.d/kexec
%endif
%changelog
* Wed Oct 08 2008 bwalle@suse.de
- IA64: Order of operations bug in PT_LOAD segment reader.
* Wed Oct 08 2008 bwalle@suse.de
- ia64: Do not include uncached memory to vmcore.
- ia64: Make PA() work for both physical identity-mapped virtual
addresses.
- PPC64: Let kexec work on IBM QS2x blade servers
- Fix build warnings.
* Mon Oct 06 2008 bwalle@suse.de
- Implement -h (help) option (bnc#432386).
- Remove documentation of -o (options) option that never existed.