lkml.org 
[lkml]   [2014]   [Sep]   [3]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH 13/26] locking: Add non-fatal spin lock assert
On Tue, Sep 02, 2014 at 05:39:22PM -0400, Peter Hurley wrote:
> Provide method for non-essential or non-critical code to warn of
> invariant errors.
>
> CC: Ingo Molnar <mingo@kernel.org>
> CC: Peter Zijlstra <peterz@infradead.org>
> CC: Thomas Gleixner <tglx@linutronix.de>
> Signed-off-by: Peter Hurley <peter@hurleysoftware.com>
> ---
> include/linux/spinlock.h | 1 +
> include/linux/spinlock_api_smp.h | 1 +
> include/linux/spinlock_api_up.h | 1 +
> 3 files changed, 3 insertions(+)
>
> diff --git a/include/linux/spinlock.h b/include/linux/spinlock.h
> index 3f2867f..8a9aaf1 100644
> --- a/include/linux/spinlock.h
> +++ b/include/linux/spinlock.h
> @@ -394,6 +394,7 @@ static inline int spin_can_lock(spinlock_t *lock)
> }
>
> #define assert_spin_locked(lock) assert_raw_spin_locked(&(lock)->rlock)
> +#define warn_not_spin_locked(lock) warn_not_raw_spin_locked(&(lock)->rlock)
>
> /*
> * Pull the atomic_t declaration:
> diff --git a/include/linux/spinlock_api_smp.h b/include/linux/spinlock_api_smp.h
> index 42dfab8..0ddd499 100644
> --- a/include/linux/spinlock_api_smp.h
> +++ b/include/linux/spinlock_api_smp.h
> @@ -18,6 +18,7 @@
> int in_lock_functions(unsigned long addr);
>
> #define assert_raw_spin_locked(x) BUG_ON(!raw_spin_is_locked(x))
> +#define warn_not_raw_spin_locked(x) WARN_ON_ONCE(!raw_spin_is_locked(x))

No we should remove assert_spin_locked() not add to it. Use
lockdep_assert_held() instead.


\
 
 \ /
  Last update: 2014-09-03 12:01    [W:0.381 / U:0.044 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site