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] Isolate cpu

Part Number: AM6442

Hello

I trying to isolate CPU 1 from scheduler by isolcpus=1 kernel parameter. I have tried several approaches: via the Yocto APPEND variable, via the --apend parameter in the wks file, via devicetree or the uEnv U-Boot script, but none of that works. In  /proc/cmdline I cannot see the isolcpus = 1 flag set, also htop shows that CPU1 have scheduled tasks. I'm using kernel 5.10 with PREEMPT_RT patch. Why this is not working?

Bellow is configuration fragment.

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 file:

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

Whatever I set, cmdline always looks like this:

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

Are these parameters configured somewhere in the meta-ti and override my settings?

BR,

Jakub

  • Hi Jakub,

    I see EFI in your wks script, are you using Kirkstone/Upstream? Note that is not recommended at this time to use those branches. I'd strongly recommend sticking to the 'dunfell'-based AM64 SDK v8.04 branches.

    Are these parameters configured somewhere in the meta-ti and override my settings?

    For customizing the Kernel command line this method should work: https://docs.yoctoproject.org/dev/kernel-dev/faq.html#how-do-i-change-the-linux-kernel-command-line but seems like you couldn't get this to actually do its job. If you look through the Yocto sources you'll see that Yocto stubbornly replaces CONFIG_CMDLINE with something it creates itself. Let me look into this a bit more and get back.

    Regards, Andreas

  • Hi Jakub,

    I was digging into this more and yes indeed you will need to change the bootargs in U-Boot as in the TI setup those supersede everything else you can configure in the DTS or Yocto.

    To do this, I have not tried the particular configuration change you made but bootargs=${bootargs}; isolcpus=1 looks not correct. If anything you'd want to make that assignment like bootargs="${bootargs} isolcpus=1" (without the semicolon) to append another parameter.

    Anyways what I tried successfully is the below Yocto  change to meta-ti... It adds a dummy "testing=123" parameter to the command line. I named it like this for easy tracing throughout the system and to not cause any behavioral changes.

    $ 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"
    

    With this, the dummy parameter correctly propagates into the kernel command line, as shown in the kernel log extract below and contents of /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:~# 

    Regards, Andreas

  • Thank you for help. With your hints I resolved my issue. But I'm wondering why these kernel parameters are hardcoded in U-Boot source code. Why was a device tree not used instead?

  • Hi Jakub,

    this is how U-Boot does the Linux boot on ARM. It replaces the 'bootargs' defined in the DTS under '/chosen' with whatever it has in the 'bootargs' ENV variable. Its supposed to provide a way for easier customization, as the U-Boot environment can easily be changed/updated/modified. It is not really hard-coded. What is hard-coded are the _defaults_ for the `bootargs` ENV variable amongst other ENV items in U-Boot, in case of your board all in include/configs/am64x_evm.h.

    If you are curious where that code is, you can follow this call hierarchy:

    boot_prep_linux() -> image_setup_linux() -> image_setup_libfdt() -> fdt_chosen()

    Also one more thing. If you don't like this behavior, you could remove 'bootargs' from the default environment in your board header file. The fixup in fdt_chosen() only happens if that ENV variable is defined. Otherwise the DTS values are used.

    Regards, Andreas