Skip to contentSkip to conversation

Add proper node alignment for the powerpc device-tree cmdline.

PATCH NAK Geoff Levand 7 participants 43 messages May 8, 2007 – May 16, 2007 1 message not in the archive

Subsystems (2)
lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): [email protected]

#1 lore raw

PATCH 1/5 kexec debug output improvments

kexec debug output improvments.
- Add better type checking for the debug output macro dfprintf().
- Add a convenence macro dprintf().

---
 kexec/kexec.h |    6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
kexec/kexec.h +4 -2
@@ -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 */
Signature · 4 lines
_______________________________________________
kexec mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/kexec
#2 lore raw

Re: [patch 1/5] kexec debug output improvments

Quoted 14 lines · Geoff Levand

kexec debug output improvments.
- Add better type checking for the debug output macro dfprintf().
- Add a convenence macro dprintf().

---
 kexec/kexec.h |    6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
kexec/kexec.h +0 -0
@@ -217,10 +217,12 @@ int parse_iomem_single(char *str, uint64
 
 #define MAX_LINE	160

kexec/kexec.h int parse_iomem_single(char *str, uint64 · line 226

Quoted 10 lines
kexec/kexec.h +4 -2
 
+#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?

Signature · 9 lines
Horms
  H: http://www.vergenet.net/~horms/
  W: http://www.valinux.co.jp/en/


_______________________________________________
kexec mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/kexec
#3 lore raw

Re: [patch 1/5] kexec debug output improvments

Quoted 28 lines · Simon Horman
Quoted 14 lines · Geoff Levand

kexec debug output improvments.
- Add better type checking for the debug output macro dfprintf().
- Add a convenence macro dprintf().

---
 kexec/kexec.h |    6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
kexec/kexec.h +0 -0
@@ -217,10 +217,12 @@ int parse_iomem_single(char *str, uint64
 
 #define MAX_LINE	160

kexec/kexec.h int parse_iomem_single(char *str, uint64 · line 226

Quoted 10 lines
kexec/kexec.h +4 -2
 
+#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

Quoted 3 lines

static inline int __attribute__ ((format (printf, 2, 3)))

am I crazy?

Yes, you are not crazy! My mistake.

-Geoff

_______________________________________________
kexec mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/kexec

#4 lore raw

Re: [patch 1/5] kexec debug output improvments

Quoted 29 lines · Geoff Levand
Quoted 28 lines · Simon Horman
Quoted 14 lines · Geoff Levand

kexec debug output improvments.
- Add better type checking for the debug output macro dfprintf().
- Add a convenence macro dprintf().

---
 kexec/kexec.h |    6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
kexec/kexec.h +0 -0
@@ -217,10 +217,12 @@ int parse_iomem_single(char *str, uint64
 
 #define MAX_LINE	160

kexec/kexec.h int parse_iomem_single(char *str, uint64 · line 226

Quoted 10 lines
kexec/kexec.h +4 -2
 
+#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

Quoted 5 lines
Quoted 3 lines

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.

Signature · 9 lines
Horms
  H: http://www.vergenet.net/~horms/
  W: http://www.valinux.co.jp/en/


_______________________________________________
kexec mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/kexec
#5 lore raw

use dprintf

In reply to Geoff Levand

Use the new fprintf macro where possible

---

 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(-)
kexec/arch/i386/crashdump-x86.c +2 -3
Index: kexec-tools-testing-geoff-levand/kexec/arch/i386/crashdump-x86.c
===================================================================
@@ -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);
kexec/arch/i386/kexec-bzImage.c +4 -5
Index: kexec-tools-testing-geoff-levand/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;
-		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,
kexec/arch/i386/x86-linux-setup.c +3 -3
Index: kexec-tools-testing-geoff-levand/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;
-		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;
kexec/crashdump-elf.c +14 -16
Index: kexec-tools-testing-geoff-levand/kexec/crashdump-elf.c
===================================================================
@@ -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
[email protected]
http://lists.infradead.org/mailman/listinfo/kexec

#6 lore raw

PATCH 1/2 kexec remove last remaining dfprintf

Remove the last remaining dfprintf call and remove the dfprintf definition.

---
 kexec/arch/ppc64/kexec-ppc64.c |    2 +-
 kexec/kexec.h                  |    7 +++----
 2 files changed, 4 insertions(+), 5 deletions(-)
kexec/arch/ppc64/kexec-ppc64.c +1 -1
@@ -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);
kexec/kexec.h +3 -4
@@ -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
[email protected]
http://lists.infradead.org/mailman/listinfo/kexec

#7 lore raw

Re: [patch 1/2] kexec remove last remaining dfprintf

Quoted 2 lines · Geoff Levand

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

Signature · 9 lines
Horms
  H: http://www.vergenet.net/~horms/
  W: http://www.valinux.co.jp/en/


_______________________________________________
kexec mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/kexec
#8 lore raw

Re: [patch 1/2] kexec remove last remaining dfprintf

Quoted 7 lines · Simon Horman
Quoted 2 lines · Geoff Levand

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 :-)

Signature · 9 lines
Horms
  H: http://www.vergenet.net/~horms/
  W: http://www.valinux.co.jp/en/


_______________________________________________
kexec mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/kexec
#9 lore raw

PATCH 2/2 kexec rename dprintf to dbgprintf

In reply to Simon Horman

The recently introduce kexec debug routine dprintf clashes with an existing libc symbol. Rename dprintf to dbgprintf.

---
 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(-)
kexec/arch/i386/crashdump-x86.c +2 -2
@@ -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);
kexec/arch/i386/kexec-bzImage.c +4 -4
@@ -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,
kexec/arch/i386/x86-linux-setup.c +2 -2
@@ -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;
kexec/arch/ppc64/kexec-ppc64.c +1 -1
@@ -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);
kexec/crashdump-elf.c +8 -8
@@ -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
kexec/kexec.h +2 -2
@@ -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
[email protected]
http://lists.infradead.org/mailman/listinfo/kexec

#10 lore raw

Re: [patch 2/2] kexec rename dprintf to dbgprintf

Quoted 2 lines · Geoff Levand

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.

Signature · 9 lines
Horms
  H: http://www.vergenet.net/~horms/
  W: http://www.valinux.co.jp/en/


_______________________________________________
kexec mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/kexec
Applied
#11 lore raw

Re: [patch 2/2] kexec rename dprintf to dbgprintf

Quoted 7 lines · Simon Horman
Quoted 2 lines · Geoff Levand

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.

Signature · 9 lines
Horms
  H: http://www.vergenet.net/~horms/
  W: http://www.valinux.co.jp/en/


_______________________________________________
kexec mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/kexec
#12 lore raw

kexec and kdb

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
[email protected]
http://lists.infradead.org/mailman/listinfo/kexec

#13 lore raw

Re: kexec and kdb

Quoted 5 lines · Preetesh Parekh

Hi,

I have a question about kexec and kdb. Please advice or point me to the right mailing list that can answer this.

Quoted 9 lines

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
[email protected]
http://lists.infradead.org/mailman/listinfo/kexec

#14 lore raw

RE: kexec and kdb

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:[email protected]]
Sent: Thursday, May 10, 2007 9:23 PM
To: Preetesh Parekh
Cc: [email protected]
Subject: Re: kexec and kdb

Quoted 3 lines · Preetesh Parekh

Hi,

I have a question about kexec and kdb. Please advice or point me to

the

Quoted 3 lines

right mailing list that can answer this.

I have a linux 2.6.20 kernel (patched with kdb patches) on i686

system.

Quoted 8 lines

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
[email protected]
http://lists.infradead.org/mailman/listinfo/kexec

#15 lore raw

Re: kexec and kdb

Quoted 5 lines · Preetesh Parekh

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
[email protected]
http://lists.infradead.org/mailman/listinfo/kexec

#16 lore raw

RE: kexec and kdb

You are right. It's working now. Thanks.

Preetesh

-----Original Message-----
From: Vivek Goyal [mailto:[email protected]]
Sent: Tuesday, May 15, 2007 12:55 AM
To: Preetesh Parekh
Cc: [email protected]
Subject: Re: kexec and kdb

Quoted 5 lines · Preetesh Parekh

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
[email protected]
http://lists.infradead.org/mailman/listinfo/kexec

#17 lore raw

Re: [patch 1/5] kexec debug output improvments

In reply to Geoff Levand
Quoted 12 lines · Geoff Levand

kexec debug output improvments.
- Add better type checking for the debug output macro dfprintf().
- Add a convenence macro dprintf().

---
 kexec/kexec.h |    6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

kexec/kexec.h int parse_iomem_single(char *str, uint64 · line 222

Quoted 7 lines
kexec/kexec.h +2 -1
@@ -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
[email protected]
http://lists.infradead.org/mailman/listinfo/kexec

#18 lore raw

Re: [patch 1/5] kexec debug output improvments

Quoted 14 lines · Vivek Goyal
Quoted 13 lines · Geoff Levand

kexec debug output improvments.
- Add better type checking for the debug output macro dfprintf().
- Add a convenence macro dprintf().

---
 kexec/kexec.h |    6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
kexec/kexec.h +0 -0
@@ -217,10 +217,12 @@ int parse_iomem_single(char *str, uint64
 
Quoted 8 lines

kexec/kexec.h int parse_iomem_single(char *str, uint64 · line 222

Quoted 6 lines
kexec/kexec.h +2 -1
 #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.

Signature · 9 lines
Horms
  H: http://www.vergenet.net/~horms/
  W: http://www.valinux.co.jp/en/


_______________________________________________
kexec mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/kexec
#19 lore raw

Re: [patch 1/5] kexec debug output improvments

In reply to Vivek Goyal
Quoted 7 lines · Vivek Goyal

kexec/kexec.h int parse_iomem_single(char *str, uint64 · line 222

Quoted 4 lines · Geoff Levand
kexec/kexec.h +2 -1
+#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
[email protected]
http://lists.infradead.org/mailman/listinfo/kexec

#20 lore raw

Re: [patch 1/5] kexec debug output improvments

Quoted 11 lines · Geoff Levand
Quoted 7 lines · Vivek Goyal

kexec/kexec.h int parse_iomem_single(char *str, uint64 · line 222

Quoted 4 lines · Geoff Levand
kexec/kexec.h +2 -1
+#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
[email protected]
http://lists.infradead.org/mailman/listinfo/kexec

#21 lore raw

Re: [patch 1/5] kexec debug output improvments

Quoted 10 lines · Vivek Goyal
Quoted 9 lines · Geoff Levand
Quoted 7 lines · Vivek Goyal

kexec/kexec.h int parse_iomem_single(char *str, uint64 · line 222

Quoted 4 lines · Geoff Levand
kexec/kexec.h +2 -1
+#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?

Quoted 6 lines
Quoted 2 lines

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
[email protected]
http://lists.infradead.org/mailman/listinfo/kexec

#22 lore raw

Re: [patch 1/5] kexec debug output improvments

Quoted 14 lines · Geoff Levand
Quoted 13 lines · Vivek Goyal
Quoted 11 lines · Geoff Levand
Quoted 7 lines · Vivek Goyal

kexec/kexec.h int parse_iomem_single(char *str, uint64 · line 222

Quoted 4 lines · Geoff Levand
kexec/kexec.h +2 -1
+#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.

Quoted 6 lines
Quoted 3 lines

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
[email protected]
http://lists.infradead.org/mailman/listinfo/kexec

#23 lore raw

PATCH 2/5 kexec improve build for ppc64

In reply to a message not in the archive

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.

---
 configure.ac |   13 +++++++++++--
 1 file changed, 11 insertions(+), 2 deletions(-)
configure.ac +11 -2
@@ -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" ])
 
Signature · 4 lines
_______________________________________________
kexec mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/kexec
#24 lore raw

Re: [patch 2/5] kexec improve build for ppc64

Quoted 4 lines · 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.

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.

Signature · 9 lines
Horms
  H: http://www.vergenet.net/~horms/
  W: http://www.valinux.co.jp/en/


_______________________________________________
kexec mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/kexec
#25 lore raw

PATCH 3/5 kexec add strict-prototypes

In reply to a message not in the archive

Add -Wstrict-prototypes to EXTRA_CFLAGS and fix the powerpc compiler warnings.

---
 configure.ac                   |    2 -
 kexec/arch/ppc64/kexec-ppc64.c |   61 +++++++++++++++++++----------------------
 2 files changed, 30 insertions(+), 33 deletions(-)
configure.ac +1 -1
@@ -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/arch/ppc64/kexec-ppc64.c +29 -32

93 lines not on this page · raw message

Signature · 4 lines
_______________________________________________
kexec mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/kexec
#26 lore raw

Re: [patch 3/5] kexec add strict-prototypes

Quoted 3 lines · Geoff Levand

Add -Wstrict-prototypes to EXTRA_CFLAGS and fix the powerpc compiler warnings.

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?

Quoted 83 lines
---
 configure.ac                   |    2 -
 kexec/arch/ppc64/kexec-ppc64.c |   61 +++++++++++++++++++----------------------
 2 files changed, 30 insertions(+), 33 deletions(-)
configure.ac +1 -1
@@ -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/arch/ppc64/kexec-ppc64.c +28 -7
@@ -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/";

kexec/arch/ppc64/kexec-ppc64.c static int get_base_ranges() · line 226

Quoted 2 lines
kexec/arch/ppc64/kexec-ppc64.c +0 -0
@@ -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?

Quoted 39 lines
kexec/arch/ppc64/kexec-ppc64.c +1 -25
-/* 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;
 
Signature · 4 lines
_______________________________________________
kexec mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/kexec
Signature · 9 lines
Horms
  H: http://www.vergenet.net/~horms/
  W: http://www.valinux.co.jp/en/


_______________________________________________
kexec mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/kexec
#27 lore raw

Re: [patch 3/5] kexec add strict-prototypes

Quoted 7 lines · Simon Horman
Quoted 3 lines · Geoff Levand

Add -Wstrict-prototypes to EXTRA_CFLAGS and fix the powerpc compiler warnings.

Hi Geoff,

Quoted 8 lines

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.

Quoted 5 lines

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
[email protected]
http://lists.infradead.org/mailman/listinfo/kexec

#28 lore raw

PATCH 1/2 kexec add strict-prototypes

In reply to Simon Horman

Add the complier flag -Wstrict-prototypes to EXTRA_CFLAGS.

---
 configure.ac                   |    2 -
configure.ac +1 -1
@@ -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
[email protected]
http://lists.infradead.org/mailman/listinfo/kexec

Applied
#29 lore raw

Re: [patch 1/2] kexec add strict-prototypes

Quoted 3 lines · Geoff Levand

Add the complier flag -Wstrict-prototypes to EXTRA_CFLAGS.

Thanks, applied.

Signature · 9 lines
Horms
  H: http://www.vergenet.net/~horms/
  W: http://www.valinux.co.jp/en/


_______________________________________________
kexec mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/kexec
#30 lore raw

PATCH 2/2 kexec fix prototypes for ppc64

In reply to Simon Horman

Fixup the ppc64 files to remove warnings generated by the -Wstrict-prototypes compiler flag.

---
 kexec/arch/ppc64/kexec-ppc64.c |   61 +++++++++++++++++++----------------------
kexec/arch/ppc64/kexec-ppc64.c +29 -32
@@ -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
[email protected]
http://lists.infradead.org/mailman/listinfo/kexec

Applied
#31 lore raw

Re: [patch 2/2] kexec fix prototypes for ppc64

Quoted 2 lines · Geoff Levand

Fixup the ppc64 files to remove warnings generated by the -Wstrict-prototypes compiler flag.

Thanks, applied.

Signature · 9 lines
Horms
  H: http://www.vergenet.net/~horms/
  W: http://www.valinux.co.jp/en/


_______________________________________________
kexec mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/kexec
#32 lore raw

PATCH 4/5 Add proper node alignment for the powerpc device-tree cmdline.

In reply to a message not in the archive

Add proper node alignment for the powerpc device-tree cmdline.

Fixes the runtime error 'Invalid tag 3a scanning flattened device tree !'.

---
 kexec/arch/ppc64/fs2dt.c |    4 ++++
 1 file changed, 4 insertions(+)
kexec/arch/ppc64/fs2dt.c +4 -0
@@ -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;
Signature · 4 lines
_______________________________________________
kexec mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/kexec
#33 lore raw
Quoted 5 lines · Geoff Levand

Add proper node alignment for the powerpc device-tree cmdline.

Fixes the runtime error 'Invalid tag 3a scanning flattened device tree !'.

This seems ok to me, though I don't know much about the device tree.

Milton, do you have any thoughts on this?

Quoted 27 lines
---
 kexec/arch/ppc64/fs2dt.c |    4 ++++
 1 file changed, 4 insertions(+)
kexec/arch/ppc64/fs2dt.c +4 -0
@@ -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;
Signature · 8 lines
-- 



_______________________________________________
kexec mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/kexec
Signature · 9 lines
Horms
  H: http://www.vergenet.net/~horms/
  W: http://www.valinux.co.jp/en/


_______________________________________________
kexec mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/kexec
#34 lore raw
Quoted 11 lines · Simon Horman
Quoted 6 lines · Geoff Levand

Add proper node alignment for the powerpc device-tree cmdline.

Fixes the runtime error 'Invalid tag 3a scanning flattened device tree !'.

This seems ok to me, though I don't know much about the device tree.

Milton, do you have any thoughts on this?

NACK

Quoted 18 lines
Quoted 18 lines
---
 kexec/arch/ppc64/fs2dt.c |    4 ++++
 1 file changed, 4 insertions(+)
kexec/arch/ppc64/fs2dt.c +4 -0
@@ -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;
Quoted 2 lines
Quoted 2 lines

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
[email protected]
http://lists.infradead.org/mailman/listinfo/kexec

#35 lore raw

PATCH 5/5 kexec fix ppc64 device-tree mem node

In reply to a message not in the archive

Change the ppc64 device-tree memory node name spec to match the allowable names specified in the booting-without-of document.

---
 kexec/arch/ppc64/crashdump-ppc64.c |    2 +-
 kexec/arch/ppc64/kexec-ppc64.c     |   10 +++++-----
 2 files changed, 6 insertions(+), 6 deletions(-)
kexec/arch/ppc64/crashdump-ppc64.c +1 -1
@@ -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/arch/ppc64/kexec-ppc64.c +5 -5
@@ -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);
Signature · 4 lines
_______________________________________________
kexec mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/kexec
#36 lore raw

Re: [patch 5/5] kexec fix ppc64 device-tree mem node

Quoted 4 lines · Geoff Levand

Change the ppc64 device-tree memory node name spec to match the allowable names specified in the booting-without-of document.

Again, this seems fine to me, but I'm not an expert on the device tree. Milton, how does this change sit with you?

Quoted 72 lines
---
 kexec/arch/ppc64/crashdump-ppc64.c |    2 +-
 kexec/arch/ppc64/kexec-ppc64.c     |   10 +++++-----
 2 files changed, 6 insertions(+), 6 deletions(-)
kexec/arch/ppc64/crashdump-ppc64.c +1 -1
@@ -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/arch/ppc64/kexec-ppc64.c +5 -5
@@ -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);
Signature · 8 lines
-- 



_______________________________________________
kexec mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/kexec
Signature · 9 lines
Horms
  H: http://www.vergenet.net/~horms/
  W: http://www.valinux.co.jp/en/


_______________________________________________
kexec mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/kexec
#37 lore raw

Re: Spam:****, Re: [patch 5/5] kexec fix ppc64 device-tree mem node

Quoted 8 lines · Simon Horman

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:

Quoted 8 lines
Quoted 5 lines

Change the ppc64 device-tree memory node name spec to match the allowable names
specified in the booting-without-of document.

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]

Quoted 2 lines

Review

Quoted 2 lines
(quoted diff) +1 -1
-		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.

Quoted 66 lines
Quoted 66 lines
---
 kexec/arch/ppc64/crashdump-ppc64.c |    2 +-
 kexec/arch/ppc64/kexec-ppc64.c     |   10 +++++-----
 2 files changed, 6 insertions(+), 6 deletions(-)
kexec/arch/ppc64/crashdump-ppc64.c +1 -1
@@ -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/arch/ppc64/kexec-ppc64.c +1 -1
@@ -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.
*/

kexec/arch/ppc64/kexec-ppc64.c +4 -4
@@ -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);
Quoted 14 lines
Quoted 8 lines
Signature · 4 lines
_______________________________________________
kexec mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/kexec
Signature · 3 lines
Horms
  H: http://www.vergenet.net/~horms/
  W: http://www.valinux.co.jp/en/

_______________________________________________
kexec mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/kexec

#38 lore raw

Re: [patch 5/5] kexec fix ppc64 device-tree mem node

In reply to Geoff Levand
Quoted 3 lines · Geoff Levand

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
[email protected]
http://lists.infradead.org/mailman/listinfo/kexec

#39 lore raw

Re: [patch 5/5] kexec fix ppc64 device-tree mem node

Quoted 8 lines · Mohan Kumar M
Quoted 3 lines · Geoff Levand

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 "/".'

Signature · 7 lines
dwmw2


_______________________________________________
kexec mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/kexec
#40 lore raw

PATCH v2 1/1 kexec fix ppc64 device-tree mem node

In reply to Geoff Levand

Change the ppc64 device-tree memory node name spec to match 'memory' or 'memory@', as specified in the booting-without-of document.

---
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(-)
kexec/arch/ppc64/crashdump-ppc64.c +2 -1
@@ -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);
kexec/arch/ppc64/kexec-ppc64.c +10 -6
@@ -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
[email protected]
http://lists.infradead.org/mailman/listinfo/kexec

#41 lore raw

PATCH v3 1/1 kexec fix ppc64 device-tree mem node

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.

---
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(-)
kexec/arch/ppc64/crashdump-ppc64.c +2 -1
@@ -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);
kexec/arch/ppc64/kexec-ppc64.c +9 -5
@@ -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
[email protected]
http://lists.infradead.org/mailman/listinfo/kexec

#42 lore raw

Re: [patch v3] kexec fix ppc64 device-tree mem node

Hi Simon.

Quoted 5 lines · Geoff Levand

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.

Quoted 8 lines

---
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
[email protected]
http://lists.infradead.org/mailman/listinfo/kexec

#43 lore raw

Re: [patch v3] kexec fix ppc64 device-tree mem node

Quoted 13 lines · Geoff Levand

Hi Simon.

Quoted 10 lines · Geoff Levand

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.

---
Version 2, Changed to look for 'memory', or 'memory@' nodes. Version 3, Fixed missing 'if' in get_base_ranges().

Quoted 7 lines
Quoted 3 lines
 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.

Signature · 9 lines
Horms
  H: http://www.vergenet.net/~horms/
  W: http://www.valinux.co.jp/en/


_______________________________________________
kexec mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/kexec