I would like to programatically disable hardware prefetching.
From Optimizing Application Performance on Intel® Core™ Microarchitecture Using Hardware-Implemented Prefetchers and How to Choose between Hardware and Software Prefetch on 32-Bit Intel® Architecture, I need to update the MSR to disable hardware prefetching.
Here is a relevant snippet:
"DPL Prefetch and L2 Streaming Prefetch settings can also be changed programmatically by writing a device driver utility for changing the bits in the
IA32_MISC_ENABLE
register –MSR 0x1A0
. Such a utility offers the ability to enable or disable prefetch mechanisms without requiring any server downtime.
The table below shows the bits in the IA32_MISC_ENABLE MSR
that have to be changed in order to control the DPL
and L2 Streaming Prefetch:
Prefetcher Type MSR (0x1A0) Bit Value
DPL (Hardware Prefetch) Bit 9 0 = Enable 1 = Disable
L2 Streamer (Adjacent Cache Line Prefetch) Bit 19 0 = Enable 1 = Disable"
I tried using http://etallen.com/msr.html but this did not work.
I also tried using wrmsr
in asm/msr.h
directly but that segfaults.
I tried doing this in a kernel module ... and killed the machine.
BTW - I am using kernel 2.6.18-92.el5 and it has MSR
linked in the kernel:
$ grep -i msr /boot/config-$(uname -r)
CONFIG_X86_MSR=y
...
Any help would be greatly appreciated.