mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [GIT PULL] lockdep stat fixes
@ 2010-05-04  3:45 Frederic Weisbecker
  2010-05-04  3:45 ` [PATCH 1/3] lockdep: Provide off case for redundant_hardirqs_on increment Frederic Weisbecker
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: Frederic Weisbecker @ 2010-05-04  3:45 UTC (permalink / raw)
  To: Ingo Molnar; +Cc: LKML, Frederic Weisbecker, Peter Zijlstra

Ingo,

Please pull the core/locking branch that can be found at:

git://git.kernel.org/pub/scm/linux/kernel/git/frederic/random-tracing.git
	core/locking

Thanks,
	Frederic
---

Frederic Weisbecker (3):
      lockdep: Provide off case for redundant_hardirqs_on increment
      lockdep: Actually _dec_ in debug_atomic_dec
      lockdep: No need to disable preemption in debug atomic ops


 kernel/lockdep.c           |    2 +-
 kernel/lockdep_internals.h |    8 ++++++--
 2 files changed, 7 insertions(+), 3 deletions(-)

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

* [PATCH 1/3] lockdep: Provide off case for redundant_hardirqs_on increment
  2010-05-04  3:45 [GIT PULL] lockdep stat fixes Frederic Weisbecker
@ 2010-05-04  3:45 ` Frederic Weisbecker
  2010-05-04  3:45 ` [PATCH 2/3] lockdep: Actually _dec_ in debug_atomic_dec Frederic Weisbecker
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: Frederic Weisbecker @ 2010-05-04  3:45 UTC (permalink / raw)
  To: Ingo Molnar; +Cc: LKML, Frederic Weisbecker, Peter Zijlstra

We forgot to provide a !CONFIG_DEBUG_LOCKDEP case for the
redundant_hardirqs_on stat handling.

Manage that in the headers with a new __debug_atomic_inc() helper.

Fixes:

	kernel/lockdep.c:2306: error: 'lockdep_stats' undeclared (first use in this function)
	kernel/lockdep.c:2306: error: (Each undeclared identifier is reported only once
	kernel/lockdep.c:2306: error: for each function it appears in.)

Reported-by: Ingo Molnar <mingo@elte.hu>
Signed-off-by: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Peter Zijlstra <peterz@infradead.org>
---
 kernel/lockdep.c           |    2 +-
 kernel/lockdep_internals.h |    4 ++++
 2 files changed, 5 insertions(+), 1 deletions(-)

diff --git a/kernel/lockdep.c b/kernel/lockdep.c
index 1b58a1b..9cf7985 100644
--- a/kernel/lockdep.c
+++ b/kernel/lockdep.c
@@ -2303,7 +2303,7 @@ void trace_hardirqs_on_caller(unsigned long ip)
 		 * so this is racy by nature but loosing one hit
 		 * in a stat is not a big deal.
 		 */
-		this_cpu_inc(lockdep_stats.redundant_hardirqs_on);
+		__debug_atomic_inc(redundant_hardirqs_on);
 		return;
 	}
 	/* we'll do an OFF -> ON transition: */
diff --git a/kernel/lockdep_internals.h b/kernel/lockdep_internals.h
index 2b17476..7de27a8 100644
--- a/kernel/lockdep_internals.h
+++ b/kernel/lockdep_internals.h
@@ -139,6 +139,9 @@ struct lockdep_stats {
 
 DECLARE_PER_CPU(struct lockdep_stats, lockdep_stats);
 
+#define __debug_atomic_inc(ptr)					\
+	this_cpu_inc(lockdep_stats.ptr);
+
 #define debug_atomic_inc(ptr)			{		\
 	WARN_ON_ONCE(!irqs_disabled());				\
 	this_cpu_inc(lockdep_stats.ptr);			\
@@ -160,6 +163,7 @@ DECLARE_PER_CPU(struct lockdep_stats, lockdep_stats);
 	__total;							\
 })
 #else
+# define __debug_atomic_inc(ptr)	do { } while (0)
 # define debug_atomic_inc(ptr)		do { } while (0)
 # define debug_atomic_dec(ptr)		do { } while (0)
 # define debug_atomic_read(ptr)		0
-- 
1.6.2.3


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

* [PATCH 2/3] lockdep: Actually _dec_ in debug_atomic_dec
  2010-05-04  3:45 [GIT PULL] lockdep stat fixes Frederic Weisbecker
  2010-05-04  3:45 ` [PATCH 1/3] lockdep: Provide off case for redundant_hardirqs_on increment Frederic Weisbecker
@ 2010-05-04  3:45 ` Frederic Weisbecker
  2010-05-04  3:45 ` [PATCH 3/3] lockdep: No need to disable preemption in debug atomic ops Frederic Weisbecker
  2010-05-04  6:34 ` [GIT PULL] lockdep stat fixes Ingo Molnar
  3 siblings, 0 replies; 5+ messages in thread
From: Frederic Weisbecker @ 2010-05-04  3:45 UTC (permalink / raw)
  To: Ingo Molnar; +Cc: LKML, Frederic Weisbecker, Peter Zijlstra

Fix a silly copy-paste mistake that was making debug_atomic_dec use
this_cpu_inc instead of this_cpu_dec.

Signed-off-by: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Peter Zijlstra <peterz@infradead.org>
---
 kernel/lockdep_internals.h |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/kernel/lockdep_internals.h b/kernel/lockdep_internals.h
index 7de27a8..8d929c7 100644
--- a/kernel/lockdep_internals.h
+++ b/kernel/lockdep_internals.h
@@ -149,7 +149,7 @@ DECLARE_PER_CPU(struct lockdep_stats, lockdep_stats);
 
 #define debug_atomic_dec(ptr)			{		\
 	WARN_ON_ONCE(!irqs_disabled());				\
-	this_cpu_inc(lockdep_stats.ptr);			\
+	this_cpu_dec(lockdep_stats.ptr);			\
 }
 
 #define debug_atomic_read(ptr)		({				\
-- 
1.6.2.3


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

* [PATCH 3/3] lockdep: No need to disable preemption in debug atomic ops
  2010-05-04  3:45 [GIT PULL] lockdep stat fixes Frederic Weisbecker
  2010-05-04  3:45 ` [PATCH 1/3] lockdep: Provide off case for redundant_hardirqs_on increment Frederic Weisbecker
  2010-05-04  3:45 ` [PATCH 2/3] lockdep: Actually _dec_ in debug_atomic_dec Frederic Weisbecker
@ 2010-05-04  3:45 ` Frederic Weisbecker
  2010-05-04  6:34 ` [GIT PULL] lockdep stat fixes Ingo Molnar
  3 siblings, 0 replies; 5+ messages in thread
From: Frederic Weisbecker @ 2010-05-04  3:45 UTC (permalink / raw)
  To: Ingo Molnar; +Cc: LKML, Frederic Weisbecker, Peter Zijlstra

No need to disable preemption in the debug_atomic_* ops, as
we ensure interrupts are disabled already.

So let's use the __this_cpu_ops() rather than this_cpu_ops() that
enclose the ops in a preempt disabled section.

Signed-off-by: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Peter Zijlstra <peterz@infradead.org>
---
 kernel/lockdep_internals.h |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/kernel/lockdep_internals.h b/kernel/lockdep_internals.h
index 8d929c7..4f560cf 100644
--- a/kernel/lockdep_internals.h
+++ b/kernel/lockdep_internals.h
@@ -144,12 +144,12 @@ DECLARE_PER_CPU(struct lockdep_stats, lockdep_stats);
 
 #define debug_atomic_inc(ptr)			{		\
 	WARN_ON_ONCE(!irqs_disabled());				\
-	this_cpu_inc(lockdep_stats.ptr);			\
+	__this_cpu_inc(lockdep_stats.ptr);			\
 }
 
 #define debug_atomic_dec(ptr)			{		\
 	WARN_ON_ONCE(!irqs_disabled());				\
-	this_cpu_dec(lockdep_stats.ptr);			\
+	__this_cpu_dec(lockdep_stats.ptr);			\
 }
 
 #define debug_atomic_read(ptr)		({				\
-- 
1.6.2.3


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

* Re: [GIT PULL] lockdep stat fixes
  2010-05-04  3:45 [GIT PULL] lockdep stat fixes Frederic Weisbecker
                   ` (2 preceding siblings ...)
  2010-05-04  3:45 ` [PATCH 3/3] lockdep: No need to disable preemption in debug atomic ops Frederic Weisbecker
@ 2010-05-04  6:34 ` Ingo Molnar
  3 siblings, 0 replies; 5+ messages in thread
From: Ingo Molnar @ 2010-05-04  6:34 UTC (permalink / raw)
  To: Frederic Weisbecker; +Cc: LKML, Peter Zijlstra

* Frederic Weisbecker <fweisbec@gmail.com> wrote:

> Ingo,
> 
> Please pull the core/locking branch that can be found at:
> 
> git://git.kernel.org/pub/scm/linux/kernel/git/frederic/random-tracing.git
> 	core/locking
> 
> Thanks,
> 	Frederic
> ---
> 
> Frederic Weisbecker (3):
>       lockdep: Provide off case for redundant_hardirqs_on increment
>       lockdep: Actually _dec_ in debug_atomic_dec
>       lockdep: No need to disable preemption in debug atomic ops
> 
> 
>  kernel/lockdep.c           |    2 +-
>  kernel/lockdep_internals.h |    8 ++++++--
>  2 files changed, 7 insertions(+), 3 deletions(-)

Pulled, thanks!

	Ingo

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

end of thread, other threads:[~2010-05-04  6:35 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-05-04  3:45 [GIT PULL] lockdep stat fixes Frederic Weisbecker
2010-05-04  3:45 ` [PATCH 1/3] lockdep: Provide off case for redundant_hardirqs_on increment Frederic Weisbecker
2010-05-04  3:45 ` [PATCH 2/3] lockdep: Actually _dec_ in debug_atomic_dec Frederic Weisbecker
2010-05-04  3:45 ` [PATCH 3/3] lockdep: No need to disable preemption in debug atomic ops Frederic Weisbecker
2010-05-04  6:34 ` [GIT PULL] lockdep stat fixes 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®