* [patch 1/4] lock validator: provide common print_ip_sym()
@ 2006-06-23 13:23 Heiko Carstens
2006-06-23 13:38 ` Ingo Molnar
0 siblings, 1 reply; 2+ messages in thread
From: Heiko Carstens @ 2006-06-23 13:23 UTC (permalink / raw)
To: Andrew Morton; +Cc: linux-kernel, Arjan van de Ven, Ingo Molnar
From: Heiko Carstens <heiko.carstens@de.ibm.com>
Provide a common print_ip_sym() function that prints the passed instruction
pointer as well as the symbol belonging to it. Avoids adding a bunch of
#ifdef CONFIG_64BIT in order to get the printk format right on 32/64 bit
platforms.
Cc: Ingo Molnar <mingo@elte.hu>
Cc: Arjan van de Ven <arjan@infradead.org>
Signed-off-by: Heiko Carstens <heiko.carstens@de.ibm.com>
---
include/linux/kallsyms.h | 14 ++++++++++++++
kernel/lockdep.c | 38 ++++++++++++++------------------------
kernel/stacktrace.c | 4 +---
3 files changed, 29 insertions(+), 27 deletions(-)
Index: linux-2.6.17-mm1/include/linux/kallsyms.h
===================================================================
--- linux-2.6.17-mm1.orig/include/linux/kallsyms.h
+++ linux-2.6.17-mm1/include/linux/kallsyms.h
@@ -63,4 +63,18 @@ do { \
__print_symbol(fmt, addr); \
} while(0)
+#ifndef CONFIG_64BIT
+#define print_ip_sym(ip) \
+do { \
+ printk("[<%08lx>]", ip); \
+ print_symbol(" %s\n", ip); \
+} while(0)
+#else
+#define print_ip_sym(ip) \
+do { \
+ printk("[<%016lx>]", ip); \
+ print_symbol(" %s\n", ip); \
+} while(0)
+#endif
+
#endif /*_LINUX_KALLSYMS_H*/
Index: linux-2.6.17-mm1/kernel/lockdep.c
===================================================================
--- linux-2.6.17-mm1.orig/kernel/lockdep.c
+++ linux-2.6.17-mm1/kernel/lockdep.c
@@ -311,12 +311,6 @@ static const char *usage_str[] =
[LOCK_ENABLED_HARDIRQS_READ] = "hardirq-on-R",
};
-static void printk_sym(unsigned long ip)
-{
- printk(" [<%08lx>]", ip);
- print_symbol(" %s\n", ip);
-}
-
const char * __get_key_name(struct lockdep_subtype_key *key, char *str)
{
unsigned long offs, size;
@@ -413,8 +407,8 @@ static void print_lockdep_cache(struct l
static void print_lock(struct held_lock *hlock)
{
print_lock_name(hlock->type);
- printk(", at:");
- printk_sym(hlock->acquire_ip);
+ printk(", at: ");
+ print_ip_sym(hlock->acquire_ip);
}
void lockdep_print_held_locks(struct task_struct *curr)
@@ -468,8 +462,8 @@ void print_lock_type_header(struct lock_
printk(" }\n");
print_spaces(depth);
- printk(" ... key at:");
- printk_sym((unsigned long)type->key);
+ printk(" ... key at: ");
+ print_ip_sym((unsigned long)type->key);
}
/*
@@ -1508,18 +1502,14 @@ check_usage_backwards(struct task_struct
static inline void print_irqtrace_events(struct task_struct *curr)
{
printk("irq event stamp: %u\n", curr->irq_events);
- printk("hardirqs last enabled at (%u): [<%08lx>]",
- curr->hardirq_enable_event, curr->hardirq_enable_ip);
- print_symbol(" %s\n", curr->hardirq_enable_ip);
- printk("hardirqs last disabled at (%u): [<%08lx>]",
- curr->hardirq_disable_event, curr->hardirq_disable_ip);
- print_symbol(" %s\n", curr->hardirq_disable_ip);
- printk("softirqs last enabled at (%u): [<%08lx>]",
- curr->softirq_enable_event, curr->softirq_enable_ip);
- print_symbol(" %s\n", curr->softirq_enable_ip);
- printk("softirqs last disabled at (%u): [<%08lx>]",
- curr->softirq_disable_event, curr->softirq_disable_ip);
- print_symbol(" %s\n", curr->softirq_disable_ip);
+ printk("hardirqs last enabled at (%u): ", curr->hardirq_enable_event);
+ print_ip_sym(curr->hardirq_enable_ip);
+ printk("hardirqs last disabled at (%u): ", curr->hardirq_disable_event);
+ print_ip_sym(curr->hardirq_disable_ip);
+ printk("softirqs last enabled at (%u): ", curr->softirq_enable_event);
+ print_ip_sym(curr->softirq_enable_ip);
+ printk("softirqs last disabled at (%u): ", curr->softirq_disable_event);
+ print_ip_sym(curr->softirq_disable_ip);
}
#else
@@ -2262,7 +2252,7 @@ print_unlock_order_bug(struct task_struc
curr->comm, curr->pid);
print_lockdep_cache(lock);
printk(") at:\n");
- printk_sym(ip);
+ print_ip_sym(ip);
printk("but the next lock to release is:\n");
print_lock(hlock);
printk("\nother info that might help us debug this:\n");
@@ -2292,7 +2282,7 @@ print_unlock_inbalance_bug(struct task_s
curr->comm, curr->pid);
print_lockdep_cache(lock);
printk(") at:\n");
- printk_sym(ip);
+ print_ip_sym(ip);
printk("but there are no more locks to release!\n");
printk("\nother info that might help us debug this:\n");
lockdep_print_held_locks(curr);
Index: linux-2.6.17-mm1/kernel/stacktrace.c
===================================================================
--- linux-2.6.17-mm1.orig/kernel/stacktrace.c
+++ linux-2.6.17-mm1/kernel/stacktrace.c
@@ -18,9 +18,7 @@ void print_stack_trace(struct stack_trac
for (j = 0; j < spaces + 1; j++)
printk(" ");
-
- printk("[<%08lx>]", ip);
- print_symbol(" %s\n", ip);
+ print_ip_sym(ip);
}
}
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [patch 1/4] lock validator: provide common print_ip_sym()
2006-06-23 13:23 [patch 1/4] lock validator: provide common print_ip_sym() Heiko Carstens
@ 2006-06-23 13:38 ` Ingo Molnar
0 siblings, 0 replies; 2+ messages in thread
From: Ingo Molnar @ 2006-06-23 13:38 UTC (permalink / raw)
To: Heiko Carstens; +Cc: Andrew Morton, linux-kernel, Arjan van de Ven
* Heiko Carstens <heiko.carstens@de.ibm.com> wrote:
> From: Heiko Carstens <heiko.carstens@de.ibm.com>
>
> Provide a common print_ip_sym() function that prints the passed instruction
> pointer as well as the symbol belonging to it. Avoids adding a bunch of
> #ifdef CONFIG_64BIT in order to get the printk format right on 32/64 bit
> platforms.
>
> Cc: Ingo Molnar <mingo@elte.hu>
> Cc: Arjan van de Ven <arjan@infradead.org>
> Signed-off-by: Heiko Carstens <heiko.carstens@de.ibm.com>
Acked-by: Ingo Molnar <mingo@elte.hu>
Ingo
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2006-06-23 13:58 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-06-23 13:23 [patch 1/4] lock validator: provide common print_ip_sym() Heiko Carstens
2006-06-23 13:38 ` Ingo Molnar
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®