Skip to contentSkip to conversation

msr(7) manpage

DISCUSSION Andi Kleen 3 participants 7 messages Feb 22, 2009 – Mar 30, 2009 4 messages not in the archive Man-pages: manual pages for Linux -- Sections 2, 3, 4, 5, and 7

lore
Share & tools
lore

Andi Kleen

author
#0 lore raw

Here's a simple manpage for the msr device.

-Andi

.\" Some sentences copied from comment in arch/x86/kernel/msr.c
.TH MSR 7 2009-02-22 "Linux" "Linux Programmer's Manual"
.SH NAME
msr \- x86 CPU MSR access device
.SH DESCRIPTION
.I /dev/cpu/CPUNUM/msr
allows to read and write the model specific registers (MSRs) of an x86 CPU.
.I CPUNUM
is the number of the cpu to access as listed in
.I /proc/cpuinfo.
The register access is done by opening the file and seeking to the MSR number
as offset in the file and then read or write in chunks of 8 bytes.
A larger size than 8 bytes means multiple reads or writes of the
same register.
.SH NOTES
The
.I msr
driver is not auto-loaded. On modular kernel you might need to use
.B modprobe msr
to load it explicitely before use.
.SH SEE ALSO
Intel Corporation Intel 64 and IA-32 Architectures Software Developer's Manual Volume 3B Appendix B for an overview of the Intel CPU MSRs.
--
To unsubscribe from this list: send the line "unsubscribe linux-man" in
the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

#2 lore raw
In reply to a message not in the archive
Quoted 3 lines · Andi Kleen

Here's a simple manpage for the msr device.

-Andi

Thanks for this page Andi.

A few comments/questions below.

Quoted 4 lines

.\" Some sentences copied from comment in arch/x86/kernel/msr.c .TH MSR 7 2009-02-22 "Linux" "Linux Programmer's Manual" .SH NAME
msr \- x86 CPU MSR access device

Quoted 8 lines

.SH DESCRIPTION
.I /dev/cpu/CPUNUM/msr
allows to read and write the model specific registers (MSRs) of an x86 CPU. .I CPUNUM
is the number of the cpu to access as listed in
.I /proc/cpuinfo.
The register access is done by opening the file and seeking to the MSR number

Could you clarify "seek to the MSR number" == does that mean seek to offset (MSR_number * 8) or something like that?

Quoted 3 lines

as offset in the file and then read or write in chunks of 8 bytes. A larger size than 8 bytes means multiple reads or writes of the same register.

What are the semantics of reading the same register multiple times? Is a read non-destructive? Do the multiple reads always get the same value?

Cheers,

Michael

Quoted 11 lines

.SH NOTES
The
.I msr
driver is not auto-loaded. On modular kernel you might need to use .B modprobe msr
to load it explicitely before use.
.SH SEE ALSO
Intel Corporation Intel 64 and IA-32 Architectures Software Developer's Manual Volume 3B Appendix B
for an overview of the Intel CPU MSRs.

Signature · 9 lines
Michael Kerrisk
Linux man-pages maintainer; http://www.kernel.org/doc/man-pages/
git://git.kernel.org/pub/scm/docs/man-pages/man-pages.git
man-pages online: http://www.kernel.org/doc/man-pages/online_pages.html
Found a bug? http://www.kernel.org/doc/man-pages/reporting_bugs.html
--
To unsubscribe from this list: send the line "unsubscribe linux-man" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
#4 lore raw
In reply to a message not in the archive

[CC+=hpa]

Quoted 58 lines · Michael Kerrisk
Quoted 3 lines · Andi Kleen

Here's a simple manpage for the msr device.

-Andi

Thanks for this page Andi.

A few comments/questions below.

Quoted 5 lines

.\" Some sentences copied from comment in arch/x86/kernel/msr.c .TH MSR 7 2009-02-22 "Linux" "Linux Programmer's Manual" .SH NAME
msr \- x86 CPU MSR access device
.SH DESCRIPTION

Quoted 8 lines

.I /dev/cpu/CPUNUM/msr
allows to read and write the model specific registers (MSRs) of an x86 CPU.
.I CPUNUM
is the number of the cpu to access as listed in
.I /proc/cpuinfo.
The register access is done by opening the file and seeking to the MSR number

Could you clarify "seek to the MSR number" == does that mean seek to offset (MSR_number * 8) or something like that?

Quoted 3 lines

as offset in the file and then read or write in chunks of 8 bytes. A larger size than 8 bytes means multiple reads or writes of the same register.

What are the semantics of reading the same register multiple times? Is a read non-destructive? Do the multiple reads always get the same value?

Cheers,

Michael

Quoted 11 lines

.SH NOTES
The
.I msr
driver is not auto-loaded. On modular kernel you might need to use .B modprobe msr
to load it explicitely before use.
.SH SEE ALSO
Intel Corporation Intel 64 and IA-32 Architectures Software Developer's Manual Volume 3B Appendix B
for an overview of the Intel CPU MSRs.

--
Michael Kerrisk
Linux man-pages maintainer; http://www.kernel.org/doc/man-pages/
git://git.kernel.org/pub/scm/docs/man-pages/man-pages.git
man-pages online: http://www.kernel.org/doc/man-pages/online_pages.html
Found a bug? http://www.kernel.org/doc/man-pages/reporting_bugs.html

Signature · 9 lines
Michael Kerrisk
Linux man-pages maintainer; http://www.kernel.org/doc/man-pages/
git://git.kernel.org/pub/scm/docs/man-pages/man-pages.git
man-pages online: http://www.kernel.org/doc/man-pages/online_pages.html
Found a bug? http://www.kernel.org/doc/man-pages/reporting_bugs.html
--
To unsubscribe from this list: send the line "unsubscribe linux-man" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
author
#7 lore raw
In reply to a message not in the archive
Quoted 13 lines · Michael Kerrisk
Quoted 4 lines

.\" Some sentences copied from comment in arch/x86/kernel/msr.c .TH MSR 7 2009-02-22 "Linux" "Linux Programmer's Manual" .SH NAME
msr \- x86 CPU MSR access device

Quoted 8 lines

.SH DESCRIPTION
.I /dev/cpu/CPUNUM/msr
allows to read and write the model specific registers (MSRs) of an x86 CPU. .I CPUNUM
is the number of the cpu to access as listed in
.I /proc/cpuinfo.
The register access is done by opening the file and seeking to the MSR number

Quoted 2 lines

Could you clarify "seek to the MSR number" == does that mean seek to offset (MSR_number * 8) or something like that?

No it means seek to MSR number. Yes the semantics are a little weird.

Quoted 8 lines
Quoted 4 lines

as offset in the file and then read or write in chunks of 8 bytes. A larger size than 8 bytes means multiple reads or writes of the same register.

What are the semantics of reading the same register multiple times? Is a read non-destructive? Do the multiple reads always get the same value?

It depends on the hardware. A typical x86 CPU has hundreds of different MSRs. Typically they're non destructive, but some might still change. I intentionally didn't try to cover that but just added references (although those could be probably also extended)

BTW what I also forgot was a note that it's root only.

Please just edit it yourself. I assume you'll be doing that anyways.

-Andi

Signature · 5 lines
ak-VuQAYsv1563Yd54FQh9/[email protected] -- Speaking for myself only.
--
To unsubscribe from this list: send the line "unsubscribe linux-man" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
#6 lore raw
In reply to a message not in the archive
Quoted 2 lines · Michael Kerrisk
Quoted 2 lines

Could you clarify "seek to the MSR number" == does that mean seek to offset (MSR_number * 8) or something like that?

No, it means see to offset (MSR_number).

Quoted 6 lines
Quoted 6 lines
Quoted 3 lines

as offset in the file and then read or write in chunks of 8 bytes. A larger size than 8 bytes means multiple reads or writes of the same register.

What are the semantics of reading the same register multiple times? Is a read non-destructive? Do the multiple reads always get the same value?

The semantics are entirely dependent on the register itself. Just like an I/O device, anything can happen.

-hpa

Signature · 7 lines
H. Peter Anvin, Intel Open Source Technology Center
I work for Intel.  I don't speak on their behalf.

--
To unsubscribe from this list: send the line "unsubscribe linux-man" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
#8 lore raw
In reply to a message not in the archive

Hi Andi,

Quoted 1 line · Andi Kleen

Here's a simple manpage for the msr device.

I've incorporated this page for man-pages-3.20, with the following changes:

* made some small wording edits to the page
* I added a copyright in your name, and a license -- I used the verbatim license, since that's what you used at least some times in the past:
http://www.kernel.org/doc/man-pages/licenses.html#verbatim
* I added text noting that the file is only r/w for root.root.

Please let me know if any of the above should be changed/fixed.

The current draft of the page is below.

Cheers,

Michael

.\" Copyright (c) 2009 by Andi Kleen <andi-Vw/[email protected]> .\" Some sentences copied from comments in arch/x86/kernel/msr.c
.\"
.\" Permission is granted to make and distribute verbatim copies of this .\" manual provided the copyright notice and this permission notice are .\" preserved on all copies.
.\"
.\" Permission is granted to copy and distribute modified versions of this .\" manual under the conditions for verbatim copying, provided that the .\" entire resulting derived work is distributed under the terms of a .\" permission notice identical to this one.
.\"
.\" Since the Linux kernel and libraries are constantly changing, this .\" manual page may be incorrect or out-of-date. The author(s) assume no .\" responsibility for errors or omissions, or for damages resulting from .\" the use of the information contained herein. The author(s) may not .\" have taken the same level of care in the production of this manual, .\" which is licensed free of charge, as they might when working
.\" professionally.
.\"
.\" Formatted or processed versions of this manual, if unaccompanied by .\" the source, must acknowledge the copyright and authors of this work. .\"
.TH MSR 7 2009-03-31 "Linux" "Linux Programmer's Manual"
.SH NAME
msr \- x86 CPU MSR access device
.SH DESCRIPTION
.I /dev/cpu/CPUNUM/msr
provides an interface to read and write the model-specific
registers (MSRs) of an x86 CPU.
.I CPUNUM
is the number of the CPU to access as listed in
.IR /proc/cpuinfo .

The register access is done by opening the file and seeking to the MSR number as offset in the file, and then reading or writing in chunks of 8 bytes.
An I/O transfer of more than 8 bytes means multiple reads or writes of the same register.

This file is protected so that it can only be read and written by the user .IR root ,
or members of the group
.IR root .
.SH NOTES
The
.I msr
driver is not auto-loaded.
On modular kernels you might need to use the following command to load it explicitly before use:

    $ \fImodprobe msr\fP
.SH SEE ALSO
Intel Corporation Intel 64 and IA-32 Architectures
Software Developer's Manual Volume 3B Appendix B
for an overview of the Intel CPU MSRs.
--
To unsubscribe from this list: send the line "unsubscribe linux-man" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
#10 lore raw
In reply to a message not in the archive
Quoted 7 lines · Michael Kerrisk

Hi Andi,

Quoted 1 line · Andi Kleen

Here's a simple manpage for the msr device.

I've incorporated this page for man-pages-3.20, with the following changes:

Quoted 8 lines

* made some small wording edits to the page
* I added a copyright in your name, and a license -- I used the verbatim license, since that's what you used at least some times in the past:
http://www.kernel.org/doc/man-pages/licenses.html#verbatim
* I added text noting that the file is only r/w for root.root.

Please let me know if any of the above should be changed/fixed.

One further change that I forgot to mention: I placed this page in Section 4 rather than 7.

Thanks,

Michael
--
To unsubscribe from this list: send the line "unsubscribe linux-man" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html