Giter VIP home page Giter VIP logo

gomsr's People

Contributors

fearful-symmetry avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

Forkers

the-locksmith

gomsr's Issues

Steal Time MSR read not working

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.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.