From: Denys Vlasenko <dvlasenk@redhat.com>
To: Ingo Molnar <mingo@kernel.org>, Andy Lutomirski <luto@amacapital.net>
Cc: Brian Gerst <brgerst@gmail.com>,
Denys Vlasenko <vda.linux@googlemail.com>,
Linus Torvalds <torvalds@linux-foundation.org>,
Steven Rostedt <rostedt@goodmis.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] x86: vdso32/syscall.S: do not load __USER32_DS to %ss
Date: Wed, 25 Mar 2015 16:03:49 +0100 [thread overview]
Message-ID: <5512CE55.6040802@redhat.com> (raw)
In-Reply-To: <20150325092845.GA1809@gmail.com>
On 03/25/2015 10:28 AM, Ingo Molnar wrote:
>
> * Andy Lutomirski <luto@amacapital.net> wrote:
>
>> Now we can do a fun hack on top. On Intel, we have
>> sysenter/sysexitl and, on AMD, we have syscall/sysretl. But, if I
>> read the docs right, Intel has sysretl, too. So we can ditch
>> sysexit entirely, since this mechanism no longer has any need to
>> keep the entry and exit conventions matching.
>
> So this only affects 32-bit vdsos, because on 64-bit both Intel and
> AMD have and use SYSCALL/SYSRET.
>
> So my question would be: what's the performance difference between
> INT80 and sysenter entries on 32-bit, on modern CPUs?
>
> If it's not too horrible (say below 100 cycles) then we could say that
> we start out the simplification and robustification by switching Intel
> over to INT80 + SYSRET on 32-bit, and once we know the 32-bit SYSRET
> and all the other simplifications work fine we implement the
> SYSENTER-hack on top of that?
int 0x80 is about 250 cycles slower than syscall/sysenter.
(I mean, the instruction per se, not the full round-trip).
This looks too horrible to ignore :(
> Is there any user-space code that relies on being able to execute an
> open coded SYSENTER, or are we shielded via the vDSO?
Userspace can't use open-coded sysenter. It will return to a different
address.
Userspace _can_ do this:
my_sysenter:
push %ecx
push %edx
push %ebp
movl %esp,%ebp
sysenter
/* end of my_sysenter() */
...
...
...
call my_sysenter
but this depends on matching stack layout with one used by vDSO.
next prev parent reply other threads:[~2015-03-25 15:03 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-03-23 16:47 [PATCH] x86: vdso32/syscall.S: do not load __USER32_DS to %ss Denys Vlasenko
2015-03-23 19:37 ` Andy Lutomirski
2015-03-23 20:38 ` Andy Lutomirski
2015-03-23 21:55 ` Denys Vlasenko
2015-03-24 6:34 ` Ingo Molnar
2015-03-24 14:08 ` Denys Vlasenko
2015-03-24 15:50 ` Ingo Molnar
2015-03-24 16:55 ` Brian Gerst
2015-03-24 20:17 ` Denys Vlasenko
2015-03-24 21:40 ` Andy Lutomirski
2015-03-25 9:28 ` Ingo Molnar
2015-03-25 15:03 ` Denys Vlasenko [this message]
2015-03-25 15:17 ` Andy Lutomirski
2015-03-25 14:55 ` Denys Vlasenko
2015-03-25 15:12 ` Andy Lutomirski
2015-03-25 0:59 ` Brian Gerst
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=5512CE55.6040802@redhat.com \
--to=dvlasenk@redhat.com \
--cc=ast@plumgrid.com \
--cc=bp@alien8.de \
--cc=brgerst@gmail.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=vda.linux@googlemail.com \
--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