All of lore.kernel.org
 help / color / mirror / Atom feed
From: "H. Peter Anvin" <hpa@zytor.com>
To: Jason Baron <jbaron@redhat.com>
Cc: Daniel Drake <dsd@laptop.org>,
	Andres Salomon <dilinger@queued.net>, Chris Ball <cjb@laptop.org>,
	linux-kernel@vger.kernel.org, rostedt@goodmis.org, mingo@elte.hu
Subject: Re: Dynamic nop selection breaks boot on Geode LX
Date: Mon, 04 Oct 2010 14:51:57 -0700	[thread overview]
Message-ID: <4CAA4C7D.8040006@zytor.com> (raw)
In-Reply-To: <20101004154633.GA2900@redhat.com>

On 10/04/2010 08:46 AM, Jason Baron wrote:
> 
> move arch_init_ideal_nop5 later
> 
> arch_init_ideal_nop5() was being called from setup_arch() before
> the exception table was setup. Move it later into
> alternative_instructions().
> 
> Fixes a boot hang on OLPC's XO-1 laptop based on Geode LX
> processor.
> 

This code is fundamentally toxic and needs to be scrapped completely --
it is simply broken beyond repair.

We tried exactly this type of dynamic selection before, and it doesn't
work on broken virtualizers; in particular Microsoft VirtualPC can pass
the exception test and yet fail later.

The end result is very simple: you can always use NOPL on 64 bits, you
can never use NOPL on 32 bits.

66 66 66 66 90 will always *work* (as in, it will never fail) but it's
pretty slow on older CPUs which took a hit on handle prefixes -- but it
might still be faster than a jump on those.  Thus, in your code the JMP
case will never be reached anyway.

There isn't, of course, a classic 5-byte sequence, although the sequence:

	2E 8D 75 26 00

... should work (leal %ds:0(,%esi,1),%esi).  However, 66 ... 90 is
likely to work better on modern processors (although I haven't measured it.)

	-hpa

  parent reply	other threads:[~2010-10-04 21:52 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-10-02 19:16 Dynamic nop selection breaks boot on Geode LX Daniel Drake
2010-10-03  5:50 ` Borislav Petkov
2010-10-03  9:26   ` Borislav Petkov
2010-10-03 14:47     ` Borislav Petkov
2010-10-03 16:32   ` Daniel Drake
2010-10-03 17:12     ` Borislav Petkov
2010-10-04 18:06     ` Steven Rostedt
2010-10-04 15:46 ` Jason Baron
2010-10-04 16:49   ` Daniel Drake
2010-10-04 20:31   ` Steven Rostedt
2010-10-04 20:39     ` Jason Baron
2010-10-04 22:11       ` Steven Rostedt
2010-10-04 21:51   ` H. Peter Anvin [this message]
2010-10-04 22:15     ` Steven Rostedt
2010-10-04 22:22       ` H. Peter Anvin
2010-10-04 22:27         ` Nick Lowe
     [not found]         ` <AANLkTikCkwF+yd4kdad8Bcz-6YX+STiy1wgrFfJxsfRg@mail.gmail.com>
2010-10-04 22:32           ` H. Peter Anvin
2010-10-26 20:08   ` Daniel Drake
2010-10-26 20:12     ` Jason Baron

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=4CAA4C7D.8040006@zytor.com \
    --to=hpa@zytor.com \
    --cc=cjb@laptop.org \
    --cc=dilinger@queued.net \
    --cc=dsd@laptop.org \
    --cc=jbaron@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    --cc=rostedt@goodmis.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.