Re: [PATCH v2] lib/spinlock_debug.c: prevent an infinite recursive cycle in spin_dump()

From: Peter Hurley
Date: Tue Jan 26 2016 - 20:13:22 EST


On 01/26/2016 04:11 PM, Andrew Morton wrote:
> On Mon, 18 Jan 2016 09:58:12 +0900 Byungchul Park <byungchul.park@xxxxxxx> wrote:
>
>> It causes an infinite recursive cycle when using CONFIG_DEBUG_SPINLOCK,
>> in the spin_dump(). Backtrace prints printk() -> console_trylock() ->
>> do_raw_spin_lock() -> spint_bug() -> spin_dump() -> printk()...
>> infinitely.
>>
>> If the spin_bug() is called from a function like printk() which is
>> trying to obtain the console lock, we should prevent the debug spinlock
>> code from calling printk() again in that context.
>>
>
> lol. Excellent.

[...]

> I can't immediately think of anything better than this. It's a hack, but
> it's a small and quite clear hack.

Andrew,

I think you may have missed this follow-up from Byungchul:

On 01/21/2016 12:12 AM, Byungchul Park wrote:
> I was careless. I think it should be fixed by another way, instead of
> the way this patch suggested.

Regards,
Peter Hurley