Re: [PATCH 1/2] Fix kexec on powerpc32
On Thu, 13 May 2010 at 15:50, Maxim Uvarov wrote: > zImage should not work with kexec. Only vmlinux. "should"? PPC64 has something nice there: > kexec/arch/ppc64/kexec-zImage-ppc64.c: > fprintf(stderr, "zImage support is still broken\n"); but I could not figure out where this is called from. Anyway, tried vmlinux now and it's working, yay! Thanks a lot, Maxim! Christian. -- BOFH excuse #363: Out of cards on drive D: ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
Re: [PATCH 1/2] Fix kexec on powerpc32
2010/5/13 Christian Kujau > On Wed, 12 May 2010 at 00:22, Christian Kujau wrote: > > # kexec -e > > Starting new kernel > > Bye! > > > > but then the system just hung there, no more messages, I had to > > powercycle it. > > Are there any debug flags (or kernel options?) I can set, to find out why > it hangs here? Or does kexec not understand zImages? > > zImage should not work with kexec. Only vmlinux. > Thanks, > Christian. > -- > BOFH excuse #373: > > Suspicious pointer corrupted virtual machine > -- Best regards, Maxim Uvarov ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
Re: [PATCH 1/2] Fix kexec on powerpc32
On Thu, 2010-05-13 at 04:19 -0700, Christian Kujau wrote: > On Wed, 12 May 2010 at 00:22, Christian Kujau wrote: > > # kexec -e > > Starting new kernel > > Bye! > > > > but then the system just hung there, no more messages, I had to > > powercycle it. > > Are there any debug flags (or kernel options?) I can set, to find out why > it hangs here? Or does kexec not understand zImages? Not really. There's extra debugging on some systems (with a hypervisor console). I think you're on 32-bit, which means I don't really know what I'm talking about, but I don't think zImage works - use vmlinux. cheers signature.asc Description: This is a digitally signed message part ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
Re: [PATCH 1/2] Fix kexec on powerpc32
On Wed, 12 May 2010 at 00:22, Christian Kujau wrote: > # kexec -e > Starting new kernel > Bye! > > but then the system just hung there, no more messages, I had to > powercycle it. Are there any debug flags (or kernel options?) I can set, to find out why it hangs here? Or does kexec not understand zImages? Thanks, Christian. -- BOFH excuse #373: Suspicious pointer corrupted virtual machine ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
Re: [PATCH 1/2] Fix kexec on powerpc32
On Wed, May 12, 2010 at 10:31:26AM +0400, Maxim Uvarov wrote: > 2010/5/12 Christian Kujau > > > Maxim Uvarov wrote on 2010-05-11 10:47 : > > > This patch is required in case if you are using new toolchains. > > > > I'm on Debian/stable (binutils 2.18, gcc 4.3.2), so I applied your patches > > to the latest -git checkout: > > > > First, compilation fails with: > > > > cc1: warnings being treated as errors > > kexec/arch/ppc/kexec-ppc.c: In function ‘get_base_ranges’: > > kexec/arch/ppc/kexec-ppc.c:258: error: value computed is not used > > make: *** [kexec/arch/ppc/kexec-ppc.o] Error 1 > > > > Somehow a "-" hyphen made it into one of the functions: > > > > > --- a/kexec/arch/ppc/kexec-ppc.c > > > +++ b/kexec/arch/ppc/kexec-ppc.c > > [...] > > > if (local_memory_ranges >= max_memory_ranges) { > > > - fclose(file); > > > - break; > > > + if (realloc_memory_ranges() < 0){ > > > + - fclose(file); > > > > Oh, I sent this patch twice with stg -a by mistake. And second version has > "-". I will fix and resend patches. > > > > > Removing this, gets me further, until: > > > > > > purgatory/arch/ppc/crt.o: In function `__lshrdi3': > > (.text+0xf0): multiple definition of `__lshrdi3' > > purgatory/arch/ppc/misc.o:(.text+0x50): first defined here > > collect2: ld returned 1 exit status > > make: *** [purgatory/purgatory.ro] Error 1 > > > > And has been defined in purgatory/arch/ppc/crt.S and > > ./purgatory/arch/ppc/misc.S. Removing it from e.g. crt.S > > makes it compile, I have not tested it yet, though :-) > > > > Yes, that is expected result for old tool chains. New tool chains (from code > sourcery ) need this crt.S. > I think we can have --with-oldtoolchain option to configure to point to old > tool chains. (or even rename it to --with-crts, > I don't know what is better.) I think --with-crts would be better as --with-oldtoolchain could mean many things. ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
Re: [PATCH 1/2] Fix kexec on powerpc32
2010/5/12 Christian Kujau > On Tue, 11 May 2010 at 21:47, Maxim Uvarov wrote: > > This patch is required in case if you are using new toolchains. > > After kexec-tools compiled, I actually tried it: > > # kexec -l /boot/2.6/zImage --command-line="root=/dev/hda6 ro" > # echo $? > 0 > # kexec -e > Starting new kernel > Bye! > > but then the system just hung there, no more messages, I had to > powercycle it. > > The --debug options is listed for "dol-ppc" systems (I have a PowerBook > G4, not sure if this falls into this category), when I use it the help > screen of kexec is displayed again and at the bottom: > > Cannot load /boot/2.6/zImage > > > This is with 2.6.34-rc7 (today's git): > > # file /boot/2.6/zImage > /boot/2.6/zImage: ELF 32-bit MSB executable, PowerPC or cisco 4500, > version 1 (SYSV), statically linked, with unknown capability 0x4100 > = 0x11676e75, with unknown capability 0x1 = 0x90402, not stripped > > > .config and dmesg: http://nerdbynature.de/bits/2.6.34-rc7/kexec/ > > Christian. > -- > make bzImage, not war > Can you try vmlinux? I tested only with vmlinux. -- Best regards, Maxim Uvarov ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
Re: [PATCH 1/2] Fix kexec on powerpc32
On Tue, 11 May 2010 at 21:47, Maxim Uvarov wrote: > This patch is required in case if you are using new toolchains. After kexec-tools compiled, I actually tried it: # kexec -l /boot/2.6/zImage --command-line="root=/dev/hda6 ro" # echo $? 0 # kexec -e Starting new kernel Bye! but then the system just hung there, no more messages, I had to powercycle it. The --debug options is listed for "dol-ppc" systems (I have a PowerBook G4, not sure if this falls into this category), when I use it the help screen of kexec is displayed again and at the bottom: Cannot load /boot/2.6/zImage This is with 2.6.34-rc7 (today's git): # file /boot/2.6/zImage /boot/2.6/zImage: ELF 32-bit MSB executable, PowerPC or cisco 4500, version 1 (SYSV), statically linked, with unknown capability 0x4100 = 0x11676e75, with unknown capability 0x1 = 0x90402, not stripped .config and dmesg: http://nerdbynature.de/bits/2.6.34-rc7/kexec/ Christian. -- make bzImage, not war ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
Re: [PATCH 1/2] Fix kexec on powerpc32
On Wed, 12 May 2010 at 10:31, Maxim Uvarov wrote: > Yes, that is expected result for old tool chains. New tool chains (from code > sourcery ) need this crt.S. > I think we can have --with-oldtoolchain option to configure to point to old > tool chains. (or even rename it to --with-crts, > I don't know what is better.) Yes, I've seen this --with-oldtoolchain flag in ./configure, but: when exactly is my toolchain old enough so that this flag has to be used? Is my binutils 2.18 too old? So, I'm all in favour of --with-crts (which I would use when compilation breaks with some descriptive error message) or, even better: can't we set this flag during ./configure automatically, based on the actual toolchain installed on the system? ./configure should be able to determine this, no? > This -Werror came from mips. kexec/arch/mips/Makefile. It is already removed > in the git. We already saw this problem. Powerpc including a mops Makefile, whooha :-) Thanks, Christian. -- BOFH excuse #91: Mouse chewed through power cable ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
Re: [PATCH 1/2] Fix kexec on powerpc32
2010/5/12 Christian Kujau > Maxim Uvarov wrote on 2010-05-11 10:47 : > > This patch is required in case if you are using new toolchains. > > I'm on Debian/stable (binutils 2.18, gcc 4.3.2), so I applied your patches > to the latest -git checkout: > > First, compilation fails with: > > cc1: warnings being treated as errors > kexec/arch/ppc/kexec-ppc.c: In function ‘get_base_ranges’: > kexec/arch/ppc/kexec-ppc.c:258: error: value computed is not used > make: *** [kexec/arch/ppc/kexec-ppc.o] Error 1 > > Somehow a "-" hyphen made it into one of the functions: > > > --- a/kexec/arch/ppc/kexec-ppc.c > > +++ b/kexec/arch/ppc/kexec-ppc.c > [...] > > if (local_memory_ranges >= max_memory_ranges) { > > - fclose(file); > > - break; > > + if (realloc_memory_ranges() < 0){ > > + - fclose(file); > > Oh, I sent this patch twice with stg -a by mistake. And second version has "-". I will fix and resend patches. > > Removing this, gets me further, until: > > > purgatory/arch/ppc/crt.o: In function `__lshrdi3': > (.text+0xf0): multiple definition of `__lshrdi3' > purgatory/arch/ppc/misc.o:(.text+0x50): first defined here > collect2: ld returned 1 exit status > make: *** [purgatory/purgatory.ro] Error 1 > > And has been defined in purgatory/arch/ppc/crt.S and > ./purgatory/arch/ppc/misc.S. Removing it from e.g. crt.S > makes it compile, I have not tested it yet, though :-) > Yes, that is expected result for old tool chains. New tool chains (from code sourcery ) need this crt.S. I think we can have --with-oldtoolchain option to configure to point to old tool chains. (or even rename it to --with-crts, I don't know what is better.) > > Thanks, > Christian. > > PS: Where is -Werror defined? I could not find it anywhere in the kexec >source (execpt in arch/mips)... > -- > This -Werror came from mips. kexec/arch/mips/Makefile. It is already removed in the git. We already saw this problem. > make bzImage, not war > -- Best regards, Maxim Uvarov ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
Re: [PATCH 1/2] Fix kexec on powerpc32
Maxim Uvarov wrote on 2010-05-11 10:47 : > This patch is required in case if you are using new toolchains. I'm on Debian/stable (binutils 2.18, gcc 4.3.2), so I applied your patches to the latest -git checkout: First, compilation fails with: cc1: warnings being treated as errors kexec/arch/ppc/kexec-ppc.c: In function ‘get_base_ranges’: kexec/arch/ppc/kexec-ppc.c:258: error: value computed is not used make: *** [kexec/arch/ppc/kexec-ppc.o] Error 1 Somehow a "-" hyphen made it into one of the functions: > --- a/kexec/arch/ppc/kexec-ppc.c > +++ b/kexec/arch/ppc/kexec-ppc.c [...] > if (local_memory_ranges >= max_memory_ranges) { > - fclose(file); > - break; > + if (realloc_memory_ranges() < 0){ > + - fclose(file); Removing this, gets me further, until: purgatory/arch/ppc/crt.o: In function `__lshrdi3': (.text+0xf0): multiple definition of `__lshrdi3' purgatory/arch/ppc/misc.o:(.text+0x50): first defined here collect2: ld returned 1 exit status make: *** [purgatory/purgatory.ro] Error 1 And has been defined in purgatory/arch/ppc/crt.S and ./purgatory/arch/ppc/misc.S. Removing it from e.g. crt.S makes it compile, I have not tested it yet, though :-) Thanks, Christian. PS: Where is -Werror defined? I could not find it anywhere in the kexec source (execpt in arch/mips)... -- make bzImage, not war ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
Re: [PATCH 1/2] Fix kexec on powerpc32
On Tue, 11 May 2010 at 21:47, Maxim Uvarov wrote: > This patch is required in case if you are using new toolchains. Ah, thanks I was missing (and looking for) crashdump-powerpc.h already :-) Christian -- make bzImage, not war ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
[PATCH 1/2] Fix kexec on powerpc32
This patch is required in case if you are using new toolchains. Best regards, Maxim Uvarov. From: Maxim Uvarov Signed-off-by: Maxim Uvarov --- kexec/arch/ppc/Makefile|2 kexec/arch/ppc/crashdump-powerpc.c | 439 ++ kexec/arch/ppc/crashdump-powerpc.h | 38 +++ kexec/arch/ppc/fs2dt.c | 460 kexec/arch/ppc/kexec-elf-ppc.c | 186 +-- kexec/arch/ppc/kexec-ppc.c | 276 -- kexec/arch/ppc/kexec-ppc.h | 32 +++ purgatory/arch/ppc/Makefile|2 purgatory/arch/ppc/purgatory-ppc.c | 38 ++- purgatory/arch/ppc/purgatory-ppc.h |4 purgatory/arch/ppc/v2wrap.S| 66 - purgatory/arch/ppc/v2wrap_32.S | 91 +++ 12 files changed, 1524 insertions(+), 110 deletions(-) create mode 100644 kexec/arch/ppc/crashdump-powerpc.c create mode 100644 kexec/arch/ppc/crashdump-powerpc.h create mode 100644 kexec/arch/ppc/fs2dt.c delete mode 100644 purgatory/arch/ppc/v2wrap.S create mode 100644 purgatory/arch/ppc/v2wrap_32.S diff --git a/kexec/arch/ppc/Makefile b/kexec/arch/ppc/Makefile index 1c7441c..5988213 100644 --- a/kexec/arch/ppc/Makefile +++ b/kexec/arch/ppc/Makefile @@ -11,6 +11,8 @@ ppc_KEXEC_SRCS += kexec/arch/ppc/kexec-uImage-ppc.c ppc_KEXEC_SRCS += kexec/arch/ppc/ppc-setup-simple.S ppc_KEXEC_SRCS += kexec/arch/ppc/ppc-setup-dol.S ppc_KEXEC_SRCS += kexec/arch/ppc/fixup_dtb.c +ppc_KEXEC_SRCS += kexec/arch/ppc/fs2dt.c +ppc_KEXEC_SRCS += kexec/arch/ppc/crashdump-powerpc.c ppc_KEXEC_SRCS += kexec/kexec-uImage.c libfdt_SRCS = kexec/arch/ppc/libfdt-wrapper.c diff --git a/kexec/arch/ppc/crashdump-powerpc.c b/kexec/arch/ppc/crashdump-powerpc.c new file mode 100644 index 000..7bfad20 --- /dev/null +++ b/kexec/arch/ppc/crashdump-powerpc.c @@ -0,0 +1,439 @@ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include "../../kexec.h" +#include "../../kexec-elf.h" +#include "../../kexec-syscall.h" +#include "../../crashdump.h" +#include "kexec-ppc.h" +#include "crashdump-powerpc.h" + +#ifdef CONFIG_PPC64 +static struct crash_elf_info elf_info64 = { +class: ELFCLASS64, +data: ELFDATA2MSB, +machine: EM_PPC64, +backup_src_start: BACKUP_SRC_START, +backup_src_end: BACKUP_SRC_END, +page_offset: PAGE_OFFSET, +lowmem_limit: MAXMEM, +}; +#endif +static struct crash_elf_info elf_info32 = { +class: ELFCLASS32, +data: ELFDATA2MSB, +#ifdef CONFIG_PPC64 +machine: EM_PPC64, +#else +machine: EM_PPC, +#endif +backup_src_start: BACKUP_SRC_START, +backup_src_end: BACKUP_SRC_END, +page_offset: PAGE_OFFSET, +lowmem_limit: MAXMEM, +}; + +/* Stores a sorted list of RAM memory ranges for which to create elf headers. + * A separate program header is created for backup region + */ +static struct memory_range *crash_memory_range; + +/* Define a variable to replace the CRASH_MAX_MEMORY_RANGES macro */ +static int crash_max_memory_ranges; + +/* + * Used to save various memory ranges/regions needed for the captured + * kernel to boot. (lime memmap= option in other archs) + */ +mem_rgns_t usablemem_rgns = {0, NULL}; + +/* + * To store the memory size of the first kernel and this value will be + * passed to the second kernel as command line (savemaxmem=xM). + * The second kernel will be calculated saved_max_pfn based on this + * variable. + * Since we are creating/using usable-memory property, there is no way + * we can determine the RAM size unless parsing the device-tree/memoy@/reg + * property in the kernel. + */ +unsigned long long saved_max_mem; + +/* Reads the appropriate file and retrieves the SYSTEM RAM regions for whom to + * create Elf headers. Keeping it separate from get_memory_ranges() as + * requirements are different in the case of normal kexec and crashdumps. + * + * Normal kexec needs to look at all of available physical memory irrespective + * of the fact how much of it is being used by currently running kernel. + * Crashdumps need to have access to memory regions actually being used by + * running kernel. Expecting a different file/data structure than /proc/iomem + * to look into down the line. May be something like /proc/kernelmem or may + * be zone data structures exported from kernel. + */ +static int get_crash_memory_ranges(struct memory_range **range, int *ranges) +{ + + int memory_ranges = 0; + char device_tree[256] = "/proc/device-tree/"; + char fname[256]; + char buf[MAXBYTES-1]; + DIR *dir, *dmem; + FILE *file; + struct dirent *dentry, *mentry; + int i, n, crash_rng_len = 0; + unsigned long long start, end, cstart, cend; + + crash_max_memory_ranges = max_memory_ranges + 6; + crash_rng_len = sizeof(struct memory_range) * crash_max_memory_ranges; + + crash_memory_range = (struct memory_range *) malloc(crash_rng_len); + if (!crash_memory_range) { + fprintf(stderr, "All