Both sides previous revisionPrevious revisionNext revision | Previous revisionNext revisionBoth sides next revision |
wiki:system_configuration [2022/05/23 14:33] – [audio group] autostatic | wiki:system_configuration [2023/10/15 17:06] – [How do I build a real-time audio workstation on Linux?] autostatic |
---|
| |
After adjusting your system using the recommendations of [[system_configuration#rtcqs]] and with JACK (QjackCtl) and a2jmidid installed, the basics should be there for a well performing real-time audio system (depending on your hardware too of course). | After adjusting your system using the recommendations of [[system_configuration#rtcqs]] and with JACK (QjackCtl) and a2jmidid installed, the basics should be there for a well performing real-time audio system (depending on your hardware too of course). |
| |
| This wiki also contains a manual on installing a Linux audio system here: [[wiki:system_build|]] |
| |
==== Preliminary ==== | ==== Preliminary ==== |
Run ''uname -a'' to find out which kernel you're running: | Run ''uname -a'' to find out which kernel you're running: |
| |
Linux bto 5.17.1-rt17 #1~focal1 SMP PREEMPT_RT Sat Apr 2 10:32:50 CEST 2022 x86_64 x86_64 x86_64 GNU/Linux | Linux bto 6.5.6-1-liquorix-amd64 #1 ZEN SMP PREEMPT liquorix 6.5-7.1~bookworm (2023-10-06) x86_64 GNU/Linux |
| |
5.17.1-rt17 is the version number of the currently running kernel. The configuration file with which this kernel was created can be found in ''/boot/config-5.17.1-rt17''. Open it, and check if it has the following characteristics: | 6.5.6-1-liquorix-amd64 is the version number of the currently running kernel. The configuration file with which this kernel was created can be found in ''/boot/config-6.5.6-1-liquorix-amd64''. Open it, and check if it has the following characteristics: |
| |
CONFIG_HIGH_RES_TIMERS=y | CONFIG_HIGH_RES_TIMERS=y |
=== Do I really need a real-time kernel? === | === Do I really need a real-time kernel? === |
| |
With the kernel boot option ''threadirqs'' standard kernels create threaded IRQs which basically nullifies the need to use a real-time kernel in most of the cases. But a real-time kernel can still be very useful on a Linux audio platform. If you need the lowest latencies possible a real-time kernel is still an option. But if you're mainly recording, a standard kernel or an optimized kernel (like the low-latency kernel Ubuntu offers) will probably suffice. | With the kernel boot option ''threadirqs'' standard kernels create threaded IRQs which basically nullifies the need to use a real-time kernel in most of the cases. But a real-time kernel can still be very useful on a Linux audio platform. If you need the lowest latencies possible or if you're working on a less powerful system (i.e. Raspberry Pi) a real-time kernel can still be an option. But if you're mainly recording, a standard kernel or an optimized kernel (like the low-latency kernel Ubuntu offers) will probably suffice. |
| |
See also: [[https://jackaudio.org/faq/realtime_vs_realtime_kernel.html|Do I need a realtime kernel to use realtime scheduling?]] | See also: [[https://jackaudio.org/faq/realtime_vs_realtime_kernel.html|Do I need a realtime kernel to use realtime scheduling?]] |
=== Using the threadirqs kernel option === | === Using the threadirqs kernel option === |
| |
This is only needed for so-called generic kernels, ie. standard kernels that are not tweaked for lowlatency performance. You can check if your kernel already includes this option with the following command: | This is only needed for so-called generic or low-latency kernels. You can check if your kernel already includes this option with the following command: |
| |
$ grep -e "CONFIG_IRQ_FORCED_THREADING=y" -e "CONFIG_PREEMPT_RT=y" /boot/config-$(uname -r) | $ grep -e "CONFIG_IRQ_FORCED_THREADING=y" -e "CONFIG_PREEMPT_RT=y" /boot/config-$(uname -r) |
=== Installing a real-time kernel === | === Installing a real-time kernel === |
| |
This section describes installing a real-time kernel on an existing Linux distribution. Some distributions contain packages you can install to get a real-time kernel, for others you'll need to compile it yourself. You can recognize real-time kernel versions by the added '-rt' or '-realtime' parts of the kernel version number. | This section describes installing a real-time kernel on an existing Linux distribution. Some distributions contain packages you can install to get a real-time kernel, for others you'll need to compile it yourself. You can recognize real-time kernel versions by the added '-rt' or '-realtime' parts of the kernel version number. As mentioned earlier, a real-time kernel is not a mandatory part of a Linux audio setup. |
| |
== Ubuntu == | == Ubuntu == |
| |
For rolling your own kernel, see [[build_your_own_real-time_kernel]]. | For rolling your own kernel, see [[build_your_own_real-time_kernel]]. |
| |
| === Other alternatives === |
| Besides low-latency or real-time kernels there are also other kernel flavors available specifically tailored for multimedia usage. |
| |
| == Liquorix == |
| > Liquorix is an enthusiast Linux kernel designed for uncompromised responsiveness in interactive systems, enabling low latency compute in A/V production, and reduced frame time deviations in games.((https://liquorix.net/)) |
| Especially when used in combination with the ''threadirqs'' kernel option this kernel flavor performs very well. It is also the kernel that drives [[https://www.bandshed.net/avlinux/|AV Linux]]. |
| |
== Other relevant links == | == Other relevant links == |
''top'' is probably the most used tool to display system information like CPU or memory usage. It is installed by default on most distros. | ''top'' is probably the most used tool to display system information like CPU or memory usage. It is installed by default on most distros. |
| |
{{:wiki:top2.png|Terminal running top}} | {{:wiki:top_2023-10-15.png|Terminal running top}} |
| |
With the help of ''top'' you can find out which process is using up all your CPU or memory. By pressing ''h'' you get a help screen. To sort on memory usage instead of CPU usage you can press ''F'' + ''n'' + ''Enter''. | With the help of ''top'' you can find out which process is using up all your CPU or memory. By pressing ''h'' you get a help screen. To sort on memory usage instead of CPU usage you can press ''F'' + ''n'' + ''Enter''. |
''htop'' is the somewhat more sophisticated big brother of ''top''. | ''htop'' is the somewhat more sophisticated big brother of ''top''. |
| |
{{:wiki:htop2.png|Terminal running htop}} | {{:wiki:htop_2023-10-15.png|Terminal running htop}} |
| |
==== latencytop ==== | ==== latencytop ==== |
==== cyclictest ==== | ==== cyclictest ==== |
| |
Just as ''latencytop'' measures system latencies, ''[[https://rt.wiki.kernel.org/index.php/Cyclictest|cyclictest]]'' measures kernel latencies. ''cyclictest'' has quite some options but one of the most used ways to run the command is: | Just as ''latencytop'' measures system latencies, ''[[https://wiki.linuxfoundation.org/realtime/documentation/howto/tools/cyclictest/start|cyclictest]]'' measures kernel latencies. ''cyclictest'' has quite some options but one of the most used ways to run the command is: |
# cyclictest -t1 -p 80 -n -i 10000 -l 10000 -m | # cyclictest -t1 -p 80 -n -i 10000 -l 10000 -m |
One single thread (''-t1''), priority of 80 (''-p 80''), use clock_nanosleep (''-n''), use 10000 us base interval of thread (''-i 1000''), use 1000 loops and then exit (''-l 10000''), lock current and future memory allocations (''-m''). More on clock_nanosleep can be found in its manpage (''man clock_nanosleep''). | One single thread (''-t1''), priority of 80 (''-p 80''), use clock_nanosleep (''-n''), use 10000 us base interval of thread (''-i 1000''), use 1000 loops and then exit (''-l 10000''), lock current and future memory allocations (''-m''). More on clock_nanosleep can be found in its manpage (''man clock_nanosleep''). |
| |
Other examples of the usage of ''cyclictest'': | Other examples of the usage of ''cyclictest'': |
* http://code.goto10.org/projects/puredyne-old/wiki/KernelAndSystemOptimization#TestingandBenchmarking | * https://web.archive.org/web/20130727095507/http://code.goto10.org/projects/puredyne-old/wiki/KernelAndSystemOptimization#TestingandBenchmarking |
* https://rt.wiki.kernel.org/index.php/Cyclictest#Expected_Results | * https://wiki.linuxfoundation.org/realtime/documentation/howto/tools/cyclictest/result-examples |
| |
===== TODO ===== | ===== TODO ===== |
* Power management | * Power management |
* Rewrite rtirq section or move to separate page | * Rewrite rtirq section or move to separate page |
| * Pipewire |