public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* For your amusement: slightly faster syscalls
@ 2015-06-13  0:09 Andy Lutomirski
       [not found] ` <CA+55aFzMCeDc5rw8bj3Zyimbi7C1RcU15TeiMA6jOMfnd+3B=Q@mail.gmail.com>
  0 siblings, 1 reply; 7+ messages in thread
From: Andy Lutomirski @ 2015-06-13  0:09 UTC (permalink / raw)
  To: linux-kernel@vger.kernel.org, X86 ML, Linus Torvalds,
	H. Peter Anvin, Denys Vlasenko, Borislav Petkov

The SYSCALL prologue starts with SWAPGS immediately followed by a
gs-prefixed instruction.  I think this causes a pipeline stall.

If we instead do:

mov %rsp, rsp_scratch(%rip)
mov sp0(%rip), %rsp)
swapgs
...
pushq rsp_scratch(%rip)

then we avoid the stall and save about three cycles.

Horrible horrible code to do this lives here:

https://git.kernel.org/cgit/linux/kernel/git/luto/devel.git/log/?h=x86/faster_syscalls

Caveat emptor: it also disables SMP.

For three cycles, I don't think this is worth trying to clean up.

--Andy

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2015-06-18  9:06 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-06-13  0:09 For your amusement: slightly faster syscalls Andy Lutomirski
     [not found] ` <CA+55aFzMCeDc5rw8bj3Zyimbi7C1RcU15TeiMA6jOMfnd+3B=Q@mail.gmail.com>
2015-06-15 21:42   ` H. Peter Anvin
2015-06-15 21:51     ` Andy Lutomirski
2015-06-18  8:01       ` Ingo Molnar
2015-06-18  8:48         ` Ingo Molnar
2015-06-18  8:50         ` H. Peter Anvin
2015-06-18  9:06           ` Ingo Molnar

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox