linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] lockdep: fix irqs on/off ip tracing
@ 2008-10-28 10:14 Heiko Carstens
  2008-10-28 10:19 ` Ingo Molnar
  0 siblings, 1 reply; 2+ messages in thread
From: Heiko Carstens @ 2008-10-28 10:14 UTC (permalink / raw)
  To: Ingo Molnar; +Cc: Steven Rostedt, linux-kernel

From: Heiko Carstens <heiko.carstens@de.ibm.com>

81d68a96 "ftrace: trace irq disabled critical timings" added wrappers around
trace_hardirqs_on/off_caller. However these functions use
__builtin_return_address(0) to figure out which function actually disabled
or enabled irqs. The result is that we save the ips of trace_hardirqs_on/off
instead of the real caller. Not very helpful.
However since the patch from Steven the ip already gets passed. So use that
and get rid of __builtin_return_address(0) in these two functions.

Cc: Steven Rostedt <srostedt@redhat.com>
Signed-off-by: Heiko Carstens <heiko.carstens@de.ibm.com>
---
 kernel/lockdep.c |   12 +++++-------
 1 file changed, 5 insertions(+), 7 deletions(-)

Index: linux-2.6/kernel/lockdep.c
===================================================================
--- linux-2.6.orig/kernel/lockdep.c
+++ linux-2.6/kernel/lockdep.c
@@ -2169,12 +2169,11 @@ void early_boot_irqs_on(void)
 /*
  * Hardirqs will be enabled:
  */
-void trace_hardirqs_on_caller(unsigned long a0)
+void trace_hardirqs_on_caller(unsigned long ip)
 {
 	struct task_struct *curr = current;
-	unsigned long ip;
 
-	time_hardirqs_on(CALLER_ADDR0, a0);
+	time_hardirqs_on(CALLER_ADDR0, ip);
 
 	if (unlikely(!debug_locks || current->lockdep_recursion))
 		return;
@@ -2188,7 +2187,6 @@ void trace_hardirqs_on_caller(unsigned l
 	}
 	/* we'll do an OFF -> ON transition: */
 	curr->hardirqs_enabled = 1;
-	ip = (unsigned long) __builtin_return_address(0);
 
 	if (DEBUG_LOCKS_WARN_ON(!irqs_disabled()))
 		return;
@@ -2224,11 +2222,11 @@ EXPORT_SYMBOL(trace_hardirqs_on);
 /*
  * Hardirqs were disabled:
  */
-void trace_hardirqs_off_caller(unsigned long a0)
+void trace_hardirqs_off_caller(unsigned long ip)
 {
 	struct task_struct *curr = current;
 
-	time_hardirqs_off(CALLER_ADDR0, a0);
+	time_hardirqs_off(CALLER_ADDR0, ip);
 
 	if (unlikely(!debug_locks || current->lockdep_recursion))
 		return;
@@ -2241,7 +2239,7 @@ void trace_hardirqs_off_caller(unsigned 
 		 * We have done an ON -> OFF transition:
 		 */
 		curr->hardirqs_enabled = 0;
-		curr->hardirq_disable_ip = _RET_IP_;
+		curr->hardirq_disable_ip = ip;
 		curr->hardirq_disable_event = ++curr->irq_events;
 		debug_atomic_inc(&hardirqs_off_events);
 	} else

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] lockdep: fix irqs on/off ip tracing
  2008-10-28 10:14 [PATCH] lockdep: fix irqs on/off ip tracing Heiko Carstens
@ 2008-10-28 10:19 ` Ingo Molnar
  0 siblings, 0 replies; 2+ messages in thread
From: Ingo Molnar @ 2008-10-28 10:19 UTC (permalink / raw)
  To: Heiko Carstens; +Cc: Steven Rostedt, linux-kernel


* Heiko Carstens <heiko.carstens@de.ibm.com> wrote:

> From: Heiko Carstens <heiko.carstens@de.ibm.com>
> 
> 81d68a96 "ftrace: trace irq disabled critical timings" added wrappers around
> trace_hardirqs_on/off_caller. However these functions use
> __builtin_return_address(0) to figure out which function actually disabled
> or enabled irqs. The result is that we save the ips of trace_hardirqs_on/off
> instead of the real caller. Not very helpful.
> However since the patch from Steven the ip already gets passed. So use that
> and get rid of __builtin_return_address(0) in these two functions.
> 
> Cc: Steven Rostedt <srostedt@redhat.com>
> Signed-off-by: Heiko Carstens <heiko.carstens@de.ibm.com>
> ---
>  kernel/lockdep.c |   12 +++++-------
>  1 file changed, 5 insertions(+), 7 deletions(-)

good catch and nice cleanup, i've applied it to tip/core/urgent, 
thanks Heiko!

	Ingo

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2008-10-28 10:20 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-10-28 10:14 [PATCH] lockdep: fix irqs on/off ip tracing Heiko Carstens
2008-10-28 10:19 ` Ingo Molnar

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).