简体   繁体   English

在 Skylake 中使用 MSR 正确禁用硬件预取

[英]Correctly disable Hardware Prefetching with MSR in Skylake

I am trying to disable hardware prefetching on my machine:我正在尝试在我的机器上禁用硬件预取:

CPU family: 6 CPU系列:6

Model: 78型号:78

Model name: Intel(R) Core(TM) i5-6200U CPU @ 2.30GHz型号名称:Intel(R) Core(TM) i5-6200U CPU @ 2.30GHz

I have checked with: gcc -march=native -Q --help=target|grep march - command and it's Skylake microarchitecture.我已经检查过:gcc -march=native -Q --help=target|grep March - 命令,它是 Skylake 微架构。

I have installed msr-tools.我已经安装了 msr-tools。 grep -i msr /boot/config-$(uname -r) this gives result: CONFIG_X86_MSR=m - I am not sure it's necessary to set it Y, or how to do that. grep -i msr /boot/config-$(uname -r) 这给出了结果:CONFIG_X86_MSR=m - 我不确定是否有必要将它设置为 Y,或者如何做到这一点。 I was trying to use this posts:我试图使用这个帖子:

How do I programmatically disable hardware prefetching? 如何以编程方式禁用硬件预取?

Unable to disable Hardware prefetcher in Core i7 无法在 Core i7 中禁用硬件预取器

However I assume posts are a bit old and don't use 0x1a4 address.但是我认为帖子有点旧并且不使用 0x1a4 地址。 Also in comments it's not described how exactly to do it with this address, or whether there is no difference between modifying 0x1a4 or 0x1a0.同样在评论中,它没有描述如何使用这个地址来做它,或者修改 0x1a4 或 0x1a0 之间是否没有区别。

I have read this article: https://software.intel.com/en-us/articles/disclosure-of-hw-prefetcher-control-on-some-intel-processors which says that it's possible to disable prefetching with setting 0-3 bits to 1's in 0x1A4.我已经阅读了这篇文章: https : //software.intel.com/en-us/articles/disclosure-of-hw-prefetcher-control-on-some-intel-processors它说可以通过设置 0 禁用预取-3 位到 0x1A4 中的 1。 modprobe msr - executing this command does not give errors (does not print any message either). modprobe msr - 执行此命令不会出错(也不打印任何消息)。 then I am trying this two commands:然后我正在尝试这两个命令:

sudo wrmsr -p 0 0x1a4 15 //for core 0 sudo wrmsr -p 0 0x1a4 15 //对于核心0

sudo wrmsr -p 2 0x1a4 15 //for core 2 sudo wrmsr -p 2 0x1a4 15 //对于核心2

15 is for setting all last 4 bits to 1's 15 用于将所有最后 4 位设置为 1

Could you help me to make sure I am correctly disabling Prefetchers?你能帮我确保我正确禁用了预取器吗? As I made a lot of assumptions for sudo wrmsr -p 0 0x1a4 15 - command I am not sure I am using it correctly.由于我对 sudo wrmsr -p 0 0x1a4 15 - 命令做了很多假设,我不确定我是否正确使用它。 I tried to provide with all the information but if anything else is necessary let me know.我试图提供所有信息,但如果需要其他任何信息,请告诉我。 (I have shortened the post as I guess it was too long to go through) (我已经缩短了帖子,因为我想它太长了无法阅读)

I found that this commands are working correctly.我发现这个命令工作正常。 sudo modprobe msr - should be executed first though. sudo modprobe msr - 不过应该先执行。 The main problem was the way I was testing it with papi events主要问题是我用 papi 事件测试它的方式

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM