首页 > 常见问题 > 常见案例说明 > 服务器产品 > 操作系统

Linux OS下启用IOMMU功能后,导致设备通信性能下降甚至宕机

浏览:265
2025-04-16
目录

Linux OS下启用IOMMU功能后,导致设备通信性能下降甚至宕机

问题描述

Linux OS下启用IOMMU功能后,OS下会联动打开ACS功能,导致设备通信性能下降甚至宕机

说明:

ACSAccess Control Services)访问控制服务:用于控制PCIe数据流向,ACS可以将peer-to-peer转发的功能关闭,强制将其下所有设备通信转发到RootComplex,导致设备间通信带宽降低。且在CPU端没有正确配置的情况下启用ACS会中断GPU Direct

涉及范围

AMD平台带有Switch芯片的GPU机型

处理方案

1.Linux OS grub中配置amd_iommu=oniommu=pt

CentOS linux下的配置示例:

编辑grub文件,在GRUB_CMDLINE_LINUX选项下添加 amd_iommu=on iommu=pt

示例:

#vim /etc/default/grub

GRUB_TIMEOUT=5

GRUB_DISTRIBUTOR="$(sed 's, release .*$,,g' /etc/system-release)"

GRUB_DEFAULT=saved

GRUB_DISABLE_SUBMENU=true

GRUB_TERMINAL_OUTPUT="console"

GRUB_CMDLINE_LINUX="amd_iommu=on iommu=pt"

GRUB_DISABLE_RECOVERY="true"

GRUB_ENABLE_BLSCFG=true

执行命令生成新的grub.cfg文件

# Legacy引导模式执行:

grub2-mkconfig -o /boot/grub2/grub.cfg

 

# UEFI引导模式执行:

grub2-mkconfig -o /boot/efi/EFI/centos/grub.cfg

 

重启OS后检查IOMMU是否开启成功。

有输出则表示IOMMU开启成功;无输出则表示IOMMU功能未开启。

# 重启OS

reboot

# 匹配IOMMU关键字

dmesg|grep -i IOMMU

#开启成功示例:

[    1.589058] pci 0000:66:00.2: AMD-Vi: IOMMU performance counters supported

[    1.589085] pci 0000:3b:00.2: AMD-Vi: IOMMU performance counters supported

[    1.589102] pci 0000:2a:00.2: AMD-Vi: IOMMU performance counters supported

[    1.589115] pci 0000:00:00.2: AMD-Vi: IOMMU performance counters supported

[    1.589144] pci 0000:f0:00.2: AMD-Vi: IOMMU performance counters supported

[    1.589169] pci 0000:c6:00.2: AMD-Vi: IOMMU performance counters supported

[    1.589192] pci 0000:ad:00.2: AMD-Vi: IOMMU performance counters supported

[    1.589211] pci 0000:7a:00.2: AMD-Vi: IOMMU performance counters supported

[    1.880060] pci 0000:66:00.2: AMD-Vi: Found IOMMU cap 0x40

[    1.880079] pci 0000:3b:00.2: AMD-Vi: Found IOMMU cap 0x40

[    1.880086] pci 0000:2a:00.2: AMD-Vi: Found IOMMU cap 0x40

[    1.880091] pci 0000:00:00.2: AMD-Vi: Found IOMMU cap 0x40

[    1.880096] pci 0000:f0:00.2: AMD-Vi: Found IOMMU cap 0x40

[    1.880101] pci 0000:c6:00.2: AMD-Vi: Found IOMMU cap 0x40

[    1.880106] pci 0000:ad:00.2: AMD-Vi: Found IOMMU cap 0x40

[    1.880111] pci 0000:7a:00.2: AMD-Vi: Found IOMMU cap 0x40

[    1.888800] perf/amd_iommu: Detected AMD IOMMU #0 (2 banks, 4 counters/bank).

[    1.888866] perf/amd_iommu: Detected AMD IOMMU #1 (2 banks, 4 counters/bank).

[    1.888905] perf/amd_iommu: Detected AMD IOMMU #2 (2 banks, 4 counters/bank).

[    1.888948] perf/amd_iommu: Detected AMD IOMMU #3 (2 banks, 4 counters/bank).

[    1.888993] perf/amd_iommu: Detected AMD IOMMU #4 (2 banks, 4 counters/bank).

[    1.889046] perf/amd_iommu: Detected AMD IOMMU #5 (2 banks, 4 counters/bank).

[    1.889091] perf/amd_iommu: Detected AMD IOMMU #6 (2 banks, 4 counters/bank).

[    1.889129] perf/amd_iommu: Detected AMD IOMMU #7 (2 banks, 4 counters/bank).

2.Linux OS下运行脚本,关闭ACS功能,并将该脚本添加至Linux 开机自启动。

1OS下手动执行脚本,关闭ACS功能。

附:执行脚本

ACS_Disable.zip



sh ACS_Disable.sh

2)完成开机自启动配置

vim /etc/rc.d/rc.local

# 在文件中添加一行, /file_path/ 替换为OS下脚本的绝对路径

bash /file_path/ACS_Disable.sh

# 赋予文件可执行权限

chmod +x /etc/rc.d/rc.local

 

# 若无/etc/rc.d/rc.local,也可编辑/etc/rc.local文件

vim /etc/rc.local

# 在文件中添加一行, /file_path/ 替换为OS下脚本的绝对路径

bash /file_path/ACS_Disable.sh

# 赋予文件可执行权限

chmod +x /etc/rc.local

完成配置后,建议重启OS 验证开机自启动配置是否生效。

 

故障根因

ACSAccess Control Services)访问控制服务:用于控制PCIe数据流向,ACS可以将peer-to-peer转发的功能关闭,强制将其下所有设备通信转发到RootComplex,导致设备间通信带宽降低。且在CPU端没有正确配置的情况下启用ACS会中断GPU Direct

建议与总结

Linux OS grub中配置amd_iommu=oniommu=pt。运行脚本,关闭ACS功能,并将该脚本添加至Linux 开机自启动。

 

 

 

 

 

 

 


*免责声明:本案例只提供参考,不提供专业意见。

售前咨询

售后服务

反馈意见

AIStore

回到顶部

回到顶部

收起
回到顶部 回到顶部
请选择服务项目
售前咨询
售后服务
访问 AIStore

扫码访问AIStore