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

Vid and Fid control, from Core 2 to Haswell

benoit_leveugle
Beginner
1,248 Views

Hi,

Im a currently working on a way to reduce power consumption and related heat dissipation. A good way on Core 2 CPUs was to play with Fid and Vid.

On linux, I load the msr module from the kernel : modprobe msr

And then I can affect Vid and Fid. On my Core 2 E8500, I was able to reduce power consuption by 15% without an impact on performances, by undervolting cpu for max frequency using for example :

wrmsr -p 0 0x199 0x0223

And applying this value every 0.1s.

etc.

I am looking for a way to do the same on Nehalem/Westmer, Sandy Bridge/IvyBridge, and Haswell. However, I do not find any documentation to know if it's still possible on the Intel Xeon series (I am using an E5520 for testing), and what are the msr addresses to be used to know defaults Fid/Vid and to change on the fly currently used Fid/Vid.

Is there a specific PDF or web page that regroups these informations ?

With My best regards.

0 Kudos
4 Replies
Patrick_F_Intel1
Employee
1,248 Views

Hello benoit,

The MSR addresses haven't changed. You can look in the SDM vol 3 (Intel® 64 and IA-32 Architectures Software Developer’s Manual Volume (3A, 3B & 3C) System Programming Guide). In the june 2013 version, the MSRs are defined in chapter 35. The architectural MSRs (MSRs defined as "we going to support this MSR from chip x going forward") are defined in table 35-2. You'll see IA32_PERF_STATUS (MSR 0x198) and IA32_PERF_CTL (MSR 0x199).

The low 2 bytes control the FID and VID but Intel has not made public the fields within the 2 bytes. You can pretty much figure them out by just inspecting IA32_PERF_STATUS but I think the fields somewhat between processors.

Rather than reinvent the wheel, have you considered using the builtin linux power management facilities? Unless you are willing to dedicate your life to your utility, the builtin and/or available utilities (such as https://wiki.debian.org/HowTo/CpuFrequencyScaling) will probably have many more features and already handle the many variations of a chip. And in any case, you can look at the source code of these utitlies and see how they do their work.

Pat

0 Kudos
benoit_leveugle
Beginner
1,248 Views

Hello Patrick,

Thank you for these informations. In fact, I am aware of the cpufreq tool. I already use it to limit frequency when useful (laptop especially). However, I observed that most CPU are using more energy than needed. For example, when using my Core 2, when calculating at full frequency, I can reduce the CPU voltage from 1.25v to 1.0v with same performances and stability, but using less energy (tested with a Watt meter) and reducing CPU temperature (I get more than 10°C less !).

The cpufreq tool is only dedicated to frequency scaling and do not play with voltages if I read right.

So, I can re-use the same MSR to override CPU VID and FID. I will try it and keep you in touch.

Ben

0 Kudos
benoit_leveugle
Beginner
1,248 Views

I have strange results on the Nehalem.

On the Core 2, I used the batch script :

for MSR in 198 199 1A0; do for CPU in `sed -rn 's@^processor[\t]: ([0-9]+)$@\1@p' /proc/cpuinfo`; do echo -n "CPU${CPU} ${MSR}: "; sudo rdmsr -0 -X -p ${CPU} 0x${MSR}; done; done

I obtained :

CPU0 198: 0616492606000616
CPU1 198: 0616492606004926
CPU0 199: 0000000000000616
CPU1 199: 0000000000004926
CPU0 1A0: 0000004062972089
CPU1 1A0: 0000004062972089

Which is all I need. On the Nehalem I got :

CPU0 198: 0000000000000010
CPU1 198: 000000000000000C
CPU2 198: 000000000000000C
CPU3 198: 000000000000000C
CPU4 198: 0000000000000012
CPU5 198: 000000000000000C
CPU6 198: 000000000000000C
CPU7 198: 000000000000000C
CPU0 199: 000000000000000C
CPU1 199: 000000000000000C
CPU2 199: 000000000000000C
CPU3 199: 000000000000000C
CPU4 199: 000000000000000C
CPU5 199: 000000000000000C
CPU6 199: 000000000000000C
CPU7 199: 000000000000000C
CPU0 1A0: 0000000000850089
CPU1 1A0: 0000000000850089
CPU2 1A0: 0000000000850089
CPU3 1A0: 0000000000850089
CPU4 1A0: 0000000000850089
CPU5 1A0: 0000000000850089
CPU6 1A0: 0000000000850089
CPU7 1A0: 0000000000850089

Few informations, but not that much. To be honest I still have not read the documentation your provided, and I now switch on this task. Do you have any idea why I got so few informations ?

0 Kudos
Patrick_F_Intel1
Employee
1,248 Views

Hello Benoit, Sorry, I don't have the time to debug your code.. Like I said, the folks writing cpufreq have probably spent many man-years on the code. Maybe someone else has the time. Pat

0 Kudos
Reply