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

From: Andy Lutomirski
Date: Wed Aug 17 2016 - 15:13:53 EST


On Wed, Aug 17, 2016 at 12:01 PM, Linus Torvalds
<torvalds@xxxxxxxxxxxxxxxxxxxx> wrote:
> On Aug 17, 2016 11:41 AM, "Denys Vlasenko" <dvlasenk@xxxxxxxxxx> wrote:
>>
>> OTOH 5 years will inevitably pass.
>
> Yes. But in five years, maybe we'll have a popf that is faster anyway.
>
> I'd actually prefer that in the end. The problem with popf right now seems
> to be mainly that it's effectively serializing and does stupid things in
> microcode. It doesn't have to be that way. It could actually do much better,
> but it hasn't been a high enough priority for Intel.
>

It wouldn't surprise me if that were easier said than done. popf
potentially changes AC, and AC affects address translation. popf also
potentially changes IOPL, and I don't know whether Intel chips track
IOPL in a way that lets them find all the dependent instructions
without serializing. But maybe their pipeline is fancy enough.

Personally, I still expect that a simple branch-and-sti is the way to
go. It wouldn't shock me if even a mispredicted branch and STI is
faster than POPF.