setting isolcpus

On Ubuntu with amd64, you can easily set isolcpus in GRUB_CMDLINE_LINUX in the /etc/default/grub and then reboot.

I’ve searched around and it seems there are a bunch of ways to set this which vary by Jetson type and versions. I’m wondering if there’s a simple way to set this on the Nano.

You need to edit the “chosen” entry in the device tree. You could extract the existing device tree, edit that, and then flash the new tree (though early boot stages do alter this somewhat it should work). You can extract a running system’s tree like this:

dtc -I fs -O dts -o extracted.dts /proc/device-tree
# Now edit. Then recreate:
dtc -I dts -O dtb -o edited.dtb extracted.dts

Use that for flash.

Note: GRUB only works on PCs (PCs have a BIOS/UEFI, embedded systems do not).

Thanks, I got the tree extracted, but I’m a noob and have no idea where to set the isolcpu command.

Also, I keep seeing references to flash or flash.sh and have no idea where to find that. What do I run afterwards?

In the device tree “chosen” entry the content is equivalent to whatever you’d pass to the kernel if you were using GRUB. It isn’t a command so much as it is an argument being passed to the kernel as it starts.

If you were to use GRUB and add “isolcpus” the command line, then finding “chosen” in the dts file (a device tree source is plain text), and within “chosen” find “bootargs”, then the “bootargs” are the same as what would gone into “GRUB_CMDLINE_LINUX”. This is just a space delimited plain text line (it is a single long line…don’t break it up).

As an example I see this for “chosen/bootargs” on an R32.1 Jetson TX2 “/proc/device-tree/chosen/bootargs” (the dts file is a tree format, the “/proc/device-tree/” is a file format, the installed and flashed format is a binary “.dtb”):

root=/dev/mmcblk0p1 rw rootwait console=ttyS0,115200n8 console=tty0 fbcon=map:0 net.ifnames=0 video=tegrafb no_console_suspend=1 earlycon=uart8250,mmio32,0x3100000 nvdumper_reserved=0x2772e0000 gpt usbcore.old_scheme_first=1 tegraid=18.1.2.0.0 maxcpus=6 boot.slot_suffix= boot.ratchetvalues=0.2031647.1 bl_prof_dataptr=0x10000@0x275840000 sdhci_tegra.en_boot_part_access=1 root=/dev/mmcblk0p1 rw

In your case, if this were a TX2 with L4T R32.1 installed (it is a TX1 with L4T R32.1 so it will be close to this) I’d simply add a space and “isolcpus” like this:

root=/dev/mmcblk0p1 rw rootwait console=ttyS0,115200n8 console=tty0 fbcon=map:0 net.ifnames=0 video=tegrafb no_console_suspend=1 earlycon=uart8250,mmio32,0x3100000 nvdumper_reserved=0x2772e0000 gpt usbcore.old_scheme_first=1 tegraid=18.1.2.0.0 maxcpus=6 boot.slot_suffix= boot.ratchetvalues=0.2031647.1 bl_prof_dataptr=0x10000@0x275840000 sdhci_tegra.en_boot_part_access=1 root=/dev/mmcblk0p1 rw <b><u><i>isolcpus</i></u></b>

(scroll to the far right of that very long line to see the appended “isolcpus”)

Then follow the guide to flash the device tree. If you have any valuable rootfs data or have invested in setting things up like you want, then I’d suggest first cloning. Assuming this is on an SD card that’s fairly simple…just use dd to save the card. It is actually somewhat unlikely on the Nano that you’d end up wiping the root partition, but you never know till you’ve tested. If things are set up correctly, then the SD card will be left alone.

Thanks so much!!

Hi,
I am new to using Jetsons. I was curious if there is a similar procedure to isolate CPUs on the Jetson TX2.

Thanks,
Ashraf

You should probably start a new thread since it is a different topic.

FYI, the name of what you are asking about is “CPU affinity”. This should be the same as it is on a desktop PC, so instructions on CPU affinity for other Linux documentation on Ubuntu will mostly apply. One exception is that in some cases you shouldn’t restrict the first core (CPU0) and should allow CPU0 as a general core.

A URL you may find of interest:
https://devtalk.nvidia.com/default/topic/1035979/jetson-tx2/camera-timeout-at-high-cpu-load/post/5263345/#5263345

In the kernel source you can find some documentation in the “Documentation/” subdirectory, file name “IRQ-affinity”.