From: Borislav Petkov <bp@alien8.de>
To: Denys Vlasenko <dvlasenk@redhat.com>
Cc: Andy Lutomirski <luto@amacapital.net>,
Linus Torvalds <torvalds@linux-foundation.org>,
Steven Rostedt <rostedt@goodmis.org>,
Ingo Molnar <mingo@kernel.org>, "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@kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH 3/5] x86/entry_64.S: use PUSH insns to build pt_regs on stack
Date: Fri, 20 Mar 2015 17:35:29 +0100 [thread overview]
Message-ID: <20150320163529.GG17058@pd.tnic> (raw)
In-Reply-To: <1426785469-15125-3-git-send-email-dvlasenk@redhat.com>
On Thu, Mar 19, 2015 at 06:17:47PM +0100, Denys Vlasenko wrote:
> With this change, on SYSCALL64 code path we are now populating
> pt_regs->cs, pt_regs->ss and pt_regs->rcx unconditionally and
> therefore don't need to do that in FIXUP_TOP_OF_STACK.
>
> We lose a number of large insns there:
>
> text data bss dec hex filename
> 13298 0 0 13298 33f2 entry_64_before.o
> 12978 0 0 12978 32b2 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 CPU sees them.
>
> Therefore they were living in FIXUP_TOP_OF_STACK instead (away from fast path).
>
> "PUSH $imm" is a small 2-byte insn. Moving it to fast path does not slow it down
> in my measurements.
>
> Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
> CC: Linus Torvalds <torvalds@linux-foundation.org>
> CC: Steven Rostedt <rostedt@goodmis.org>
> CC: Ingo Molnar <mingo@kernel.org>
> CC: Borislav Petkov <bp@alien8.de>
> CC: "H. Peter Anvin" <hpa@zytor.com>
> CC: Andy Lutomirski <luto@amacapital.net>
> CC: Oleg Nesterov <oleg@redhat.com>
> CC: Frederic Weisbecker <fweisbec@gmail.com>
> CC: Alexei Starovoitov <ast@plumgrid.com>
> CC: Will Drewry <wad@chromium.org>
> CC: Kees Cook <keescook@chromium.org>
> CC: x86@kernel.org
> CC: linux-kernel@vger.kernel.org
> ---
>
> Changes since last version: reformulate old comment which was
> mostly failing to explain why we don't have TRACE_IRQS_OFF/ONs
> around a irq-off section in SYSCALL64 code path.
>
> arch/x86/kernel/entry_64.S | 54 +++++++++++++++++++++++++++-------------------
> 1 file changed, 32 insertions(+), 22 deletions(-)
Acked-by: Borislav Petkov <bp@suse.de>
--
Regards/Gruss,
Boris.
ECO tip #101: Trim your mails when you reply.
--
next prev parent reply other threads:[~2015-03-20 16:37 UTC|newest]
Thread overview: 32+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-03-19 17:17 [PATCH 1/5] x86: change THREAD_INFO definition to not depend on KERNEL_STACK_OFFSET Denys Vlasenko
2015-03-19 17:17 ` [PATCH 2/5] x86: get rid of KERNEL_STACK_OFFSET Denys Vlasenko
2015-03-20 16:21 ` Borislav Petkov
2015-03-25 9:10 ` [tip:x86/asm] x86/asm/entry: Get " tip-bot for Denys Vlasenko
2015-03-19 17:17 ` [PATCH 3/5] x86/entry_64.S: use PUSH insns to build pt_regs on stack Denys Vlasenko
2015-03-20 16:35 ` Borislav Petkov [this message]
2015-03-25 9:11 ` [tip:x86/asm] x86/asm/entry/64: Use PUSH instructions " tip-bot for Denys Vlasenko
2015-03-19 17:17 ` [PATCH 4/5] x86/entry_64.S: get rid of FIXUP_TOP_OF_STACK/RESTORE_TOP_OF_STACK Denys Vlasenko
2015-03-20 16:38 ` Borislav Petkov
2015-03-25 9:11 ` [tip:x86/asm] x86/asm/entry/64: Get rid of the FIXUP_TOP_OF_STACK /RESTORE_TOP_OF_STACK macros tip-bot for Denys Vlasenko
2015-03-19 17:17 ` [PATCH 5/5] x86/entry_64.S: get rid of int_ret_from_sys_call_fixup Denys Vlasenko
2015-03-20 16:39 ` Borislav Petkov
2015-03-25 9:11 ` [tip:x86/asm] x86/asm/entry/64: Get " tip-bot for Denys Vlasenko
2015-03-20 10:30 ` [PATCH 1/5] x86: change THREAD_INFO definition to not depend on KERNEL_STACK_OFFSET Borislav Petkov
2015-03-20 22:27 ` Andy Lutomirski
2015-03-24 18:09 ` Ingo Molnar
2015-03-24 18:43 ` [PATCH] x86/asm/entry/64: Improve the THREAD_INFO() macro explanation Ingo Molnar
2015-03-24 18:50 ` Denys Vlasenko
2015-03-24 19:07 ` Andy Lutomirski
2015-03-24 19:20 ` Borislav Petkov
2015-03-25 9:12 ` [tip:x86/asm] " tip-bot for Ingo Molnar
2015-03-24 18:44 ` [PATCH] x86/asm/entry/64: Merge the field offset into the THREAD_INFO() macro Ingo Molnar
2015-03-24 18:50 ` Denys Vlasenko
2015-03-24 19:29 ` Ingo Molnar
2015-03-24 19:34 ` Denys Vlasenko
2015-03-24 19:08 ` Andy Lutomirski
2015-03-25 9:12 ` [tip:x86/asm] " tip-bot for Ingo Molnar
2015-03-24 18:44 ` [PATCH] x86/asm/entry/64: Rename THREAD_INFO() to ASM_ASM_THREAD_INFO_MEMOP() Ingo Molnar
2015-03-24 19:24 ` Borislav Petkov
2015-03-24 19:34 ` Ingo Molnar
2015-03-25 9:13 ` [tip:x86/asm] x86/asm/entry/64: Rename THREAD_INFO() to ASM_THREAD_INFO() tip-bot for Ingo Molnar
2015-03-25 9:10 ` [tip:x86/asm] x86/asm/entry/64: Change the THREAD_INFO() definition to not depend on KERNEL_STACK_OFFSET tip-bot for 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=20150320163529.GG17058@pd.tnic \
--to=bp@alien8.de \
--cc=ast@plumgrid.com \
--cc=dvlasenk@redhat.com \
--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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox