IOMMU打开 关闭
目录
1. 背景介绍
2. Arm iommu 打开
2.1 打开 iommu
2.2 生成配置
2.3 查看配置是否生效
3. X86 iommu 打开
3.1 打开 iommu
3.2 生成配置
3.3 查看配置是否生效
1. 背景介绍
打开关闭iommu
2. Arm iommu 打开
2.1 打开 iommu
开启/关闭iommu1、ARM服务器上开启IOMMU# 修改GRUB配置文件(通常在/etc/default/grub) 文件中“GRUB_CMDLINE_LINUX”对应行,添加“iommu.passthrough=0 iommu=on"[root@localhost ~]#
[root@localhost ~]# cat /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="crashkernel=1024M,high rd.lvm.lv=klas/root rd.lvm.lv=klas/swap video=VGA-1:640x480-32@60me rhgb quiet smmu.bypassdev=0x1000:0x17 smmu.bypassdev=0x1000:0x15 video=efifb:off video=VGA-1:640x480-32@60me iommu=pt isolcpus=1,3 nohz_full=1,3 rcu_nocbs=1,3 idle=poll default_hugepagesz=2M hugepagesz=2M hugepages=1024"
GRUB_DISABLE_RECOVERY="true"
[root@localhost ~]#
[root@localhost ~]#
[root@localhost ~]# cat /proc/cmdline
BOOT_IMAGE=/vmlinuz-4.19.90-23.8.v2101.ky10.aarch64 root=/dev/mapper/klas-root ro crashkernel=1024M,high rd.lvm.lv=klas/root rd.lvm.lv=klas/swap video=VGA-1:640x480-32@60me rhgb quiet smmu.bypassdev=0x1000:0x17 smmu.bypassdev=0x1000:0x15 video=efifb:off video=VGA-1:640x480-32@60me iommu=pt isolcpus=1,3 nohz_full=1,3 rcu_nocbs=1,3 idle=poll default_hugepagesz=2M hugepagesz=2M hugepages=1024
[root@localhost ~]#
[root@localhost ~]#
[root@localhost ~]#
[root@localhost ~]#
[root@localhost ~]# vi /etc/default/grub
[root@localhost ~]#
[root@localhost ~]#
[root@localhost ~]#
[root@localhost ~]# cat /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="crashkernel=1024M,high rd.lvm.lv=klas/root rd.lvm.lv=klas/swap video=VGA-1:640x480-32@60me rhgb quiet smmu.bypassdev=0x1000:0x17 smmu.bypassdev=0x1000:0x15 video=efifb:off video=VGA-1:640x480-32@60me iommu=pt isolcpus=1,3 nohz_full=1,3 rcu_nocbs=1,3 idle=poll default_hugepagesz=2M hugepagesz=2M hugepages=1024 iommu.passthrough=0 iommu=on"
GRUB_DISABLE_RECOVERY="true"
[root@localhost ~]#
2.2 生成配置
注意“grub.cfg”所在目录在不同版本系统中会有所不同
执行“grub2-mkconfig -o /boot/efi/EFI/centos/grub.cfg” 生成配置,然后重启系统注意“grub.cfg”所在目录在不同版本系统中会有所不同,[root@localhost ~]#
[root@localhost ~]#
[root@localhost ~]# ls /boot/grub*/grub.cfg 2>/dev/null || ls /boot/efi/EFI/*/grub.cfg 2>/dev/null
/boot/efi/EFI/kylin/grub.cfg # 如果回显是/boot/grub2/grub.cfg,下面命令同步修改
[root@localhost ~]#
[root@localhost ~]#
[root@localhost ~]# grub2-mkconfig -o /boot/efi/EFI/kylin/grub.cfg
Generating grub configuration file ...
Found linux image: /boot/vmlinuz-4.19.90-23.8.v2101.ky10.aarch64
Found initrd image: /boot/initramfs-4.19.90-23.8.v2101.ky10.aarch64.img
Found linux image: /boot/vmlinuz-0-rescue-375913e1d4ba4c028b029fe067c61af0
Found initrd image: /boot/initramfs-0-rescue-375913e1d4ba4c028b029fe067c61af0.img
Found Kylin V10 (V10) on /dev/mapper/klas00-root
Adding boot menu entry for EFI firmware configuration
done
[root@localhost ~]#
[root@localhost ~]#
[root@localhost ~]# reboot
重启后,继续检查
2.3 查看配置是否生效
执行“cat /proc/cmdline”,查看配置是否生效# cat /proc/cmdline[root@localhost ~]#
[root@localhost ~]# cat /proc/cmdline
BOOT_IMAGE=/vmlinuz-4.19.90-23.8.v2101.ky10.aarch64 root=/dev/mapper/klas-root ro crashkernel=1024M,high rd.lvm.lv=klas/root rd.lvm.lv=klas/swap video=VGA-1:640x480-32@60me rhgb quiet smmu.bypassdev=0x1000:0x17 smmu.bypassdev=0x1000:0x15 video=efifb:off video=VGA-1:640x480-32@60me iommu=pt isolcpus=1,3 nohz_full=1,3 rcu_nocbs=1,3 idle=poll default_hugepagesz=2M hugepagesz=2M hugepages=1024 iommu.passthrough=0 iommu=on
[root@localhost ~]#
3. X86 iommu 打开
3.1 打开 iommu
1. 查询cpu 型号:[root@localhost ~]#
[root@localhost ~]# lscpu
Architecture: x86_64
CPU op-mode(s): 32-bit, 64-bit
Byte Order: Little Endian
CPU(s): 40
On-line CPU(s) list: 0-39
Thread(s) per core: 2
Core(s) per socket: 10
座: 2
NUMA 节点: 2
厂商 ID: GenuineIntel
CPU 系列: 6
型号: 85
型号名称: Intel(R) Xeon(R) Silver 4210R CPU @ 2.40GHz # cpu Inter
.......
.......
....... 2. 根据cpu 型号添加 字段
# CPU inter: inter_iommu=on
# CPU AMD: amd_iommu=on[root@localhost ~]#
[root@localhost ~]#
[root@localhost ~]# vi /etc/default/grub
[root@localhost ~]#
[root@localhost ~]# cat /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="crashkernel=auto rd.lvm.lv=centos/root rd.lvm.lv=centos/swap rhgb quiet isolcpus=1-3 default_hugepagesz=2M hugepagesz=2M hugepages=1024 inter_iommu=on"
GRUB_DISABLE_RECOVERY="true"
intel_iommu=on
[root@localhost ~]#
[root@localhost ~]#
[root@localhost ~]#
3.2 生成配置
3. 生成配置,然后重启系统注意“grub.cfg”所在目录在不同版本系统中会有所不同,[root@localhost ~]#
[root@localhost ~]# ls /boot/grub*/grub.cfg 2>/dev/null
/boot/grub2/grub.cfg
[root@localhost ~]#
[root@localhost ~]#
[root@localhost ~]# ls /boot/efi/EFI/*/grub.cfg 2>/dev/null
/boot/efi/EFI/centos/grub.cfg
[root@localhost ~]#
[root@localhost ~]#
[root@localhost ~]# # X86 Centos 上以下2个路径都需要执行:
Path_1: grub2-mkconfig -o /boot/grub2/grub.cfg
Path_2:grub2-mkconfig -o /boot/efi/EFI/centos/grub.cfg[root@localhost ~]#
[root@localhost ~]#
[root@localhost ~]#
[root@localhost ~]# grub2-mkconfig -o /boot/grub2/grub.cfg
Generating grub configuration file ...
Found linux image: /boot/vmlinuz-3.10.0-1160.62.1.el7.x86_64
Found initrd image: /boot/initramfs-3.10.0-1160.62.1.el7.x86_64.img
Found linux image: /boot/vmlinuz-3.10.0-1160.36.2.el7.x86_64
Found initrd image: /boot/initramfs-3.10.0-1160.36.2.el7.x86_64.img
Found linux image: /boot/vmlinuz-3.10.0-957.el7.x86_64
Found initrd image: /boot/initramfs-3.10.0-957.el7.x86_64.img
Found linux image: /boot/vmlinuz-0-rescue-52d1fe1020fe44b2a095ce3f94ace989
Found initrd image: /boot/initramfs-0-rescue-52d1fe1020fe44b2a095ce3f94ace989.img
done
[root@localhost ~]#
[root@localhost ~]#
[root@localhost ~]#
[root@localhost ~]#
[root@localhost ~]#
[root@localhost ~]#
[root@localhost ~]# grub2-mkconfig -o /boot/efi/EFI/centos/grub.cfg
Generating grub configuration file ...
Found linux image: /boot/vmlinuz-3.10.0-1160.62.1.el7.x86_64
Found initrd image: /boot/initramfs-3.10.0-1160.62.1.el7.x86_64.img
Found linux image: /boot/vmlinuz-3.10.0-1160.36.2.el7.x86_64
Found initrd image: /boot/initramfs-3.10.0-1160.36.2.el7.x86_64.img
Found linux image: /boot/vmlinuz-3.10.0-957.el7.x86_64
Found initrd image: /boot/initramfs-3.10.0-957.el7.x86_64.img
Found linux image: /boot/vmlinuz-0-rescue-52d1fe1020fe44b2a095ce3f94ace989
Found initrd image: /boot/initramfs-0-rescue-52d1fe1020fe44b2a095ce3f94ace989.img
done
[root@localhost ~]#
[root@localhost ~]#
[root@localhost ~]#
[root@localhost ~]# cat /proc/cmdline
BOOT_IMAGE=/vmlinuz-3.10.0-1160.62.1.el7.x86_64 root=/dev/mapper/centos-root ro crashkernel=auto rd.lvm.lv=centos/root rd.lvm.lv=centos/swap rhgb quiet isolcpus=1-3 default_hugepagesz=512M hugepagesz=512M hugepages=6
[root@localhost ~]#
[root@localhost ~]#
[root@localhost ~]#
[root@localhost ~]# reboot
重启后,继续检查
3.3 查看配置是否生效
[root@localhost ~]#
[root@localhost ~]#
[root@localhost ~]# cat /proc/cmdline
BOOT_IMAGE=/vmlinuz-3.10.0-1160.62.1.el7.x86_64 root=/dev/mapper/centos-root ro crashkernel=auto rd.lvm.lv=centos/root rd.lvm.lv=centos/swap rhgb quiet isolcpus=1-3 default_hugepagesz=2M hugepagesz=2M hugepages=1024 inter_iommu=on
[root@localhost ~]#