mtrr funnies

Nifty Fedora Mitch niftyfedora at niftyegg.com
Wed Oct 8 05:55:50 UTC 2008


On Tue, Oct 07, 2008 at 10:59:02AM -0700, Wolfgang S. Rupprecht wrote:
> 
> I've got a motherboard with a fairly new chipset (Asus M3A78T
> w. AMD/ATI 790GX) and I'm seeing a funny MTRR setting.  I have 8GB
> memory and am running a 64-bit kernel, but I'm only seeing ~4GB
> mentioned in the MTRR's.  Is this a bug?  Do I need to add the upper
> 4+GB by hand?
> 
>     $ cat /proc/mtrr
>     reg00: base=0x00000000 (   0MB), size=2048MB: write-back, count=1
>     reg01: base=0x80000000 (2048MB), size=1024MB: write-back, count=1
>     reg02: base=0xc0000000 (3072MB), size= 256MB: write-back, count=1
>     reg03: base=0xd0000000 (3328MB), size= 256MB: write-combining, count=1
> 
> It does seem like the kernel sees the whole memory, at least at times,
> but it isn't clear if that high memory is being cached the right way.
> 
>     Oct  7 10:54:30 poblano kernel: Memory: 7678940k/8650752k available (2699k kernel code, 184672k reserved, 1485k data, 980k init)
> 

What does /proc/meminfo report.

If I understand MTRR registers the important point is that they do not
conflict with mapping that the kernel or a device driver might require. In
this case the memory above MTRR#03 has no restrictions so the kernel is
able to setup the page tables any way it needs to.  

The kernel will not assign coherency atributes to a page that risks
data corruption.  If a region of memory has an existing MTRR mapping anything
the kernel does must be correct from a coherency point of view.

Just curious, what device is mapped at 3.3GB?  Is it a graphics card, which one?  
Write-combining is an interesting mapping... the driver must manage
coherency with care but the driver can gain a near ten fold speedup for some 
IO devices.

For what it is worth WindoZ uses per page atributes (PAT) and can ignore MTRR mapping
once booted.  Thus many system BIOS setup IO regions too conservativly 
which causes Linux IO to suffer.  The kernel will respect MTRR mappings as it
should...

-- 
	T o m  M i t c h e l l 
	Found me a new hat, now what?




More information about the fedora-list mailing list