mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: ebiederm@xmission.com (Eric W. Biederman)
To: "Yinghai Lu" <yhlu.kernel@gmail.com>
Cc: "Howard Chu" <hyc@symas.com>, "Andi Kleen" <ak@suse.de>,
	linux-kernel <linux-kernel@vger.kernel.org>
Subject: Re: MTRR initialization
Date: Sun, 16 Sep 2007 12:40:57 -0600	[thread overview]
Message-ID: <m1lkb6xxl2.fsf@ebiederm.dsl.xmission.com> (raw)
In-Reply-To: <86802c440709161053x7f549e84u815c6494d921d393@mail.gmail.com> (Yinghai Lu's message of "Sun, 16 Sep 2007 10:53:28 -0700")

"Yinghai Lu" <yhlu.kernel@gmail.com> writes:

> On 9/16/07, Howard Chu <hyc@symas.com> wrote:
>> Yinghai Lu wrote:
>> > On 9/14/07, Howard Chu <hyc@symas.com> wrote:
>> >> Hi, was wondering if anyone else has been tripped up by this... I've got
> 4GB of
>> >> RAM in my Asus A8V Deluxe and memory hole mapping enabled in the BIOS. By
>> >> default, my system boots up with these MTRR settings:
>> >>
>> >> reg00: base=0x00000000 (   0MB), size=4096MB: write-back, count=1
>> >> reg01: base=0x100000000 (4096MB), size=1024MB: write-back, count=1
>> >> reg02: base=0xc0000000 (3072MB), size=1024MB: uncachable, count=1
>> >> reg03: base=0xc0000000 (3072MB), size= 256MB: write-combining, count=1
>
> if rev F before cpu aka Rev E is installed, and 8G RAM installed, it will be
>> >> reg00: base=0x00000000 (   0MB), size=8192MB: write-back, count=1
>> >> reg01: base=0x100000000 (8192MB), size=1024MB: write-back, count=1
>> >> reg02: base=0xc0000000 (3072MB), size=1024MB: uncachable, count=1
>> >> reg03: base=0xc0000000 (3072MB), size= 256MB: write-combining, count=1
> and you will have problem...
>
> So good way is get the ram top, and hole size...and reset the whole
> set ot var mtrr.
>
> you could refer the code in LinuxBIOS about setting that...
> http://www.openbios.org/viewvc/trunk/LinuxBIOSv2/src/cpu/x86/mtrr/mtrr.c?revision=2616&view=markup
> esp the part about CONFIG_VAR_MTRR_HOLE...
>
> 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.

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.

Eric

  reply	other threads:[~2007-09-16 18:41 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-09-14 16:33 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 [this message]
2007-09-18 17:53         ` Howard Chu
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=m1lkb6xxl2.fsf@ebiederm.dsl.xmission.com \
    --to=ebiederm@xmission.com \
    --cc=ak@suse.de \
    --cc=hyc@symas.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

all inboxes | Powered by JetHome®