mtrr
Guides
Configuration history
On 25 May 2002, after installing a CPU upgrade on gubbio and defining the
video driver to use 3d tdfx, I got an mtrr-related crash in XFree:
(==) Log file: /var/log/XFree86.0.log
(==) Using config file: /etc/X11/XF86Config
(WW) TDFX(0): Failed to set up write-combining range (0xd8000000,0x2000000)
Now, the console windowwas reporting
gubbio kernel: mtrr: 0xd8000000,0x2000000 overlaps existing 0xd8000000,0x1000000
To see the current values of mtrr, type cat /proc/mtrr -- here's gubbio's:
reg00: base=0x00000000 ( 0MB), size= 256MB: write-back, count=1
reg01: base=0xd8000000 (3456MB), size= 16MB: write-combining, count=1
In the guide,
the author writes,
On Intel P6 family processors (Pentium Pro, Pentium II and later) the
Memory Type Range Registers (MTRRs) may be used to control processor
access to memory ranges. This is most useful when you have a video (VGA)
card on a PCI or AGP bus. Enabling write-combining allows bus write
transfers to be combined into a larger transfer before bursting over
the PCI/AGP bus. This can increase performance of image write operations
2.5 times or more.
The trick here is to get the right values to put into the mtrr. Here
is a hint:
To find out your video RAM base address, you need to look at the output
of your X server, which tells you where the linear framebuffer address
is. A typical line that you may get is:
(--) S3: PCI: 968 rev 0, Linear FB @ 0xf8000000
Here is the output of my /var/log/XFree86.0.log:
(--) Chipset 3dfx Banshee found
(--) TDFX(0): Linear framebuffer at 0xD8000000
(--) TDFX(0): VideoRAM: 16384 kByte Mapping 32768 kByte
All right -- so that's where the linear framebuffer is -- at 0xD8000000.
Now, you already have this value in mtrr:
reg01: base=0xd8000000 (3456MB), size= 16MB: write-combining, count=1
What Richard Gooch says (below) is that some cards, especially Voodoo
cards, need a 4MB area "excluded from the beginning of the region
because it is used for registers" -- so we would define an uncachable
area, like this:
%echo "base=0xd8000000 size=0x1000 type=uncachable" >/proc/mtrr
We'll try that. I got it wrong the first time but used
echo "disable=2" >| /proc/mtrr
to remove my mistake and this tidied it up. Here's the new look of cat
/proc/mtrr:
reg00: base=0x00000000 ( 0MB), size= 256MB: write-back, count=1
reg01: base=0xd8000000 (3456MB), size= 16MB: write-combining, count=1
reg02: base=0xd8000000 (3456MB), size= 4KB: uncachable, count=1
Looks plausible, but no, that didn't fix it -- I got "No "base"
in line UUUUUUUUUUUUU" and gubbio kernel: mtrr: 0xd8000000,0x2000000
overlaps existing 0xd8000000,0x1000000 as before. I'll try something slightly
different -- the capital D. First I emptied out the /proc/mtrr completely
with echo "disable=0" >| /proc/mtrr commands. Then I did:
echo "base=0xD8000000 size=0x1000000 type=write-combining"
>/proc/mtrr
This got me, with cat /proc/mtrr,
reg00: base=0xd8000000 (3456MB), size= 16MB: write-combining, count=1
Then,
echo "base=0xd8000000 size=0x1000 type=uncachable" >/proc/mtrr
where cat /proc/mtrr got me,
reg00: base=0xd8000000 (3456MB), size= 16MB: write-combining, count=1
reg01: base=0xd8000000 (3456MB), size= 4KB: uncachable, count=1
This lacks the previous base, and the console gives the error message
gubbio kernel: mtrr: 0xd8000000 is no aligned on a size (0x100000000)
boundary
I tried this and got a machine freeze, so I removed it.
Alternatively,
echo "base=0x00000000 size=0x10000000 type=write-back" >/proc/mtrr
This got me back to the first region, from at /proc/mtrr,
reg00: base=0x00000000 ( 0MB), size= 256MB: write-back, count=1
which is exactly what I had. Then,
echo "base=0xd8000000 size=0x1000000 type=write-combining"
>/proc/mtrr
which recovered the second part of the default mtrr,
reg00: base=0x00000000 ( 0MB), size= 256MB: write-back, count=1
reg01: base=0xd8000000 (3456MB), size= 16MB: write-combining, count=1
Now this is back to square one -- I'm just getting the overlap error.
I then read Gerd Knorr writing,
both *fb fbcon drivers and xfree 4 try to setup mtrr ranges, which
are the same for the video card => mtrr complains because the entry
is already there. Source
This seems to suggest the problem is different from the one I've been
trying to address. I end up not being able to figure out what's going
on --
gubbio~ #: fbset
mode "640x480-60"
# D: 25.174 MHz, H: 31.468 kHz, V: 59.939 Hz
geometry 640 480 640 1024 8
timings 39723 40 24 32 11 96 2
rgba 8/0,8/0,8/0,0/0
endmode
No idea if this can be manipulated and how, or to what purpose. So pull
out -- here are other factors that could matter:
- I've had the CPU to run at 1189MHz instead of the default 800MHz --
I achieve this by setting the CPU to 850 in the Bios. It's possible
this somehow cramped the resources.
The gory details from the guide:
Creating overlapping MTRRs:
%echo "base=0xfb000000 size=0x1000000 type=write-combining"
>/proc/mtrr
%echo "base=0xfb000000 size=0x1000 type=uncachable" >/proc/mtrr
And the results: cat /proc/mtrr
reg00: base=0x00000000 ( 0MB), size= 64MB: write-back, count=1
reg01: base=0xfb000000 (4016MB), size= 16MB: write-combining, count=1
reg02: base=0xfb000000 (4016MB), size= 4kB: uncachable, count=1
Some cards (especially Voodoo Graphics boards) need this 4 kB area
excluded from the beginning of the region because it is used for registers.
NOTE: You can only create type=uncachable region if the first region
that you created is type=write-combining.
|