Re: [PATCH] syscall latency improvement #1

Andi Kleen
2002-01-26T02:27:16Z

On Fri, Jan 25, 2002 at 06:14:25PM -0800, Linus Torvalds wrote:
>
> On Sat, 26 Jan 2002, Andi Kleen wrote:
> > On Fri, Jan 25, 2002 at 05:53:57PM -0800, Linus Torvalds wrote:
> > >
> > > On 26 Jan 2002, Andi Kleen wrote:
> > > >
> > > > It doesn't explain the Athlon speedups. On athlon cli is ~4 cycles.
> > >
> > > .. and it probably serializes the instruction stream.
> >
> > I have word from AMD engineering that it doesn't stall the pipeline
> > or serializes.
>
> Note that it may not be the "cli" itself - the "iret" may be slower if it
> has to enable interrupts that were disabled before. Ie the iret microcode
> may have the equivalent of

[...]

Yes that could explain it. I ignored it on x86-64 because it always uses
SYSCALL/SYSRET (at least for 64bit) @)

The real fix for that would be support of SYSENTER/SYSCALL on 32bit too
(more likely SYSENTER because it's supported by Athlons and SYSCALL is too
broken on K6 to be usable)

An int $0x80 does a awful lot of locked cycles for example and IRET is
also not exactly a speed daemon and very complex.

SYSENTER/SYSEXIT would be likely a much bigger win than nanooptimizations of
a few cycles around this.
-Andi