定制Linux Kernel
Linux 里面有一个工具,叫 Grub2,全称 Grand Unified Bootloader Version 2。顾名思义,就是搞系统启动的。
修改启动参数
|
|
GRUB 2 reads its configuration from the /boot/grub2/grub.cfg
file on traditional BIOS-based machines and from the /boot/efi/EFI/redhat/grub.cfg
file on UEFI machines. This file contains menu information.
The GRUB 2 configuration file, grub.cfg
, is generated during installation, or by invoking the /usr/sbin/grub2-mkconfig utility, and is automatically updated by grubby
each time a new kernel is installed. When regenerated manually using grub2-mkconfig, the file is generated according to the template files located in /etc/grub.d/
, and custom settings in the /etc/default/grub
file. Edits of grub.cfg
will be lost any time grub2-mkconfig is used to regenerate the file, so care must be taken to reflect any manual changes in /etc/default/grub
as well.
查看kernel编译参数
一般在 /boot/config-** 文件内放置所有内核编译参数
|
|
修改是否启用透明大页
|
|
制作启动盘
Windows 上用 UltraISO、rufus 烧制,MacOS 上就比较简单了,直接用 dd 就可以做好:
|
|
|
|
iommu passthrough
IOMMU 硬件单元
DMA Remapping Feature 的工作是通过 CPU 硬件平台的 IOMMU(I/O MMU,Input/Output Memory Management Unit,I/O 内存管理硬件单元)来完成的。IOMMU 的出现,实现了地址空间上的隔离,使设备只能访问规定的内存区域。
参考资料:https://lenovopress.lenovo.com/lp1467.pdf
|
|
说明配置了iommu=pt 的话函数iommu_no_mapping返回1,那么驱动就直接return paddr,并不会真正调用到domain_pfn_mapping,直接用了物理地址少了一次映射性能当然会高一些。如果是跑KVM建议 passthrough=0,物理机场景 passthrough=1
iommu=pt并不会影响kvm/dpdk/spdk的性能,这三者本质上都是用户态驱动,iommu=pt只会影响内核驱动,能让内核驱动设备性能更高。
定制内存
物理内存700多G,要求OS只能用512G:
|
|
高级版 按numa限制内存
每个numa 128G内存,总共1024G(32条*32G),8个numa node,需要将每个numa node内存限制在64G
在grub中cmdline中加入如下配置,每个node只用64G内存:
|
|
或者:
|
|
比如在一个4node的机器上,总共768G内存(32G*24),每个node使用64G内存
|
|
128G表示相对地址,$64G是绝对地址,128G\$64G 的意思是屏蔽64G到(64+128)G的地址对应的内存
检查
检查正在运行的系统使用的grub参数:
|
|
内存信息
|
|
内存速度对延迟的影响
左边两列是同一种机型和CPU、内存,只是最左边的开了numa,他们的内存Speed: 2400 MT/s,但是实际运行速度是2133;最右边的是另外一种CPU,内存速度更快,用mlc测试他们的延时、带宽。可以看到V52机型带宽能力提升特别大,时延变化不大
对比一下V62,intel8269 机型
|
|
BIOS定制
ipmitool
直接在linux内设置主板bios,然后重启就可以生效:
|
|
基本语法:ipmitool raw 0x3e 0x5c index 0x01 value
raw 0x3e 0x5c 固定不需要改,
Index表示需要修改的配置项, 接下来的 0x01 固定不需要改
value 表示值,0x81表示enable; 0x80表示disable