MTRR ioctls don't work as documented
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
linux (Ubuntu) |
Expired
|
Undecided
|
Unassigned |
Bug Description
The kernel's Documentation/
or Documentation/
describes the ioctl interface to the MTRRs.
The sample code for printing out the MTRRs ("mtrr-show.c") fails to print many of the values. I think that this is a bug in the ioctl implementation, not the documentation since the same code works on Fedora 9.
/proc/mttr shows:
reg00: base=0xd0000000 (3328MB), size= 256MB: uncachable, count=1
reg01: base=0xe0000000 (3584MB), size= 512MB: uncachable, count=1
reg02: base=0x00000000 ( 0MB), size=4096MB: write-back, count=1
reg03: base=0x100000000 (4096MB), size=2048MB: write-back, count=1
reg04: base=0x180000000 (6144MB), size= 512MB: write-back, count=1
reg05: base=0x1a0000000 (6656MB), size= 256MB: write-back, count=1
The sample code prints:
Register: 0 base: 0xd0000000 size: 0x10000000 type: uncachable
Register: 1 base: 0xe0000000 size: 0x20000000 type: uncachable
Register: 2 disabled
Register: 3 disabled
Register: 4 disabled
Register: 5 disabled
Register: 6 disabled
Register: 7 disabled
If I remove the disabled check, it prints:
Register: 0 base: 0xd0000000 size: 0x10000000 type: uncachable
Register: 1 base: 0xe0000000 size: 0x20000000 type: uncachable
Register: 2 base: 0x0 size: 0x0 type: uncachable
Register: 3 base: 0x0 size: 0x0 type: uncachable
Register: 4 base: 0x0 size: 0x0 type: uncachable
Register: 5 base: 0x0 size: 0x0 type: uncachable
Register: 6 base: 0x0 size: 0x0 type: uncachable
Register: 7 base: 0x0 size: 0x0 type: uncachable
Note: the architecture is AMD64. The code is native (according to file(1)).
The same code seems to work on a Fedora 9 x86-64 system, albeit one with less than 4G of RAM.
BTW, the reason I care is that the MTRRs need to be rearranged for X to work on my system and I want to do that programmatically.
I guess I should have stated the version information. Why isn't this asked?
I'm running 8.04.1. /proc/version says:
Linux version 2.6.24-19-generic (buildd@king) (gcc version 4.2.3 (Ubuntu 4.2.3-2ubuntu7)) #1 SMP Fri Jul 11 21:01:46 UTC 2008
My system was updated a couple of days ago. Funny thing: the kernel changed but all I noticed changing in /proc/version was the build machine and date.
dmesg shows that the kernel is Ubuntu 2.6.24- 19.36-generic
======= ======= ======= ======= ======= =
cc -E shows that the x86-64 version of struct mtrr_gentry is being used.