-
Notifications
You must be signed in to change notification settings - Fork 14
Add RT Conf documentation #98
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
base: main
Are you sure you want to change the base?
Changes from all commits
9ab4bab
bb08f77
21a071d
de25bc8
432195e
9a25fcb
faf59ce
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,98 @@ | ||
| # How-to tune Real-Time Ubuntu using rt-conf | ||
|
|
||
| *rt-conf* is a tool that helps users tune their system for real-time responsiveness. | ||
| This guide describes how to install and use it on Ubuntu. | ||
|
|
||
| ## Install | ||
|
|
||
| Install rt-conf as a snap: | ||
|
|
||
| ```shell | ||
| sudo snap install rt-conf --beta --devmode | ||
| ``` | ||
|
|
||
| ````{admonition} Developer mode | ||
| The snap must be installed with `--devmode` to allow IRQ configuration. | ||
| This is due to issue [#67](https://github.com/canonical/rt-conf/issues/67). | ||
|
|
||
| When installed in developer mode, the snap will not update automatically. | ||
| To force an update: | ||
| ```shell | ||
| sudo snap refresh rt-conf | ||
| ``` | ||
| ```` | ||
|
|
||
| Grant access to allow GRUB configuration on a system that supports it: | ||
| ```shell | ||
| sudo snap connect rt-conf:etc-default-grub | ||
| ``` | ||
| rt-conf uses this access to write a drop-in GRUB config file at `/etc/default/grub.d/60_rt-conf.cfg`. | ||
| This file is removed when uninstalling the rt-conf snap. | ||
|
|
||
| ## Configure | ||
|
|
||
| The default configuration file is located at `/var/snap/rt-conf/common/config.yaml`: | ||
|
|
||
| ```{literalinclude} rt-conf-config.yaml | ||
| :language: yaml | ||
| ``` | ||
|
|
||
| The configuration file includes several examples. | ||
| Uncomment useful examples and modify them to meet the tuning requirements. | ||
| If a configuration is commented out, rt-conf will not perform any operations. | ||
| Anything that is set on your system remains untouched. | ||
| Refer to the {doc}`../reference/rt-conf-yaml` for more details. | ||
|
|
||
| ## Run | ||
|
|
||
| Once ready with the configurations, run rt-conf: | ||
| ```shell | ||
| sudo rt-conf | ||
| ``` | ||
|
|
||
| ```{admonition} Kernel command line parameters | ||
| Pay attention to the output as it shows platform-specific instructions to complete kernel command line configurations. | ||
|
|
||
| Setting kernel command line via rt-conf is not supported on [Ubuntu Core][UC]. | ||
| Instead, refer to {ref}`ubuntu-core-kernel-cmdline`. | ||
| ``` | ||
|
|
||
| The kernel command line parameters are persisted on the system, but this is not the case for other configurations. | ||
| The IRQ and CPU governance are reset to the system defaults after a reboot. | ||
| The rt-conf snap has a oneshot service which runs on every boot to re-apply the non-persistent configurations. | ||
| This service runs only once and stops immediately after setting the configurations. | ||
|
|
||
| If re-applying non-persistent configurations on boot is not wanted, disable the service: | ||
| ```shell | ||
| sudo snap stop --disable rt-conf | ||
| ``` | ||
|
|
||
| ### Change configuration path | ||
|
|
||
| The configuration file path can be changed with [snap configurations][snap-config]. | ||
| For example: | ||
| ```shell | ||
| sudo snap set rt-conf config-file=/home/ubuntu/rt-conf/config.yaml | ||
| ``` | ||
|
|
||
| ```{note} | ||
| The configuration file must be in a location accessible to the snap, such as a user home directory. | ||
|
|
||
| The file must be owned by and writable to root only. | ||
| ``` | ||
|
|
||
| To revert to the default path: | ||
| ```shell | ||
| sudo snap unset rt-conf config-file | ||
| ``` | ||
|
|
||
| ### Verbose logging | ||
|
|
||
| To enable debug logging set: | ||
| ```shell | ||
| sudo snap set rt-conf verbose=true | ||
| ``` | ||
|
|
||
| % Links | ||
| [UC]: https://ubuntu.com/core | ||
| [snap-config]: https://snapcraft.io/docs/configuration-in-snaps |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -8,3 +8,4 @@ Reference | |
| kernel-boot-parameters | ||
| kernel-config-options | ||
| releases | ||
| rt-conf-yaml | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I quite like the Read the Docs YAML file docs. Is there a way to pull the type / format etc from somewhere in the rt-conf repo? so we can automatically generate it and format it a certain way? |
| Original file line number | Diff line number | Diff line change | ||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -0,0 +1,162 @@ | ||||||||||||
| # RT Conf YAML configuration schema | ||||||||||||
|
|
||||||||||||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think a brief description / intro on rt-conf should be included here. |
||||||||||||
| The following schema reflects all settings available in the configuration file of the `rt-conf` tool | ||||||||||||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||||||||
|
|
||||||||||||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||||||||
| There are three top-level dictionaries in the configuration file:, {ref}`kcmd`, {ref}`irqt` and {ref}`cpug`. | ||||||||||||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||||||||
|
|
||||||||||||
| (kcmd)= | ||||||||||||
| ## kernel_cmdline | ||||||||||||
|
|
||||||||||||
| Type: `dict` | ||||||||||||
|
|
||||||||||||
| _Optional_ | ||||||||||||
|
|
||||||||||||
| ### kernel_cmdline.parameters | ||||||||||||
|
|
||||||||||||
| Type: `list[string]` | ||||||||||||
|
|
||||||||||||
| _Optional_ | ||||||||||||
|
|
||||||||||||
| {ref}`kernel-boot-parameters` that affects real-time behavior. | ||||||||||||
|
|
||||||||||||
| ```{admonition} Validated parameters | ||||||||||||
|
|
||||||||||||
| `rt-conf` performs syntax validation on all parameters names. | ||||||||||||
| In addition, `rt-conf` carries out syntax validation on values of the parameters which are common for real-time tuning. These parameters are: | ||||||||||||
|
|
||||||||||||
| - {ref}`irqaffinity <reference-irqaffinity>` | ||||||||||||
| - {ref}`isolcpus <reference-isolcpus>` | ||||||||||||
| - {ref}`kthread_cpus <reference-kthread_cpus>` | ||||||||||||
| - {ref}`nohz <reference-nohz>` | ||||||||||||
| - nohz_full | ||||||||||||
| - rcu_nocbs | ||||||||||||
|
|
||||||||||||
| <!-- TODO: add references for nohz_full and rcu_nocbs --> | ||||||||||||
| ``` | ||||||||||||
|
|
||||||||||||
| (irqt)= | ||||||||||||
| ## irq_tuning | ||||||||||||
|
|
||||||||||||
| Type: `list[dict]` | ||||||||||||
|
|
||||||||||||
| _Optional_ | ||||||||||||
|
|
||||||||||||
| A list of configurations including the list of cpus to be applied and the filters. | ||||||||||||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||||||||
| Runtime configurations that aren't persisted, related to IRQ affinity tuning. | ||||||||||||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is this a continuation of the previous sentence? It feels like something is missing to connect these 2 statements. |
||||||||||||
|
|
||||||||||||
| Example: | ||||||||||||
|
|
||||||||||||
| ```yaml | ||||||||||||
| irq_tuning: | ||||||||||||
| - cpus: "2-3" | ||||||||||||
| filter: | ||||||||||||
| actions: "iwlwifi" | ||||||||||||
| chip_name: "IR-PCI" | ||||||||||||
| name: "edge" | ||||||||||||
| type: "edge" | ||||||||||||
| ``` | ||||||||||||
|
|
||||||||||||
| ### irq_tuning[*].cpus | ||||||||||||
|
|
||||||||||||
| Type `string` | ||||||||||||
|
|
||||||||||||
| _Required_ | ||||||||||||
|
|
||||||||||||
| A string formatted as {ref}`cpu-lists`. | ||||||||||||
| Specifies the list of CPUs which will handle the matched IRQs on the {ref}`filter <irqfilter>`. | ||||||||||||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||||||||
|
|
||||||||||||
| (irqfilter)= | ||||||||||||
| ### irq_tuning[*].filter | ||||||||||||
|
|
||||||||||||
| Type: `dict` | ||||||||||||
|
|
||||||||||||
| _Required_ | ||||||||||||
|
|
||||||||||||
| A dictionary with keys related to IRQ properties of `/sys/kernel/irq/<IRQ-num>/`. | ||||||||||||
|
|
||||||||||||
| #### irq_tuning[*].filter.actions | ||||||||||||
|
|
||||||||||||
| Type: `regex string` | ||||||||||||
|
|
||||||||||||
| _Optional_ | ||||||||||||
|
|
||||||||||||
| The IRQ action chain. A comma-separated list of zero or more device names associated with this interrupt. | ||||||||||||
| For network related, generally is the name of the network interface shown in `ip link show`. | ||||||||||||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I don't find the second sentence very clear. Do you mean to say "For network-related purposes, the IRQ action chain is generally the name of the network interface, shown in |
||||||||||||
|
|
||||||||||||
| #### irq_tuning[*].filter.chip_name | ||||||||||||
|
|
||||||||||||
| Type: `regex string` | ||||||||||||
|
|
||||||||||||
| _Optional_ | ||||||||||||
|
|
||||||||||||
| Chip name supplied by the associated device driver. | ||||||||||||
|
|
||||||||||||
| Example: `IR-PCI-MSIX-0000:04:00.0` | ||||||||||||
|
|
||||||||||||
| #### irq_tuning[*].filter.name | ||||||||||||
|
|
||||||||||||
| Type: `regex string` | ||||||||||||
|
|
||||||||||||
| _Optional_ | ||||||||||||
|
|
||||||||||||
| Human-readable flow handler name as defined by the irq chip driver. | ||||||||||||
| Example values are: | ||||||||||||
| * `edge` | ||||||||||||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. the potential values are arbitary right? as in anything is possible? |
||||||||||||
| * `fasteoi` | ||||||||||||
|
|
||||||||||||
| #### irq_tuning[*].filter.type | ||||||||||||
|
|
||||||||||||
| Type: `enum` | ||||||||||||
|
|
||||||||||||
| _Optional_ | ||||||||||||
|
|
||||||||||||
| The type of the interrupt. | ||||||||||||
| Valid values: | ||||||||||||
| * `edge` | ||||||||||||
| * `level` | ||||||||||||
|
|
||||||||||||
| (cpug)= | ||||||||||||
| ## cpu_governance | ||||||||||||
|
|
||||||||||||
| Type: `list[dict]` | ||||||||||||
|
|
||||||||||||
| _Optional_ | ||||||||||||
|
|
||||||||||||
| Runtime configurations that aren't persisted, related to cpu power management. | ||||||||||||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Same comment as previously. I am not clear how these 2 sentences are "connected". I am missing something but it's not clear what. |
||||||||||||
| A list of dictionaries with the CPU scaling governor and the cpu list to be applied. | ||||||||||||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
Anyways please do a quick search-and-replace to keep the use of CPU consistent. |
||||||||||||
|
|
||||||||||||
| Example: | ||||||||||||
|
|
||||||||||||
| ```yaml | ||||||||||||
| cpu_governance: | ||||||||||||
| - cpus: "0-1" | ||||||||||||
| scaling_governor: "performance" | ||||||||||||
| ``` | ||||||||||||
|
|
||||||||||||
| ### cpu_governance[*].cpus | ||||||||||||
|
|
||||||||||||
| Type: `string` | ||||||||||||
|
|
||||||||||||
| _Required_ | ||||||||||||
|
|
||||||||||||
| A string formatted as {ref}`cpu-lists`. | ||||||||||||
| Specifies which cpus are going to be configured with the scaling governor specified in the item. | ||||||||||||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'll limit my comments but reword to say what the user does with the command. Do apply this to the rest of the params.
Suggested change
|
||||||||||||
|
|
||||||||||||
|
|
||||||||||||
| ### cpu_governance[*].scaling_governor | ||||||||||||
|
|
||||||||||||
| Type: `string` | ||||||||||||
|
|
||||||||||||
| _Required_ | ||||||||||||
|
|
||||||||||||
| The chosen scaling governor. | ||||||||||||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||||||||
|
|
||||||||||||
| Valid values: | ||||||||||||
| * `performance`: Run the CPU at the maximum frequency, get from `/sys/devices/system/cpu/cpuX/cpufreq/scaling_max_freq`. | ||||||||||||
| * `powersave`: Run the CPU at the minimum frequency, get from `/sys/devices/system/cpu/cpuX/cpufreq/scaling_min_freq`. | ||||||||||||
| * `userspace`: Run the CPU at user specified frequencies, configurable via `/sys/devices/system/cpu/cpuX/cpufreq/scaling_setspeed`. | ||||||||||||
| * `ondemand`: Scales the frequency dynamically according to current load. Jumps to the highest frequency and then possibly back off as the idle time increases. | ||||||||||||
| * `conservative`: Scales the frequency dynamically according to current load (more gradually than ondemand). | ||||||||||||
| * `schedutil`: [Scheduler-driven](https://lwn.net/Articles/682391/) CPU frequency selection. | ||||||||||||
|
|
||||||||||||
|
|
||||||||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we don't necessarily need a fix here.
but i think we should have a better structure for naming our targets.
as the doc set grows we can run into conflicts since similar headings can easily appear across pages.
E.g.
cpu-configs-cpu-listsor something along this convention would be a more robust target.