* [patch 1/5] kexec debug output improvments [not found] <20070507235727.631477448@am.sony.com> @ 2007-05-08 0:02 ` Geoff Levand 2007-05-08 6:08 ` Simon Horman ` (2 more replies) 2007-05-08 0:02 ` [patch 2/5] kexec improve build for ppc64 Geoff Levand ` (3 subsequent siblings) 4 siblings, 3 replies; 43+ messages in thread From: Geoff Levand @ 2007-05-08 0:02 UTC (permalink / raw) To: kexec; +Cc: Geoff Levand kexec debug output improvments. - Add better type checking for the debug output macro dfprintf(). - Add a convenence macro dprintf(). Signed-off-by: Geoff Levand <geoffrey.levand@am.sony.com> --- kexec/kexec.h | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) --- kexec-tools-hacked.orig/kexec/kexec.h +++ kexec-tools-hacked/kexec/kexec.h @@ -217,10 +217,12 @@ int parse_iomem_single(char *str, uint64 #define MAX_LINE 160 +#define dprintf(args...) dfprintf(stdout, args) #ifdef DEBUG -#define dfprintf(args...) do {fprintf(args);} while(0) +#define dfprintf(_f, _args...) do {fprintf(_f, _args);} while(0) #else -#define dfprintf(args...) do { } while(0) +static inline int __attribute__ ((format (printf, 1, 2))) + dfprintf(FILE *f, const char *fmt, ...) {return 0;} #endif #endif /* KEXEC_H */ -- _______________________________________________ kexec mailing list kexec@lists.infradead.org http://lists.infradead.org/mailman/listinfo/kexec ^ permalink raw reply [flat|nested] 43+ messages in thread
* Re: [patch 1/5] kexec debug output improvments 2007-05-08 0:02 ` [patch 1/5] kexec debug output improvments Geoff Levand @ 2007-05-08 6:08 ` Simon Horman 2007-05-08 14:40 ` Geoff Levand 2007-05-08 6:12 ` use dprintf Simon Horman 2007-05-08 6:20 ` [patch 1/5] kexec debug output improvments Vivek Goyal 2 siblings, 1 reply; 43+ messages in thread From: Simon Horman @ 2007-05-08 6:08 UTC (permalink / raw) To: Geoff Levand; +Cc: kexec On Mon, May 07, 2007 at 05:02:47PM -0700, Geoff Levand wrote: > kexec debug output improvments. > - Add better type checking for the debug output macro dfprintf(). > - Add a convenence macro dprintf(). > > Signed-off-by: Geoff Levand <geoffrey.levand@am.sony.com> > --- > kexec/kexec.h | 6 ++++-- > 1 file changed, 4 insertions(+), 2 deletions(-) > > --- kexec-tools-hacked.orig/kexec/kexec.h > +++ kexec-tools-hacked/kexec/kexec.h > @@ -217,10 +217,12 @@ int parse_iomem_single(char *str, uint64 > > #define MAX_LINE 160 > > +#define dprintf(args...) dfprintf(stdout, args) > #ifdef DEBUG > -#define dfprintf(args...) do {fprintf(args);} while(0) > +#define dfprintf(_f, _args...) do {fprintf(_f, _args);} while(0) > #else > -#define dfprintf(args...) do { } while(0) > +static inline int __attribute__ ((format (printf, 1, 2))) > + dfprintf(FILE *f, const char *fmt, ...) {return 0;} > #endif I think that this should be static inline int __attribute__ ((format (printf, 2, 3))) am I crazy? -- Horms H: http://www.vergenet.net/~horms/ W: http://www.valinux.co.jp/en/ _______________________________________________ kexec mailing list kexec@lists.infradead.org http://lists.infradead.org/mailman/listinfo/kexec ^ permalink raw reply [flat|nested] 43+ messages in thread
* Re: [patch 1/5] kexec debug output improvments 2007-05-08 6:08 ` Simon Horman @ 2007-05-08 14:40 ` Geoff Levand 2007-05-09 6:47 ` Simon Horman 0 siblings, 1 reply; 43+ messages in thread From: Geoff Levand @ 2007-05-08 14:40 UTC (permalink / raw) To: Simon Horman; +Cc: kexec Simon Horman wrote: > On Mon, May 07, 2007 at 05:02:47PM -0700, Geoff Levand wrote: >> kexec debug output improvments. >> - Add better type checking for the debug output macro dfprintf(). >> - Add a convenence macro dprintf(). >> >> Signed-off-by: Geoff Levand <geoffrey.levand@am.sony.com> >> --- >> kexec/kexec.h | 6 ++++-- >> 1 file changed, 4 insertions(+), 2 deletions(-) >> >> --- kexec-tools-hacked.orig/kexec/kexec.h >> +++ kexec-tools-hacked/kexec/kexec.h >> @@ -217,10 +217,12 @@ int parse_iomem_single(char *str, uint64 >> >> #define MAX_LINE 160 >> >> +#define dprintf(args...) dfprintf(stdout, args) >> #ifdef DEBUG >> -#define dfprintf(args...) do {fprintf(args);} while(0) >> +#define dfprintf(_f, _args...) do {fprintf(_f, _args);} while(0) >> #else >> -#define dfprintf(args...) do { } while(0) >> +static inline int __attribute__ ((format (printf, 1, 2))) >> + dfprintf(FILE *f, const char *fmt, ...) {return 0;} >> #endif > > I think that this should be > > static inline int __attribute__ ((format (printf, 2, 3))) > > am I crazy? Yes, you are not crazy! My mistake. -Geoff _______________________________________________ kexec mailing list kexec@lists.infradead.org http://lists.infradead.org/mailman/listinfo/kexec ^ permalink raw reply [flat|nested] 43+ messages in thread
* Re: [patch 1/5] kexec debug output improvments 2007-05-08 14:40 ` Geoff Levand @ 2007-05-09 6:47 ` Simon Horman 0 siblings, 0 replies; 43+ messages in thread From: Simon Horman @ 2007-05-09 6:47 UTC (permalink / raw) To: Geoff Levand; +Cc: Vivek Goyal, kexec On Tue, May 08, 2007 at 07:40:09AM -0700, Geoff Levand wrote: > Simon Horman wrote: > > On Mon, May 07, 2007 at 05:02:47PM -0700, Geoff Levand wrote: > >> kexec debug output improvments. > >> - Add better type checking for the debug output macro dfprintf(). > >> - Add a convenence macro dprintf(). > >> > >> Signed-off-by: Geoff Levand <geoffrey.levand@am.sony.com> > >> --- > >> kexec/kexec.h | 6 ++++-- > >> 1 file changed, 4 insertions(+), 2 deletions(-) > >> > >> --- kexec-tools-hacked.orig/kexec/kexec.h > >> +++ kexec-tools-hacked/kexec/kexec.h > >> @@ -217,10 +217,12 @@ int parse_iomem_single(char *str, uint64 > >> > >> #define MAX_LINE 160 > >> > >> +#define dprintf(args...) dfprintf(stdout, args) > >> #ifdef DEBUG > >> -#define dfprintf(args...) do {fprintf(args);} while(0) > >> +#define dfprintf(_f, _args...) do {fprintf(_f, _args);} while(0) > >> #else > >> -#define dfprintf(args...) do { } while(0) > >> +static inline int __attribute__ ((format (printf, 1, 2))) > >> + dfprintf(FILE *f, const char *fmt, ...) {return 0;} > >> #endif > > > > I think that this should be > > > > static inline int __attribute__ ((format (printf, 2, 3))) > > > > am I crazy? > > Yes, you are not crazy! My mistake. Thanks, I've applied a version with that fix. I also tried moving dprintf inside the #ifdef as suggested by Vivek. Turns out that both he and I were (somewhat obviously) wrong as if dprintf is in there and DEBUG isn't defined, then dprintf doesn't exists at all, which kind of bothers code that calls it. -- Horms H: http://www.vergenet.net/~horms/ W: http://www.valinux.co.jp/en/ _______________________________________________ kexec mailing list kexec@lists.infradead.org http://lists.infradead.org/mailman/listinfo/kexec ^ permalink raw reply [flat|nested] 43+ messages in thread
* use dprintf 2007-05-08 0:02 ` [patch 1/5] kexec debug output improvments Geoff Levand 2007-05-08 6:08 ` Simon Horman @ 2007-05-08 6:12 ` Simon Horman 2007-05-09 21:40 ` [patch 1/2] kexec remove last remaining dfprintf Geoff Levand 2007-05-09 21:40 ` [patch 2/2] kexec rename dprintf to dbgprintf Geoff Levand 2007-05-08 6:20 ` [patch 1/5] kexec debug output improvments Vivek Goyal 2 siblings, 2 replies; 43+ messages in thread From: Simon Horman @ 2007-05-08 6:12 UTC (permalink / raw) To: Geoff Levand; +Cc: kexec Use the new fprintf macro where possible Cc: Geoff Levand <geoffrey.levand@am.sony.com> Signed-off-by: Simon Horman <horms@verge.net.au> --- kexec/arch/i386/crashdump-x86.c | 5 ++--- kexec/arch/i386/kexec-bzImage.c | 9 ++++----- kexec/arch/i386/x86-linux-setup.c | 6 +++--- kexec/crashdump-elf.c | 30 ++++++++++++++---------------- 4 files changed, 23 insertions(+), 27 deletions(-) Index: kexec-tools-testing-geoff-levand/kexec/arch/i386/crashdump-x86.c =================================================================== --- kexec-tools-testing-geoff-levand.orig/kexec/arch/i386/crashdump-x86.c 2007-05-08 12:08:53.000000000 +0900 +++ kexec-tools-testing-geoff-levand/kexec/arch/i386/crashdump-x86.c 2007-05-08 12:10:58.000000000 +0900 @@ -515,8 +515,7 @@ int load_crashdump_segments(struct kexec memset(tmp, 0, sz); info->backup_start = add_buffer(info, tmp, sz, sz, align, 0, max_addr, -1); - dfprintf(stdout, "Created backup segment at 0x%lx\n", - info->backup_start); + dprintf("Created backup segment at 0x%lx\n", info->backup_start); if (delete_memmap(memmap_p, info->backup_start, sz) < 0) return -1; @@ -545,7 +544,7 @@ int load_crashdump_segments(struct kexec */ elfcorehdr = add_buffer(info, tmp, sz, 16*1024, align, min_base, max_addr, -1); - dfprintf(stdout, "Created elf header segment at 0x%lx\n", elfcorehdr); + dprintf("Created elf header segment at 0x%lx\n", elfcorehdr); if (delete_memmap(memmap_p, elfcorehdr, sz) < 0) return -1; cmdline_add_memmap(mod_cmdline, memmap_p); Index: kexec-tools-testing-geoff-levand/kexec/arch/i386/kexec-bzImage.c =================================================================== --- kexec-tools-testing-geoff-levand.orig/kexec/arch/i386/kexec-bzImage.c 2007-05-08 12:08:53.000000000 +0900 +++ kexec-tools-testing-geoff-levand/kexec/arch/i386/kexec-bzImage.c 2007-05-08 12:10:58.000000000 +0900 @@ -136,7 +136,7 @@ int do_bzImage_load(struct kexec_info *i if (setup_header.protocol_version >= 0x0205) { relocatable_kernel = setup_header.relocatable_kernel; - dfprintf(stdout, "bzImage is relocatable\n"); + dprintf("bzImage is relocatable\n"); } /* Can't use bzImage for crash dump purposes with real mode entry */ @@ -192,8 +192,7 @@ int do_bzImage_load(struct kexec_info *i else elf_rel_build_load(info, &info->rhdr, purgatory, purgatory_size, 0x3000, 640*1024, -1, 0); - dfprintf(stdout, "Loaded purgatory at addr 0x%lx\n", - info->rhdr.rel_addr); + dprintf("Loaded purgatory at addr 0x%lx\n", info->rhdr.rel_addr); /* The argument/parameter segment */ setup_size = kern16_size + command_line_len; real_mode = xmalloc(setup_size); @@ -215,7 +214,7 @@ int do_bzImage_load(struct kexec_info *i add_segment(info, real_mode, setup_size, SETUP_BASE, setup_size); setup_base = SETUP_BASE; } - dfprintf(stdout, "Loaded real-mode code and command line at 0x%lx\n", + dprintf("Loaded real-mode code and command line at 0x%lx\n", setup_base); /* Verify purgatory loads higher than the parameters */ @@ -247,7 +246,7 @@ int do_bzImage_load(struct kexec_info *i kernel32_load_addr, size); } - dfprintf(stdout, "Loaded 32bit kernel at 0x%lx\n", kernel32_load_addr); + dprintf("Loaded 32bit kernel at 0x%lx\n", kernel32_load_addr); /* Tell the kernel what is going on */ setup_linux_bootloader_parameters(info, real_mode, setup_base, Index: kexec-tools-testing-geoff-levand/kexec/arch/i386/x86-linux-setup.c =================================================================== --- kexec-tools-testing-geoff-levand.orig/kexec/arch/i386/x86-linux-setup.c 2007-05-08 12:08:53.000000000 +0900 +++ kexec-tools-testing-geoff-levand/kexec/arch/i386/x86-linux-setup.c 2007-05-08 12:10:58.000000000 +0900 @@ -61,7 +61,7 @@ void setup_linux_bootloader_parameters( initrd_addr_max = DEFAULT_INITRD_ADDR_MAX; if (real_mode->protocol_version >= 0x0203) { initrd_addr_max = real_mode->initrd_addr_max; - dfprintf(stdout, "initrd_addr_max is 0x%lx\n", initrd_addr_max); + dprintf("initrd_addr_max is 0x%lx\n", initrd_addr_max); } /* Load the initrd if we have one */ @@ -69,8 +69,8 @@ void setup_linux_bootloader_parameters( initrd_base = add_buffer(info, initrd_buf, initrd_size, initrd_size, 4096, INITRD_BASE, initrd_addr_max, -1); - dfprintf(stdout, "Loaded initrd at 0x%lx size 0x%lx\n", - initrd_base, initrd_size); + dprintf("Loaded initrd at 0x%lx size 0x%lx\n", initrd_base, + initrd_size); } else { initrd_base = 0; initrd_size = 0; Index: kexec-tools-testing-geoff-levand/kexec/crashdump-elf.c =================================================================== --- kexec-tools-testing-geoff-levand.orig/kexec/crashdump-elf.c 2007-05-08 12:08:53.000000000 +0900 +++ kexec-tools-testing-geoff-levand/kexec/crashdump-elf.c 2007-05-08 12:12:03.000000000 +0900 @@ -4,22 +4,20 @@ #endif #if (ELF_WIDTH == 64) -#define dfprintf_phdr(fh, prefix, phdr) \ +#define dprintf_phdr(prefix, phdr) \ do { \ - dfprintf((fh), \ - "%s: p_type = %u, p_offset = 0x%lx p_paddr = 0x%lx " \ - "p_vaddr = 0x%lx p_filesz = 0x%lx p_memsz = 0x%lx\n", \ - (prefix), (phdr)->p_type, (phdr)->p_offset, (phdr)->p_paddr, \ - (phdr)->p_vaddr, (phdr)->p_filesz, (phdr)->p_memsz); \ + dprintf("%s: p_type = %u, p_offset = 0x%lx p_paddr = 0x%lx " \ + "p_vaddr = 0x%lx p_filesz = 0x%lx p_memsz = 0x%lx\n", \ + (prefix), (phdr)->p_type, (phdr)->p_offset, (phdr)->p_paddr, \ + (phdr)->p_vaddr, (phdr)->p_filesz, (phdr)->p_memsz); \ } while(0) #else -#define dfprintf_phdr(fh, prefix, phdr) \ +#define dprintf_phdr(prefix, phdr) \ do { \ - dfprintf((fh), \ - "%s: p_type = %u, p_offset = 0x%x " "p_paddr = 0x%x " \ - "p_vaddr = 0x%x p_filesz = 0x%x p_memsz = 0x%x\n", \ - (prefix), (phdr)->p_type, (phdr)->p_offset, (phdr)->p_paddr, \ - (phdr)->p_vaddr, (phdr)->p_filesz, (phdr)->p_memsz); \ + dprintf("%s: p_type = %u, p_offset = 0x%x " "p_paddr = 0x%x " \ + "p_vaddr = 0x%x p_filesz = 0x%x p_memsz = 0x%x\n", \ + (prefix), (phdr)->p_type, (phdr)->p_offset, (phdr)->p_paddr, \ + (phdr)->p_vaddr, (phdr)->p_filesz, (phdr)->p_memsz); \ } while(0) #endif @@ -145,7 +143,7 @@ int FUNC(struct kexec_info *info, /* Increment number of program headers. */ (elf->e_phnum)++; - dfprintf_phdr(stdout, "Elf header", phdr); + dprintf_phdr("Elf header", phdr); } /* Setup an PT_LOAD type program header for the region where @@ -162,7 +160,7 @@ int FUNC(struct kexec_info *info, phdr->p_filesz = phdr->p_memsz = info->kern_size; phdr->p_align = 0; (elf->e_phnum)++; - dfprintf_phdr(stdout, "Kernel text Elf header", phdr); + dprintf_phdr("Kernel text Elf header", phdr); } /* Setup PT_LOAD type program header for every system RAM chunk. @@ -203,9 +201,9 @@ int FUNC(struct kexec_info *info, /* Increment number of program headers. */ (elf->e_phnum)++; - dfprintf_phdr(stdout, "Elf header", phdr); + dprintf_phdr("Elf header", phdr); } return 0; } -#undef dfprintf_phdr +#undef dprintf_phdr _______________________________________________ kexec mailing list kexec@lists.infradead.org http://lists.infradead.org/mailman/listinfo/kexec ^ permalink raw reply [flat|nested] 43+ messages in thread
* [patch 1/2] kexec remove last remaining dfprintf 2007-05-08 6:12 ` use dprintf Simon Horman @ 2007-05-09 21:40 ` Geoff Levand 2007-05-10 2:13 ` Simon Horman 2007-05-09 21:40 ` [patch 2/2] kexec rename dprintf to dbgprintf Geoff Levand 1 sibling, 1 reply; 43+ messages in thread From: Geoff Levand @ 2007-05-09 21:40 UTC (permalink / raw) To: Simon Horman; +Cc: kexec Remove the last remaining dfprintf call and remove the dfprintf definition. Signed-off-by: Geoff Levand <geoffrey.levand@am.sony.com> --- kexec/arch/ppc64/kexec-ppc64.c | 2 +- kexec/kexec.h | 7 +++---- 2 files changed, 4 insertions(+), 5 deletions(-) --- ps3-kexec-tools.orig/kexec/arch/ppc64/kexec-ppc64.c +++ ps3-kexec-tools/kexec/arch/ppc64/kexec-ppc64.c @@ -207,7 +207,7 @@ static int get_base_ranges(void) ((unsigned long long *)buf)[1]; base_memory_range[local_memory_ranges].type = RANGE_RAM; local_memory_ranges++; - dfprintf(stderr, "%016llx-%016llx : %x\n", + dprintf("%016llx-%016llx : %x\n", base_memory_range[local_memory_ranges-1].start, base_memory_range[local_memory_ranges-1].end, base_memory_range[local_memory_ranges-1].type); --- ps3-kexec-tools.orig/kexec/kexec.h +++ ps3-kexec-tools/kexec/kexec.h @@ -217,12 +217,11 @@ int parse_iomem_single(char *str, uint64 #define MAX_LINE 160 -#define dprintf(args...) dfprintf(stdout, args) #ifdef DEBUG -#define dfprintf(_f, _args...) do {fprintf(_f, _args);} while(0) +#define dprintf(_args...) do {printf(_args);} while(0) #else -static inline int __attribute__ ((format (printf, 2, 3))) - dfprintf(FILE *f, const char *fmt, ...) {return 0;} +static inline int __attribute__ ((format (printf, 1, 2))) + dprintf(const char *fmt, ...) {return 0;} #endif #endif /* KEXEC_H */ _______________________________________________ kexec mailing list kexec@lists.infradead.org http://lists.infradead.org/mailman/listinfo/kexec ^ permalink raw reply [flat|nested] 43+ messages in thread
* Re: [patch 1/2] kexec remove last remaining dfprintf 2007-05-09 21:40 ` [patch 1/2] kexec remove last remaining dfprintf Geoff Levand @ 2007-05-10 2:13 ` Simon Horman 2007-05-10 2:55 ` Simon Horman 0 siblings, 1 reply; 43+ messages in thread From: Simon Horman @ 2007-05-10 2:13 UTC (permalink / raw) To: Geoff Levand; +Cc: kexec On Wed, May 09, 2007 at 02:40:20PM -0700, Geoff Levand wrote: > Remove the last remaining dfprintf call and remove the dfprintf > definition. So we are standardising on stdout for debug messages? Thats fine by me. However, curiously with your patch I get the following error. Perhaps we should choose a different name? i686-unknown-linux-gnu-gcc -Wall -O2 -fomit-frame-pointer -pipe -Wall -g -fno-strict-aliasing -Wstrict-prototypes -I/home/horms/local/opt/crosstool/i686/gcc-3.4.5-glibc-2.3.6/i686-unknown-linux-gnu/include -I./include -I./util_lib/include -DVERSION='"20070330-git"' -DRELEASE_DATE='"30th March 2007"' -DPACKAGE='"kexec-tools-testing"' -DPACKAGE_NAME=\"\" -DPACKAGE_TARNAME=\"\" -DPACKAGE_VERSION=\"\" -DPACKAGE_STRING=\"\" -DPACKAGE_BUGREPORT=\"\" -DSTDC_HEADERS=1 -DHAVE_SYS_TYPES_H=1 -DHAVE_SYS_STAT_H=1 -DHAVE_STDLIB_H=1 -DHAVE_STRING_H=1 -DHAVE_MEMORY_H=1 -DHAVE_STRINGS_H=1 -DHAVE_INTTYPES_H=1 -DHAVE_STDINT_H=1 -DHAVE_UNISTD_H=1 -DHAVE_ZLIB_H=1 -Wall -g -fno-strict-aliasing -Wstrict-prototypes -I/home/horms/local/opt/crosstool/i686/gcc-3.4.5-glibc-2.3.6/i686-unknown-linux-gnu/include -Ikexec/arch/i386/include -o /home/horms/lang/c/kexec-tools/kexec-tools-testing-geoff-levand/objdir-i686-unknown-linux-gnu/kexec/kexec.o -c kexec/kexec.c In file included from kexec/kexec.c:36: kexec/kexec.h:224: error: conflicting types for 'dprintf' /home/horms/local/opt/crosstool/i686/gcc-3.4.5-glibc-2.3.6/i686-unknown-linux-gnu/bin/../lib/gcc/i686-unknown-linux-gnu/3.4.5/../../../../i686-unknown-linux-gnu/sys-include/stdio.h:384: error: previous declaration of 'dprintf' was here kexec/kexec.h:224: error: conflicting types for 'dprintf' /home/horms/local/opt/crosstool/i686/gcc-3.4.5-glibc-2.3.6/i686-unknown-linux-gnu/bin/../lib/gcc/i686-unknown-linux-gnu/3.4.5/../../../../i686-unknown-linux-gnu/sys-include/stdio.h:384: error: previous declaration of 'dprintf' was here make: *** [/home/horms/lang/c/kexec-tools/kexec-tools-testing-geoff-levand/objdir-i686-unknown-linux-gnu/kexec/kexec.o] Error 1 The relevant section of stdio.h is: #ifdef __USE_GNU /* Write formatted output to a string dynamically allocated with `malloc'. Store the address of the string in *PTR. */ extern int vasprintf (char **__restrict __ptr, __const char *__restrict __f, _G_va_list __arg) __THROW __attribute__ ((__format__ (__printf__, 2, 0))); extern int __asprintf (char **__restrict __ptr, __const char *__restrict __fmt, ...) __THROW __attribute__ ((__format__ (__printf__, 2, 3))); extern int asprintf (char **__restrict __ptr, __const char *__restrict __fmt, ...) __THROW __attribute__ ((__format__ (__printf__, 2, 3))); /* Write formatted output to a file descriptor. These functions are not part of POSIX and therefore no official cancellation point. But due to similarity with an POSIX interface or due to the implementation they are cancellation points and therefore not marked with __THROW. */ extern int vdprintf (int __fd, __const char *__restrict __fmt, _G_va_list __arg) __attribute__ ((__format__ (__printf__, 2, 0))); extern int dprintf (int __fd, __const char *__restrict __fmt, ...) __attribute__ ((__format__ (__printf__, 2, 3))); #endif -- Horms H: http://www.vergenet.net/~horms/ W: http://www.valinux.co.jp/en/ _______________________________________________ kexec mailing list kexec@lists.infradead.org http://lists.infradead.org/mailman/listinfo/kexec ^ permalink raw reply [flat|nested] 43+ messages in thread
* Re: [patch 1/2] kexec remove last remaining dfprintf 2007-05-10 2:13 ` Simon Horman @ 2007-05-10 2:55 ` Simon Horman 0 siblings, 0 replies; 43+ messages in thread From: Simon Horman @ 2007-05-10 2:55 UTC (permalink / raw) To: Geoff Levand; +Cc: kexec On Thu, May 10, 2007 at 11:13:19AM +0900, Simon Horman wrote: > On Wed, May 09, 2007 at 02:40:20PM -0700, Geoff Levand wrote: > > Remove the last remaining dfprintf call and remove the dfprintf > > definition. > > So we are standardising on stdout for debug messages? > Thats fine by me. However, curiously with your patch I get > the following error. Perhaps we should choose a different name? I see that you fixed this in a subsequent patch. Applied :-) -- Horms H: http://www.vergenet.net/~horms/ W: http://www.valinux.co.jp/en/ _______________________________________________ kexec mailing list kexec@lists.infradead.org http://lists.infradead.org/mailman/listinfo/kexec ^ permalink raw reply [flat|nested] 43+ messages in thread
* [patch 2/2] kexec rename dprintf to dbgprintf 2007-05-08 6:12 ` use dprintf Simon Horman 2007-05-09 21:40 ` [patch 1/2] kexec remove last remaining dfprintf Geoff Levand @ 2007-05-09 21:40 ` Geoff Levand 2007-05-10 2:14 ` Simon Horman 1 sibling, 1 reply; 43+ messages in thread From: Geoff Levand @ 2007-05-09 21:40 UTC (permalink / raw) To: Simon Horman; +Cc: kexec The recently introduce kexec debug routine dprintf clashes with an existing libc symbol. Rename dprintf to dbgprintf. Signed-off-by: Geoff Levand <geoffrey.levand@am.sony.com> --- kexec/arch/i386/crashdump-x86.c | 4 ++-- kexec/arch/i386/kexec-bzImage.c | 8 ++++---- kexec/arch/i386/x86-linux-setup.c | 4 ++-- kexec/arch/ppc64/kexec-ppc64.c | 2 +- kexec/crashdump-elf.c | 16 ++++++++-------- kexec/kexec.h | 4 ++-- 6 files changed, 19 insertions(+), 19 deletions(-) --- ps3-kexec-tools.orig/kexec/arch/i386/crashdump-x86.c +++ ps3-kexec-tools/kexec/arch/i386/crashdump-x86.c @@ -515,7 +515,7 @@ int load_crashdump_segments(struct kexec memset(tmp, 0, sz); info->backup_start = add_buffer(info, tmp, sz, sz, align, 0, max_addr, -1); - dprintf("Created backup segment at 0x%lx\n", info->backup_start); + dbgprintf("Created backup segment at 0x%lx\n", info->backup_start); if (delete_memmap(memmap_p, info->backup_start, sz) < 0) return -1; @@ -544,7 +544,7 @@ int load_crashdump_segments(struct kexec */ elfcorehdr = add_buffer(info, tmp, sz, 16*1024, align, min_base, max_addr, -1); - dprintf("Created elf header segment at 0x%lx\n", elfcorehdr); + dbgprintf("Created elf header segment at 0x%lx\n", elfcorehdr); if (delete_memmap(memmap_p, elfcorehdr, sz) < 0) return -1; cmdline_add_memmap(mod_cmdline, memmap_p); --- ps3-kexec-tools.orig/kexec/arch/i386/kexec-bzImage.c +++ ps3-kexec-tools/kexec/arch/i386/kexec-bzImage.c @@ -136,7 +136,7 @@ int do_bzImage_load(struct kexec_info *i if (setup_header.protocol_version >= 0x0205) { relocatable_kernel = setup_header.relocatable_kernel; - dprintf("bzImage is relocatable\n"); + dbgprintf("bzImage is relocatable\n"); } /* Can't use bzImage for crash dump purposes with real mode entry */ @@ -192,7 +192,7 @@ int do_bzImage_load(struct kexec_info *i else elf_rel_build_load(info, &info->rhdr, purgatory, purgatory_size, 0x3000, 640*1024, -1, 0); - dprintf("Loaded purgatory at addr 0x%lx\n", info->rhdr.rel_addr); + dbgprintf("Loaded purgatory at addr 0x%lx\n", info->rhdr.rel_addr); /* The argument/parameter segment */ setup_size = kern16_size + command_line_len; real_mode = xmalloc(setup_size); @@ -214,7 +214,7 @@ int do_bzImage_load(struct kexec_info *i add_segment(info, real_mode, setup_size, SETUP_BASE, setup_size); setup_base = SETUP_BASE; } - dprintf("Loaded real-mode code and command line at 0x%lx\n", + dbgprintf("Loaded real-mode code and command line at 0x%lx\n", setup_base); /* Verify purgatory loads higher than the parameters */ @@ -246,7 +246,7 @@ int do_bzImage_load(struct kexec_info *i kernel32_load_addr, size); } - dprintf("Loaded 32bit kernel at 0x%lx\n", kernel32_load_addr); + dbgprintf("Loaded 32bit kernel at 0x%lx\n", kernel32_load_addr); /* Tell the kernel what is going on */ setup_linux_bootloader_parameters(info, real_mode, setup_base, --- ps3-kexec-tools.orig/kexec/arch/i386/x86-linux-setup.c +++ ps3-kexec-tools/kexec/arch/i386/x86-linux-setup.c @@ -61,7 +61,7 @@ void setup_linux_bootloader_parameters( initrd_addr_max = DEFAULT_INITRD_ADDR_MAX; if (real_mode->protocol_version >= 0x0203) { initrd_addr_max = real_mode->initrd_addr_max; - dprintf("initrd_addr_max is 0x%lx\n", initrd_addr_max); + dbgprintf("initrd_addr_max is 0x%lx\n", initrd_addr_max); } /* Load the initrd if we have one */ @@ -69,7 +69,7 @@ void setup_linux_bootloader_parameters( initrd_base = add_buffer(info, initrd_buf, initrd_size, initrd_size, 4096, INITRD_BASE, initrd_addr_max, -1); - dprintf("Loaded initrd at 0x%lx size 0x%lx\n", initrd_base, + dbgprintf("Loaded initrd at 0x%lx size 0x%lx\n", initrd_base, initrd_size); } else { initrd_base = 0; --- ps3-kexec-tools.orig/kexec/arch/ppc64/kexec-ppc64.c +++ ps3-kexec-tools/kexec/arch/ppc64/kexec-ppc64.c @@ -207,7 +207,7 @@ static int get_base_ranges(void) ((unsigned long long *)buf)[1]; base_memory_range[local_memory_ranges].type = RANGE_RAM; local_memory_ranges++; - dprintf("%016llx-%016llx : %x\n", + dbgprintf("%016llx-%016llx : %x\n", base_memory_range[local_memory_ranges-1].start, base_memory_range[local_memory_ranges-1].end, base_memory_range[local_memory_ranges-1].type); --- ps3-kexec-tools.orig/kexec/crashdump-elf.c +++ ps3-kexec-tools/kexec/crashdump-elf.c @@ -4,17 +4,17 @@ #endif #if (ELF_WIDTH == 64) -#define dprintf_phdr(prefix, phdr) \ +#define dbgprintf_phdr(prefix, phdr) \ do { \ - dprintf("%s: p_type = %u, p_offset = 0x%lx p_paddr = 0x%lx " \ + dbgprintf("%s: p_type = %u, p_offset = 0x%lx p_paddr = 0x%lx " \ "p_vaddr = 0x%lx p_filesz = 0x%lx p_memsz = 0x%lx\n", \ (prefix), (phdr)->p_type, (phdr)->p_offset, (phdr)->p_paddr, \ (phdr)->p_vaddr, (phdr)->p_filesz, (phdr)->p_memsz); \ } while(0) #else -#define dprintf_phdr(prefix, phdr) \ +#define dbgprintf_phdr(prefix, phdr) \ do { \ - dprintf("%s: p_type = %u, p_offset = 0x%x " "p_paddr = 0x%x " \ + dbgprintf("%s: p_type = %u, p_offset = 0x%x " "p_paddr = 0x%x " \ "p_vaddr = 0x%x p_filesz = 0x%x p_memsz = 0x%x\n", \ (prefix), (phdr)->p_type, (phdr)->p_offset, (phdr)->p_paddr, \ (phdr)->p_vaddr, (phdr)->p_filesz, (phdr)->p_memsz); \ @@ -143,7 +143,7 @@ int FUNC(struct kexec_info *info, /* Increment number of program headers. */ (elf->e_phnum)++; - dprintf_phdr("Elf header", phdr); + dbgprintf_phdr("Elf header", phdr); } /* Setup an PT_LOAD type program header for the region where @@ -160,7 +160,7 @@ int FUNC(struct kexec_info *info, phdr->p_filesz = phdr->p_memsz = info->kern_size; phdr->p_align = 0; (elf->e_phnum)++; - dprintf_phdr("Kernel text Elf header", phdr); + dbgprintf_phdr("Kernel text Elf header", phdr); } /* Setup PT_LOAD type program header for every system RAM chunk. @@ -201,9 +201,9 @@ int FUNC(struct kexec_info *info, /* Increment number of program headers. */ (elf->e_phnum)++; - dprintf_phdr("Elf header", phdr); + dbgprintf_phdr("Elf header", phdr); } return 0; } -#undef dprintf_phdr +#undef dbgprintf_phdr --- ps3-kexec-tools.orig/kexec/kexec.h +++ ps3-kexec-tools/kexec/kexec.h @@ -218,10 +218,10 @@ int parse_iomem_single(char *str, uint64 #define MAX_LINE 160 #ifdef DEBUG -#define dprintf(_args...) do {printf(_args);} while(0) +#define dbgprintf(_args...) do {printf(_args);} while(0) #else static inline int __attribute__ ((format (printf, 1, 2))) - dprintf(const char *fmt, ...) {return 0;} + dbgprintf(const char *fmt, ...) {return 0;} #endif #endif /* KEXEC_H */ _______________________________________________ kexec mailing list kexec@lists.infradead.org http://lists.infradead.org/mailman/listinfo/kexec ^ permalink raw reply [flat|nested] 43+ messages in thread
* Re: [patch 2/2] kexec rename dprintf to dbgprintf 2007-05-09 21:40 ` [patch 2/2] kexec rename dprintf to dbgprintf Geoff Levand @ 2007-05-10 2:14 ` Simon Horman 2007-05-10 2:55 ` Simon Horman 0 siblings, 1 reply; 43+ messages in thread From: Simon Horman @ 2007-05-10 2:14 UTC (permalink / raw) To: Geoff Levand; +Cc: kexec On Wed, May 09, 2007 at 02:40:27PM -0700, Geoff Levand wrote: > The recently introduce kexec debug routine dprintf clashes with an existing > libc symbol. Rename dprintf to dbgprintf. Ok, ignore my previous email :-) This seems good to me. I'll test it out in my tree. -- Horms H: http://www.vergenet.net/~horms/ W: http://www.valinux.co.jp/en/ _______________________________________________ kexec mailing list kexec@lists.infradead.org http://lists.infradead.org/mailman/listinfo/kexec ^ permalink raw reply [flat|nested] 43+ messages in thread
* Re: [patch 2/2] kexec rename dprintf to dbgprintf 2007-05-10 2:14 ` Simon Horman @ 2007-05-10 2:55 ` Simon Horman 2007-05-10 22:10 ` kexec and kdb Preetesh Parekh 0 siblings, 1 reply; 43+ messages in thread From: Simon Horman @ 2007-05-10 2:55 UTC (permalink / raw) To: Geoff Levand; +Cc: kexec On Thu, May 10, 2007 at 11:14:16AM +0900, Simon Horman wrote: > On Wed, May 09, 2007 at 02:40:27PM -0700, Geoff Levand wrote: > > The recently introduce kexec debug routine dprintf clashes with an existing > > libc symbol. Rename dprintf to dbgprintf. > > Ok, ignore my previous email :-) > > This seems good to me. I'll test it out in my tree. Applied. -- Horms H: http://www.vergenet.net/~horms/ W: http://www.valinux.co.jp/en/ _______________________________________________ kexec mailing list kexec@lists.infradead.org http://lists.infradead.org/mailman/listinfo/kexec ^ permalink raw reply [flat|nested] 43+ messages in thread
* kexec and kdb 2007-05-10 2:55 ` Simon Horman @ 2007-05-10 22:10 ` Preetesh Parekh 2007-05-11 4:23 ` Vivek Goyal 0 siblings, 1 reply; 43+ messages in thread From: Preetesh Parekh @ 2007-05-10 22:10 UTC (permalink / raw) To: kexec Hi, I have a question about kexec and kdb. Please advice or point me to the right mailing list that can answer this. I have a linux 2.6.20 kernel (patched with kdb patches) on i686 system. I have setup a crash kernel using "kexec -p" command which is working very well. I tested this by triggering a crash by using "echo c > /proc/sysrq-trigger" command. The requirement is to allow kdb to invoke first after the kernel crash which is not happening now (The system directly gets booted with the dump kernel). Please let me know how to do this. Do we have any patch or steps for it ? You will get more details about my system below: # uname -a Linux mybox 2.6.20smp #1 SMP Mon May 7 11:23:42 PDT 2007 i686 i686 i386 GNU/Linux # kexec -p /boot/vmlinux-dump --initrd=/boot/initrd-dump.img --args-linux --append="root=/dev/hda6 init 1 irqpoll maxcpus=1" # more /proc/sys/kernel/kdb 1 # System Kernel config file: CONFIG_KEXEC=y CONFIG_KALLSYMS=y CONFIG_KALLSYMS_ALL=y CONFIG_KALLSYMS_EXTRA_PASS=y CONFIG_KDB=y CONFIG_KDB_MODULES=y # CONFIG_KDB_OFF is not set CONFIG_KDB_CONTINUE_CATASTROPHIC=0 CONFIG_KDB_USB=y Thanks Preetesh _______________________________________________ kexec mailing list kexec@lists.infradead.org http://lists.infradead.org/mailman/listinfo/kexec ^ permalink raw reply [flat|nested] 43+ messages in thread
* Re: kexec and kdb 2007-05-10 22:10 ` kexec and kdb Preetesh Parekh @ 2007-05-11 4:23 ` Vivek Goyal 2007-05-14 23:20 ` Preetesh Parekh 0 siblings, 1 reply; 43+ messages in thread From: Vivek Goyal @ 2007-05-11 4:23 UTC (permalink / raw) To: Preetesh Parekh; +Cc: kexec On Thu, May 10, 2007 at 03:10:16PM -0700, Preetesh Parekh wrote: > Hi, > > I have a question about kexec and kdb. Please advice or point me to the > right mailing list that can answer this. > > I have a linux 2.6.20 kernel (patched with kdb patches) on i686 system. > I have setup a crash kernel using "kexec -p" command which is working > very well. I tested this by triggering a crash by using "echo c > > /proc/sysrq-trigger" command. > > The requirement is to allow kdb to invoke first after the kernel crash > which is not happening now (The system directly gets booted with the > dump kernel). > crash_kexec() is the entry point for dump capture start process. I think before that you need to put the KDB entry point so that upon a crash control first goes to kdb. Thanks Vivek _______________________________________________ kexec mailing list kexec@lists.infradead.org http://lists.infradead.org/mailman/listinfo/kexec ^ permalink raw reply [flat|nested] 43+ messages in thread
* RE: kexec and kdb 2007-05-11 4:23 ` Vivek Goyal @ 2007-05-14 23:20 ` Preetesh Parekh 2007-05-15 7:54 ` Vivek Goyal 0 siblings, 1 reply; 43+ messages in thread From: Preetesh Parekh @ 2007-05-14 23:20 UTC (permalink / raw) To: vgoyal; +Cc: kexec Hi Vivek, I did modify "arch/i386/kernel/traps.c" file at 2 places as per your suggestion but still problem is not solved. Please let us know. File content of traps.c in function __kprobes die_nmi: show_registers(regs); #ifdef CONFIG_KDB kdb(KDB_REASON_NMI, 0, regs); #endif /* CONFIG_KDB */ console_silent(); spin_unlock(&nmi_print_lock); bust_spinlocks(0); /* If we are in kernel we are probably nested up pretty bad * and might aswell get out now while we still can. */ if (!user_mode_vm(regs)) { current->thread.trap_no = 2; crash_kexec(regs); } File content of traps.c in function die: bust_spinlocks(0); die.lock_owner = -1; spin_unlock_irqrestore(&die.lock, flags); #ifdef CONFIG_KDB kdb_diemsg = str; kdb(KDB_REASON_OOPS, err, regs); #endif /* CONFIG_KDB */ if (!regs) return; if (kexec_should_crash(current)) crash_kexec(regs); Thanks Preetesh -----Original Message----- From: Vivek Goyal [mailto:vgoyal@in.ibm.com] Sent: Thursday, May 10, 2007 9:23 PM To: Preetesh Parekh Cc: kexec@lists.infradead.org Subject: Re: kexec and kdb On Thu, May 10, 2007 at 03:10:16PM -0700, Preetesh Parekh wrote: > Hi, > > I have a question about kexec and kdb. Please advice or point me to the > right mailing list that can answer this. > > I have a linux 2.6.20 kernel (patched with kdb patches) on i686 system. > I have setup a crash kernel using "kexec -p" command which is working > very well. I tested this by triggering a crash by using "echo c > > /proc/sysrq-trigger" command. > > The requirement is to allow kdb to invoke first after the kernel crash > which is not happening now (The system directly gets booted with the > dump kernel). > crash_kexec() is the entry point for dump capture start process. I think before that you need to put the KDB entry point so that upon a crash control first goes to kdb. Thanks Vivek _______________________________________________ kexec mailing list kexec@lists.infradead.org http://lists.infradead.org/mailman/listinfo/kexec ^ permalink raw reply [flat|nested] 43+ messages in thread
* Re: kexec and kdb 2007-05-14 23:20 ` Preetesh Parekh @ 2007-05-15 7:54 ` Vivek Goyal 2007-05-16 17:45 ` Preetesh Parekh 0 siblings, 1 reply; 43+ messages in thread From: Vivek Goyal @ 2007-05-15 7:54 UTC (permalink / raw) To: Preetesh Parekh; +Cc: kexec On Mon, May 14, 2007 at 04:20:29PM -0700, Preetesh Parekh wrote: > Hi Vivek, > > I did modify "arch/i386/kernel/traps.c" file at 2 places as per your > suggestion but still problem is not solved. Please let us know. > This should have worked. What method are you using to simulate a crash. If you are using "echo c > /proc/sysrq-trigger" then you also need to modify drivers/char/sysrq.c file. Thanks Vivek _______________________________________________ kexec mailing list kexec@lists.infradead.org http://lists.infradead.org/mailman/listinfo/kexec ^ permalink raw reply [flat|nested] 43+ messages in thread
* RE: kexec and kdb 2007-05-15 7:54 ` Vivek Goyal @ 2007-05-16 17:45 ` Preetesh Parekh 0 siblings, 0 replies; 43+ messages in thread From: Preetesh Parekh @ 2007-05-16 17:45 UTC (permalink / raw) To: vgoyal; +Cc: kexec You are right. It's working now. Thanks. Preetesh -----Original Message----- From: Vivek Goyal [mailto:vgoyal@in.ibm.com] Sent: Tuesday, May 15, 2007 12:55 AM To: Preetesh Parekh Cc: kexec@lists.infradead.org Subject: Re: kexec and kdb On Mon, May 14, 2007 at 04:20:29PM -0700, Preetesh Parekh wrote: > Hi Vivek, > > I did modify "arch/i386/kernel/traps.c" file at 2 places as per your > suggestion but still problem is not solved. Please let us know. > This should have worked. What method are you using to simulate a crash. If you are using "echo c > /proc/sysrq-trigger" then you also need to modify drivers/char/sysrq.c file. Thanks Vivek _______________________________________________ kexec mailing list kexec@lists.infradead.org http://lists.infradead.org/mailman/listinfo/kexec ^ permalink raw reply [flat|nested] 43+ messages in thread
* Re: [patch 1/5] kexec debug output improvments 2007-05-08 0:02 ` [patch 1/5] kexec debug output improvments Geoff Levand 2007-05-08 6:08 ` Simon Horman 2007-05-08 6:12 ` use dprintf Simon Horman @ 2007-05-08 6:20 ` Vivek Goyal 2007-05-08 7:24 ` Simon Horman 2007-05-08 14:36 ` Geoff Levand 2 siblings, 2 replies; 43+ messages in thread From: Vivek Goyal @ 2007-05-08 6:20 UTC (permalink / raw) To: Geoff Levand; +Cc: kexec On Mon, May 07, 2007 at 05:02:47PM -0700, Geoff Levand wrote: > kexec debug output improvments. > - Add better type checking for the debug output macro dfprintf(). > - Add a convenence macro dprintf(). > > Signed-off-by: Geoff Levand <geoffrey.levand@am.sony.com> > --- > kexec/kexec.h | 6 ++++-- > 1 file changed, 4 insertions(+), 2 deletions(-) > > --- kexec-tools-hacked.orig/kexec/kexec.h > +++ kexec-tools-hacked/kexec/kexec.h > @@ -217,10 +217,12 @@ int parse_iomem_single(char *str, uint64 > > #define MAX_LINE 160 > > +#define dprintf(args...) dfprintf(stdout, args) > #ifdef DEBUG > -#define dfprintf(args...) do {fprintf(args);} while(0) > +#define dfprintf(_f, _args...) do {fprintf(_f, _args);} while(0) Should't dprintf() also be inside #ifdef DEBUG? Thanks Vivek _______________________________________________ kexec mailing list kexec@lists.infradead.org http://lists.infradead.org/mailman/listinfo/kexec ^ permalink raw reply [flat|nested] 43+ messages in thread
* Re: [patch 1/5] kexec debug output improvments 2007-05-08 6:20 ` [patch 1/5] kexec debug output improvments Vivek Goyal @ 2007-05-08 7:24 ` Simon Horman 2007-05-08 14:36 ` Geoff Levand 1 sibling, 0 replies; 43+ messages in thread From: Simon Horman @ 2007-05-08 7:24 UTC (permalink / raw) To: Vivek Goyal; +Cc: kexec, Geoff Levand On Tue, May 08, 2007 at 11:50:19AM +0530, Vivek Goyal wrote: > On Mon, May 07, 2007 at 05:02:47PM -0700, Geoff Levand wrote: > > kexec debug output improvments. > > - Add better type checking for the debug output macro dfprintf(). > > - Add a convenence macro dprintf(). > > > > Signed-off-by: Geoff Levand <geoffrey.levand@am.sony.com> > > --- > > kexec/kexec.h | 6 ++++-- > > 1 file changed, 4 insertions(+), 2 deletions(-) > > > > --- kexec-tools-hacked.orig/kexec/kexec.h > > +++ kexec-tools-hacked/kexec/kexec.h > > @@ -217,10 +217,12 @@ int parse_iomem_single(char *str, uint64 > > > > #define MAX_LINE 160 > > > > +#define dprintf(args...) dfprintf(stdout, args) > > #ifdef DEBUG > > -#define dfprintf(args...) do {fprintf(args);} while(0) > > +#define dfprintf(_f, _args...) do {fprintf(_f, _args);} while(0) > > Should't dprintf() also be inside #ifdef DEBUG? Good point, yes I think so too. -- Horms H: http://www.vergenet.net/~horms/ W: http://www.valinux.co.jp/en/ _______________________________________________ kexec mailing list kexec@lists.infradead.org http://lists.infradead.org/mailman/listinfo/kexec ^ permalink raw reply [flat|nested] 43+ messages in thread
* Re: [patch 1/5] kexec debug output improvments 2007-05-08 6:20 ` [patch 1/5] kexec debug output improvments Vivek Goyal 2007-05-08 7:24 ` Simon Horman @ 2007-05-08 14:36 ` Geoff Levand 2007-05-08 16:02 ` Vivek Goyal 1 sibling, 1 reply; 43+ messages in thread From: Geoff Levand @ 2007-05-08 14:36 UTC (permalink / raw) To: vgoyal; +Cc: kexec Vivek Goyal wrote: > On Mon, May 07, 2007 at 05:02:47PM -0700, Geoff Levand wrote: >> +#define dprintf(args...) dfprintf(stdout, args) >> #ifdef DEBUG >> -#define dfprintf(args...) do {fprintf(args);} while(0) >> +#define dfprintf(_f, _args...) do {fprintf(_f, _args);} while(0) > > Should't dprintf() also be inside #ifdef DEBUG? Then you need two identical defs for dprintf. -Geoff _______________________________________________ kexec mailing list kexec@lists.infradead.org http://lists.infradead.org/mailman/listinfo/kexec ^ permalink raw reply [flat|nested] 43+ messages in thread
* Re: [patch 1/5] kexec debug output improvments 2007-05-08 14:36 ` Geoff Levand @ 2007-05-08 16:02 ` Vivek Goyal 2007-05-09 1:11 ` Geoff Levand 0 siblings, 1 reply; 43+ messages in thread From: Vivek Goyal @ 2007-05-08 16:02 UTC (permalink / raw) To: Geoff Levand; +Cc: kexec On Tue, May 08, 2007 at 07:36:45AM -0700, Geoff Levand wrote: > Vivek Goyal wrote: > > On Mon, May 07, 2007 at 05:02:47PM -0700, Geoff Levand wrote: > >> +#define dprintf(args...) dfprintf(stdout, args) > >> #ifdef DEBUG > >> -#define dfprintf(args...) do {fprintf(args);} while(0) > >> +#define dfprintf(_f, _args...) do {fprintf(_f, _args);} while(0) > > > > Should't dprintf() also be inside #ifdef DEBUG? > > Then you need two identical defs for dprintf. > Nope. #ifdef DEBUG #define dprintf() fprintf() #else #define dprintf() do{}while(0) #endif This is a debug print and should be enabled only if DEBUG is defined. Thanks Vivek _______________________________________________ kexec mailing list kexec@lists.infradead.org http://lists.infradead.org/mailman/listinfo/kexec ^ permalink raw reply [flat|nested] 43+ messages in thread
* Re: [patch 1/5] kexec debug output improvments 2007-05-08 16:02 ` Vivek Goyal @ 2007-05-09 1:11 ` Geoff Levand 2007-05-09 4:19 ` Vivek Goyal 0 siblings, 1 reply; 43+ messages in thread From: Geoff Levand @ 2007-05-09 1:11 UTC (permalink / raw) To: vgoyal; +Cc: kexec Vivek Goyal wrote: > On Tue, May 08, 2007 at 07:36:45AM -0700, Geoff Levand wrote: >> Vivek Goyal wrote: >> > On Mon, May 07, 2007 at 05:02:47PM -0700, Geoff Levand wrote: >> >> +#define dprintf(args...) dfprintf(stdout, args) >> >> #ifdef DEBUG >> >> -#define dfprintf(args...) do {fprintf(args);} while(0) >> >> +#define dfprintf(_f, _args...) do {fprintf(_f, _args);} while(0) >> > >> > Should't dprintf() also be inside #ifdef DEBUG? >> >> Then you need two identical defs for dprintf. >> > > Nope. > > This is a debug print and should be enabled only if DEBUG is defined. I have that, but you cut that part of the patch which shows it from your reply. -Geoff _______________________________________________ kexec mailing list kexec@lists.infradead.org http://lists.infradead.org/mailman/listinfo/kexec ^ permalink raw reply [flat|nested] 43+ messages in thread
* Re: [patch 1/5] kexec debug output improvments 2007-05-09 1:11 ` Geoff Levand @ 2007-05-09 4:19 ` Vivek Goyal 0 siblings, 0 replies; 43+ messages in thread From: Vivek Goyal @ 2007-05-09 4:19 UTC (permalink / raw) To: Geoff Levand; +Cc: kexec On Tue, May 08, 2007 at 06:11:56PM -0700, Geoff Levand wrote: > Vivek Goyal wrote: > > On Tue, May 08, 2007 at 07:36:45AM -0700, Geoff Levand wrote: > >> Vivek Goyal wrote: > >> > On Mon, May 07, 2007 at 05:02:47PM -0700, Geoff Levand wrote: > >> >> +#define dprintf(args...) dfprintf(stdout, args) > >> >> #ifdef DEBUG > >> >> -#define dfprintf(args...) do {fprintf(args);} while(0) > >> >> +#define dfprintf(_f, _args...) do {fprintf(_f, _args);} while(0) > >> > > >> > Should't dprintf() also be inside #ifdef DEBUG? > >> > >> Then you need two identical defs for dprintf. > >> > > > > Nope. > > > > This is a debug print and should be enabled only if DEBUG is defined. > > I have that, but you cut that part of the patch which shows it > from your reply. Ok. You seem to be saying that because dfprintf() is under DEBUG, and dprintf() is just a variant of dfprintf() so we don't have to put dprintf() under debug. I still feel that we should move dprintf() under DEBUG, in case definition of dprintf() changes tomorrow and it is no more dependent on dfprintf(). It will not be very intitutive to the person changing the definition that dprintf() now should be moved inside DEBUG. #ifdef DEBUG dprintf() dfprintf() dfprintf() fprintf #else dprintf do{} while(0) dfprintf() do{} while(0) #endif _______________________________________________ kexec mailing list kexec@lists.infradead.org http://lists.infradead.org/mailman/listinfo/kexec ^ permalink raw reply [flat|nested] 43+ messages in thread
* [patch 2/5] kexec improve build for ppc64 [not found] <20070507235727.631477448@am.sony.com> 2007-05-08 0:02 ` [patch 1/5] kexec debug output improvments Geoff Levand @ 2007-05-08 0:02 ` Geoff Levand 2007-05-08 6:07 ` Simon Horman 2007-05-08 0:02 ` [patch 3/5] kexec add strict-prototypes Geoff Levand ` (2 subsequent siblings) 4 siblings, 1 reply; 43+ messages in thread From: Geoff Levand @ 2007-05-08 0:02 UTC (permalink / raw) To: kexec; +Cc: Geoff Levand Powerpc 64 bit platforms support both 64 bit and 32 bit runtimes. Allow ARCH= to be specified on the command line to separate the processor arch from the compiler machine. This also helps cross-builds with non-standard compiler names. Signed-off-by: Geoff Levand <geoffrey.levand@am.sony.com> --- configure.ac | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) --- kexec-tools-hacked.orig/configure.ac +++ kexec-tools-hacked/configure.ac @@ -45,7 +45,12 @@ case $host_cpu in AC_MSG_ERROR([ unsupported architecture $host_cpu]) ;; esac -ARCH=$host_cpu + +dnl Try to guess the kernel ARCH based on the autoconf host_cpu variable. + +if ! test "${ARCH}" ; then + ARCH=$host_cpu +fi dnl ---Options @@ -59,10 +64,14 @@ BUILD_CFLAGS='-O2 -Wall $(CPPFLAGS)' # Check whether ppc64. Add -m64 for building 64-bit binary # Add -mcall-aixdesc to generate dot-symbols as in gcc 3.3.3 -if test "$ARCH" = ppc64; then +if test "$host_cpu" = ppc64; then EXTRA_CFLAGS="$EXTRA_CFLAGS -m64 -mcall-aixdesc" fi; +if test "$host_cpu" = ppc; then + EXTRA_CFLAGS="$EXTRA_CFLAGS -m32" +fi; + AC_ARG_WITH([objdir], AC_HELP_STRING([--with-objdir=<dir>],[select directory for object files]), [ OBJDIR="$withval" ], [ OBJDIR="$OBJDIR" ]) -- _______________________________________________ kexec mailing list kexec@lists.infradead.org http://lists.infradead.org/mailman/listinfo/kexec ^ permalink raw reply [flat|nested] 43+ messages in thread
* Re: [patch 2/5] kexec improve build for ppc64 2007-05-08 0:02 ` [patch 2/5] kexec improve build for ppc64 Geoff Levand @ 2007-05-08 6:07 ` Simon Horman 0 siblings, 0 replies; 43+ messages in thread From: Simon Horman @ 2007-05-08 6:07 UTC (permalink / raw) To: Geoff Levand; +Cc: kexec On Mon, May 07, 2007 at 05:02:52PM -0700, Geoff Levand wrote: > Powerpc 64 bit platforms support both 64 bit and 32 bit runtimes. Allow > ARCH= to be specified on the command line to separate the processor arch > from the compiler machine. This also helps cross-builds with non-standard > compiler names. Hi Geoff, This does fundamentally change the affect that ARCH has on the build - that is, it now has an affect. And this worries me in the context of cross-compiling. However, after reasonably extensive testing of all the supported architectures, I have convinced myself that it at least for cross-compiling its ok :-) I have gone ahead and applied this change. But if people could test building various architectures, I would appreciate it. -- Horms H: http://www.vergenet.net/~horms/ W: http://www.valinux.co.jp/en/ _______________________________________________ kexec mailing list kexec@lists.infradead.org http://lists.infradead.org/mailman/listinfo/kexec ^ permalink raw reply [flat|nested] 43+ messages in thread
* [patch 3/5] kexec add strict-prototypes [not found] <20070507235727.631477448@am.sony.com> 2007-05-08 0:02 ` [patch 1/5] kexec debug output improvments Geoff Levand 2007-05-08 0:02 ` [patch 2/5] kexec improve build for ppc64 Geoff Levand @ 2007-05-08 0:02 ` Geoff Levand 2007-05-08 2:38 ` Simon Horman 2007-05-08 0:03 ` [patch 4/5] Add proper node alignment for the powerpc device-tree cmdline Geoff Levand 2007-05-08 0:03 ` [patch 5/5] kexec fix ppc64 device-tree mem node Geoff Levand 4 siblings, 1 reply; 43+ messages in thread From: Geoff Levand @ 2007-05-08 0:02 UTC (permalink / raw) To: kexec; +Cc: Geoff Levand Add -Wstrict-prototypes to EXTRA_CFLAGS and fix the powerpc compiler warnings. Signed-off-by: Geoff Levand <geoffrey.levand@am.sony.com> --- configure.ac | 2 - kexec/arch/ppc64/kexec-ppc64.c | 61 +++++++++++++++++++---------------------- 2 files changed, 30 insertions(+), 33 deletions(-) --- kexec-tools-hacked.orig/configure.ac +++ kexec-tools-hacked/configure.ac @@ -59,7 +59,7 @@ if test "${host_alias}" ; then OBJDIR="$OBJDIR-${host_alias}" fi -EXTRA_CFLAGS='-Wall -g -fno-strict-aliasing $(CPPFLAGS) $(EXTRA_CPPFLAGS)' +EXTRA_CFLAGS='-Wall -g -fno-strict-aliasing -Wstrict-prototypes $(CPPFLAGS) $(EXTRA_CPPFLAGS)' BUILD_CFLAGS='-O2 -Wall $(CPPFLAGS)' # Check whether ppc64. Add -m64 for building 64-bit binary --- kexec-tools-hacked.orig/kexec/arch/ppc64/kexec-ppc64.c +++ kexec-tools-hacked/kexec/arch/ppc64/kexec-ppc64.c @@ -45,10 +45,7 @@ unsigned long long crash_base, crash_siz unsigned int rtas_base, rtas_size; int max_memory_ranges; -static int sort_base_ranges(); - - -static void cleanup_memory_ranges() +static void cleanup_memory_ranges(void) { if (memory_range) free(memory_range); @@ -64,7 +61,7 @@ static void cleanup_memory_ranges() * Allocate memory for various data structures used to hold * values of different memory ranges */ -static int alloc_memory_ranges() +static int alloc_memory_ranges(void) { int memory_range_len; @@ -105,7 +102,7 @@ err1: * max_memory_ranges variable. This variable replaces MAX_MEMORY_RANGES * macro used earlier. */ -static int count_memory_ranges() +static int count_memory_ranges(void) { char device_tree[256] = "/proc/device-tree/"; struct dirent *dentry; @@ -132,8 +129,32 @@ static int count_memory_ranges() return 0; } +/* Sort the base ranges in memory - this is useful for ensuring that our + * ranges are in ascending order, even if device-tree read of memory nodes + * is done differently. Also, could be used for other range coalescing later + */ +static int sort_base_ranges(void) +{ + int i, j; + unsigned long long tstart, tend; + + for (i = 0; i < nr_memory_ranges - 1; i++) { + for (j = 0; j < nr_memory_ranges - i - 1; j++) { + if (base_memory_range[j].start > base_memory_range[j+1].start) { + tstart = base_memory_range[j].start; + tend = base_memory_range[j].end; + base_memory_range[j].start = base_memory_range[j+1].start; + base_memory_range[j].end = base_memory_range[j+1].end; + base_memory_range[j+1].start = tstart; + base_memory_range[j+1].end = tend; + } + } + } + return 0; +} + /* Get base memory ranges */ -static int get_base_ranges() +static int get_base_ranges(void) { int local_memory_ranges = 0; char device_tree[256] = "/proc/device-tree/"; @@ -204,32 +225,8 @@ static int get_base_ranges() return 0; } -/* Sort the base ranges in memory - this is useful for ensuring that our - * ranges are in ascending order, even if device-tree read of memory nodes - * is done differently. Also, could be used for other range coalescing later - */ -static int sort_base_ranges() -{ - int i, j; - unsigned long long tstart, tend; - - for (i = 0; i < nr_memory_ranges - 1; i++) { - for (j = 0; j < nr_memory_ranges - i - 1; j++) { - if (base_memory_range[j].start > base_memory_range[j+1].start) { - tstart = base_memory_range[j].start; - tend = base_memory_range[j].end; - base_memory_range[j].start = base_memory_range[j+1].start; - base_memory_range[j].end = base_memory_range[j+1].end; - base_memory_range[j+1].start = tstart; - base_memory_range[j+1].end = tend; - } - } - } - return 0; -} - /* Sort the exclude ranges in memory */ -static int sort_ranges() +static int sort_ranges(void) { int i, j; unsigned long long tstart, tend; -- _______________________________________________ kexec mailing list kexec@lists.infradead.org http://lists.infradead.org/mailman/listinfo/kexec ^ permalink raw reply [flat|nested] 43+ messages in thread
* Re: [patch 3/5] kexec add strict-prototypes 2007-05-08 0:02 ` [patch 3/5] kexec add strict-prototypes Geoff Levand @ 2007-05-08 2:38 ` Simon Horman 2007-05-08 14:56 ` Geoff Levand ` (2 more replies) 0 siblings, 3 replies; 43+ messages in thread From: Simon Horman @ 2007-05-08 2:38 UTC (permalink / raw) To: Geoff Levand; +Cc: kexec On Mon, May 07, 2007 at 05:02:56PM -0700, Geoff Levand wrote: > Add -Wstrict-prototypes to EXTRA_CFLAGS and fix the powerpc compiler warnings. > > Signed-off-by: Geoff Levand <geoffrey.levand@am.sony.com> Hi Geoff, I'm all for fixing up this kind of thing, but I'm not sure that hardcoding it into -Wstrict-prototypes is the right way to go. People who want -Wstrict-prototypes can just add it to CFLAGS in the environment and fix problems from there. Then again, it is kind of nice to get rid of all this crap :-) Could you split the configure.ac patch and the fixes into two separate patches so that they can be considered separtely? > --- > configure.ac | 2 - > kexec/arch/ppc64/kexec-ppc64.c | 61 +++++++++++++++++++---------------------- > 2 files changed, 30 insertions(+), 33 deletions(-) > > --- kexec-tools-hacked.orig/configure.ac > +++ kexec-tools-hacked/configure.ac > @@ -59,7 +59,7 @@ if test "${host_alias}" ; then > OBJDIR="$OBJDIR-${host_alias}" > fi > > -EXTRA_CFLAGS='-Wall -g -fno-strict-aliasing $(CPPFLAGS) $(EXTRA_CPPFLAGS)' > +EXTRA_CFLAGS='-Wall -g -fno-strict-aliasing -Wstrict-prototypes $(CPPFLAGS) $(EXTRA_CPPFLAGS)' > BUILD_CFLAGS='-O2 -Wall $(CPPFLAGS)' > > # Check whether ppc64. Add -m64 for building 64-bit binary > --- kexec-tools-hacked.orig/kexec/arch/ppc64/kexec-ppc64.c > +++ kexec-tools-hacked/kexec/arch/ppc64/kexec-ppc64.c > @@ -45,10 +45,7 @@ unsigned long long crash_base, crash_siz > unsigned int rtas_base, rtas_size; > int max_memory_ranges; > > -static int sort_base_ranges(); > - > - > -static void cleanup_memory_ranges() > +static void cleanup_memory_ranges(void) > { > if (memory_range) > free(memory_range); > @@ -64,7 +61,7 @@ static void cleanup_memory_ranges() > * Allocate memory for various data structures used to hold > * values of different memory ranges > */ > -static int alloc_memory_ranges() > +static int alloc_memory_ranges(void) > { > int memory_range_len; > > @@ -105,7 +102,7 @@ err1: > * max_memory_ranges variable. This variable replaces MAX_MEMORY_RANGES > * macro used earlier. > */ > -static int count_memory_ranges() > +static int count_memory_ranges(void) > { > char device_tree[256] = "/proc/device-tree/"; > struct dirent *dentry; > @@ -132,8 +129,32 @@ static int count_memory_ranges() > return 0; > } > > +/* Sort the base ranges in memory - this is useful for ensuring that our > + * ranges are in ascending order, even if device-tree read of memory nodes > + * is done differently. Also, could be used for other range coalescing later > + */ > +static int sort_base_ranges(void) > +{ > + int i, j; > + unsigned long long tstart, tend; > + > + for (i = 0; i < nr_memory_ranges - 1; i++) { > + for (j = 0; j < nr_memory_ranges - i - 1; j++) { > + if (base_memory_range[j].start > base_memory_range[j+1].start) { > + tstart = base_memory_range[j].start; > + tend = base_memory_range[j].end; > + base_memory_range[j].start = base_memory_range[j+1].start; > + base_memory_range[j].end = base_memory_range[j+1].end; > + base_memory_range[j+1].start = tstart; > + base_memory_range[j+1].end = tend; > + } > + } > + } > + return 0; > +} > + > /* Get base memory ranges */ > -static int get_base_ranges() > +static int get_base_ranges(void) > { > int local_memory_ranges = 0; > char device_tree[256] = "/proc/device-tree/"; > @@ -204,32 +225,8 @@ static int get_base_ranges() > return 0; > } The change to sort_base_ranges() seems like a lot of diff for very little change. Is it whitespace fixes. If so could you put that in a separate patch? > -/* Sort the base ranges in memory - this is useful for ensuring that our > - * ranges are in ascending order, even if device-tree read of memory nodes > - * is done differently. Also, could be used for other range coalescing later > - */ > -static int sort_base_ranges() > -{ > - int i, j; > - unsigned long long tstart, tend; > - > - for (i = 0; i < nr_memory_ranges - 1; i++) { > - for (j = 0; j < nr_memory_ranges - i - 1; j++) { > - if (base_memory_range[j].start > base_memory_range[j+1].start) { > - tstart = base_memory_range[j].start; > - tend = base_memory_range[j].end; > - base_memory_range[j].start = base_memory_range[j+1].start; > - base_memory_range[j].end = base_memory_range[j+1].end; > - base_memory_range[j+1].start = tstart; > - base_memory_range[j+1].end = tend; > - } > - } > - } > - return 0; > -} > - > /* Sort the exclude ranges in memory */ > -static int sort_ranges() > +static int sort_ranges(void) > { > int i, j; > unsigned long long tstart, tend; > > -- > > > > _______________________________________________ > kexec mailing list > kexec@lists.infradead.org > http://lists.infradead.org/mailman/listinfo/kexec -- Horms H: http://www.vergenet.net/~horms/ W: http://www.valinux.co.jp/en/ _______________________________________________ kexec mailing list kexec@lists.infradead.org http://lists.infradead.org/mailman/listinfo/kexec ^ permalink raw reply [flat|nested] 43+ messages in thread
* Re: [patch 3/5] kexec add strict-prototypes 2007-05-08 2:38 ` Simon Horman @ 2007-05-08 14:56 ` Geoff Levand 2007-05-09 0:33 ` [patch 1/2] " Geoff Levand 2007-05-09 0:33 ` [patch 2/2] kexec fix prototypes for ppc64 Geoff Levand 2 siblings, 0 replies; 43+ messages in thread From: Geoff Levand @ 2007-05-08 14:56 UTC (permalink / raw) To: Simon Horman; +Cc: kexec Simon Horman wrote: > On Mon, May 07, 2007 at 05:02:56PM -0700, Geoff Levand wrote: >> Add -Wstrict-prototypes to EXTRA_CFLAGS and fix the powerpc compiler warnings. >> >> Signed-off-by: Geoff Levand <geoffrey.levand@am.sony.com> > > Hi Geoff, > > I'm all for fixing up this kind of thing, but I'm not sure that > hardcoding it into -Wstrict-prototypes is the right way to go. > People who want -Wstrict-prototypes can just add it to CFLAGS > in the environment and fix problems from there. Then again, it is > kind of nice to get rid of all this crap :-) > > Could you split the configure.ac patch and the fixes into two separate > patches so that they can be considered separtely? Sure. New patches will follow. > > The change to sort_base_ranges() seems like a lot of diff for very > little change. Is it whitespace fixes. If so could you put that in a > separate patch? > It is just a move. sort_base_ranges() was defined after it was used. -Geoff _______________________________________________ kexec mailing list kexec@lists.infradead.org http://lists.infradead.org/mailman/listinfo/kexec ^ permalink raw reply [flat|nested] 43+ messages in thread
* [patch 1/2] kexec add strict-prototypes 2007-05-08 2:38 ` Simon Horman 2007-05-08 14:56 ` Geoff Levand @ 2007-05-09 0:33 ` Geoff Levand 2007-05-09 6:48 ` Simon Horman 2007-05-09 0:33 ` [patch 2/2] kexec fix prototypes for ppc64 Geoff Levand 2 siblings, 1 reply; 43+ messages in thread From: Geoff Levand @ 2007-05-09 0:33 UTC (permalink / raw) To: Simon Horman; +Cc: kexec Add the complier flag -Wstrict-prototypes to EXTRA_CFLAGS. Signed-off-by: Geoff Levand <geoffrey.levand@am.sony.com> --- configure.ac | 2 - --- kexec-tools-hacked.orig/configure.ac +++ kexec-tools-hacked/configure.ac @@ -59,7 +59,7 @@ if test "${host_alias}" ; then OBJDIR="$OBJDIR-${host_alias}" fi -EXTRA_CFLAGS='-Wall -g -fno-strict-aliasing $(CPPFLAGS) $(EXTRA_CPPFLAGS)' +EXTRA_CFLAGS='-Wall -g -fno-strict-aliasing -Wstrict-prototypes $(CPPFLAGS) $(EXTRA_CPPFLAGS)' BUILD_CFLAGS='-O2 -Wall $(CPPFLAGS)' # Check whether ppc64. Add -m64 for building 64-bit binary _______________________________________________ kexec mailing list kexec@lists.infradead.org http://lists.infradead.org/mailman/listinfo/kexec ^ permalink raw reply [flat|nested] 43+ messages in thread
* Re: [patch 1/2] kexec add strict-prototypes 2007-05-09 0:33 ` [patch 1/2] " Geoff Levand @ 2007-05-09 6:48 ` Simon Horman 0 siblings, 0 replies; 43+ messages in thread From: Simon Horman @ 2007-05-09 6:48 UTC (permalink / raw) To: Geoff Levand; +Cc: kexec On Tue, May 08, 2007 at 05:33:11PM -0700, Geoff Levand wrote: > Add the complier flag -Wstrict-prototypes to EXTRA_CFLAGS. > > Signed-off-by: Geoff Levand <geoffrey.levand@am.sony.com> Thanks, applied. -- Horms H: http://www.vergenet.net/~horms/ W: http://www.valinux.co.jp/en/ _______________________________________________ kexec mailing list kexec@lists.infradead.org http://lists.infradead.org/mailman/listinfo/kexec ^ permalink raw reply [flat|nested] 43+ messages in thread
* [patch 2/2] kexec fix prototypes for ppc64 2007-05-08 2:38 ` Simon Horman 2007-05-08 14:56 ` Geoff Levand 2007-05-09 0:33 ` [patch 1/2] " Geoff Levand @ 2007-05-09 0:33 ` Geoff Levand 2007-05-09 6:48 ` Simon Horman 2 siblings, 1 reply; 43+ messages in thread From: Geoff Levand @ 2007-05-09 0:33 UTC (permalink / raw) To: Simon Horman; +Cc: kexec Fixup the ppc64 files to remove warnings generated by the -Wstrict-prototypes compiler flag. Signed-off-by: Geoff Levand <geoffrey.levand@am.sony.com> --- kexec/arch/ppc64/kexec-ppc64.c | 61 +++++++++++++++++++---------------------- --- kexec-tools-hacked.orig/kexec/arch/ppc64/kexec-ppc64.c +++ kexec-tools-hacked/kexec/arch/ppc64/kexec-ppc64.c @@ -45,10 +45,7 @@ unsigned long long crash_base, crash_siz unsigned int rtas_base, rtas_size; int max_memory_ranges; -static int sort_base_ranges(); - - -static void cleanup_memory_ranges() +static void cleanup_memory_ranges(void) { if (memory_range) free(memory_range); @@ -64,7 +61,7 @@ static void cleanup_memory_ranges() * Allocate memory for various data structures used to hold * values of different memory ranges */ -static int alloc_memory_ranges() +static int alloc_memory_ranges(void) { int memory_range_len; @@ -105,7 +102,7 @@ err1: * max_memory_ranges variable. This variable replaces MAX_MEMORY_RANGES * macro used earlier. */ -static int count_memory_ranges() +static int count_memory_ranges(void) { char device_tree[256] = "/proc/device-tree/"; struct dirent *dentry; @@ -132,8 +129,32 @@ static int count_memory_ranges() return 0; } +/* Sort the base ranges in memory - this is useful for ensuring that our + * ranges are in ascending order, even if device-tree read of memory nodes + * is done differently. Also, could be used for other range coalescing later + */ +static int sort_base_ranges(void) +{ + int i, j; + unsigned long long tstart, tend; + + for (i = 0; i < nr_memory_ranges - 1; i++) { + for (j = 0; j < nr_memory_ranges - i - 1; j++) { + if (base_memory_range[j].start > base_memory_range[j+1].start) { + tstart = base_memory_range[j].start; + tend = base_memory_range[j].end; + base_memory_range[j].start = base_memory_range[j+1].start; + base_memory_range[j].end = base_memory_range[j+1].end; + base_memory_range[j+1].start = tstart; + base_memory_range[j+1].end = tend; + } + } + } + return 0; +} + /* Get base memory ranges */ -static int get_base_ranges() +static int get_base_ranges(void) { int local_memory_ranges = 0; char device_tree[256] = "/proc/device-tree/"; @@ -204,32 +225,8 @@ static int get_base_ranges() return 0; } -/* Sort the base ranges in memory - this is useful for ensuring that our - * ranges are in ascending order, even if device-tree read of memory nodes - * is done differently. Also, could be used for other range coalescing later - */ -static int sort_base_ranges() -{ - int i, j; - unsigned long long tstart, tend; - - for (i = 0; i < nr_memory_ranges - 1; i++) { - for (j = 0; j < nr_memory_ranges - i - 1; j++) { - if (base_memory_range[j].start > base_memory_range[j+1].start) { - tstart = base_memory_range[j].start; - tend = base_memory_range[j].end; - base_memory_range[j].start = base_memory_range[j+1].start; - base_memory_range[j].end = base_memory_range[j+1].end; - base_memory_range[j+1].start = tstart; - base_memory_range[j+1].end = tend; - } - } - } - return 0; -} - /* Sort the exclude ranges in memory */ -static int sort_ranges() +static int sort_ranges(void) { int i, j; unsigned long long tstart, tend; _______________________________________________ kexec mailing list kexec@lists.infradead.org http://lists.infradead.org/mailman/listinfo/kexec ^ permalink raw reply [flat|nested] 43+ messages in thread
* Re: [patch 2/2] kexec fix prototypes for ppc64 2007-05-09 0:33 ` [patch 2/2] kexec fix prototypes for ppc64 Geoff Levand @ 2007-05-09 6:48 ` Simon Horman 0 siblings, 0 replies; 43+ messages in thread From: Simon Horman @ 2007-05-09 6:48 UTC (permalink / raw) To: Geoff Levand; +Cc: kexec On Tue, May 08, 2007 at 05:33:22PM -0700, Geoff Levand wrote: > Fixup the ppc64 files to remove warnings generated by the -Wstrict-prototypes > compiler flag. Thanks, applied. -- Horms H: http://www.vergenet.net/~horms/ W: http://www.valinux.co.jp/en/ _______________________________________________ kexec mailing list kexec@lists.infradead.org http://lists.infradead.org/mailman/listinfo/kexec ^ permalink raw reply [flat|nested] 43+ messages in thread
* [patch 4/5] Add proper node alignment for the powerpc device-tree cmdline. [not found] <20070507235727.631477448@am.sony.com> ` (2 preceding siblings ...) 2007-05-08 0:02 ` [patch 3/5] kexec add strict-prototypes Geoff Levand @ 2007-05-08 0:03 ` Geoff Levand 2007-05-08 6:13 ` Simon Horman 2007-05-08 0:03 ` [patch 5/5] kexec fix ppc64 device-tree mem node Geoff Levand 4 siblings, 1 reply; 43+ messages in thread From: Geoff Levand @ 2007-05-08 0:03 UTC (permalink / raw) To: kexec; +Cc: Geoff Levand Add proper node alignment for the powerpc device-tree cmdline. Fixes the runtime error 'Invalid tag 3a scanning flattened device tree !'. Signed-off-by: Geoff Levand <geoffrey.levand@am.sony.com> --- kexec/arch/ppc64/fs2dt.c | 4 ++++ 1 file changed, 4 insertions(+) --- kexec-tools-hacked.orig/kexec/arch/ppc64/fs2dt.c +++ kexec-tools-hacked/kexec/arch/ppc64/fs2dt.c @@ -283,6 +283,10 @@ static void putprops(char *fn, struct di strcat(local_cmdline, " "); cmd_len = strlen(local_cmdline); cmd_len = cmd_len + 1; + if ((cmd_len >= 8) && ((unsigned long)dt & 0x4)) { + fprintf(stderr, "Aligning cmdline %p\n", dt); + dt++; + } memcpy(dt, local_cmdline,cmd_len); len = cmd_len; *dt_len = cmd_len; -- _______________________________________________ kexec mailing list kexec@lists.infradead.org http://lists.infradead.org/mailman/listinfo/kexec ^ permalink raw reply [flat|nested] 43+ messages in thread
* Re: [patch 4/5] Add proper node alignment for the powerpc device-tree cmdline. 2007-05-08 0:03 ` [patch 4/5] Add proper node alignment for the powerpc device-tree cmdline Geoff Levand @ 2007-05-08 6:13 ` Simon Horman 2007-05-08 14:50 ` Milton Miller 0 siblings, 1 reply; 43+ messages in thread From: Simon Horman @ 2007-05-08 6:13 UTC (permalink / raw) To: Geoff Levand; +Cc: kexec, Milton Miller On Mon, May 07, 2007 at 05:03:00PM -0700, Geoff Levand wrote: > Add proper node alignment for the powerpc device-tree cmdline. > > Fixes the runtime error 'Invalid tag 3a scanning flattened device tree !'. > > Signed-off-by: Geoff Levand <geoffrey.levand@am.sony.com> This seems ok to me, though I don't know much about the device tree. Milton, do you have any thoughts on this? > > --- > kexec/arch/ppc64/fs2dt.c | 4 ++++ > 1 file changed, 4 insertions(+) > > --- kexec-tools-hacked.orig/kexec/arch/ppc64/fs2dt.c > +++ kexec-tools-hacked/kexec/arch/ppc64/fs2dt.c > @@ -283,6 +283,10 @@ static void putprops(char *fn, struct di > strcat(local_cmdline, " "); > cmd_len = strlen(local_cmdline); > cmd_len = cmd_len + 1; > + if ((cmd_len >= 8) && ((unsigned long)dt & 0x4)) { > + fprintf(stderr, "Aligning cmdline %p\n", dt); > + dt++; > + } > memcpy(dt, local_cmdline,cmd_len); > len = cmd_len; > *dt_len = cmd_len; > > -- > > > > _______________________________________________ > kexec mailing list > kexec@lists.infradead.org > http://lists.infradead.org/mailman/listinfo/kexec -- Horms H: http://www.vergenet.net/~horms/ W: http://www.valinux.co.jp/en/ _______________________________________________ kexec mailing list kexec@lists.infradead.org http://lists.infradead.org/mailman/listinfo/kexec ^ permalink raw reply [flat|nested] 43+ messages in thread
* Re: [patch 4/5] Add proper node alignment for the powerpc device-tree cmdline. 2007-05-08 6:13 ` Simon Horman @ 2007-05-08 14:50 ` Milton Miller 0 siblings, 0 replies; 43+ messages in thread From: Milton Miller @ 2007-05-08 14:50 UTC (permalink / raw) To: Simon Horman; +Cc: kexec, Geoff Levand On May 8, 2007, at 1:13 AM, Simon Horman wrote: > On Mon, May 07, 2007 at 05:03:00PM -0700, Geoff Levand wrote: >> Add proper node alignment for the powerpc device-tree cmdline. >> >> Fixes the runtime error 'Invalid tag 3a scanning flattened device >> tree !'. >> >> Signed-off-by: Geoff Levand <geoffrey.levand@am.sony.com> > > This seems ok to me, though I don't know much about the device tree. > > Milton, do you have any thoughts on this? NACK >> --- >> kexec/arch/ppc64/fs2dt.c | 4 ++++ >> 1 file changed, 4 insertions(+) >> >> --- kexec-tools-hacked.orig/kexec/arch/ppc64/fs2dt.c >> +++ kexec-tools-hacked/kexec/arch/ppc64/fs2dt.c >> @@ -283,6 +283,10 @@ static void putprops(char *fn, struct di >> strcat(local_cmdline, " "); >> cmd_len = strlen(local_cmdline); >> cmd_len = cmd_len + 1; >> + if ((cmd_len >= 8) && ((unsigned long)dt & 0x4)) { >> + fprintf(stderr, "Aligning cmdline %p\n", dt); >> + dt++; >> + } >> memcpy(dt, local_cmdline,cmd_len); >> len = cmd_len; >> *dt_len = cmd_len; >> >> -- >> That's only half the fix. If the propety was > 8 and is now < 8 it might need to undo this alignment, but only if it was there before. Please change the code to behave like the initrd, where we skip the property totally when copying, and then insert it at the end of the directory. That also handles the case where the source device-tree doesn't have the property. milton _______________________________________________ kexec mailing list kexec@lists.infradead.org http://lists.infradead.org/mailman/listinfo/kexec ^ permalink raw reply [flat|nested] 43+ messages in thread
* [patch 5/5] kexec fix ppc64 device-tree mem node [not found] <20070507235727.631477448@am.sony.com> ` (3 preceding siblings ...) 2007-05-08 0:03 ` [patch 4/5] Add proper node alignment for the powerpc device-tree cmdline Geoff Levand @ 2007-05-08 0:03 ` Geoff Levand 2007-05-08 6:14 ` Simon Horman ` (2 more replies) 4 siblings, 3 replies; 43+ messages in thread From: Geoff Levand @ 2007-05-08 0:03 UTC (permalink / raw) To: kexec; +Cc: Geoff Levand Change the ppc64 device-tree memory node name spec to match the allowable names specified in the booting-without-of document. Signed-off-by: Geoff Levand <geoffrey.levand@am.sony.com> --- kexec/arch/ppc64/crashdump-ppc64.c | 2 +- kexec/arch/ppc64/kexec-ppc64.c | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-) --- kexec-tools-hacked.orig/kexec/arch/ppc64/crashdump-ppc64.c +++ kexec-tools-hacked/kexec/arch/ppc64/crashdump-ppc64.c @@ -129,7 +129,7 @@ static int get_crash_memory_ranges(struc goto err; } while ((dentry = readdir(dir)) != NULL) { - if (strncmp(dentry->d_name, "memory@", 7)) + if (strncmp(dentry->d_name, "memory", 6)) continue; strcpy(fname, device_tree); strcat(fname, dentry->d_name); --- kexec-tools-hacked.orig/kexec/arch/ppc64/kexec-ppc64.c +++ kexec-tools-hacked/kexec/arch/ppc64/kexec-ppc64.c @@ -98,7 +98,7 @@ err1: } /* - * Count the memory@ nodes under /proc/device-tree and populate the + * Count the memory nodes under /proc/device-tree and populate the * max_memory_ranges variable. This variable replaces MAX_MEMORY_RANGES * macro used earlier. */ @@ -114,7 +114,7 @@ static int count_memory_ranges(void) } while ((dentry = readdir(dir)) != NULL) { - if (strncmp(dentry->d_name, "memory@", 7) && + if (strncmp(dentry->d_name, "memory", 6) && strncmp(dentry->d_name, "pci@", 4)) continue; max_memory_ranges++; @@ -170,7 +170,7 @@ static int get_base_ranges(void) return -1; } while ((dentry = readdir(dir)) != NULL) { - if (strncmp(dentry->d_name, "memory@", 7)) + if (strncmp(dentry->d_name, "memory", 6)) continue; strcpy(fname, device_tree); strcat(fname, dentry->d_name); @@ -272,7 +272,7 @@ static int get_devtree_details(unsigned while ((dentry = readdir(dir)) != NULL) { if (strncmp(dentry->d_name, "chosen", 6) && - strncmp(dentry->d_name, "memory@0", 8) && + strncmp(dentry->d_name, "memory", 6) && strncmp(dentry->d_name, "pci@", 4) && strncmp(dentry->d_name, "rtas", 4)) continue; @@ -452,7 +452,7 @@ static int get_devtree_details(unsigned add_usable_mem_rgns(rtas_base, rtas_size); } /* rtas */ - if (strncmp(dentry->d_name, "memory@0", 8) == 0) { + if (strncmp(dentry->d_name, "memory", 6) == 0) { strcat(fname, "/reg"); if ((file = fopen(fname, "r")) == NULL) { perror(fname); -- _______________________________________________ kexec mailing list kexec@lists.infradead.org http://lists.infradead.org/mailman/listinfo/kexec ^ permalink raw reply [flat|nested] 43+ messages in thread
* Re: [patch 5/5] kexec fix ppc64 device-tree mem node 2007-05-08 0:03 ` [patch 5/5] kexec fix ppc64 device-tree mem node Geoff Levand @ 2007-05-08 6:14 ` Simon Horman 2007-05-08 14:57 ` Spam:****, " Milton Miller 2007-05-08 6:35 ` Mohan Kumar M 2007-05-09 2:39 ` [patch v2] " Geoff Levand 2 siblings, 1 reply; 43+ messages in thread From: Simon Horman @ 2007-05-08 6:14 UTC (permalink / raw) To: Geoff Levand; +Cc: kexec, Milton Miller On Mon, May 07, 2007 at 05:03:04PM -0700, Geoff Levand wrote: > Change the ppc64 device-tree memory node name spec to match the allowable names > specified in the booting-without-of document. > > Signed-off-by: Geoff Levand <geoffrey.levand@am.sony.com> Again, this seems fine to me, but I'm not an expert on the device tree. Milton, how does this change sit with you? > --- > kexec/arch/ppc64/crashdump-ppc64.c | 2 +- > kexec/arch/ppc64/kexec-ppc64.c | 10 +++++----- > 2 files changed, 6 insertions(+), 6 deletions(-) > > --- kexec-tools-hacked.orig/kexec/arch/ppc64/crashdump-ppc64.c > +++ kexec-tools-hacked/kexec/arch/ppc64/crashdump-ppc64.c > @@ -129,7 +129,7 @@ static int get_crash_memory_ranges(struc > goto err; > } > while ((dentry = readdir(dir)) != NULL) { > - if (strncmp(dentry->d_name, "memory@", 7)) > + if (strncmp(dentry->d_name, "memory", 6)) > continue; > strcpy(fname, device_tree); > strcat(fname, dentry->d_name); > --- kexec-tools-hacked.orig/kexec/arch/ppc64/kexec-ppc64.c > +++ kexec-tools-hacked/kexec/arch/ppc64/kexec-ppc64.c > @@ -98,7 +98,7 @@ err1: > } > > /* > - * Count the memory@ nodes under /proc/device-tree and populate the > + * Count the memory nodes under /proc/device-tree and populate the > * max_memory_ranges variable. This variable replaces MAX_MEMORY_RANGES > * macro used earlier. > */ > @@ -114,7 +114,7 @@ static int count_memory_ranges(void) > } > > while ((dentry = readdir(dir)) != NULL) { > - if (strncmp(dentry->d_name, "memory@", 7) && > + if (strncmp(dentry->d_name, "memory", 6) && > strncmp(dentry->d_name, "pci@", 4)) > continue; > max_memory_ranges++; > @@ -170,7 +170,7 @@ static int get_base_ranges(void) > return -1; > } > while ((dentry = readdir(dir)) != NULL) { > - if (strncmp(dentry->d_name, "memory@", 7)) > + if (strncmp(dentry->d_name, "memory", 6)) > continue; > strcpy(fname, device_tree); > strcat(fname, dentry->d_name); > @@ -272,7 +272,7 @@ static int get_devtree_details(unsigned > > while ((dentry = readdir(dir)) != NULL) { > if (strncmp(dentry->d_name, "chosen", 6) && > - strncmp(dentry->d_name, "memory@0", 8) && > + strncmp(dentry->d_name, "memory", 6) && > strncmp(dentry->d_name, "pci@", 4) && > strncmp(dentry->d_name, "rtas", 4)) > continue; > @@ -452,7 +452,7 @@ static int get_devtree_details(unsigned > add_usable_mem_rgns(rtas_base, rtas_size); > } /* rtas */ > > - if (strncmp(dentry->d_name, "memory@0", 8) == 0) { > + if (strncmp(dentry->d_name, "memory", 6) == 0) { > strcat(fname, "/reg"); > if ((file = fopen(fname, "r")) == NULL) { > perror(fname); > > -- > > > > _______________________________________________ > kexec mailing list > kexec@lists.infradead.org > http://lists.infradead.org/mailman/listinfo/kexec -- Horms H: http://www.vergenet.net/~horms/ W: http://www.valinux.co.jp/en/ _______________________________________________ kexec mailing list kexec@lists.infradead.org http://lists.infradead.org/mailman/listinfo/kexec ^ permalink raw reply [flat|nested] 43+ messages in thread
* Re: Spam:****, Re: [patch 5/5] kexec fix ppc64 device-tree mem node 2007-05-08 6:14 ` Simon Horman @ 2007-05-08 14:57 ` Milton Miller 0 siblings, 0 replies; 43+ messages in thread From: Milton Miller @ 2007-05-08 14:57 UTC (permalink / raw) To: Simon Horman; +Cc: kexec, Geoff Levand On May 8, 2007, at 1:14 AM, Simon Horman wrote: > X-SpamDetect-Info: ------------- Start ASpam results --------------- > X-SpamDetect-Info: This message may be spam. This message BODY has > been altered to show you the spam information > X-SpamDetect: ****: 4.500000 From3consonants=0.5, GreyPassed=1.0, > DodgySource=2.0, SPF Default Fail=1.0 > X-SpamDetect-Info: ------------- End ASpam results ----------------- > > On Mon, May 07, 2007 at 05:03:04PM -0700, Geoff Levand wrote: >> Change the ppc64 device-tree memory node name spec to match the >> allowable names >> specified in the booting-without-of document. >> >> Signed-off-by: Geoff Levand <geoffrey.levand@am.sony.com> > > Again, this seems fine to me, but I'm not an expert on the device tree. > Milton, how does this change sit with you? [several cases of] >> - if (strncmp(dentry->d_name, "memory@", 7)) >> + if (strncmp(dentry->d_name, "memory", 6)) Thinking about it a bit, this makes the check too generic. There are firmware platforms that generate /memory-controller nodes which should not be found. While we really should be looking for the device type, for now the simplest would be to accept ether memory@ or memory\0. The one counting the nodes could remain memory, since we are just sizing an allocation. > >> --- >> kexec/arch/ppc64/crashdump-ppc64.c | 2 +- >> kexec/arch/ppc64/kexec-ppc64.c | 10 +++++----- >> 2 files changed, 6 insertions(+), 6 deletions(-) >> >> --- kexec-tools-hacked.orig/kexec/arch/ppc64/crashdump-ppc64.c >> +++ kexec-tools-hacked/kexec/arch/ppc64/crashdump-ppc64.c >> @@ -129,7 +129,7 @@ static int get_crash_memory_ranges(struc >> goto err; >> } >> while ((dentry = readdir(dir)) != NULL) { >> - if (strncmp(dentry->d_name, "memory@", 7)) >> + if (strncmp(dentry->d_name, "memory", 6)) >> continue; >> strcpy(fname, device_tree); >> strcat(fname, dentry->d_name); >> --- kexec-tools-hacked.orig/kexec/arch/ppc64/kexec-ppc64.c >> +++ kexec-tools-hacked/kexec/arch/ppc64/kexec-ppc64.c >> @@ -98,7 +98,7 @@ err1: >> } >> >> /* >> - * Count the memory@ nodes under /proc/device-tree and populate the >> + * Count the memory nodes under /proc/device-tree and populate the >> * max_memory_ranges variable. This variable replaces >> MAX_MEMORY_RANGES >> * macro used earlier. >> */ >> @@ -114,7 +114,7 @@ static int count_memory_ranges(void) >> } >> >> while ((dentry = readdir(dir)) != NULL) { >> - if (strncmp(dentry->d_name, "memory@", 7) && >> + if (strncmp(dentry->d_name, "memory", 6) && >> strncmp(dentry->d_name, "pci@", 4)) >> continue; >> max_memory_ranges++; >> @@ -170,7 +170,7 @@ static int get_base_ranges(void) >> return -1; >> } >> while ((dentry = readdir(dir)) != NULL) { >> - if (strncmp(dentry->d_name, "memory@", 7)) >> + if (strncmp(dentry->d_name, "memory", 6)) >> continue; >> strcpy(fname, device_tree); >> strcat(fname, dentry->d_name); >> @@ -272,7 +272,7 @@ static int get_devtree_details(unsigned >> >> while ((dentry = readdir(dir)) != NULL) { >> if (strncmp(dentry->d_name, "chosen", 6) && >> - strncmp(dentry->d_name, "memory@0", 8) && >> + strncmp(dentry->d_name, "memory", 6) && >> strncmp(dentry->d_name, "pci@", 4) && >> strncmp(dentry->d_name, "rtas", 4)) >> continue; >> @@ -452,7 +452,7 @@ static int get_devtree_details(unsigned >> add_usable_mem_rgns(rtas_base, rtas_size); >> } /* rtas */ >> >> - if (strncmp(dentry->d_name, "memory@0", 8) == 0) { >> + if (strncmp(dentry->d_name, "memory", 6) == 0) { >> strcat(fname, "/reg"); >> if ((file = fopen(fname, "r")) == NULL) { >> perror(fname); >> >> -- >> >> >> >> _______________________________________________ >> kexec mailing list >> kexec@lists.infradead.org >> http://lists.infradead.org/mailman/listinfo/kexec > > -- > Horms > H: http://www.vergenet.net/~horms/ > W: http://www.valinux.co.jp/en/ > _______________________________________________ kexec mailing list kexec@lists.infradead.org http://lists.infradead.org/mailman/listinfo/kexec ^ permalink raw reply [flat|nested] 43+ messages in thread
* Re: [patch 5/5] kexec fix ppc64 device-tree mem node 2007-05-08 0:03 ` [patch 5/5] kexec fix ppc64 device-tree mem node Geoff Levand 2007-05-08 6:14 ` Simon Horman @ 2007-05-08 6:35 ` Mohan Kumar M 2007-05-08 8:20 ` David Woodhouse 2007-05-09 2:39 ` [patch v2] " Geoff Levand 2 siblings, 1 reply; 43+ messages in thread From: Mohan Kumar M @ 2007-05-08 6:35 UTC (permalink / raw) To: Geoff Levand; +Cc: kexec On Mon, May 07, 2007 at 05:03:04PM -0700, Geoff Levand wrote: > Change the ppc64 device-tree memory node name spec to match the allowable names > specified in the booting-without-of document. > Hi, Which part of booting-without-of-document you are refering to use "memory" instead of "memory@"/"memory@0" node? Regards, Mohan. _______________________________________________ kexec mailing list kexec@lists.infradead.org http://lists.infradead.org/mailman/listinfo/kexec ^ permalink raw reply [flat|nested] 43+ messages in thread
* Re: [patch 5/5] kexec fix ppc64 device-tree mem node 2007-05-08 6:35 ` Mohan Kumar M @ 2007-05-08 8:20 ` David Woodhouse 0 siblings, 0 replies; 43+ messages in thread From: David Woodhouse @ 2007-05-08 8:20 UTC (permalink / raw) To: mohan; +Cc: kexec, Geoff Levand On Tue, 2007-05-08 at 12:05 +0530, Mohan Kumar M wrote: > On Mon, May 07, 2007 at 05:03:04PM -0700, Geoff Levand wrote: > > Change the ppc64 device-tree memory node name spec to match the allowable names > > specified in the booting-without-of document. > > > Hi, > > Which part of booting-without-of-document you are refering to use > "memory" instead of "memory@"/"memory@0" node? About line 449: 'The kernel powerpc generic code does not make any formal use of the unit address (though some board support code may do) so the only real requirement here for the unit address is to ensure uniqueness of the node unit name at a given level of the tree. Nodes with no notion of address and no possible sibling of the same name (like /memory or /cpus) may omit the unit address in the context of this specification, or use the "@0" default unit address. The unit name is used to define a node "full path", which is the concatenation of all parent node unit names separated with "/".' -- dwmw2 _______________________________________________ kexec mailing list kexec@lists.infradead.org http://lists.infradead.org/mailman/listinfo/kexec ^ permalink raw reply [flat|nested] 43+ messages in thread
* [patch v2] kexec fix ppc64 device-tree mem node 2007-05-08 0:03 ` [patch 5/5] kexec fix ppc64 device-tree mem node Geoff Levand 2007-05-08 6:14 ` Simon Horman 2007-05-08 6:35 ` Mohan Kumar M @ 2007-05-09 2:39 ` Geoff Levand 2007-05-09 22:35 ` [patch v3] " Geoff Levand 2 siblings, 1 reply; 43+ messages in thread From: Geoff Levand @ 2007-05-09 2:39 UTC (permalink / raw) To: Geoff Levand; +Cc: kexec Change the ppc64 device-tree memory node name spec to match 'memory' or 'memory@', as specified in the booting-without-of document. Signed-off-by: Geoff Levand <geoffrey.levand@am.sony.com> --- Version 2, changed to look for 'memory' or 'memory@' nodes. kexec/arch/ppc64/crashdump-ppc64.c | 3 ++- kexec/arch/ppc64/kexec-ppc64.c | 16 ++++++++++------ 2 files changed, 12 insertions(+), 7 deletions(-) --- ps3-kexec-tools.orig/kexec/arch/ppc64/crashdump-ppc64.c +++ ps3-kexec-tools/kexec/arch/ppc64/crashdump-ppc64.c @@ -129,7 +129,8 @@ static int get_crash_memory_ranges(struc goto err; } while ((dentry = readdir(dir)) != NULL) { - if (strncmp(dentry->d_name, "memory@", 7)) + if (strncmp(dentry->d_name, "memory@", 7) && + strcmp(dentry->d_name, "memory")) continue; strcpy(fname, device_tree); strcat(fname, dentry->d_name); --- ps3-kexec-tools.orig/kexec/arch/ppc64/kexec-ppc64.c +++ ps3-kexec-tools/kexec/arch/ppc64/kexec-ppc64.c @@ -98,7 +98,7 @@ err1: } /* - * Count the memory@ nodes under /proc/device-tree and populate the + * Count the memory nodes under /proc/device-tree and populate the * max_memory_ranges variable. This variable replaces MAX_MEMORY_RANGES * macro used earlier. */ @@ -114,8 +114,9 @@ static int count_memory_ranges(void) } while ((dentry = readdir(dir)) != NULL) { - if (strncmp(dentry->d_name, "memory@", 7) && - strncmp(dentry->d_name, "pci@", 4)) + strncmp(dentry->d_name, "memory@", 7) && + strcmp(dentry->d_name, "memory") && + strncmp(dentry->d_name, "pci@", 4)) continue; max_memory_ranges++; } @@ -170,7 +171,8 @@ static int get_base_ranges(void) return -1; } while ((dentry = readdir(dir)) != NULL) { - if (strncmp(dentry->d_name, "memory@", 7)) + if (strncmp(dentry->d_name, "memory@", 7) && + strcmp(dentry->d_name, "memory")) continue; strcpy(fname, device_tree); strcat(fname, dentry->d_name); @@ -272,7 +274,8 @@ static int get_devtree_details(unsigned while ((dentry = readdir(dir)) != NULL) { if (strncmp(dentry->d_name, "chosen", 6) && - strncmp(dentry->d_name, "memory@0", 8) && + strncmp(dentry->d_name, "memory@", 7) && + strcmp(dentry->d_name, "memory") && strncmp(dentry->d_name, "pci@", 4) && strncmp(dentry->d_name, "rtas", 4)) continue; @@ -452,7 +455,8 @@ static int get_devtree_details(unsigned add_usable_mem_rgns(rtas_base, rtas_size); } /* rtas */ - if (strncmp(dentry->d_name, "memory@0", 8) == 0) { + if (!strncmp(dentry->d_name, "memory@", 7) || + !strcmp(dentry->d_name, "memory")) { strcat(fname, "/reg"); if ((file = fopen(fname, "r")) == NULL) { perror(fname); _______________________________________________ kexec mailing list kexec@lists.infradead.org http://lists.infradead.org/mailman/listinfo/kexec ^ permalink raw reply [flat|nested] 43+ messages in thread
* [patch v3] kexec fix ppc64 device-tree mem node 2007-05-09 2:39 ` [patch v2] " Geoff Levand @ 2007-05-09 22:35 ` Geoff Levand 2007-05-14 19:08 ` Geoff Levand 0 siblings, 1 reply; 43+ messages in thread From: Geoff Levand @ 2007-05-09 22:35 UTC (permalink / raw) To: Geoff Levand; +Cc: kexec Subject: kexec fix ppc64 device-tree mem node Change the ppc64 device-tree memory node name spec to match the allowable names specified in the booting-without-of document. Signed-off-by: Geoff Levand <geoffrey.levand@am.sony.com> --- Version 2, Changed to look for 'memory', or 'memory@' nodes. Version 3, Fixed missing 'if' in get_base_ranges(). kexec/arch/ppc64/crashdump-ppc64.c | 3 ++- kexec/arch/ppc64/kexec-ppc64.c | 14 +++++++++----- 2 files changed, 11 insertions(+), 6 deletions(-) --- ps3-kexec-tools.orig/kexec/arch/ppc64/crashdump-ppc64.c +++ ps3-kexec-tools/kexec/arch/ppc64/crashdump-ppc64.c @@ -129,7 +129,8 @@ static int get_crash_memory_ranges(struc goto err; } while ((dentry = readdir(dir)) != NULL) { - if (strncmp(dentry->d_name, "memory@", 7)) + if (strncmp(dentry->d_name, "memory@", 7) && + strcmp(dentry->d_name, "memory")) continue; strcpy(fname, device_tree); strcat(fname, dentry->d_name); --- ps3-kexec-tools.orig/kexec/arch/ppc64/kexec-ppc64.c +++ ps3-kexec-tools/kexec/arch/ppc64/kexec-ppc64.c @@ -98,7 +98,7 @@ err1: } /* - * Count the memory@ nodes under /proc/device-tree and populate the + * Count the memory nodes under /proc/device-tree and populate the * max_memory_ranges variable. This variable replaces MAX_MEMORY_RANGES * macro used earlier. */ @@ -115,7 +115,8 @@ static int count_memory_ranges(void) while ((dentry = readdir(dir)) != NULL) { if (strncmp(dentry->d_name, "memory@", 7) && - strncmp(dentry->d_name, "pci@", 4)) + strcmp(dentry->d_name, "memory") && + strncmp(dentry->d_name, "pci@", 4)) continue; max_memory_ranges++; } @@ -170,7 +171,8 @@ static int get_base_ranges(void) return -1; } while ((dentry = readdir(dir)) != NULL) { - if (strncmp(dentry->d_name, "memory@", 7)) + if (strncmp(dentry->d_name, "memory@", 7) && + strcmp(dentry->d_name, "memory")) continue; strcpy(fname, device_tree); strcat(fname, dentry->d_name); @@ -272,7 +274,8 @@ static int get_devtree_details(unsigned while ((dentry = readdir(dir)) != NULL) { if (strncmp(dentry->d_name, "chosen", 6) && - strncmp(dentry->d_name, "memory@0", 8) && + strncmp(dentry->d_name, "memory@", 7) && + strcmp(dentry->d_name, "memory") && strncmp(dentry->d_name, "pci@", 4) && strncmp(dentry->d_name, "rtas", 4)) continue; @@ -452,7 +455,8 @@ static int get_devtree_details(unsigned add_usable_mem_rgns(rtas_base, rtas_size); } /* rtas */ - if (strncmp(dentry->d_name, "memory@0", 8) == 0) { + if (!strncmp(dentry->d_name, "memory@", 7) || + !strcmp(dentry->d_name, "memory")) { strcat(fname, "/reg"); if ((file = fopen(fname, "r")) == NULL) { perror(fname); _______________________________________________ kexec mailing list kexec@lists.infradead.org http://lists.infradead.org/mailman/listinfo/kexec ^ permalink raw reply [flat|nested] 43+ messages in thread
* Re: [patch v3] kexec fix ppc64 device-tree mem node 2007-05-09 22:35 ` [patch v3] " Geoff Levand @ 2007-05-14 19:08 ` Geoff Levand 2007-05-15 4:38 ` Simon Horman 0 siblings, 1 reply; 43+ messages in thread From: Geoff Levand @ 2007-05-14 19:08 UTC (permalink / raw) To: horms; +Cc: kexec Hi Simon. Geoff Levand wrote: > Subject: kexec fix ppc64 device-tree mem node > > Change the ppc64 device-tree memory node name spec to match the allowable names > specified in the booting-without-of document. > > Signed-off-by: Geoff Levand <geoffrey.levand@am.sony.com> > --- > Version 2, Changed to look for 'memory', or 'memory@' nodes. > Version 3, Fixed missing 'if' in get_base_ranges(). > > kexec/arch/ppc64/crashdump-ppc64.c | 3 ++- > kexec/arch/ppc64/kexec-ppc64.c | 14 +++++++++----- > 2 files changed, 11 insertions(+), 6 deletions(-) There are currently no outstanding issues with this, so I would like it to get merged in. It is needed to support kexec on the PS3 game console. -Geoff _______________________________________________ kexec mailing list kexec@lists.infradead.org http://lists.infradead.org/mailman/listinfo/kexec ^ permalink raw reply [flat|nested] 43+ messages in thread
* Re: [patch v3] kexec fix ppc64 device-tree mem node 2007-05-14 19:08 ` Geoff Levand @ 2007-05-15 4:38 ` Simon Horman 0 siblings, 0 replies; 43+ messages in thread From: Simon Horman @ 2007-05-15 4:38 UTC (permalink / raw) To: Geoff Levand; +Cc: kexec On Mon, May 14, 2007 at 12:08:52PM -0700, Geoff Levand wrote: > Hi Simon. > > Geoff Levand wrote: > > Subject: kexec fix ppc64 device-tree mem node > > > > Change the ppc64 device-tree memory node name spec to match the allowable names > > specified in the booting-without-of document. > > > > Signed-off-by: Geoff Levand <geoffrey.levand@am.sony.com> > > --- > > Version 2, Changed to look for 'memory', or 'memory@' nodes. > > Version 3, Fixed missing 'if' in get_base_ranges(). > > > > kexec/arch/ppc64/crashdump-ppc64.c | 3 ++- > > kexec/arch/ppc64/kexec-ppc64.c | 14 +++++++++----- > > 2 files changed, 11 insertions(+), 6 deletions(-) > > There are currently no outstanding issues with this, so > I would like it to get merged in. It is needed to support > kexec on the PS3 game console. Sure, I have applied it now. -- Horms H: http://www.vergenet.net/~horms/ W: http://www.valinux.co.jp/en/ _______________________________________________ kexec mailing list kexec@lists.infradead.org http://lists.infradead.org/mailman/listinfo/kexec ^ permalink raw reply [flat|nested] 43+ messages in thread
end of thread, other threads:[~2007-05-16 17:46 UTC | newest]
Thread overview: 43+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <20070507235727.631477448@am.sony.com>
2007-05-08 0:02 ` [patch 1/5] kexec debug output improvments Geoff Levand
2007-05-08 6:08 ` Simon Horman
2007-05-08 14:40 ` Geoff Levand
2007-05-09 6:47 ` Simon Horman
2007-05-08 6:12 ` use dprintf Simon Horman
2007-05-09 21:40 ` [patch 1/2] kexec remove last remaining dfprintf Geoff Levand
2007-05-10 2:13 ` Simon Horman
2007-05-10 2:55 ` Simon Horman
2007-05-09 21:40 ` [patch 2/2] kexec rename dprintf to dbgprintf Geoff Levand
2007-05-10 2:14 ` Simon Horman
2007-05-10 2:55 ` Simon Horman
2007-05-10 22:10 ` kexec and kdb Preetesh Parekh
2007-05-11 4:23 ` Vivek Goyal
2007-05-14 23:20 ` Preetesh Parekh
2007-05-15 7:54 ` Vivek Goyal
2007-05-16 17:45 ` Preetesh Parekh
2007-05-08 6:20 ` [patch 1/5] kexec debug output improvments Vivek Goyal
2007-05-08 7:24 ` Simon Horman
2007-05-08 14:36 ` Geoff Levand
2007-05-08 16:02 ` Vivek Goyal
2007-05-09 1:11 ` Geoff Levand
2007-05-09 4:19 ` Vivek Goyal
2007-05-08 0:02 ` [patch 2/5] kexec improve build for ppc64 Geoff Levand
2007-05-08 6:07 ` Simon Horman
2007-05-08 0:02 ` [patch 3/5] kexec add strict-prototypes Geoff Levand
2007-05-08 2:38 ` Simon Horman
2007-05-08 14:56 ` Geoff Levand
2007-05-09 0:33 ` [patch 1/2] " Geoff Levand
2007-05-09 6:48 ` Simon Horman
2007-05-09 0:33 ` [patch 2/2] kexec fix prototypes for ppc64 Geoff Levand
2007-05-09 6:48 ` Simon Horman
2007-05-08 0:03 ` [patch 4/5] Add proper node alignment for the powerpc device-tree cmdline Geoff Levand
2007-05-08 6:13 ` Simon Horman
2007-05-08 14:50 ` Milton Miller
2007-05-08 0:03 ` [patch 5/5] kexec fix ppc64 device-tree mem node Geoff Levand
2007-05-08 6:14 ` Simon Horman
2007-05-08 14:57 ` Spam:****, " Milton Miller
2007-05-08 6:35 ` Mohan Kumar M
2007-05-08 8:20 ` David Woodhouse
2007-05-09 2:39 ` [patch v2] " Geoff Levand
2007-05-09 22:35 ` [patch v3] " Geoff Levand
2007-05-14 19:08 ` Geoff Levand
2007-05-15 4:38 ` Simon Horman
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox