msr

Root Has Segfault Executing RDMSR Assembly Code

五迷三道 提交于 2020-06-18 12:12:28
问题 I would like to read msr 0x19a (IA32_CLOCK_MODULATIOn) directly from C code WITH root privilege. However, I get the following segfault error. a.out[27843] general protection ip:40053b sp:7fffefc38020 error:0 in a.out[400000+1000] Does anyone know whether this way of calling rdmsr is a viable option? Thanks in advance! #include <stdio.h> #define __init typedef unsigned uint32_t; static int __init test3_init(void) { uint32_t hi,lo; hi=0x0; lo=0x0; asm volatile("mov $0x19a,%ecx"); asm volatile(

Unable to disable Hardware prefetcher in Core i7

删除回忆录丶 提交于 2019-12-30 19:01:31
问题 I am getting Error while trying to disable Hardware prefetcher in my Core i7 system. I am following the method as per the link How do I programmatically disable hardware prefetching? In my system grep -i msr /boot/config-$(uname -r) CONFIG_X86_DEBUGCTLMSR=y CONFIG_X86_MSR=y CONFIG_SCSI_ARCMSR=m Here is my error message root@ ./rdmsr 0x1a0 850089 [root@ ./wrmsr -p 0 0x1a0 0x850289 (to disable hardware prefetcher in Core i7) wrmsr:pwrite: Input/output error I am getting same error for disabling

Reading /dev/cpu/*/msr from userspace: operation not permitted

故事扮演 提交于 2019-12-18 16:28:08
问题 I am trying to write a simple application that can read msr registers, and am running this application from userspace. I have loaded the msr module and given read permissions for everyone to /dev/cpu/*/msr. But still the user is not able to access these files but the root can. The permissions look like this: crw-r--r-- 1 root root 202, 0 sep 6 17:55 /dev/cpu/0/msr crw-r--r-- 1 root root 202, 1 sep 6 17:55 /dev/cpu/1/msr crw-r--r-- 1 root root 202, 2 sep 6 17:55 /dev/cpu/2/msr crw-r--r-- 1

Haswell microarchitecture don't have Stalled-cycles-backend in perf

泄露秘密 提交于 2019-12-08 19:44:21
问题 I installed perf on Haswell CPU( Intel Core i7-4790 ). But the "perf list" does not include "stalled-cycles-frontend" nor "stalled-cycles-backend". I checked the http://www.intel.com/content/www/us/en/processors/architectures-software-developer-manuals.html and not found the performance events relevant to stalled-cycles-backend from the Table 19-7( Non-Architectural Performance Events In the Processor Core of 4th Generation Intel Core Processors). So my question is: how can I measure stalled

Hardware Processor Counters Incorrectly Resetting

a 夏天 提交于 2019-12-06 07:58:08
I wrote a program which reads the APERF/MPERF counters on an Intel chip (page 2 on http://www.intel.com/content/dam/doc/manual/64-ia-32-architectures-software-developer-vol-3b-part-2-manual.pdf ). These counters are readable/writable via the readmsr/writemsr instructions, and I'm currently simply reading them at a regular interval via a device driver in Windows 7. The counters are 64 bits, and increment approximately with each processor clock, so you'd expect them to overflow in a very long amount of time, but when I read the counters, their value jumps around as if they are being reset by

Unable to disable Hardware prefetcher in Core i7

☆樱花仙子☆ 提交于 2019-12-01 18:01:06
I am getting Error while trying to disable Hardware prefetcher in my Core i7 system. I am following the method as per the link How do I programmatically disable hardware prefetching? In my system grep -i msr /boot/config-$(uname -r) CONFIG_X86_DEBUGCTLMSR=y CONFIG_X86_MSR=y CONFIG_SCSI_ARCMSR=m Here is my error message root@ ./rdmsr 0x1a0 850089 [root@ ./wrmsr -p 0 0x1a0 0x850289 (to disable hardware prefetcher in Core i7) wrmsr:pwrite: Input/output error I am getting same error for disabling Adjacent cache line prefetcher Any idea how to resolve this problem ? Thanks in advance . MSR

Using GDB to read MSRs

烂漫一生 提交于 2019-11-30 15:51:55
问题 Is there some way to read the x86-64 model-specific registers, specifically IA32_FS_BASE and IA32_GS_BASE, while debugging a program using GDB? Less preferable would be a solution using a dynamic instrumentation package like Intel's Pintool, but it would be appreciated all the same. 回答1: If you prefer not changing your code (or if the code is not available) you could do something similar to amdn's answer in the following way. The call to arch_prctl requires a pointer to a uint64_t, for which

Using GDB to read MSRs

生来就可爱ヽ(ⅴ<●) 提交于 2019-11-30 15:34:08
Is there some way to read the x86-64 model-specific registers, specifically IA32_FS_BASE and IA32_GS_BASE, while debugging a program using GDB? Less preferable would be a solution using a dynamic instrumentation package like Intel's Pintool, but it would be appreciated all the same. If you prefer not changing your code (or if the code is not available) you could do something similar to amdn's answer in the following way. The call to arch_prctl requires a pointer to a uint64_t, for which I use the address to an empty portion of the stack (8 bytes below the current stack pointer). After the call

Reading /dev/cpu/*/msr from userspace: operation not permitted

元气小坏坏 提交于 2019-11-30 14:03:53
I am trying to write a simple application that can read msr registers, and am running this application from userspace. I have loaded the msr module and given read permissions for everyone to /dev/cpu/*/msr. But still the user is not able to access these files but the root can. The permissions look like this: crw-r--r-- 1 root root 202, 0 sep 6 17:55 /dev/cpu/0/msr crw-r--r-- 1 root root 202, 1 sep 6 17:55 /dev/cpu/1/msr crw-r--r-- 1 root root 202, 2 sep 6 17:55 /dev/cpu/2/msr crw-r--r-- 1 root root 202, 3 sep 6 17:55 /dev/cpu/3/msr I keep getting "Operation not permitted" error message when I

How can the L1, L2, L3 CPU caches be turned off on modern x86/amd64 chips?

时光毁灭记忆、已成空白 提交于 2019-11-30 12:22:00
Every modern high-performance CPU of the x86/x86_64 architecture has some hierarchy of data caches: L1, L2, and sometimes L3 (and L4 in very rare cases), and data loaded from/to main RAM is cached in some of them. Sometimes the programmer may want some data to not be cached in some or all cache levels (for example, when wanting to memset 16 GB of RAM and keep some data still in the cache): there are some non-temporal (NT) instructions for this like MOVNTDQA ( https://stackoverflow.com/a/37092 http://lwn.net/Articles/255364/ ) But is there a programmatic way (for some AMD or Intel CPU families