lkml.org 
[lkml]   [2015]   [Mar]   [28]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [RFC] x86, ia32entry: Use sysretl to return from sysenter

* Andy Lutomirski <luto@kernel.org> wrote:

> Sysexit is scary on 64-bit kernels -- sysexit must be invoked with
> usergs and IRQs on. That means that we rely on sti to correctly
> mask interrupts for one instruction. This is okay by itself, but
> the semantics with respect to NMIs are unclear.

At least judging by profiling output I think NMIs observe the STI
window of one instruction non-execution as well. (But I'm not 100%
sure.)

> Avoid the whole issue by using sysretl instead. For background,
> Intel CPUs don't allow syscall from compat mode, but they do allow
> sysret back to compat mode. Go figure.
>
> Oddly this seems to be 30 cycles or so faster. Avoiding popfq and
> sti will account for under half of that, I think, so my best guess
> is that Intel just optimizes sysret much better than sysexit.
>
> Cc: stable@vger.kernel.org

I like it, but no way is this automatic -stable material ... if proven
upstream we can forward it as a fix for SYSEXIT fragility, but not
automatically, IMHO.

Thanks,

Ingo


\
 
 \ /
  Last update: 2015-03-28 09:41    [W:1.398 / U:0.008 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site