Re: [PATCH v2 27/36] x86/entry/32: Re-implement SYSENTER using the new C path

From: Andy Lutomirski
Date: Wed Oct 07 2015 - 15:06:50 EST


On Wed, Oct 7, 2015 at 11:08 AM, Denys Vlasenko <dvlasenk@xxxxxxxxxx> wrote:
> On 10/06/2015 02:48 AM, Andy Lutomirski wrote:
>> +
>> +/* Opportunistic SYSEXIT */
>> + TRACE_IRQS_ON /* User mode traces as IRQs on. */
>> + movl PT_EIP(%esp), %edx /* pt_regs->ip */
>> + movl PT_OLDESP(%esp), %ecx /* pt_regs->sp */
>> + popl %ebx /* pt_regs->bx */
>> + addl $2*4, %esp /* skip pt_regs->cx and pt_regs->dx */
>
> Here stack engine and ALUs operating on ESP conflict,
> potentially adding a stall both before and after ADD.
>
> It might be faster to just pop twice into an unused register, say,
> popl %eax
> popl %eax
>
>> + popl %esi /* pt_regs->si */
>> + popl %edi /* pt_regs->di */
>> + popl %ebp /* pt_regs->bp */
>> + popl %eax /* pt_regs->ax */
>> 1: mov PT_FS(%esp), %fs
>> PTGS_TO_GS
>

I'll benchmark it and possibly add it at the end of the series.

--Andy
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/