lockdep && recursive-read

From: Oleg Nesterov
Date: Tue Aug 29 2017 - 13:08:08 EST


On 08/29, Oleg Nesterov wrote:
>
> Plus process_one_work() does lock_map_acquire_read(), I don't really
> understand this too.

and in fact I don't understand lock_map_acquire_read() itself. I mean, read == 2
and this code in check_prevs_add()

/*
* Only non-recursive-read entries get new dependencies
* added:
*/
if (hlock->read != 2 && hlock->check) {
if (!check_prev_add(curr, hlock, next,
distance, &stack_saved))


Well, I forgot everything I ever knew about lockdep, unlikely I understand what
the code above actually does. But I verified that this code

static DEFINE_SPINLOCK(exlk);
static DEFINE_RWLOCK(rwlk);

spin_lock(&exlk);
write_lock(&rwlk);
write_unlock(&rwlk);
spin_unlock(&exlk);

read_lock(&rwlk);
spin_lock(&exlk);
spin_unlock(&exlk);
read_unlock(&rwlk);

runs without any warning from lockdep. Doesn't look right or I am totally
confused...

Oleg.