On Wed, Aug 17, 2016 at 12:01 PM, Linus Torvalds <torva...@linux-foundation.org> wrote: > On Aug 17, 2016 11:41 AM, "Denys Vlasenko" <dvlas...@redhat.com> 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.