lkml.org 
[lkml]   [2020]   [Aug]   [20]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH] lockdep: Do no validate wait context for novalidate class
On 2020-06-29 22:15:29 [+0200], To linux-kernel@vger.kernel.org wrote:
> The novalidate class is ignored in the lockchain validation but is
> considered in the wait context validation.
> If a mutex and a spinlock_t is ignored by using
> lockdep_set_novalidate_class() then both locks will share the same lock
> class. From the wait validation point of view the mutex will then appear
> like a spinlock_t and the validator will complain if another mutex will
> be acquired.
>
> Ignore the nonvalidate locks from wait context checking.

ping :)

> Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
> ---
> kernel/locking/lockdep.c | 5 ++++-
> 1 file changed, 4 insertions(+), 1 deletion(-)
>
> diff --git a/kernel/locking/lockdep.c b/kernel/locking/lockdep.c
> index 29a8de4c50b90..fb9a642d8ebef 100644
> --- a/kernel/locking/lockdep.c
> +++ b/kernel/locking/lockdep.c
> @@ -4067,7 +4067,7 @@ static int check_wait_context(struct task_struct *curr, struct held_lock *next)
> */
> for (depth = curr->lockdep_depth - 1; depth >= 0; depth--) {
> struct held_lock *prev = curr->held_locks + depth;
> - if (prev->irq_context != next->irq_context)
> + if (prev->check && prev->irq_context != next->irq_context)
> break;
> }
> depth++;
> @@ -4078,6 +4078,9 @@ static int check_wait_context(struct task_struct *curr, struct held_lock *next)
> struct held_lock *prev = curr->held_locks + depth;
> short prev_inner = hlock_class(prev)->wait_type_inner;
>
> + if (!prev->check)
> + continue;
> +
> if (prev_inner) {
> /*
> * We can have a bigger inner than a previous one

Sebastian

\
 
 \ /
  Last update: 2020-08-20 11:06    [W:0.089 / U:0.076 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site