From: Borislav Petkov <bp@alien8.de>
To: Andy Lutomirski <luto@amacapital.net>
Cc: Denys Vlasenko <dvlasenk@redhat.com>, X86 ML <x86@kernel.org>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] x86/asm/entry/64: better check for canonical address
Date: Fri, 27 Mar 2015 09:57:59 +0100 [thread overview]
Message-ID: <20150327085758.GA18912@pd.tnic> (raw)
In-Reply-To: <CALCETrX-Eh9+LK-yuysRsOzD5y6B6i4m3bJaXkjy9DvmDZ-yTQ@mail.gmail.com>
On Thu, Mar 26, 2015 at 11:45:19AM -0700, Andy Lutomirski wrote:
> I suspect that the two added ALU ops are free for all practical
> purposes, and the performance of this path isn't *that* critical.
>
> If anyone is running with vsyscall=native because they need the
> performance, then this would be a big win. Otherwise I don't have a
> real preference. Anyone else have any thoughts here?
>
> Let me just run through the math quickly to make sure I believe all the numbers:
>
> Canonical addresses either start with 17 zeros or 17 ones.
>
> In the old code, we checked that the top (64-47) = 17 bits were all
> zero. We did this by shifting right by 47 bits and making sure that
> nothing was left.
>
> In the new code, we're shifting left by (64 - 48) = 16 bits and then
> signed shifting right by the same amount, this propagating the 17th
> highest bit to all positions to its left. If we get the same value we
> started with, then we're good to go.
>
> So it looks okay to me.
>
> IOW, the new code extends the optimization correctly to one more case
> (native vsyscalls or the really weird corner case of returns to
> emulated vsyscalls, although that should basically never happen) at
> the cost of two probably-free ALU ops.
If we're going to apply this, I'd like this text in the commit message
please.
--
Regards/Gruss,
Boris.
ECO tip #101: Trim your mails when you reply.
--
next prev parent reply other threads:[~2015-03-27 8:59 UTC|newest]
Thread overview: 32+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-03-26 12:42 [PATCH] x86/asm/entry/64: better check for canonical address Denys Vlasenko
2015-03-26 18:45 ` Andy Lutomirski
2015-03-27 8:57 ` Borislav Petkov [this message]
2015-03-30 14:27 ` Denys Vlasenko
2015-03-30 14:30 ` Andy Lutomirski
2015-03-30 14:45 ` Andy Lutomirski
2015-03-27 8:11 ` Ingo Molnar
2015-03-27 10:45 ` Denys Vlasenko
2015-03-27 11:17 ` Ingo Molnar
2015-03-27 11:28 ` Brian Gerst
2015-03-27 11:34 ` Ingo Molnar
2015-03-27 12:14 ` Denys Vlasenko
2015-03-27 12:16 ` Ingo Molnar
2015-03-27 12:31 ` Denys Vlasenko
2015-03-28 9:11 ` Ingo Molnar
2015-03-29 19:36 ` Denys Vlasenko
2015-03-29 21:12 ` Andy Lutomirski
2015-03-29 21:46 ` Denys Vlasenko
2015-03-31 16:43 ` Ingo Molnar
2015-03-31 17:08 ` Andy Lutomirski
2015-03-31 17:31 ` Denys Vlasenko
2015-03-27 11:27 ` Brian Gerst
2015-03-27 11:31 ` Ingo Molnar
2015-03-27 21:37 ` Andy Lutomirski
2015-04-02 17:37 ` Denys Vlasenko
2015-04-02 18:10 ` Ingo Molnar
2015-04-21 16:27 Denys Vlasenko
2015-04-21 18:08 ` Andy Lutomirski
2015-04-23 15:10 ` Borislav Petkov
2015-04-23 15:41 ` Andy Lutomirski
2015-04-23 15:49 ` Borislav Petkov
2015-04-23 15:52 ` Andy Lutomirski
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=20150327085758.GA18912@pd.tnic \
--to=bp@alien8.de \
--cc=dvlasenk@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=luto@amacapital.net \
--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;
as well as URLs for NNTP newsgroup(s).