Have you ever read from or written to the /dev/cpu/*/msr files? If you aren’t in virtualization, RAPL monitoring tools, or performance analysis tools, chances are low. But if you have, you might have stumbled across some very weird behavior:

  • Reading into a buffer that is bigger than 8 bytes (the size of one MSR register), does not read consecutive registers, but the same register over and over.

  • Writing from a buffer that is bigger than 8 bytes does not write consecutive registers, but the same register over and over.

  • Access to these files is locked behind file mode 0600 and CAP_SYS_RAWIO.

My attempt to let ordinary users read at least some MSR registers in 2023 failed, but I want to try again and make at least the reading and writing behavior less surprising. Patch is here.

Update, 2026-06-26:

Review is in. Need to drop the restriction to single writes. I can see the argument, but I don’t know if the overhead of multiple pwrite calls would really be so noticeable.

Update, 2026-06-26, but later:

Review for v2 is here as well, and there goes the restriction to the read function. Unsatisfactory. I hope at least the changes to the file comment go through so that the next developer who stumbles across this knows that there are users for this behavior.

Update, 2026-07-21:

They did!