[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <4CAA4C7D.8040006@zytor.com>
Date: Mon, 04 Oct 2010 14:51:57 -0700
From: "H. Peter Anvin" <hpa@...or.com>
To: Jason Baron <jbaron@...hat.com>
CC: Daniel Drake <dsd@...top.org>,
Andres Salomon <dilinger@...ued.net>,
Chris Ball <cjb@...top.org>, linux-kernel@...r.kernel.org,
rostedt@...dmis.org, mingo@...e.hu
Subject: Re: Dynamic nop selection breaks boot on Geode LX
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
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists