You can enable or disable the hardware prefetchers using msr-tools
http://www.kernel.org/pub/linux/utils/cpu/msr-tools/.
The following enables the hardware prefetcher (by unsetting bit 9):
[root@... msr-tools-1.2]# ./wrmsr -p 0 0x1a0 0x60628e2089
[root@... msr-tools-1.2]# ./rdmsr 0x1a0
60628e2089
The following disables the hardware prefetcher (by enabling bit 9):
[root@... msr-tools-1.2]# ./wrmsr -p 0 0x1a0 0x60628e2289
[root@... msr-tools-1.2]# ./rdmsr 0x1a0
60628e2289
Programatically, you can do this as root by opening /dev/cpu/<cpunumber>/msr
and
using pwrite to write to the msr "file" at the 0x1a0
offset.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…