From: Benjamin Herrenschmidt <benh@kernel.crashing.org>
To: Segher Boessenkool <segher@kernel.crashing.org>
Cc: linuxppc-dev@lists.ozlabs.org, Anton Blanchard <anton@samba.org>,
paulus@samba.org
Subject: Re: [PATCH] powerpc: 32 bit getcpu VDSO function uses 64 bit instructions
Date: Fri, 28 Nov 2014 13:00:17 +1100 [thread overview]
Message-ID: <1417140017.2852.20.camel@kernel.crashing.org> (raw)
In-Reply-To: <20141127205015.GA10073@gate.crashing.org>
On Thu, 2014-11-27 at 14:50 -0600, Segher Boessenkool wrote:
> On Thu, Nov 27, 2014 at 11:41:40AM -0600, Peter Bergner wrote:
> > On Thu, 2014-11-27 at 10:08 -0600, Segher Boessenkool wrote:
> > > On Wed, Nov 26, 2014 at 05:50:27PM -0600, Peter Bergner wrote:
> > > > Nope, you don't get a SIGILL when executing 64-bit instructions in
> > > > 32-bit mode, so it'll happily just execute the instruction, doing
> > > > a full 64-bit compare. I'm guessing that the upper 32-bits of both
> > > > r3 and r4 contain zeros, so we're probably just getting lucky.
> > >
> > > You will get a SIGILL if you run on 32-bit hardware.
> >
> > Ha, I completely forgot about 32-bit hardware. Anyway, I looked
> > at the ISA, and cmpdi and cmpwi are just extended mnemonics for
> > cmpi, with cmpdi setting the L field to 1. Probably on 32-bit
> > hardware, the hardware is just ignoring the L bit being set and
> > doing a cmpwi for us???
>
> Huh. Yes, maybe some implementations do that.
>
> The good news is that those then compute the correct thing ;-)
>
> Can QEMU help catch such bugs more reliably?
That's all moot, that piece of code only exist on 64-bit kernels :-)
So the only risk here is the very remote and unlikely case where the
register might contain 0 in the low 32-bits and some garbage in the top.
Cheers,
Ben.
next prev parent reply other threads:[~2014-11-28 2:00 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-11-26 21:11 [PATCH] powerpc: 32 bit getcpu VDSO function uses 64 bit instructions Anton Blanchard
2014-11-26 22:38 ` Michael Ellerman
2014-11-26 23:23 ` Segher Boessenkool
2014-11-26 23:28 ` Segher Boessenkool
2014-11-26 23:50 ` Peter Bergner
2014-11-27 16:08 ` Segher Boessenkool
2014-11-27 17:41 ` Peter Bergner
2014-11-27 20:50 ` Segher Boessenkool
2014-11-28 2:00 ` Benjamin Herrenschmidt [this message]
2014-11-27 18:20 ` Andreas Schwab
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=1417140017.2852.20.camel@kernel.crashing.org \
--to=benh@kernel.crashing.org \
--cc=anton@samba.org \
--cc=linuxppc-dev@lists.ozlabs.org \
--cc=paulus@samba.org \
--cc=segher@kernel.crashing.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).