我想改变IRQ SMP亲和力,原因如下: CPU0被eth1中断吞噬
但我不能 – 当我尝试写入/proc/irq/*/smp_affinity时,发现Input/output error 。
请向我指出有关此事的HOWTO。 ( /proc/irq/*/的正式引用也会很酷。)
血淋淋的细节:
请注意,这是基于Ubuntu的Xen XCP主机中的VM(PV domU)。
$ uname -a Linux MYHOST 2.6.38-15-virtual#59 -Ubuntu SMP Fri Apr 27 16:40:18 UTC 2012 i686 i686 i386 GNU / Linux $ lsb_release -a 没有LSB模块可用。 经销商ID:Ubuntu 说明:Ubuntu 11.04 发行date:11.04 代号:natty $ sudo cat / proc / irq / * / smp_affinity 01 01 01 01 01 80 80 80 80 80 80 40 40 40 40 40 40 20 20 20 20 20 20 10 10 10 10 10 10 08 08 08 08 08 08 04 04 04 04 04 04 02 02 02 02 02 02 01 01 01 01 01 01
更新。 错误的详细信息:
$ N = $(grep -c处理器/ proc / cpuinfo) $ echo $ N 8 $ printf%x $((2 ** N-1)) FF $ printf%x $((2 ** N-1))| sudo tee / proc / irq / * / smp_affinity fftee:/ proc / irq / 288 / smp_affinity:input/输出错误 tee:/ proc / irq / 289 / smp_affinity:input/输出错误 tee:/ proc / irq / 290 / smp_affinity:input/输出错误 tee:/ proc / irq / 291 / smp_affinity:input/输出错误 tee:/ proc / irq / 292 / smp_affinity:input/输出错误 tee:/ proc / irq / 293 / smp_affinity:input/输出错误 tee:/ proc / irq / 294 / smp_affinity:input/输出错误 tee:/ proc / irq / 295 / smp_affinity:input/输出错误 tee:/ proc / irq / 296 / smp_affinity:input/输出错误 tee:/ proc / irq / 297 / smp_affinity:input/输出错误 tee:/ proc / irq / 298 / smp_affinity:input/输出错误 tee:/ proc / irq / 299 / smp_affinity:input/输出错误 tee:/ proc / irq / 300 / smp_affinity:input/输出错误 tee:/ proc / irq / 301 / smp_affinity:input/输出错误 tee:/ proc / irq / 302 / smp_affinity:input/输出错误 tee:/ proc / irq / 303 / smp_affinity:input/输出错误 tee:/ proc / irq / 304 / smp_affinity:input/输出错误 tee:/ proc / irq / 305 / smp_affinity:input/输出错误 tee:/ proc / irq / 306 / smp_affinity:input/输出错误 tee:/ proc / irq / 307 / smp_affinity:input/输出错误 tee:/ proc / irq / 308 / smp_affinity:input/输出错误 tee:/ proc / irq / 309 / smp_affinity:input/输出错误 tee:/ proc / irq / 310 / smp_affinity:input/输出错误 tee:/ proc / irq / 311 / smp_affinity:input/输出错误 tee:/ proc / irq / 312 / smp_affinity:input/输出错误 tee:/ proc / irq / 313 / smp_affinity:input/输出错误 tee:/ proc / irq / 314 / smp_affinity:input/输出错误 tee:/ proc / irq / 315 / smp_affinity:input/输出错误 tee:/ proc / irq / 316 / smp_affinity:input/输出错误 tee:/ proc / irq / 317 / smp_affinity:input/输出错误 tee:/ proc / irq / 318 / smp_affinity:input/输出错误 tee:/ proc / irq / 319 / smp_affinity:input/输出错误 tee:/ proc / irq / 320 / smp_affinity:input/输出错误 tee:/ proc / irq / 321 / smp_affinity:input/输出错误 tee:/ proc / irq / 322 / smp_affinity:input/输出错误 tee:/ proc / irq / 323 / smp_affinity:input/输出错误 tee:/ proc / irq / 324 / smp_affinity:input/输出错误 tee:/ proc / irq / 325 / smp_affinity:input/输出错误 tee:/ proc / irq / 326 / smp_affinity:input/输出错误 tee:/ proc / irq / 327 / smp_affinity:input/输出错误 tee:/ proc / irq / 328 / smp_affinity:input/输出错误 tee:/ proc / irq / 329 / smp_affinity:input/输出错误 tee:/ proc / irq / 330 / smp_affinity:input/输出错误 tee:/ proc / irq / 331 / smp_affinity:input/输出错误 tee:/ proc / irq / 332 / smp_affinity:input/输出错误 tee:/ proc / irq / 333 / smp_affinity:input/输出错误 tee:/ proc / irq / 334 / smp_affinity:input/输出错误 tee:/ proc / irq / 335 / smp_affinity:input/输出错误
更新。 irqbalance正在运行:
$ sudo服务irqbalance状态 irqbalance开始/运行,过程560
我不认为把中断移到不同的CPU上 – 特别是处理networking事件 – 会提高性能。
相反会发生,因为networking代码不能再保存在特定的CPU中。
所以只要你的networking接口没有丢包,我就会说 – 这对于服务很多数据包的networking来说是非常正常的行为。
你需要降低中断次数 – 移动它们不会有帮助(相反,正如我试图概述的那样)。
我看到两个可能的解决scheme
更新 2012年12月17日:由于您要求权威链接 – 我试图问一个普遍的问题何时不使用虚拟化 – 我认为这是其中一个情况,你在一般的VM限制。 其中一个问题的答案包含一个不同的方法:使用容器,而不是虚拟化。
我希望这有帮助…
在Linux源代码中有一个名为Documentation/IRQ-affinity.txt的文件。
/proc/irq/IRQ#/smp_affinity specifies which target CPUs are permitted for a given IRQ source. It's a bitmask of allowed CPUs. It's not allowed to turn off all CPUs, and if an IRQ controller does not support IRQ affinity then the value will not change from the default 0xffffffff.
这里的问题是位掩码是hex的。 所以,如果你有N个CPU,
N=$(grep -c processor /proc/cpuinfo)
为所有CPU启用所有IRQ,您可以使用N个CPU
printf %x $((2**N-1)) | sudo tee /proc/irq/*/smp_affinity
内核3.0和更高版本有一个名为smp_affinity_list的文件。 该文件采用逗号分隔的CPU或CPU范围列表。 有效的例子: 2,3,5-7 。 以前的命令相当于:
echo 0-$((N-1)) | sudo tee /proc/irq/*/smp_affinity_list
但是我想看看为什么亲和configuration不起作用的权威答案。 我担心,每个人似乎都认为这是可能的,但我不能那样做。
只是在这个特定的问题上 – 我不知道Xen是否影响到这个答案 – 当没有设备驱动程序当前为此中断安装处理程序时,会得到Input/output error消息。
例如,如果驱动程序在“105”上安装了一个处理程序,则会创build目录/proc/irq/105 ,并包含一个smp_affinity等等。 您现在可以写入smp_affinity 。 如果closures设备,该目录将保留,并带有smp_affinity ,但不能再写入。 打开设备(通过open ,或者最终调用驱动程序中的request_irq ),现在可以写入文件。 仅在RHEL / SL 6上进行testing。
如果您不知道设备当前是否打开,请检查目录。 它将包含设备名称,如果它是打开的。