fearful-symmetry / gomsr Goto Github PK
View Code? Open in Web Editor NEWRead / write Intel MSRs in go
License: Apache License 2.0
Read / write Intel MSRs in go
License: Apache License 2.0
Hi,
I'm trying to probe the steal-time MSR at 0x4b564d03
to check if steal-time communication is enabled. I keep getting input/output error
. Here's my go program:
package main
import (
"fmt"
"github.com/fearful-symmetry/gomsr"
"os"
)
func main() {
data, err := gomsr.ReadMSR(0, 0x4b564d03)
if err != nil {
fmt.Println("FAILED: ", err)
os.Exit(1)
}
fmt.Println(data)
}
This produces output:
[ec2-user@ip-172-31-43-88 ~]$ sudo ./main
FAILED input/output error
I know steal-time communication is supposed to work because I can see there has been some ticks:
[ec2-user@ip-172-31-43-88 ~]$ cat /proc/stat | grep "cpu " | awk '{print $9}'
1439
I suspect this is nothing wrong with your library, but am just hoping you could help since I am a bit stumped. I've also checked the official msr-tools tool and run into the same issue (meaning it's probably not an issue with your library but rather on my end):
[ec2-user@ip-172-31-43-88 ~]$ sudo strace ./rdmsr --all 0x4b564d03
execve("./rdmsr", ["./rdmsr", "--all", "0x4b564d03"], 0x7fff32f797e0 /* 18 vars */) = 0
brk(NULL) = 0x55fd18c09000
access("/etc/ld.so.preload", R_OK) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/etc/ld.so.cache", O_RDONLY|O_CLOEXEC) = 3
fstat(3, {st_mode=S_IFREG|0644, st_size=23644, ...}) = 0
mmap(NULL, 23644, PROT_READ, MAP_PRIVATE, 3, 0) = 0x7f475a172000
close(3) = 0
openat(AT_FDCWD, "/lib64/libc.so.6", O_RDONLY|O_CLOEXEC) = 3
read(3, "\177ELF\2\1\1\3\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0@\21\2\0\0\0\0\0"..., 832) = 832
fstat(3, {st_mode=S_IFREG|0755, st_size=2021312, ...}) = 0
mmap(NULL, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7f475a170000
mmap(NULL, 3844768, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x7f4759baa000
mprotect(0x7f4759d4b000, 2097152, PROT_NONE) = 0
mmap(0x7f4759f4b000, 24576, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x1a1000) = 0x7f4759f4b000
mmap(0x7f4759f51000, 15008, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0) = 0x7f4759f51000
close(3) = 0
arch_prctl(ARCH_SET_FS, 0x7f475a171500) = 0
mprotect(0x7f4759f4b000, 16384, PROT_READ) = 0
mprotect(0x55fd1821e000, 4096, PROT_READ) = 0
mprotect(0x7f475a178000, 4096, PROT_READ) = 0
munmap(0x7f475a172000, 23644) = 0
open("/dev/cpu", O_RDONLY|O_NONBLOCK|O_CLOEXEC|O_DIRECTORY) = 3
fstat(3, {st_mode=S_IFDIR|0755, st_size=60, ...}) = 0
brk(NULL) = 0x55fd18c09000
brk(0x55fd18c2a000) = 0x55fd18c2a000
brk(NULL) = 0x55fd18c2a000
getdents(3, /* 3 entries */, 32768) = 72
getdents(3, /* 0 entries */, 32768) = 0
close(3) = 0
openat(AT_FDCWD, "/dev/cpu/0/msr", O_RDONLY) = 3
pread64(3, 0x7ffd42e78a38, 8, 1263947011) = -1 EIO (Input/output error)
write(2, "rdmsr: CPU 0 cannot read MSR 0x4"..., 40rdmsr: CPU 0 cannot read MSR 0x4b564d03
) = 40
exit_group(4) = ?
+++ exited with 4 +++
I've also made sure the msr module is loaded with sudo modprobe msr
Any ideas as to what I'm doing wrong? I fully expect that I have some misconception somewhere. Any advice would be appreciated.
Add this project to circleCI.
Add examples to our testfile for the godoc.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.