Skip to content

ti: config: kernel: Add current RT config file #8280

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

jsuhaas22
Copy link
Contributor

Description

Please include a summary of the change and which issue is fixed. Please also include relevant motivation and context. List any dependencies that are required for this change.

This PR adds the RT kernel config file for TI devices. If RT_KERNEL=yes is passed as an argument to ./compile.sh, a PREEMPT_RT image is built.

How Has This Been Tested?

Please describe the tests that you ran to verify your changes. Please also note any relevant details for your test configuration.

Tested this on SK-AM62B.

Test 1: boot test: the board successfully booted
Test 2: uname -a test: PREEMPT_RT string was present in the output, thus suggesting that its indeed an RT image
Test 3: zcat /proc/config.gz | grep -i RT: Further confirmed that the PREEMPT_RT config is enabled in the running image

Checklist:

Please delete options that are not relevant.

  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • My changes generate no new warnings

cc: @glneo @Grippy98 @nmenon @sadik-smd

Copy link
Contributor

coderabbitai bot commented Jun 9, 2025

Walkthrough

A new Linux kernel configuration file named linux-k3-rt-current.config was added, providing an extensive set of kernel options optimized for ARM64 K3 real-time platforms. This configuration enables numerous kernel features including PREEMPT_RT, networking, wireless drivers, storage, filesystems, security modules, cryptography, debugging, virtualization, and various device drivers, while disabling some CPU errata workarounds and advanced ARM64 features. Additionally, the K3 family build configuration script was modified to check if the RT_KERNEL environment variable is set to "yes". When true, it outputs "Building RT Image" and switches the kernel family from "k3" to "k3-rt" before proceeding with the existing branch logic. No exported functions or public entities were altered.

Suggested labels

ready to merge

Suggested reviewers

  • glneo
  • igorpecovnik
  • Grippy98

📜 Recent review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 782f2de and 35a5dca.

📒 Files selected for processing (2)
  • config/kernel/linux-k3-rt-current.config (1 hunks)
  • config/sources/families/k3.conf (1 hunks)
✅ Files skipped from review due to trivial changes (1)
  • config/kernel/linux-k3-rt-current.config
🚧 Files skipped from review as they are similar to previous changes (1)
  • config/sources/families/k3.conf
⏰ Context from checks skipped due to timeout of 90000ms (1)
  • GitHub Check: Shell script analysis
✨ Finishing Touches
🧪 Generate Unit Tests
  • Create PR with Unit Tests
  • Commit Unit Tests in branch ti-add-rt
  • Post Copyable Unit Tests in Comment

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Explain this complex logic.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai auto-generate unit tests to generate unit tests for this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@coderabbitai coderabbitai bot added the Ready to merge Reviewed, tested and ready for merge label Jun 9, 2025
@github-actions github-actions bot added 08 Milestone: Third quarter release size/large PR with 250 lines or more Needs review Seeking for review Hardware Hardware related like kernel, U-Boot, ... and removed Ready to merge Reviewed, tested and ready for merge labels Jun 9, 2025
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

🧹 Nitpick comments (1)
config/kernel/linux-k3-rt-current.config (1)

927-928: Security frameworks disabled for RT performance.

SELinux and AppArmor are disabled, which is common in RT kernels to reduce overhead. However, this reduces security posture.

Consider implementing application-level security measures since kernel-level security frameworks are disabled. You may also want to evaluate if mandatory access controls are required for your specific use case and document this security trade-off.

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between c0da650 and 782f2de.

📒 Files selected for processing (2)
  • config/kernel/linux-k3-rt-current.config (1 hunks)
  • config/sources/families/k3.conf (1 hunks)
🔇 Additional comments (5)
config/kernel/linux-k3-rt-current.config (4)

972-976: LGTM! Proper RT kernel configuration.

The real-time specific configurations are correctly set:

  • PREEMPT_RT=y enables full real-time preemption
  • HZ_1000=y provides 1ms timer resolution for low latency
  • NO_HZ_FULL=y enables full tickless operation for isolated CPUs
  • CONTEXT_TRACKING_USER=y supports user/kernel context tracking

These settings are appropriate for real-time workloads requiring deterministic latency.


81-90: CPU power management correctly disabled for RT.

The configuration appropriately disables CPU power management features that can introduce latency jitter:

  • CPU_IDLE=n prevents CPU from entering idle states
  • CPU_FREQ=n disables dynamic frequency scaling
  • CPU_FREQ_GOV_PERFORMANCE=y ensures maximum performance mode

This is correct for real-time applications requiring consistent performance.


961-982: Debugging and instrumentation appropriately configured for RT.

Most debugging features are disabled to minimize overhead:

  • SCHED_DEBUG=n removes scheduler debugging
  • FTRACE=n disables function tracing
  • PERF_EVENTS=n disables performance monitoring

Some ARM64 features are also disabled to reduce complexity. This configuration prioritizes deterministic performance over observability.


37-70:

❓ Verification inconclusive

Review the disabled ARM64 CPU errata workarounds.

Multiple ARM64 CPU errata workarounds are disabled, which could cause stability issues on affected hardware. While this may reduce overhead for RT performance, it could lead to system instability on vulnerable CPU models.

Please verify that the target TI K3 hardware doesn't require these errata workarounds, or consider enabling the ones relevant to your target platform:


🏁 Script executed:

#!/bin/bash
# Check which ARM64 errata are commonly needed for TI K3 platforms
echo "Searching for ARM64 errata references in TI K3 related files..."
rg -A 3 "ARM64_ERRATUM.*K3|K3.*ARM64_ERRATUM" 
rg -A 3 "ERRATUM.*AM6" 
rg -A 3 "erratum.*j721e|j721e.*erratum" 

Length of output: 251


#!/bin/bash
set -e

# 1. Check SoC and architecture settings in the K3 RT defconfig
echo "Inspecting config/kernel/linux-k3-rt-current.config for SoC/ARCH definitions..."
grep -E 'CONFIG_SOC_|CONFIG_ARCH_' config/kernel/linux-k3-rt-current.config || true

# 2. List any device-tree source files in the repo
echo -e "\nFound .dts files:"
fd --extension dts || true

# 3. Search those DTS files for TI K3/AM6-compatible strings
echo -e "\nSearching .dts files for TI K3/AM6 SoC identifiers..."
fd --extension dts -x rg -H -n 'compatible.*ti,(j721e|j7200|am6|am62)' {}

#!/bin/bash
set -e

# 1. Search for AM6 references in arch/arm64 Kconfig
echo "Searching for AM6 in arch/arm64/Kconfig..."
rg -n "AM6" arch/arm64/Kconfig || true

# 2. Search for ARM64 errata entries in the CPU feature Kconfig
echo -e "\nSearching for ARM64_ERRATUM in arch/arm64/cpufeature/Kconfig..."
rg -n "ARM64_ERRATUM" arch/arm64/cpufeature/Kconfig || true

# 3. Search device-tree source files for TI K3 SoC identifiers (j721e, j7200, am6)
echo -e "\nSearching .dts files for TI K3 compatible strings..."
rg -n "compatible.*ti,(j721e|j7200|am6|am62)" --glob '*.dts' || true

# 4. As a fallback, look for any mention of j721e/j7200 across the repo
echo -e "\nSearching for j721e/j7200 mentions in repository..."
rg -n "j721e|j7200" || true

Verify ARM64 CPU Errata for TI K3
We didn’t find any TI K3–specific erratum references in the config or DTS files; please manually confirm that none of the disabled workarounds are required for your SoC (J721E/J7200/AM6):

• Check arch/arm64/cpufeature/Kconfig for any ERRATUM entries targeting the Cortex-A cores used on TI K3.
• Inspect your device-tree (.dts/.dtsi) for compatible = "ti,j721e", "ti,j7200", "ti,am62", etc., and cross-reference against the ARM64_ERRATUM_* options.
• Consult the TI K3 Technical Reference Manual or errata sheets to determine which CPU errata workarounds are mandatory for your silicon revision.

If any apply, enable them in your config to avoid potential stability issues.

config/sources/families/k3.conf (1)

23-26: LGTM! Clean conditional logic for RT kernel selection.

The implementation correctly:

  • Checks for RT_KERNEL=yes environment variable
  • Provides user feedback with display_alert
  • Sets LINUXCONFIG to use the new RT configuration
  • Uses proper bash conditional syntax with [[ ]]

The placement before the BRANCH case statement ensures the RT configuration takes precedence when requested.

@rpardini
Copy link
Member

This will cause inconsistency for .deb/apt repo, although it works for building images.
You'd need to create a separate kernel package, so that you've both rt and non-rt .deb's available.
Do so by changing LINUXFAMILY. It might be easier to create a BRANCH=k3-rt too.

TI SDK supports images with real-time kernel. Add support for building
such images for the `current` release by adding a config file for it.

Signed-off-by: Suhaas Joshi <s-joshi@ti.com>
@coderabbitai coderabbitai bot added the Ready to merge Reviewed, tested and ready for merge label Jun 11, 2025
@jsuhaas22
Copy link
Contributor Author

jsuhaas22 commented Jun 11, 2025

@rpardini

This will cause inconsistency for .deb/apt repo, although it works for building images. You'd need to create a separate kernel package, so that you've both rt and non-rt .deb's available. Do so by changing LINUXFAMILY. It might be easier to create a BRANCH=k3-rt too.

Have updated the PR to use LINUXFAMILY. Tested on SK-AM62B; even got the *-rt*.deb packages built.

@glneo
Copy link
Collaborator

glneo commented Jun 11, 2025

What happens if someone sets RT_KERNEL=yes but selects a kernel other than current? We would need to keep an RT version of every kernel config. Instead would it be easier to simply add a current-rt BRANCH?

@igorpecovnik
Copy link
Member

Also this would be good to be solved generally. Not just for this family, similar as we do it here:
https://github.com/armbian/build/blob/main/lib/functions/compilation/armbian-kernel.sh

@igorpecovnik igorpecovnik added Discussion Being discussed - Voice your opinions :) and removed Ready to merge Reviewed, tested and ready for merge labels Jun 11, 2025
@jsuhaas22
Copy link
Contributor Author

@glneo

What happens if someone sets RT_KERNEL=yes but selects a kernel other than current? We would need to keep an RT version of every kernel config. Instead would it be easier to simply add a current-rt BRANCH?

We can do this, yes.

But are we sure we wouldn't want an edge-rt image in the future? If we eventually want to introduce an edge-rt image, then we'd have to introduce another edge-rt branch. It seems easier to just go with the RT_KERNEL build switch method, and add a check somewhere to fail with a proper error message if someone builds RT image for edge. This would also be in-line with Armbian's docs which mention only 3 branches (current, edge, legacy).

But if we don't want edge-rt in the near future, then yeah, I will add a current-rt branch.

@jsuhaas22
Copy link
Contributor Author

Also this would be good to be solved generally. Not just for this family, similar as we do it here: https://github.com/armbian/build/blob/main/lib/functions/compilation/armbian-kernel.sh

TI kernel uses its own RT config file which overrides many options in the defconfig file. So we'd have to maintain a separate RT config file for TI devices.. I assume its the same with the other families too.

@igorpecovnik
Copy link
Member

igorpecovnik commented Jun 12, 2025

TI kernel uses its own RT config file which overrides many options in the defconfig file.

Understand. I am just trying to open discussion if something like that is possible - not by maintaining a separate config, but dedicated config override definitions. Just the diff. Maintaining separate configs for (all) other kernel is not possible - we barely manage to maintain default configs.

BTW. I was experimenting some AI assisted config management which could help doing this. In that case, many things become possible. For humans on the project ... there are already too many different configs.

@jsuhaas22
Copy link
Contributor Author

TI kernel uses its own RT config file which overrides many options in the defconfig file.

Understand. I am just trying to open discussion if something like that is possible - not by maintaining a separate config, but dedicated config override definitions. Just the diff. Maintaining separate configs for (all) other kernel is not possible - we barely manage to maintain default configs.

Personally, I agree.
As I said, we maintain override config files inside the TI kernel repository. So building the correct .config is just a matter of doing make ... defconfig <override-config-file>.

If other vendors also have the same flow, then we can just introduce a OVERRIDE_CONFIGS variable. This variable will hold the names of all override-config files that should be appended to the make defconfig command.

By doing so, we move the responsibility of managing kernel configs away from Armbian entirely. Ideally, we shouldn't maintain even diff's as you suggested; all of this should be provided by the vendor kernel itself.

This is just my personal opinion, maybe @glneo can correct me if I am wrong.

Anyway, even if we go ahead with this, it would take time align with the others. In the meantime, we'd have to continue with these individual config files in Armbian.

@igorpecovnik
Copy link
Member

igorpecovnik commented Jun 13, 2025

we maintain override config

I get that.

If other vendors

Some vendors might do that, but <10%, which means that would fall on us. And this is not something we could possibly afford.

By doing so, we move the responsibility of managing kernel configs away from Armbian entirely.

Even only you will use this functionality, we can find a way to integrate this into Armbian. There is always a way. But one issue was already exposed - if we have a different config, we need a different linux family. We can at least make this part automated - if RT config is uses, a subfamily is automatically generated. If we go for dedicated branch, this could IMO be a temporal solution, unless we go for legacy-rt, current-rt, edge-rt automation. And still there are two ways to achieve this and both can be possible - one is - integrating into framework with switch REALTIME_KERNEL=yes https://github.com/armbian/build/blob/main/lib/functions/compilation/armbian-kernel.sh and maintain it there (if it doesn't have any hw family specific configs) and second, if "rt" config file is used, then family / sub-branch management is automatic.

If there is no rush adding this, lets brainstorm and do it right.

@jsuhaas22
Copy link
Contributor Author

We can at least make this part automated - if RT config is uses, a subfamily is automatically generated.

if "rt" config file is used, then family / sub-branch management is automatic.

Could you explain what you have in mind? You said you've been experimenting with AI for this, so does that work reliably?

integrating into framework with switch REALTIME_KERNEL=yes https://github.com/armbian/build/blob/main/lib/functions/compilation/armbian-kernel.sh and maintain it there (if it doesn't have any hw family specific configs)

We could move most configs to armbian-kernel.sh, but some board-/family-specific ones would always exist. So we'd have to maintain vendor-maintained diff's at least.

If there is no rush adding this, lets brainstorm and do it right.

I am hoping to have this merged by end of June, so we have a couple of weeks to get this right. So please do elaborate on your automatic generation idea and how we could go about it. There'd be some vendor-specific configs, so our method would have to accommodate that.

If it takes longer than that to implement a better method, then I'd suggest we merge this (with a separate current-rt branch, if you and Andrew prefer it that way) as a temporary measure until we implement the better method. TI will be maintaining its own config files, so it would not be additional effort for you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
08 Milestone: Third quarter release Discussion Being discussed - Voice your opinions :) Hardware Hardware related like kernel, U-Boot, ... Needs review Seeking for review size/large PR with 250 lines or more
Development

Successfully merging this pull request may close these issues.

4 participants