Home / Alt manpages / proc_mtrr(5)

  • proc_mtrr(5)
  • File format
  • linux

Inspect Legacy x86 MTRR State Safely with /proc/mtrr

You will check whether this Linux system exposes the legacy /proc/mtrr interface, read its entries without changing anything, and decide when to stop instead of forcing an old workaround. Allow about ten minutes. You need a shell; the inspection commands are unprivileged, although a restricted container may hide the file even when the host kernel supports MTRRs.

This guide follows the installed proc_mtrr(5) page from Linux man-pages 6.7, dated 15 August 2023, and the upstream Linux x86 documentation. The local test system is running kernel 6.8.0-139-generic. MTRR is an x86 facility, so these instructions do not apply to other architectures.

1. Check whether the interface exists

Start with a read-only test. Do not use sudo yet, and do not redirect anything into the file.

$ test -r /proc/mtrr && echo '/proc/mtrr is readable' || echo '/proc/mtrr is unavailable or unreadable'

A readable result means this process can inspect the legacy interface. A failure is not proof that the CPU lacks MTRRs: the kernel may have been built without the relevant support, the interface may be absent on this kernel, or a container policy may be hiding it. Check the environment before treating the result as a hardware diagnosis.

Checkpoint: record this result and the kernel version before moving on.

$ uname -r
6.8.0-139-generic
$ stat /proc/mtrr

Your version and stat output will differ. If stat reports that the path does not exist, stop the procedure here. There is no useful MTRR configuration to perform through this path.

2. Read the current ranges

If the file is readable, display it with cat:

$ cat /proc/mtrr
reg00: base=0x00000000 (   0MB), size= 256MB: write-back, count=1

The exact entries are machine-specific. Each line identifies a register slot, a physical base address, a byte size expressed in a human-readable unit, a memory type, and a reference count. Common types include write-back, write-combining, and uncachable. Treat the output as a report of the kernel's current view, not as a list of ranges that should be recreated by hand.

On a system with no configured variable ranges, output may be empty. On this host, /proc/mtrr is not readable from the current process, so there is no local register listing to copy. That is an access result, not a reason to write a guessed range.

3. Understand the legacy write interface

The upstream MTRR documentation describes an ASCII administration interface as well as an ioctl interface for programs. The documented forms include a new range such as:

# printf '%s\n' 'base=0xf8000000 size=0x400000 type=write-combining' > /proc/mtrr

It also describes removing a slot with a form such as:

# printf '%s\n' 'disable=2' > /proc/mtrr

These are privileged, state-changing operations. Do not paste either command merely to test the interface. A wrong base address or size can apply a cache policy to the wrong physical range, and disabling the wrong slot can disrupt a device or display service. The base must describe the actual device mapping and the size must match the intended range; do not infer either value from an example.

Before considering a change, take a complete copy of the current output and identify the device documentation that requires it:

$ cat /proc/mtrr | tee "$HOME/mtrr-before.txt"
$ dmesg | grep -i mtrr

The first command changes no kernel state but writes a record in your home directory. The second may require elevated access on a hardened system. If you cannot explain why a specific device needs a legacy MTRR range, do not proceed.

4. Prefer PAT-aware interfaces for new work

Modern Linux x86 systems generally use the Page Attribute Table, or PAT, instead of direct MTRR manipulation. The kernel documentation says direct MTRR use by drivers has been phased out. Driver code should use the kernel's PAT-aware interfaces, such as ioremap_wc() for device mappings or the appropriate set_memory_* helpers for RAM ranges. Those are kernel programming interfaces, not shell commands for changing an arbitrary machine.

This distinction prevents a common error: finding an old forum command that writes to /proc/mtrr and applying it to a current graphics stack. For a display or PCI performance problem, first use the device driver's current documentation and inspect its logs. Do not add a boot parameter or alter cache policy because a legacy file is missing.

5. Recover from an investigated change

If an administrator has already changed a range, compare the current listing with the saved record:

$ diff -u "$HOME/mtrr-before.txt" <(cat /proc/mtrr)

Undoing a change is not a generic "reset" command. It requires identifying the changed register and the device-specific configuration that should replace it. Use the documented disable=<register> form only when you have confirmed the slot number and have an explicit recovery plan. If a graphical or device service is affected, stop and use its vendor or distribution recovery procedure rather than experimenting with overlapping ranges.

Done means

  • You checked /proc/mtrr without assuming that an inaccessible file means unsupported hardware.
  • You recorded the kernel version and, when available, read the current ranges with cat.
  • You treated writes and disabling entries as privileged, service-affecting operations.
  • You used current driver and PAT documentation as the starting point for new work.
  • You kept any existing configuration unchanged unless a specific, recoverable device requirement justified a change.