Re: [PATCH v4] lib/spinlock_debug.c: prevent a recursive cycle in the debug code

Byungchul Park
2016-01-29T06:54:33Z

On Fri, Jan 29, 2016 at 09:27:03AM +0900, Sergey Senozhatsky wrote:
>
> well, the stack is surely limited, but on every
> spin_dump()->spin_lock() recursive call it does another
> round of
>
> u64 loops = loops_per_jiffy * HZ;
>
> for (i = 0; i < loops; i++) {
> if (arch_spin_trylock(&lock->raw_lock))
> return;
> __delay(1);
> }
>
> so if you have 1000 spin_dump()->spin_lock() then, well,
> something has been holding the lock for '1000 * loops_per_jiffy * HZ'.

Or the printk() is heavily called and the lock is congested.