public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Howard Chu <hyc@symas.com>
To: "Eric W. Biederman" <ebiederm@xmission.com>
Cc: Yinghai Lu <yhlu.kernel@gmail.com>, Andi Kleen <ak@suse.de>,
	linux-kernel <linux-kernel@vger.kernel.org>
Subject: Re: MTRR initialization
Date: Tue, 18 Sep 2007 10:53:53 -0700	[thread overview]
Message-ID: <46F010B1.5060502@symas.com> (raw)
In-Reply-To: <m1lkb6xxl2.fsf@ebiederm.dsl.xmission.com>

Eric W. Biederman wrote:
>> but Andi and Eric said resetting mtrr is not good... when someone from
>> intel try to trim the MTRR for intel CPU.
> 
> There are a couple issues with changing the MTRR configuration.
> - You may not have perfect information on the cpu, the AMD revF is a good
>   example.
> - Code in SMM mode may actually depend on the current mtrr configuration.
> - The BIOS's need to fixed to setup MTRRs properly.

Well the BIOS is definitely doing it wrong here. As I mentioned before, it was 
setting up
	0-0x100000000 WB
	0xc0000000 - 0x100000000 UC
	0xc0000000 - 0xd0000000 WC

But the Intel Architecture Software Developer's Manual states that whenever 
any variable MTRR range overlaps with an UC MTRR range, the range remains UC. 
(Section 9.12.2.3). So in fact what I needed to set was
	0-2GB WB
	2-3GB WB
	3-3.25GB WC
and delete the 3-4GB UC range to get the behavior that the BIOS seems to have 
been intending to set up. (Relying on the default of UC for the unspecified 
ranges.)

> So the sanest approach appears to be.
> - In linux only use ram that is mapped by a write-back mtrr.
>   This preserves performance and is always safe.
> - If you need write-combining set it up in the page tables with PAT.
> 
> There is some difficulty there but software can always do those things
> safely.

Hm. Section 9.5.1 of the doc (table 9-5) says that anything marked UC is 
always UC regardless of the bits in the page table. So with the MTRR setup 
that the BIOS left me with, this is still a no-go. There's no way to get the 
desired effect without completely reinitializing the MTRRs.

Of course, this isn't the only problem with these Asus BIOSs...
-- 
   -- Howard Chu
   Chief Architect, Symas Corp.  http://www.symas.com
   Director, Highland Sun        http://highlandsun.com/hyc/
   Chief Architect, OpenLDAP     http://www.openldap.org/project/

  reply	other threads:[~2007-09-18 17:59 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-09-14 16:33 MTRR initialization Howard Chu
2007-09-14 17:12 ` Yinghai Lu
2007-09-16 16:08   ` Howard Chu
2007-09-16 17:53     ` Yinghai Lu
2007-09-16 18:40       ` Eric W. Biederman
2007-09-18 17:53         ` Howard Chu [this message]
2007-09-18 18:18           ` Eric W. Biederman
2007-09-19 21:52 ` Jesse Barnes
2007-09-20  6:50   ` Andi Kleen
2007-09-20 12:05     ` Avi Kivity
2007-09-20 12:10       ` Andi Kleen
2007-09-20 12:46         ` Avi Kivity
2007-09-20 15:03     ` Jesse Barnes
2007-09-20 17:08       ` Jesse Barnes
2007-09-22  0:27 ` Siddha, Suresh B
2007-09-22  0:46   ` Howard Chu

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=46F010B1.5060502@symas.com \
    --to=hyc@symas.com \
    --cc=ak@suse.de \
    --cc=ebiederm@xmission.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=yhlu.kernel@gmail.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