Re: [PATCH] dump_stack: Avoid the livelock of the dump_lock

From: Linus Torvalds
Date: Tue Oct 29 2019 - 11:23:55 EST


On Tue, Oct 29, 2019 at 3:09 PM Kevin Hao <haokexin@xxxxxxxxx> wrote:
>
> Do you mean something like this?

Yeah, except I'd make it be something like

local_irq_restore(flags);
- cpu_relax();
+ do { cpu_relax(); } while (atomic_read(&dump_lock) != -1);
goto retry;

instead, ie doing the cpu_relax() inside that loop.

Obviously untested.

Linus