Re: RFC: Petition Intel/AMD to add POPF_IF insn

From: Denys Vlasenko
Date: Wed Aug 17 2016 - 14:51:37 EST




On 08/17/2016 07:32 PM, Linus Torvalds wrote:
On Wed, Aug 17, 2016 at 10:20 AM, Denys Vlasenko <dvlasenk@xxxxxxxxxx> wrote:
Last year, a proposal was floated to avoid costly POPF.
In particular, each spin_unlock_irqrestore() does it,
a rather common operation.

Quiet frankly, it takes so long for hw features that I don't think
it's worth it for something like this.

True, it will take some ~5 years for new hardware to become
widely used.

OTOH 5 years will inevitably pass. Just like now 32-bit Linux userspace
is commonly compiled to "i686" instruction set, because
inevitably enough time has passed that you can safely assume
most people run at least Pentium Pro-level CPU, with CMOV, CMPXCHG,
etc.

If the new instruction will be implemented with "REPZ POPF" encoding,
no recompilation or alternatives will be needed for the new kernel
to run on an old CPU. On an old CPU, entire EFLAGS will be restored.
On a new one, only EFLAGS.IF.