On Thu, Feb 28, 2019 at 02:09:36PM -0500, Waiman Long wrote:
> diff --git a/kernel/locking/rwsem.h b/kernel/locking/rwsem.h
> index 1d8f722..c8fd3f1 100644
> --- a/kernel/locking/rwsem.h
> +++ b/kernel/locking/rwsem.h
> @@ -27,9 +27,13 @@
>  #define RWSEM_ANONYMOUSLY_OWNED      (1UL << 1)
>  
>  #ifdef CONFIG_DEBUG_RWSEMS
> -# define DEBUG_RWSEMS_WARN_ON(c)     DEBUG_LOCKS_WARN_ON(c)
> +# define DEBUG_RWSEMS_WARN_ON(c, sem)                                \
> +     WARN_ONCE(c, "DEBUG_RWSEMS_WARN_ON(%s): count = 0x%lx, owner = 0x%lx, 
> curr 0x%lx, list %sempty\n",\
> +             #c, atomic_long_read(&(sem)->count),            \
> +             (long)((sem)->owner), (long)current,            \
> +             list_empty(&(sem)->wait_list) ? "" : "not ")

This changes DEBUG_LOCKS_WARN_ON() to WARN_ONCE(), the difference being
that you now fail to kill lockdep on a rwsem error, which seems
unfortunate.

>  #else
> -# define DEBUG_RWSEMS_WARN_ON(c)
> +# define DEBUG_RWSEMS_WARN_ON(c, sem)
>  #endif

Reply via email to