[RFC PATCH] x86/asm/irq: Don't use POPF but STI

From: Ingo Molnar
Date: Tue Apr 21 2015 - 08:46:12 EST



* Andy Lutomirski <luto@xxxxxxxxxx> wrote:

> > Another different approach would be to formally state that
> > pv_irq_ops.save_fl() needs to return all the flags, which would
> > make local_irq_save() safe to use in this circumstance, but that
> > makes a hotpath longer for the sake of a single boot time check.
>
> ...which reminds me:
>
> Why does native_restore_fl restore anything other than IF? A branch
> and sti should be considerably faster than popf.

Yes, this has come up in the past, something like the patch below?

Totally untested and not signed off yet: because we'd first have to
make sure (via irq flags debugging) that it's not used in reverse, to
re-disable interrupts:

local_irq_save(flags);
local_irq_enable();
...
local_irq_restore(flags); /* effective local_irq_disable() */

I don't think we have many (any?) such patterns left, but it has to be
checked first. If we have such cases then we'll have to use different
primitives there.

But this patch should be good enough to give an good overview of the
effects: the text impact does not look too horrible, if we decide to
do this. The bloat of +1K on x86 defconfig is better than I first
feared.

Thanks,

Ingo

======================>