* [PATCH] locking: Add WARN_ON_ONCE lock assertion
@ 2014-09-10 18:31 Peter Hurley
2014-09-16 8:08 ` Ingo Molnar
0 siblings, 1 reply; 5+ messages in thread
From: Peter Hurley @ 2014-09-10 18:31 UTC (permalink / raw)
To: Ingo Molnar, Peter Zijlstra
Cc: linux-kernel, Peter Hurley, Greg Kroah-Hartman
An interface may need to assert a lock invariant and not flood the
system logs; add a lockdep helper macro equivalent to
lockdep_assert_held() which only WARNs once.
cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Peter Hurley <peter@hurleysoftware.com>
---
include/linux/lockdep.h | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/include/linux/lockdep.h b/include/linux/lockdep.h
index 008388f9..64c7425 100644
--- a/include/linux/lockdep.h
+++ b/include/linux/lockdep.h
@@ -362,6 +362,10 @@ extern void lockdep_trace_alloc(gfp_t mask);
WARN_ON(debug_locks && !lockdep_is_held(l)); \
} while (0)
+#define lockdep_assert_held_once(l) do { \
+ WARN_ON_ONCE(debug_locks && !lockdep_is_held(l)); \
+ } while (0)
+
#define lockdep_recursing(tsk) ((tsk)->lockdep_recursion)
#else /* !CONFIG_LOCKDEP */
@@ -412,6 +416,7 @@ struct lock_class_key { };
#define lockdep_depth(tsk) (0)
#define lockdep_assert_held(l) do { (void)(l); } while (0)
+#define lockdep_assert_held_once(l) do { (void)(l); } while (0)
#define lockdep_recursing(tsk) (0)
--
2.1.0
^ permalink raw reply related [flat|nested] 5+ messages in thread* Re: [PATCH] locking: Add WARN_ON_ONCE lock assertion
2014-09-10 18:31 [PATCH] locking: Add WARN_ON_ONCE lock assertion Peter Hurley
@ 2014-09-16 8:08 ` Ingo Molnar
2014-09-16 18:17 ` Greg Kroah-Hartman
0 siblings, 1 reply; 5+ messages in thread
From: Ingo Molnar @ 2014-09-16 8:08 UTC (permalink / raw)
To: Peter Hurley; +Cc: Peter Zijlstra, linux-kernel, Greg Kroah-Hartman
* Peter Hurley <peter@hurleysoftware.com> wrote:
> An interface may need to assert a lock invariant and not flood the
> system logs; add a lockdep helper macro equivalent to
> lockdep_assert_held() which only WARNs once.
>
> cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
> Signed-off-by: Peter Hurley <peter@hurleysoftware.com>
Acked-by: Ingo Molnar <mingo@kernel.org>
Thanks,
Ingo
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] locking: Add WARN_ON_ONCE lock assertion
2014-09-16 8:08 ` Ingo Molnar
@ 2014-09-16 18:17 ` Greg Kroah-Hartman
2014-09-17 12:32 ` Ingo Molnar
0 siblings, 1 reply; 5+ messages in thread
From: Greg Kroah-Hartman @ 2014-09-16 18:17 UTC (permalink / raw)
To: Ingo Molnar; +Cc: Peter Hurley, Peter Zijlstra, linux-kernel
On Tue, Sep 16, 2014 at 10:08:14AM +0200, Ingo Molnar wrote:
>
> * Peter Hurley <peter@hurleysoftware.com> wrote:
>
> > An interface may need to assert a lock invariant and not flood the
> > system logs; add a lockdep helper macro equivalent to
> > lockdep_assert_held() which only WARNs once.
> >
> > cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
> > Signed-off-by: Peter Hurley <peter@hurleysoftware.com>
>
> Acked-by: Ingo Molnar <mingo@kernel.org>
Any objection for me taking this through the TTY tree due to the
dependancies on future tty patches that use the function in this patch?
thanks,
greg k-h
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] locking: Add WARN_ON_ONCE lock assertion
2014-09-16 18:17 ` Greg Kroah-Hartman
@ 2014-09-17 12:32 ` Ingo Molnar
2014-09-17 16:09 ` Greg Kroah-Hartman
0 siblings, 1 reply; 5+ messages in thread
From: Ingo Molnar @ 2014-09-17 12:32 UTC (permalink / raw)
To: Greg Kroah-Hartman; +Cc: Peter Hurley, Peter Zijlstra, linux-kernel
* Greg Kroah-Hartman <gregkh@linuxfoundation.org> wrote:
> On Tue, Sep 16, 2014 at 10:08:14AM +0200, Ingo Molnar wrote:
> >
> > * Peter Hurley <peter@hurleysoftware.com> wrote:
> >
> > > An interface may need to assert a lock invariant and not flood the
> > > system logs; add a lockdep helper macro equivalent to
> > > lockdep_assert_held() which only WARNs once.
> > >
> > > cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
> > > Signed-off-by: Peter Hurley <peter@hurleysoftware.com>
> >
> > Acked-by: Ingo Molnar <mingo@kernel.org>
>
> Any objection for me taking this through the TTY tree due to
> the dependancies on future tty patches that use the function in
> this patch?
Now that the patch is correct I have no objection whatsoever,
feel free!
Thanks,
Ingo
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] locking: Add WARN_ON_ONCE lock assertion
2014-09-17 12:32 ` Ingo Molnar
@ 2014-09-17 16:09 ` Greg Kroah-Hartman
0 siblings, 0 replies; 5+ messages in thread
From: Greg Kroah-Hartman @ 2014-09-17 16:09 UTC (permalink / raw)
To: Ingo Molnar; +Cc: Peter Hurley, Peter Zijlstra, linux-kernel
On Wed, Sep 17, 2014 at 02:32:56PM +0200, Ingo Molnar wrote:
>
> * Greg Kroah-Hartman <gregkh@linuxfoundation.org> wrote:
>
> > On Tue, Sep 16, 2014 at 10:08:14AM +0200, Ingo Molnar wrote:
> > >
> > > * Peter Hurley <peter@hurleysoftware.com> wrote:
> > >
> > > > An interface may need to assert a lock invariant and not flood the
> > > > system logs; add a lockdep helper macro equivalent to
> > > > lockdep_assert_held() which only WARNs once.
> > > >
> > > > cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
> > > > Signed-off-by: Peter Hurley <peter@hurleysoftware.com>
> > >
> > > Acked-by: Ingo Molnar <mingo@kernel.org>
> >
> > Any objection for me taking this through the TTY tree due to
> > the dependancies on future tty patches that use the function in
> > this patch?
>
> Now that the patch is correct I have no objection whatsoever,
> feel free!
Thanks, will do.
greg k-h
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2014-09-17 16:10 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-09-10 18:31 [PATCH] locking: Add WARN_ON_ONCE lock assertion Peter Hurley
2014-09-16 8:08 ` Ingo Molnar
2014-09-16 18:17 ` Greg Kroah-Hartman
2014-09-17 12:32 ` Ingo Molnar
2014-09-17 16:09 ` Greg Kroah-Hartman
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox