Re: [PATCH] lockdep: Introduce CONFIG_LOCKDEP_LARGE
From: Tetsuo Handa
Date: Sat Jul 25 2020 - 01:40:18 EST
On 2020/07/25 13:48, Dmitry Vyukov wrote:
>> diff --git a/kernel/locking/lockdep.c b/kernel/locking/lockdep.c
>> index 29a8de4..85ba7eb 100644
>> --- a/kernel/locking/lockdep.c
>> +++ b/kernel/locking/lockdep.c
>> @@ -1349,7 +1349,11 @@ static int add_lock_to_list(struct lock_class *this,
>> * For good efficiency of modular, we use power of 2
>> +#ifdef CONFIG_LOCKDEP_LARGE
>> +#define MAX_CIRCULAR_QUEUE_SIZE 8192UL
>> #define MAX_CIRCULAR_QUEUE_SIZE 4096UL
> Maybe this number should be the config value? So that we don't ever
> return here to introduce "VERY_LARGE" :)
They can be "tiny, small, medium, compact, large and huge". Yeah, it's a joke. :-)
> Also somebody may use it to _reduce_ size of the table for a smaller kernel.
Maybe. But my feeling is that it is very rare that the kernel actually deadlocks
as soon as lockdep warned the possibility of deadlock.
Since syzbot runs many instances in parallel, a lot of CPU resource is spent for
checking the same dependency tree. However, the possibility of deadlock can be
warned for only locks held within each kernel boot, and it is impossible to hold
all locks with one kernel boot.
Then, it might be nice if lockdep can audit only "which lock was held from which
context and what backtrace" and export that log like KCOV data (instead of evaluating
the possibility of deadlock), and rebuild the whole dependency (and evaluate the
possibility of deadlock) across multiple kernel boots in userspace.
>> #define CQ_MASK (MAX_CIRCULAR_QUEUE_SIZE-1)