Software Tuning, Performance Optimization & Platform Monitoring
Discussion regarding monitoring and software tuning methodologies, Performance Monitoring Unit (PMU) of Intel microprocessors, and platform updating.

Hang in /dev/cpu/0/msr

GHui
Novice
984 Views

I was access /dev/cpu/0msr, but it was hang there. (eg. cat /dev/cpu/0/msr, I cann't kill(-9) the cat.)

0 Kudos
3 Replies
McCalpinJohn
Honored Contributor III
984 Views

These files are special device drivers that are accessed using raw binary reads and writes with a different offset for each MSR.

The best way to understand the interface is to download msr-tools from https://01.org/msr-tools and review the source code for rdmsr.c and wrmsr.c.

0 Kudos
GHui
Novice
984 Views

It also hang there. And take almost 100% CPU.

-------------------------

[root@rh5.7 tmp]# strace ./read1 -p 0 regno
execve("./read1", ["./read1", "-p", "0", "regno"], [/* 32 vars */]) = 0
brk(0)                                  = 0xad62000
mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x2b81d3f2a000
mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x2b81d3f2b000
access("/etc/ld.so.preload", R_OK)      = -1 ENOENT (No such file or directory)
open("/opt/gridengine/lib/lx26-amd64/tls/x86_64/libc.so.6", O_RDONLY) = -1 ENOENT (No such file or directory)
stat("/opt/gridengine/lib/lx26-amd64/tls/x86_64", 0x7fff26103510) = -1 ENOENT (No such file or directory)
open("/opt/gridengine/lib/lx26-amd64/tls/libc.so.6", O_RDONLY) = -1 ENOENT (No such file or directory)
stat("/opt/gridengine/lib/lx26-amd64/tls", 0x7fff26103510) = -1 ENOENT (No such file or directory)
open("/opt/gridengine/lib/lx26-amd64/x86_64/libc.so.6", O_RDONLY) = -1 ENOENT (No such file or directory)
stat("/opt/gridengine/lib/lx26-amd64/x86_64", 0x7fff26103510) = -1 ENOENT (No such file or directory)
open("/opt/gridengine/lib/lx26-amd64/libc.so.6", O_RDONLY) = -1 ENOENT (No such file or directory)
stat("/opt/gridengine/lib/lx26-amd64", {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0
open("/opt/openmpi/lib/tls/x86_64/libc.so.6", O_RDONLY) = -1 ENOENT (No such file or directory)
stat("/opt/openmpi/lib/tls/x86_64", 0x7fff26103510) = -1 ENOENT (No such file or directory)
open("/opt/openmpi/lib/tls/libc.so.6", O_RDONLY) = -1 ENOENT (No such file or directory)
stat("/opt/openmpi/lib/tls", 0x7fff26103510) = -1 ENOENT (No such file or directory)
open("/opt/openmpi/lib/x86_64/libc.so.6", O_RDONLY) = -1 ENOENT (No such file or directory)
stat("/opt/openmpi/lib/x86_64", 0x7fff26103510) = -1 ENOENT (No such file or directory)
open("/opt/openmpi/lib/libc.so.6", O_RDONLY) = -1 ENOENT (No such file or directory)
stat("/opt/openmpi/lib", {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0
open("/etc/ld.so.cache", O_RDONLY)      = 3
fstat(3, {st_mode=S_IFREG|0644, st_size=43552, ...}) = 0
mmap(NULL, 43552, PROT_READ, MAP_PRIVATE, 3, 0) = 0x2b81d3f2c000
close(3)                                = 0
open("/lib64/libc.so.6", O_RDONLY)      = 3
read(3, "\177ELF\2\1\1\0\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0\220\332\1D2\0\0\0"..., 832) = 832
fstat(3, {st_mode=S_IFREG|0755, st_size=1722304, ...}) = 0
mmap(0x3244000000, 3502424, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x3244000000
mprotect(0x324414e000, 2097152, PROT_NONE) = 0
mmap(0x324434e000, 20480, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x14e000) = 0x324434e000
mmap(0x3244353000, 16728, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0) = 0x3244353000
close(3)                                = 0
mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x2b81d3f37000
arch_prctl(ARCH_SET_FS, 0x2b81d3f376e0) = 0
mprotect(0x324434e000, 16384, PROT_READ) = 0
mprotect(0x3243e1c000, 4096, PROT_READ) = 0
munmap(0x2b81d3f2c000, 43552)           = 0
open("/dev/cpu/0/msr", O_RDONLY)        = 3
pread(3, 
 

0 Kudos
McCalpinJohn
Honored Contributor III
984 Views

Sounds like time to reboot....

0 Kudos
Reply