public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: "H. Peter Anvin" <hpa@zytor.com>
To: "Eric W. Biederman" <ebiederm@xmission.com>
Cc: Alexander van Heukelum <heukelum@mailshack.com>,
	"Antonino A. Daplas" <adaplas@gmail.com>, Andi Kleen <ak@suse.de>,
	Andrew Morton <akpm@osdl.org>, Matt Domsch <Matt_Domsch@dell.com>,
	Vivek Goyal <vgoyal@in.ibm.com>,
	James Bottomley <James.Bottomley@HansenPar>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>
Subject: Re: x86 setup rewrite tree ready for flamage^W review
Date: Sat, 12 May 2007 11:09:32 -0700	[thread overview]
Message-ID: <464602DC.4050603@zytor.com> (raw)
In-Reply-To: <m1r6pmqg1n.fsf@ebiederm.dsl.xmission.com>

Eric W. Biederman wrote:
> 
> HPA is both right and wrong on this.  The safe sequence for entering
> protected mode requires a jump immediately after setting PE in %cr0.
> To serialize the instruction stream and to be on an execution that
> is tested and guaranteed to work in cpus.
> 

Eric, that's complete nonsense.  What Intel documents and what Intel
tests are two very different things.

Intel appears to be afraid of what they call "the crack", but the
semantics of the transition are quite well understood.

> On a lot of processors you can get away with more then that, but
> Intel at least explicitly states in their "Software Developers Manual
> Volume 3: System Programming" in 9.9.1 "Switching to Protected Mode"
> that you need the jump immediately following enabling PE in cr0.
> 
> So while I was debugging and instrumenting code I would happily
> place an instruction before the jump so I could get output.
> However in production grade code I would not place anything
> between the setting of PE in cr0 and the first jump instruction.

A lot of the Intel manuals are boilerplate written by technical writers.
 Once you're used to them you can spot it quite easily because it's
carried from generation to generation with little change, even when it's
blatantly obsoleted.

I can tell you there is tons of production code out there which *never*
reloads CS after switching into and out of protected mode.  It just
plain has to work, on every x86 CPU ever made, with the obvious
semantics.  With Intel's VT, you want to avoid sticking in that mode for
extended periods of time, for performance reasons, but it will work even
there (it kicks to interpreter, though.)  Staying long enough to load
the segment registers is not an issue.

	-hpa

  reply	other threads:[~2007-05-12 18:10 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-05-09  5:15 x86 setup rewrite tree ready for flamage^W review H. Peter Anvin
2007-05-09  6:51 ` Sam Ravnborg
2007-05-09  7:02   ` H. Peter Anvin
2007-05-09  8:11     ` Sam Ravnborg
2007-05-10 14:10 ` Alexander van Heukelum
2007-05-10 18:08   ` H. Peter Anvin
2007-05-10 18:38     ` Martin Mares
2007-05-11  0:55       ` H. Peter Anvin
2007-05-10 22:04     ` Alexander van Heukelum
2007-05-10 22:48       ` H. Peter Anvin
2007-05-12 12:21         ` Alexander van Heukelum
2007-05-12 14:20           ` Eric W. Biederman
2007-05-12 18:09             ` H. Peter Anvin [this message]
2007-05-12 18:35               ` Eric W. Biederman
2007-05-12 18:59                 ` H. Peter Anvin
2007-05-12 22:04                   ` Eric W. Biederman
2007-05-12 22:08                     ` H. Peter Anvin
2007-05-11  4:37 ` Vivek Goyal
2007-05-11 23:58 ` Kevin Winchester
2007-05-12  0:23   ` H. Peter Anvin
2007-05-13  0:35     ` Kevin Winchester
2007-05-15 20:45     ` Rob Landley

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=464602DC.4050603@zytor.com \
    --to=hpa@zytor.com \
    --cc=James.Bottomley@HansenPar \
    --cc=Matt_Domsch@dell.com \
    --cc=adaplas@gmail.com \
    --cc=ak@suse.de \
    --cc=akpm@osdl.org \
    --cc=ebiederm@xmission.com \
    --cc=heukelum@mailshack.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=vgoyal@in.ibm.com \
    /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