diff options
author | Horms <horms@verge.net.au> | 2006-12-01 15:08:53 +0900 |
---|---|---|
committer | Simon Horman <horms@verge.net.au> | 2006-12-12 18:30:49 +0900 |
commit | 7b347834d35633578c60496a13d1e913926e50f2 (patch) | |
tree | b4390e84a50994f2d770d086d11c89ae45a2e363 | |
parent | 7f093bceb950d24d91359965d135c835c584c953 (diff) |
send slave cpus to SAL slave loop on crash (IA64)
On Tue, Nov 21, 2006 at 07:13:56AM +0800, Zou Nan hai wrote:
> This patch make normal "kexec -l" first try physical address suggested
> by vmlinux.
>
> If there is no enough memory, kexec tools will search /proc/iomem and
> find a place to put the new kernel.
>
> This is necessary for "kexec -l" to work on SN platform.
>
> Signed-off-by: Zou Nan hai <nanhai.zou@intel.com>
>
Hi Nan hai,
sorry for not responding sooner.
I have take a look at your patch with an eye to including it into
kexec-tools-testing. It does seem like a good feature.
Below is an updated version of the patch that cleans up your
implementation a little. In particular.
* update_loaded_segments() returns -1 on error, 0 on success
- amongst other things the previous incarnation could return nothing
at all in once case.
* else { if () { ; } } -> else if () { ; }
* < 80 columns wide
* removed trailing whitespace
Is it ok to apply this incarntation of the patch?
I can make my changes a second patch if you prefer.
Signed-off-by: Simon Horman <horms@verge.net.au>
* Incremental version of above patch
* Include kexec-ia64.h in kexec-elf-ia64.c for update_loaded_segments()
Signed-off-by: Simon Horman <horms@verge.net.au>
-rw-r--r-- | kexec/arch/ia64/kexec-elf-ia64.c | 13 | ||||
-rw-r--r-- | kexec/arch/ia64/kexec-ia64.c | 49 | ||||
-rw-r--r-- | kexec/arch/ia64/kexec-ia64.h | 2 |
3 files changed, 32 insertions, 32 deletions
diff --git a/kexec/arch/ia64/kexec-elf-ia64.c b/kexec/arch/ia64/kexec-elf-ia64.c index 2dd0bc8..1d63c07 100644 --- a/kexec/arch/ia64/kexec-elf-ia64.c +++ b/kexec/arch/ia64/kexec-elf-ia64.c @@ -42,6 +42,7 @@ #include "../../kexec.h" #include "../../kexec-syscall.h" #include "../../kexec-elf.h" +#include "kexec-ia64.h" #include "crashdump-ia64.h" #include <arch/options.h> @@ -86,8 +87,8 @@ void elf_ia64_usage(void) /* Move the crash kerenl physical offset to reserved region */ -void move_loaded_segments(struct kexec_info *info, struct mem_ehdr *ehdr, - unsigned long addr) +void move_loaded_segments(struct kexec_info *info, struct mem_ehdr *ehdr, + unsigned long addr) { int i; long offset; @@ -191,11 +192,9 @@ int elf_ia64_load(int argc, char **argv, const char *buf, off_t len, return -1; } move_loaded_segments(info, &ehdr, mem_min); - } else { - if (update_loaded_segments(info, &ehdr)) { - fprintf(stderr, "Failed to place kernel\n"); - return -1; - } + } else if (update_loaded_segments(info, &ehdr) < 0) { + fprintf(stderr, "Failed to place kernel\n"); + return -1; } entry = ehdr.e_entry; diff --git a/kexec/arch/ia64/kexec-ia64.c b/kexec/arch/ia64/kexec-ia64.c index f71236d..506d37d 100644 --- a/kexec/arch/ia64/kexec-ia64.c +++ b/kexec/arch/ia64/kexec-ia64.c @@ -38,6 +38,7 @@ static struct memory_range memory_range[MAX_MEMORY_RANGES]; static int memory_ranges; + /* Reserve range for EFI memmap and Boot parameter */ static int split_range(int range, unsigned long start, unsigned long end) { @@ -215,38 +216,38 @@ int update_loaded_segments(struct kexec_info *info, struct mem_ehdr *ehdr) int i; struct mem_phdr *phdr; unsigned long start_addr = ULONG_MAX, end_addr = 0; - unsigned long align = 1UL<<26; // 64M - for(i = 0; i < ehdr->e_phnum; i++) { - phdr = &ehdr->e_phdr[i]; - if (phdr->p_type == PT_LOAD) { - if (phdr->p_paddr < start_addr) - start_addr = phdr->p_paddr; - if ((phdr->p_paddr + phdr->p_memsz) > end_addr) - end_addr = phdr->p_paddr + phdr->p_memsz; - } + unsigned long align = 1UL<<26; /* 64M */ + unsigned long start, end; + for (i = 0; i < ehdr->e_phnum; i++) { + phdr = &ehdr->e_phdr[i]; + if (phdr->p_type != PT_LOAD) + continue; + if (phdr->p_paddr < start_addr) + start_addr = phdr->p_paddr; + if ((phdr->p_paddr + phdr->p_memsz) > end_addr) + end_addr = phdr->p_paddr + phdr->p_memsz; } - - for (i = 0; i < memory_ranges - && memory_range[i].start <= start_addr; i++) { + + for (i = 0; i < memory_ranges && memory_range[i].start <= start_addr; + i++) { if (memory_range[i].type == RANGE_RAM && - memory_range[i].end > end_addr) - return; + memory_range[i].end > end_addr) + return 0; } for (i = 0; i < memory_ranges; i++) { - if (memory_range[i].type == RANGE_RAM) { - unsigned long start = - (memory_range[i].start + align - 1)&~(align - 1); - unsigned long end = memory_range[i].end; - if (end > start && - (end - start) > (end_addr - start_addr)) { - move_loaded_segments(info, ehdr, start); - return 0; - } + if (memory_range[i].type != RANGE_RAM) + continue; + start = (memory_range[i].start + align - 1) & ~(align - 1); + end = memory_range[i].end; + if (end > start && (end - start) > (end_addr - start_addr)) { + move_loaded_segments(info, ehdr, start); + return 0; } } - return 1; + + return -1; } void arch_update_purgatory(struct kexec_info *info) diff --git a/kexec/arch/ia64/kexec-ia64.h b/kexec/arch/ia64/kexec-ia64.h index 138bf40..7995307 100644 --- a/kexec/arch/ia64/kexec-ia64.h +++ b/kexec/arch/ia64/kexec-ia64.h @@ -9,7 +9,7 @@ int elf_ia64_load(int argc, char **argv, const char *buf, off_t len, void elf_ia64_usage(void); int update_loaded_segments(struct kexec_info *info, struct mem_ehdr *ehdr); void move_loaded_segments(struct kexec_info *info, struct mem_ehdr *ehdr, - unsigned long addr); + unsigned long addr); #define MAX_MEMORY_RANGES 1024 #define EFI_PAGE_SIZE (1UL<<12) |