通过uboot命令开启核隔离
拿到一个ubuntu的系统,该系统应该缺少某些编译选项,修改/etc/default/grub之后通过update-grub更新grub.cfg失败;
所有想通过uboot进行修改,修改过程记录如下:
在bootloader加载完成后的等待时间里,通过ctrl+c进入uboot命令行;
输入env print查看env:
E2000#env print
arch=arm
baudrate=9600
board=e2000
board_name=e2000
boot_os=bootm $kernel_addr -:- $ft_fdt_addr
bootcmd=run bootcmd_mmc||run bootcmd_usb||run bootcmd_tftp
bootcmd_mmc=run set_bootargs;ext4load mmc 0:1 $kernel_addr_r /Image;ext4load mmc 0:1 $fdt_addr_r /e2000-PR069MB-8GET4GEF-board.dtb;booti $kernel_addr_r - $fdt_addr_r
bootcmd_tftp=tftpboot $kernel_addr $image_name;tftpboot $fdt_addr $fdt_name;booti $kernel_addr - $fdt_addr
bootcmd_usb=usb reset;fatload usb 0 $kernel_addr $image_name;fatload usb 0 $fdt_addr $fdt_name;booti $kernel_addr - $fdt_addr
bootdate=Apr/19/2023
bootdelay=2
bootver=1.0.0.06
bsp_backboot=ext4load mmc 0:2 ${loadaddr} %s
bsp_bootCmd=booti
bsp_bootParam= -:- ${fdtcontroladdr}
bsp_bootethdev=dc0
bsp_bootlineDynamicMaxIndex=3
bsp_bootlineDynamicMinIndex=0
bsp_bootlineMaxIndex=4
bsp_bootlineMinIndex=0
bsp_dir=ext4ls mmc 0:1 %s
bsp_ethboot=tftpboot ${loadaddr} %s
bsp_fbdir=ext4ls mmc 0:2 %s
bsp_fileexist=ext4load mmc 0:1 $(loadaddr) %s 1
bsp_flashboot=fatload mmc 0:1 ${loadaddr} %s
console=ttyAMA1,9600 earlycon=pl011,0x2800d000
cpu=armv8
distro_bootcmd=run load_kernel; run load_initrd; run load_fdt; run boot_os
eth0addr=00:11:22:33:44:55
eth1addr=10:22:33:44:55:66
eth2addr=10:11:22:33:44:55
eth3addr=00:22:33:44:55:66
ethaddr=00:11:22:33:44:55
fdt_addr=0x90000000
fdt_addr_r=0x90000000
fdt_name=e2000-PR069MB-8GET4GEF-board.dtb
fdtcontroladdr=f9915500
ft_fdt_addr=0x90000000
ft_fdt_name=boot/dtb/e2000.dtb
gatewayip=202.197.67.1
image_name=Image
initrd_addr=0x95000000
ipaddr=202.197.67.2
kernel_addr=0x90100000
kernel_addr_r=0x90100000
load_fdt=ext4load scsi 0:2 $ft_fdt_addr $ft_fdt_name
load_initrd=ext4load scsi 0:2 $initrd_addr initrd.img-4.19.0.e2000
load_kernel=ext4load scsi 0:2 $kernel_addr boot/uImage-2004
loadaddr=0x90000000
netdev=eth0
netmask=255.255.255.0
serverip=202.197.67.3
set_bootargs=setenv bootargs console=$console $extra_params $cpuidle $gzFlag $bspBaseMac root=/dev/mmcblk0p2 rootfstype=ext4 ro cma=128M
stderr=uart@2800d000
stdin=uart@2800d000
stdout=uart@2800d000
vendor=phytium
通过如下命令补充isolcpus核隔离命令
setenv set_bootargs "setenv bootargs console=$console $extra_params $cpuidle $gzFlag $bspBaseMac root=/dev/mmcblk0p2 rootfstype=ext4 ro cma=128M isolcpus=1-3"
saveenv
保存后退出,重启;
进入系统后通过如下命令查看设置结果:
root@dev9130:/zz/E2000-Image-1011/boot_ko# cat /proc/cmdline
console=ttyAMA1,9600 earlycon=pl011,0x2800d000 root=/dev/mmcblk0p2 rootfstype=ext4 ro cma=128M isolcpus=1-3
root@dev9130:/zz/E2000-Image-1011/boot_ko#
有isolcpus=1-3,表明命令已配置;
root@dev9130:/zz/E2000-Image-1011/boot_ko# taskset -cp 1
pid 1's current affinity list: 0
root@dev9130:/zz/E2000-Image-1011/boot_ko#
测试亲和性,只有0核,表明配置生效。