This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

[参考译文] AM6442:[Yocto]隔离 CPU

Guru**** 2539500 points


请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

https://e2e.ti.com/support/processors-group/processors/f/processors-forum/1163933/am6442-yocto-isolate-cpu

器件型号:AM6442

你好

我尝试通过 isolcpus=1内核参数将 CPU 1与调度程序隔离。  我已经尝试了几种方法:通过 Yocto append 变量、通过 wks 文件中的--apend 参数、通过 devicetree 或 uEnv U-Boot 脚本、但这些方法都不起作用。 在 /proc/cmdline 中、我看不到 isolcpus = 1标志设置、htop 还显示 CPU1已调度任务。 我将内核5.10与 preemp_RT 补丁一同使用。 为什么这不起作用?

下面是配置片段。

CONFIG_CMDLINE="console=ttyS2,115200n8 earlycon=ns16550a,mmio32,0x02800000 isolcpus=1"
CONFIG_CMDLINE_EXTEND=y
CONFIG_CMDLINE_FORCE=y
CONFIG_CPU_ISOLATION=y

uEnv.txt 文件:

bootargs=${bootargs}; isolcpus=1
name_overlays=tpm-slb9670-overlay.dtbo spidev-overlay.dtbo gpios-hardware-test-overlay.dtbo
uenvcmd=run init_${boot}; run get_kern_${boot}; run get_fdt_${boot};run get_overlay_mmc; run run_kern

.wks:

bootloader --append="rootfstype=ext4 isolcpus=1"
part /boot --source bootimg-efi --sourceparams="loader=grub-efi" --fstype=vfat --label boot --active --align 1024 --use-uuid --fixed-size 192M
part / --source rootfs --fstype=ext4 --label root --align 1024 --use-uuid

无论我设置什么、cmdline 始终如下所示:

console=ttyS2,115200n8 earlycon=ns16550a,mmio32,0x02800000 mtdparts=fc40000.spi.0:1m(ospi.tiboot3),2m(ospi.tispl),4m(ospi.u-boot),256k(ospi.env),256k(ospi.env.backup),57088k@8m(ospi.rootfs),256k(ospi.phypattern);omap2-nand.0:2m(NAND.tiboot3),2m(NAND.tispl),2m(NAND.tiboot3.backup),4m(NAND.u-boot),256k(NAND.u-boot-env),256k(NAND.u-boot-env.backup),-(NAND.file-system) root=PARTUUID=05bf03dd-02 rw rootfstype=ext4 rootwait

这些参数是否在 meta-ti 中的某个位置配置并覆盖我的设置?

BR、

Jakub

  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

    您好、Jakub、

    我在您的 wks 脚本中看到 EFI,您是否正在使用 Kirkston/上游? 请注意、此时不建议使用这些分支。 我强烈建议坚持使用基于"设计"的 AM64 SDK v8.04分支。

    Unknown 说:
    这些参数是否在 meta-ti 中的某个位置配置并覆盖我的设置?

    要自定义内核命令行、此方法应该起作用: https://docs.yoctoproject.org/dev/kernel-dev/faq.html#how-do-i-change-the-linux-kernel-command-line 、但您似乎无法使其实际执行任务。 如果您仔细查看 Yocto 源、您将看到 Yocto 会用它自己创建的内容顽固地替换 CONFIG_CMDLINE。 让我更深入地了解一下这个、然后返回。

    此致、Andreas

  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

    您好、Jakub、

    我已经深入探讨了这一点、是的、您确实需要更改 U-Boot 中的 bootargs、正如在 TI 设置中、这些 bootargs 将取代您可以在 DTS 或 Yocto 中配置的所有内容。

    为此、我尚未尝试您所做的特定配置更改、但 bootargs=${bootargs};isolcpus=1看起来不正确。 如果您希望进行 该分配、如 bootargs="${bootargs}isolcpus=1"(不带分号)以附加另一个参数。

    不管怎样、我成功尝试了以下 Yocto 更改为 meta-ti... 它向命令行添加了一个虚拟"testing=123"参数。 我将其命名为这样、以便在整个系统中轻松跟踪、并且不会导致任何行为变化。

    $ git diff --cached
    diff --git a/recipes-bsp/u-boot/files/0001-configs-am64x_evm-Add-test-string-to-kernel-command-.patch b/recipes-bsp/u-boot/files/0001-configs-am64x_evm-Add-test-string-to-kernel-command-.patch
    new file mode 100644
    index 00000000..5525abd5
    --- /dev/null
    +++ b/recipes-bsp/u-boot/files/0001-configs-am64x_evm-Add-test-string-to-kernel-command-.patch
    @@ -0,0 +1,28 @@
    +From 02abc90ad082ee52ee2ad2347a649fa61d591bfc Mon Sep 17 00:00:00 2001
    +From: Andreas Dannenberg <dannenberg@ti.com>
    +Date: Fri, 21 Oct 2022 12:42:19 -0500
    +Subject: [PATCH] configs: am64x_evm: Add test string to kernel command line
    +
    +This is for testing of how to modify/update the kernel command line
    +parameters used during Linux boot.
    +
    +Signed-off-by: Andreas Dannenberg <dannenberg@ti.com>
    +---
    + include/configs/am64x_evm.h | 1 +
    + 1 file changed, 1 insertion(+)
    +
    +diff --git a/include/configs/am64x_evm.h b/include/configs/am64x_evm.h
    +index 33ba5da31f..ab648e30eb 100644
    +--- a/include/configs/am64x_evm.h
    ++++ b/include/configs/am64x_evm.h
    +@@ -114,6 +114,7 @@
    +                       "echo WARNING: Could not determine device tree to use; fi; \0" \
    +       "name_kern=Image\0"                                             \
    +       "console=ttyS2,115200n8\0"                                      \
    ++      "optargs=testing=123\0"                                         \
    +       "args_all=setenv optargs ${optargs} "                           \
    +               "earlycon=ns16550a,mmio32,0x02800000 ${mtdparts}\0"     \
    +       "run_kern=booti ${loadaddr} ${rd_spec} ${fdtaddr}\0"
    +--
    +2.34.1
    +
    diff --git a/recipes-bsp/u-boot/u-boot-ti-staging_2021.01.bb b/recipes-bsp/u-boot/u-boot-ti-staging_2021.01.bb
    index 04e823e5..e385c723 100644
    --- a/recipes-bsp/u-boot/u-boot-ti-staging_2021.01.bb
    +++ b/recipes-bsp/u-boot/u-boot-ti-staging_2021.01.bb
    @@ -7,3 +7,5 @@ PR = "r33"
     BRANCH = "ti-u-boot-2021.01"
    
     SRCREV = "2dd2e1d366acf7f41bbd8f2d1dbe6cf5e1bcbad6"
    +
    +SRC_URI += "file://0001-configs-am64x_evm-Add-test-string-to-kernel-command-.patch"
    

    这样、虚拟参数就会正确地传播到内核命令行中、如下面的内核日志提取和/proc/cmdline 的内容所示

    [    0.000000] CPU features: detected: ARM erratum 845719
    [    0.000000] CPU features: detected: GIC system register CPU interface
    [    0.000000] Built 1 zonelists, mobility grouping on.  Total pages: 516096
    [    0.000000] Kernel command line: console=ttyS2,115200n8 testing=123 earlycon=ns16550a,mmio32,0x02800000 mtdparts=fc40000.spi.0:1m(ospi.tiboot3),2m(ospi.tispl),4m(ospi.u-boot),256k(ospi.env),256k(ospi.env.backup),57088k@8m(ospi.rootfs),256k(ospi.phypattern);omap2-nand.0:2m(NAND.tiboot3),2m(NAND.tispl),2m(NAND.tiboot3.backup),4m(NAND.u-boot),256k(NAND.u-boot-env),256k(NAND.u-boot-env.backup),-(NAND.file-system) root=PARTUUID=c061342c-02 rw rootfstype=ext4 rootwait
    [    0.000000] Dentry cache hash table entries: 262144 (order: 9, 2097152 bytes, linear)
    [    0.000000] Inode-cache hash table entries: 131072 (order: 8, 1048576 bytes, linear)
    
    <snip>
    
    root@am64xx-evm:~# cat /proc/cmdline 
    console=ttyS2,115200n8 testing=123 earlycon=ns16550a,mmio32,0x02800000 mtdparts=fc40000.spi.0:1m(ospi.tiboot3),2m(ospi.tispl),4m(ospi.u-boot),256k(ospi.env),256k(ospi.env.backup),57088k@8m(ospi.rootfs),256k(ospi.phypattern);omap2-nand.0:2m(NAND.tiboot3),2m(NAND.tispl),2m(NAND.tiboot3.backup),4m(NAND.u-boot),256k(NAND.u-boot-env),256k(NAND.u-boot-env.backup),-(NAND.file-system) root=PARTUUID=c061342c-02 rw rootfstype=ext4 rootwait
    root@am64xx-evm:~# 

    此致、Andreas

  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

    感谢你的帮助。 通过您的提示、我解决了我的问题。 但我想知道为什么这些内核参数在 U-Boot 源代码中进行硬编码。 为什么不使用设备树?

  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

    您好、Jakub、

    这就是 U-Boot 在 ARM 上执行 Linux 引导的方式。 它用"bootargs" ENV 变量中的任何内容替换在"/sched"下 DTS 中定义的"bootargs"。 它应该提供一种更易于定制的方法、因为 U-Boot 环境可以轻松地更改/更新/修改。 它并不是真正的硬编码。 对于您的电路板、在包括 /configs/am64x_evm.h 在内的情况下、U-Boot 中其他 ENV 项中的`bootargs` ENV 变量的_default_s

    如果您想了解代码所在的位置、可以遵循以下呼叫层次结构:

    boot_prep_linux ()-> image_setup_linux ()-> image_setup_libfdt ()-> FDT_cheted()

    还有一件事。 如果您不喜欢这种行为、可以从板头文件中的默认环境中删除'bootargs'。 当定义了 ENV 变量时,才会发生 FDT_CHENETOW()中的修复。 否则将使用 DTS 值。

    此致、Andreas