PVE 设置PCIe CPU亲和力,将PCIe设备固定到某些核心,使虚拟机性能更好。主要是通过IRQ的CPU亲和力设置。
首先找到你的PCIe设备号如,01:00
查看PCIe的IRQ号
cat /proc/interrupts |grep "01:00\|CPU"
root@pve1:/proc/irq/166# cat /proc/interrupts |grep "01:00\|CPU"
CPU0 CPU1 CPU2 CPU3 CPU4 CPU5 CPU6 CPU7
166: 1221 0 39150443 115 35583 0 748 63430 IR-PCI-MSI 524288-edge vfio-msix[
root@pve1:/proc/irq/166#
这个166就是irq号
将166绑定到cpu 5-6去
echo 5-6 > /proc/irq/166/smp_affinity_list
这样,再查看中断,会发现CPU5-6有明显的中断数。
root@pve1:/proc/irq/166# cat /proc/interrupts |grep "01:00\|CPU"
CPU0 CPU1 CPU2 CPU3 CPU4 CPU5 CPU6 CPU7
166: 1221 0 39150443 115 35583 296 748 64237 IR-PCI-MSI 524288-edge vfio-msix[0](0000:01:00.0)
在PVE上实现,可以参考pve-helpers