[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CA+55aFy=Nb0Qp50SbArw2S+9frMOeHNXs0WuaEwacfip41HK9Q@mail.gmail.com>
Date: Mon, 5 Feb 2018 14:25:02 -0800
From: Linus Torvalds <torvalds@...ux-foundation.org>
To: Andy Lutomirski <luto@...nel.org>
Cc: Dan Williams <dan.j.williams@...el.com>,
Ingo Molnar <mingo@...nel.org>,
Thomas Gleixner <tglx@...utronix.de>,
Andi Kleen <ak@...ux.intel.com>, X86 ML <x86@...nel.org>,
Linux Kernel Mailing List <linux-kernel@...r.kernel.org>,
Ingo Molnar <mingo@...hat.com>,
"H. Peter Anvin" <hpa@...or.com>
Subject: Re: [PATCH v2 1/3] x86/entry: Clear extra registers beyond syscall
arguments for 64bit kernels
On Mon, Feb 5, 2018 at 2:22 PM, Linus Torvalds
<torvalds@...ux-foundation.org> wrote:
>
> But I'm not timing it.
I lied.
I did this:
for (i = 0; i < 100000; i++)
asm(".rept 16384\n"
"subq $128,%rsp\n\t"
"pushq %rbx\n\t"
"pushq %r10\n\t"
"pushq %r11\n\t"
"pushq %r12\n\t"
"pushq %r13\n\t"
"pushq %r14\n\t"
"pushq %r15\n\t"
"popq %r15\n\t"
"popq %r14\n\t"
"popq %r13\n\t"
"popq %r12\n\t"
"popq %r11\n\t"
"popq %r10\n\t"
"popq %rbx\n\t"
"addq $128,%rsp\n\t"
".endr");
and then I timed it like that, and with "xorq" of the register after
each "pushq".
And the timings came out the same, to within the (bad) timing I did.
So I really do think you can just put the xor right next to the push,
and it will be effectively free.
Linus
Powered by blists - more mailing lists