Skip to contentSkip to conversation

fix initcall_debug on ppc64/ia64

PATCH New Olaf Hering 2 participants 3 messages Nov 4, 2004 – Nov 5, 2004 2 messages not in the archive

lore
Share & tools
lore

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

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

#2 lore raw
Quoted 8 lines · Andrew Morton
Quoted 4 lines · Olaf Hering

Is a patch like that acceptable (for mainline)? Currently only the descriptor is printed, not the function itself. Another redirection is needed.

Is this acked by Paul and Anton? If so, I'll replace __powerpc64__ with CONFIG_PPC64 and run with it.

I guess we need something like this.
Just where to put it, how to name it and how to handle ia64:

include/linux/kallsyms.h +9 -0
diff -purNx tags linux-2.6.9/include/linux/kallsyms.h linux-2.6.10-rc1-bk14.initcall_debug/include/linux/kallsyms.h
@@ -47,6 +47,15 @@ __attribute__((format(printf,1,2)));
 static inline void __check_printsym_format(const char *fmt, ...)
 {
 }
+#ifdef CONFIG_PPC64
+#define print_foo_symbol(fmt, addr)		\
+do {						\
+	unsigned long *__pfs = (unsigned long*) addr;		\
+	print_symbol(fmt, __pfs[0]);		\
+} while (0)
+#else
+#define print_foo_symbol(fmt, addr) print_symbol(fmt, addr)
+#endif
 
 #define print_symbol(fmt, addr)			\
 do {						\
init/main.c +1 -1
diff -purNx tags linux-2.6.9/init/main.c linux-2.6.10-rc1-bk14.initcall_debug/init/main.c
@@ -604,7 +604,7 @@ static void __init do_initcalls(void)
 
 		if (initcall_debug) {
 			printk(KERN_DEBUG "Calling initcall 0x%p", *call);
-			print_symbol(": %s()", (unsigned long) *call);
+			print_foo_symbol(": %s()", (unsigned long) *call);
 			printk("\n");
 		}
 
Signature · 3 lines
USB is for mice, FireWire is for men!

sUse lINUX ag, nÜRNBERG
#3 lore raw
Quoted 8 lines · Olaf Hering
Quoted 6 lines · Andrew Morton
Quoted 4 lines · Olaf Hering

Is a patch like that acceptable (for mainline)? Currently only the descriptor is printed, not the function itself. Another redirection is needed.

Quoted 6 lines
Quoted 2 lines

Is this acked by Paul and Anton? If so, I'll replace __powerpc64__ with CONFIG_PPC64 and run with it.

I guess we need something like this.
Just where to put it, how to name it and how to handle ia64:

The ia64 version should be identical.

Andreas.

Signature · 4 lines
Andreas Schwab, SuSE Labs, [email protected]
SuSE Linux AG, Maxfeldstraße 5, 90409 Nürnberg, Germany
Key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."
#4 lore raw

PATCH 1/1 fix initcall_debug on ppc64/ia64

In reply to Olaf Hering

ia64 and ppc64 have function descriptors.
Booting with initcall_debug will print the descriptor address, not the address and name of the actual function. Another redirection is required.

Tested on ppc, ppc64 and ia64.

include/linux/kallsyms.h +10 -0
diff -purNx tags linux-2.6.9/include/linux/kallsyms.h linux-2.6.10-rc1-bk14.initcall_debug/include/linux/kallsyms.h
@@ -47,6 +47,16 @@ __attribute__((format(printf,1,2)));
 static inline void __check_printsym_format(const char *fmt, ...)
 {
 }
+/* ia64 and ppc64 use function descriptors, which contain the real address */
+#if defined(CONFIG_IA64) || defined(CONFIG_PPC64)
+#define print_fn_descriptor_symbol(fmt, addr)		\
+do {						\
+	unsigned long *__faddr = (unsigned long*) addr;		\
+	print_symbol(fmt, __faddr[0]);		\
+} while (0)
+#else
+#define print_fn_descriptor_symbol(fmt, addr) print_symbol(fmt, addr)
+#endif
 
 #define print_symbol(fmt, addr)			\
 do {						\
init/main.c +1 -1
diff -purNx tags linux-2.6.9/init/main.c linux-2.6.10-rc1-bk14.initcall_debug/init/main.c
@@ -604,7 +604,7 @@ static void __init do_initcalls(void)
 
 		if (initcall_debug) {
 			printk(KERN_DEBUG "Calling initcall 0x%p", *call);
-			print_symbol(": %s()", (unsigned long) *call);
+			print_fn_descriptor_symbol(": %s()", (unsigned long) *call);
 			printk("\n");
 		}
 
Signature · 3 lines
USB is for mice, FireWire is for men!

sUse lINUX ag, nÜRNBERG