Processors
Intel® Processors, Tools, and Utilities
14534 Discussions

Trying to calculate true frequency - segfault with rdmsr

idata
Employee
1,558 Views

Hello everyone,

I'm trying to make a small command line tool that displays the actual frequency (especially when Turbo is on) according to the Frequency Algorithm outlined in point 2.2 in the intel whitepaper http://download.intel.com/design/processor/applnots/320354.pdf http://download.intel.com/design/processor/applnots/320354.pdf. However, I'm stuck at the very first step, that is reading the MSR with ECX=0xCE - the following code snippet simply segfaults:

unsigned low, high;

asm volatile ("rdsm" : "=a" (low), "=d" (high) : "c" (0xce));

Any ideas why?

/proc/cpuinfo says that msr flag is present, the processor is an Intel Xeon X5550

0 Kudos
1 Reply
idata
Employee
547 Views

I think I've found an answer - it looks like the rdmsr instruction requires kernel mode, user space just doesn't cut it. Which is why the msr module must be used to read the MSR.

Reply