Skip to main content

Real-Time (RT) kernel

A real-time system is a deterministic system, where response to an event is expected in a set time. A system is classified as compatible with RT if:
  • It’s devoid of unbounded latency.
  • The maximum response time is calculated with precision.
  • It meets the set criteria for scheduling of tasks (latency and deadline).
Linux can be configured as a real-time operating system (RTOS) in which real-time tasks have well-defined periodic execution cycles (cycle time) and meet execution criteria within specified limits (jitter). To install the patches, see Versions of PREEMPT_RT patches.
The real-time support is for kernelspace process and not for userspace.
This section isn’t applicable for QCS5430.
Figure : Build sequence

Figure : Build sequence

Set up the workspace

The Qualcomm Linux kernel supports the LTS RT kernel (6.18.x), which is maintained through the Yocto recipe in the meta-qcom layer in the recipes-kernel/linux/linux-qcom-rt_6.18.bb file. For more information about cloning the workspace and getting all Qualcomm Linux meta layers to use Qualcomm RT Linux, see Sync.

Enable the RT kernel

The Qualcomm Linux meta-qcom layer supports linux-qcom-rt_6.18.bb recipe that fetches and builds the Qualcomm Linux kernel for the supported machines by default. The meta-qcom layer applies the changes on top of the existing layer. During the kernel build, meta-qcom layer enables PREEMPT_RT using rt.config based on the kernel version, and allows real-time configurations.
  • Use linux-qcom-rt_6.18.bb for QLI.2.0.
  • Use linux-qcom-next-rt_git.bb for qcom-next.
For more information about supported machines, see Build critical release tags.

Customize the RT kernel

  • If you are carrying any changes for the RT kernel, maintain them in the recipe as shown below:
    • Maintain the patch file under recipes-kernel/linux/linux-qcom-6.18/<your_patch_file>.patch
    • Append the patch file to SRC_URI in the recipes-kernel/linux/linux-qcom-rt_6.18.bb file.
  • To apply any external configurations on the RT kernel:
    • Maintain the configuration file in the recipes-kernel/linux/linux-qcom-6.18/configs/<your_config>.cfg recipe.
    • Append the configuration file to SRC_URI in the recipes-kernel/linux/linux-qcom-rt_6.18.bb file.
  • To modify the kernel command-line, add the command-line parameters into the meta-qcom/ci/base.yml file to KERNEL_CMDLINE_EXTRA variable.

Configure kernel settings for the RT kernel

Optional and mandatory kernel configurations are used in the RT kernel. To enable full preemption in the RT kernel, use CONFIG_PREEMPT_RT. The CONFIG_PREEMPT_RT flag is enabled by default as part of the rt.config used in linux-qcom-rt_6.18.bb recipe. The following example shows the kernel configuration:
Set the following kernel configuration options when affining the RT task:
  • CONFIG_NO_HZ_COMMON - When enabled, it configures the kernel infrastructure for tickless operation.
  • CONFIG_NO_HZ_FULL - When enabled, it configures the kernel to avoid sending scheduling-clock interrupts to CPUs with a single runnable task.
  • CONFIG_CPUSETS - Use the CONFIG_CPUSETS configuration option to enable cpuset, where the CPU is grouped to form a set.
Figure: RT kernel verification

Figure: RT kernel verification

Build the RT kernel

To build the RT kernel, run the following commands:
  1. To ensure that you are in the KAS shell, run the following command:
The qcom-distro-kvm.yml configuration is supported with KVM only for QLI 2.0. The RT kernel (PREEMPT_RT) is hypervisor-agnostic. KVM is selected as the default hypervisor for QLI 2.0 due to the following reasons:
  • Upstream community support — KVM and its drivers are part of the mainline Linux kernel, enabling broader ecosystem contributions and long-term support.
  • Standard VirtIO support — KVM supports all upstream VirtIO devices and is compatible with standard VMMs such as QEMU.
  • Open development — Active upstream community with broader developer familiarity.
The kas build command automatically includes xbl_config_kvm.elf in the generated qcomflash package. No manual UEFI BDS configuration is required.
Copy the kas lock file from meta-qcom-releases to meta-qcom, see Build a BSP image.
  1. To compile the BitBake Qualcomm Linux multimedia image, run the following command:

Tune the RT kernel

Tune the RT kernel to achieve a deterministic latency for RT tasks in the device. Set the CPU cores that run RT tasks to run at maximum operating frequency while preventing thermal mitigation of CPU frequency. For example, in an idle sleep scenario, RT tasks face scheduling latency due to CPU wake time delay.
These optimizations are automatically applied by the URM. when RT tests(cyclictest) is launched.
Manual configuration is not required under normal operation. The following steps are provided for reference, debugging, or custom setups.
To configure the system before running the tests, do the following for QCS6490, Qualcomm Dragonwing™ IQ-9075, and Qualcomm Dragonwing™ IQ-615 Development Kit:
  1. Disable the timer migration:
  2. Affine all kernel work queues in /sys/devices/virtual/workqueue/* to the housekeeping CPUs:
  3. Set CPU frequency governor to performance:
  4. Disable RT accounting/throttling:
  5. Set IRQ affinity to housekeeping CPUs:
To configure the system before running the tests, do the following for the Dragonwing™ IQ-8275 Development Kit:
  1. Disable the timer migration:
  2. Affine all kernel work queues in /sys/devices/virtual/workqueue/* to the housekeeping CPUs:
  3. Set CPU frequency governor to performance:
  4. Disable RT accounting/throttling:
  5. Set IRQ affinity to housekeeping CPUs:
The following example shows how to add a kernel command-line parameter to disable RCU callbacks (rcu_nocbs) in meta-qcom/conf/machine/<machine-name.conf>:
  • CPU cores 7
  • IRQ affine to core 0-6
  • RCU no call back 7

Test the RT kernel

A suite of tests is available in the Linux foundation RT test suite. The RT Linux kernel test obtains the following information:
  • Real-time performance of the RT Linux kernel
  • RT Linux kernel latencies and key performance indicators (KPIs)
Don’t reboot the system during the RT Linux kernel test as it runs for over 24 hours.
Cyclictest tool is used for benchmarking the RT Linux kernel systems. It’s used to evaluate the relative performance of the real-time systems. The Qualcomm Linux build has the cyclictest tool. For more information, see Cyclictest. This guide describes the following cyclictests:
  • Cyclictest with no-load: System load isn’t added to perform this test.
  • Cyclictest with stress-ng (next-generation): Specific percentage of load is added to perform this test to measure the worst case system latencies.
  1. Run the following cyclic test for QCS6490, Qualcomm Dragonwing™ IQ-9075, and Qualcomm Dragonwing™ IQ-615 development kits:
  2. Run the following cyclic test for the Dragonwing™ IQ-8275 Development Kit:
To access the RT test suite source code, see rt-tests/rt-tests.git. For more information, see RT-Tests.
  1. Note the latencies.
To run cyclic test with stress-ng on QCS6490, Qualcomm Dragonwing IQ-9075, and Qualcomm Dragonwing™ IQ-615, do the following:
  1. Set the target CPU load. Define the desired CPU load percentage. If not specified, the default load is 60%:
  2. Run stress-ng on selected CPU cores in the background. Apply CPU load on cores 0, 1, 2, 4, 5, 6, and 7 using stress-ng. Each instance runs for one day and is pinned to a specific CPU core:
  3. Run the cyclic latency test. Execute cyclictest with high priority to measure scheduling latency. The test runs for approximately 27.78 hours:
  4. Note the worst-case latencies.
To run cyclic test with stress-ng on Dragonwing IQ-8275, do the following:
  1. Set the target CPU load:
  2. Run stress-ng on selected CPU cores:
  3. Run the cyclic latency test:
  4. Note the worst-case latencies.

RT test results

RT Benchmarks by Platform

RT Benchmarks IQX

Benchmark results for IQ-X series high-performance platforms

RT Benchmarks IQ9

Benchmark results for the Dragonwing IQ-9075 platform

RT Benchmarks IQ8

Benchmark results for the Dragonwing IQ-8275 platform

RT Benchmarks IQ6

Benchmark results for the Dragonwing IQ-615 platform