From: Denys Vlasenko <dvlasenk@redhat.com>
To: Andy Lutomirski <luto@amacapital.net>
Cc: Linus Torvalds <torvalds@linux-foundation.org>,
Steven Rostedt <rostedt@goodmis.org>,
Ingo Molnar <mingo@kernel.org>, Borislav Petkov <bp@alien8.de>,
"H. Peter Anvin" <hpa@zytor.com>, Oleg Nesterov <oleg@redhat.com>,
Frederic Weisbecker <fweisbec@gmail.com>,
Alexei Starovoitov <ast@plumgrid.com>,
Will Drewry <wad@chromium.org>, Kees Cook <keescook@chromium.org>,
X86 ML <x86@kernel.org>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH 2/3] x86: entry_64.S: use PUSH insns to build pt_regs on stack
Date: Wed, 18 Mar 2015 22:32:42 +0100 [thread overview]
Message-ID: <5509EEFA.5030105@redhat.com> (raw)
In-Reply-To: <CALCETrUKjsbZGUUHNG95V98g0mfv=70x-+EzPT+YBEf-ZUxkWQ@mail.gmail.com>
On 03/18/2015 10:22 PM, Andy Lutomirski wrote:
> On Wed, Mar 18, 2015 at 2:12 PM, Denys Vlasenko <dvlasenk@redhat.com> wrote:
>> On 03/18/2015 10:01 PM, Andy Lutomirski wrote:
>>> On Wed, Mar 18, 2015 at 12:47 PM, Denys Vlasenko <dvlasenk@redhat.com> wrote:
>>>> We lose a number of large insns there:
>>>>
>>>> text data bss dec hex filename
>>>> 9863 0 0 9863 2687 entry_64_before.o
>>>> 9671 0 0 9671 25c7 entry_64.o
>>>>
>>>> What's more important, we convert two "MOVQ $imm,off(%rsp)" to "PUSH $imm"
>>>> (the ones which fill pt_regs->cs,ss).
>>>>
>>>> Before this patch, placing them on fast path was slowing it down by two cycles:
>>>> this form of MOV is very large, 12 bytes, and this probably reduces decode bandwidth
>>>> to one insn per cycle when it meets them.
>>>> Therefore they were living in FIXUP_TOP_OF_STACK instead (away from hot path).
>>>
>>> Does that mean that this has zero performance impact, or is it
>>> actually a speedup?
>>
>>
>> No, it's not a speedup because those big bad instructions weren't
>> on hot path to begin with.
>>
>> We want them to be there.
>>
>> Inserting them in a form of MOVs into hot path (say, in order
>> to eliminate FIXUP_TOP_OF_STACK) *would be* a slowdown.
>>
>> But we switch to PUSH method, and then inserting them _as PUSHes_
>> seems to be a wash.
>>
>
> Sorry, what I meant was: what was the performance impact of this patch
> on fast-path syscalls?
I measured the next patch (which added one additional push)
and it was a wash compared to timings before both patches.
See comment there.
I did not measure this patch in isolation this time around,
on the previous iteration of this patch it was a single-cycle speedup.
next prev parent reply other threads:[~2015-03-18 21:33 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-03-18 19:47 [PATCH 1/3] x86: get rid of KERNEL_STACK_OFFSET Denys Vlasenko
2015-03-18 19:47 ` [PATCH 2/3] x86: entry_64.S: use PUSH insns to build pt_regs on stack Denys Vlasenko
2015-03-18 21:01 ` Andy Lutomirski
2015-03-18 21:12 ` Denys Vlasenko
2015-03-18 21:22 ` Andy Lutomirski
2015-03-18 21:32 ` Denys Vlasenko [this message]
2015-03-18 21:42 ` Andy Lutomirski
2015-03-18 19:47 ` [PATCH 3/3] x86: get rid of FIXUP_TOP_OF_STACK/RESTORE_TOP_OF_STACK Denys Vlasenko
2015-03-18 21:02 ` Andy Lutomirski
2015-03-18 20:47 ` [PATCH 1/3] x86: get rid of KERNEL_STACK_OFFSET Borislav Petkov
2015-03-18 20:54 ` Andy Lutomirski
2015-03-19 15:28 ` Denys Vlasenko
2015-03-19 15:43 ` Andy Lutomirski
2015-03-19 15:47 ` Denys Vlasenko
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=5509EEFA.5030105@redhat.com \
--to=dvlasenk@redhat.com \
--cc=ast@plumgrid.com \
--cc=bp@alien8.de \
--cc=fweisbec@gmail.com \
--cc=hpa@zytor.com \
--cc=keescook@chromium.org \
--cc=linux-kernel@vger.kernel.org \
--cc=luto@amacapital.net \
--cc=mingo@kernel.org \
--cc=oleg@redhat.com \
--cc=rostedt@goodmis.org \
--cc=torvalds@linux-foundation.org \
--cc=wad@chromium.org \
--cc=x86@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.