From: Coywolf Qi Hunt <coywolf@greatcn.org>
To: Philippe Elie <phil.el@wanadoo.fr>
Cc: "H. Peter Anvin" <hpa@zytor.com>, linux-kernel@vger.kernel.org
Subject: Re: Does Flushing the Queue after PG REALLY a Necessity?
Date: Tue, 24 Feb 2004 10:36:07 +0800 [thread overview]
Message-ID: <403AB897.8070002@greatcn.org> (raw)
In-Reply-To: <20040223151815.GA403@zaniah>
Philippe Elie wrote:
> On Mon, 23 Feb 2004 at 18:27 +0000, Coywolf Qi Hunt wrote:
>
>
>>H. Peter Anvin wrote:
>>
>>
>>>Anyone happen to know of any legitimate reason not to reload %cs in
>>>head.S? I think the following would be a lot cleaner, as well as a
>>>lot safer (the jump and indirect branch aren't guaranteed to have the
>>>proper effects, although technically neither should be required due to
>>>the %cr0 write):
>
>
> jump is sufficent when setting PG and required with cpu where cr0 write
> does not serialize.
The problem is there's two jumps in the kernel. Intel's manual only asks
for "Execute a near JMP instruction".
>
>
>>Anyone happen to know of any legitimate reason to flush the prefetch
>>queue after enabling paging?
>>
>>I've read the intel manual volume 3 thoroughly. It only says that after
>>entering protected mode, flushing is required, but never says
>>specifically about whether to do flushing after enabling paging.
>>
>>Furthermore the intel example code enables protected mode and paging at
>>the same time. So does FreeBSD. There's really no more references to check.
>>
>> From the cpu's internal view, flushing for PE is to flush the prefetch
>>queue as well as re-load the %cs, since the protected mode is just about
>>to begin. But no reason to flushing for PG, since linux maps the
>>addresses *identically*.
>>
>>If no any reason, please remove the after paging flushing queue code,
>>two near jump.
>
>
> See IA32 vol 3 7.4 and 18.27.3
>
> Anyway this code is known to work on dozen of intel/non intel processor,
> how can you know if changing this code will not break an obscure clone ?
Right, I also think removing the flush code is risky. Thanks very much,
chapter 18 is what i was looking for. I recalled in an old intel
booklet, named like something 386 system guide, says JMP after PG as
well as PE. But I didn't have that book at hand and didn't find any e-doc.
However, in 18.27.3, "The sequence bounded by the MOV and JMP
instructions should be identity" implies no JMP is also viable
practically. But we needn't to be that pedantic.
If no any reason for the two jumps, the code should be fixed to remains
only ONE near jump.
Coywolf
--
Coywolf Qi Hunt
Admin of http://GreatCN.org and http://LoveCN.org
next prev parent reply other threads:[~2004-02-24 2:36 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2004-02-21 5:47 BOOT_CS H. Peter Anvin
2004-02-21 12:43 ` BOOT_CS Coywolf Qi Hunt
2004-02-21 16:32 ` BOOT_CS Jamie Lokier
2004-02-23 4:43 ` [PATCH] BOOT_CS Coywolf Qi Hunt
2004-02-23 14:30 ` Jamie Lokier
2004-02-23 15:24 ` Rene Herman
2004-02-24 3:11 ` [PATCH] Remove the extra jmp Coywolf Qi Hunt
2004-02-24 3:30 ` Brian Gerst
2004-02-24 10:10 ` Coywolf Qi Hunt
2004-02-22 15:13 ` BOOT_CS Eric W. Biederman
2004-02-22 19:47 ` BOOT_CS H. Peter Anvin
2004-02-22 22:05 ` BOOT_CS Eric W. Biederman
2004-02-23 10:27 ` Does Flushing the Queue after PG REALLY a Necessity? Coywolf Qi Hunt
2004-02-23 15:18 ` Philippe Elie
2004-02-24 2:36 ` Coywolf Qi Hunt [this message]
2004-02-24 3:10 ` H. Peter Anvin
2004-02-24 4:55 ` Randy.Dunlap
2004-02-24 9:17 ` Coywolf Qi Hunt
2004-02-24 11:21 ` Herbert Poetzl
2004-02-24 11:33 ` Coywolf Qi Hunt
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=403AB897.8070002@greatcn.org \
--to=coywolf@greatcn.org \
--cc=hpa@zytor.com \
--cc=linux-kernel@vger.kernel.org \
--cc=phil.el@wanadoo.fr \
/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