Re: [GIT pull] locking/urgent for v5.10-rc6

From: Peter Zijlstra
Date: Tue Dec 01 2020 - 02:57:20 EST


On Tue, Dec 01, 2020 at 08:39:06AM +0100, Peter Zijlstra wrote:
> On Mon, Nov 30, 2020 at 09:55:44AM -0800, Linus Torvalds wrote:
>
> > Yes, yes, I can very well imagine some hardware doing a "idle until
> > you sense an interrupt, but don't actually take it". It's not
> > _impossible_. But it's certainly not normal.
>
> A lot of hardware actually does that, including modern x86. But yes, not
> nearly everything.

So the thing is that (with exception of RCU-tiny), we need interrupts
disabled when coming out of idle to prod RCU back into action.

So even if an architecture needs to enable interrupts on idle, we need
it disabled again when coming out. So we might as well have the arch
idle routine then be: STI; HLT; CLI; because then architectures than can
idle with interrupts disabled can avoid mucking about with the interrupt
state entirely.

Currently they (and this includes much of ARM) are effectively doing:

wfi();
raw_local_irq_enable();
raw_local_irq_disable();

where a plain: wfi(), would be sufficient.