Both sides previous revisionPrevious revisionNext revision | Previous revisionNext revisionBoth sides next revision |
wiki:system_configuration [2017/05/29 16:56] – [Disabling resource-intensive daemons, services and processes] autostatic | wiki:system_configuration [2020/03/17 21:15] – [The kernel] autostatic |
---|
=== Note about kernels === | === Note about kernels === |
| |
* Kernels >= 2.6.31 seem to work pretty good without RT patch, also for real-time pro audio usage. It's not strictly necessary anymore to install a real-time ('rt') kernel to get good results. Although the best results are still expected when using a real-time kernel. Try it, test it and decide for yourself. | * Kernels >= 2.6.31 seem to work pretty well without RT patch, also for real-time pro audio usage. It's not strictly necessary anymore to install a real-time ('rt') kernel to get good results. Although the best results are still expected when using a real-time kernel. Try it, test it and decide for yourself. |
* In the pre-2.6.39 kernel era rt kernels were indeed necessary in some cases where sound devices were sharing IRQ's with other peripherals. With the rt kernel and the rtirq script you could prioritize IRQ threads but since 2.6.39 it is possible to use the rtirq kernel with a generic kernel and the ''threadirqs'' kernel option. | * In the pre-2.6.39 kernel era rt kernels were indeed necessary in some cases where sound devices were sharing IRQ's with other peripherals. With the rt kernel and the rtirq script you could prioritize IRQ threads but since 2.6.39 it is possible to use the rtirq kernel with a generic kernel and the ''threadirqs'' kernel option. |
* Many distro kernels, and many third-party-provided real-time kernels, are configured without the 1000 Hz setting. This is not significant for recording, but it can be an issue for live MIDI work if the application you're using does not rely on the ''snd-hrtimer'' kernel module. If your application is live MIDI, using ALSA MIDI and relies on ''/dev/rtc'' (so it doesn't rely on the ''snd-hrtimer'' kernel module), you may well want real-time, but you certainly need 1000 Hz. | * Many distro kernels, and many third-party-provided real-time kernels, are configured without the 1000 Hz setting. This is not significant for recording, but it can be an issue for live MIDI work if the application you're using does not rely on the ''snd-hrtimer'' kernel module. If your application is live MIDI, using ALSA MIDI and relies on ''/dev/rtc'' (so it doesn't rely on the ''snd-hrtimer'' kernel module), you may well want real-time, but you certainly need 1000 Hz. |
Run ''uname -a'' to find out which kernel you're running: | Run ''uname -a'' to find out which kernel you're running: |
| |
Linux xps13 4.8.15-core2-rt10 #1 SMP PREEMPT RT Sun May 28 10:43:44 CEST 2017 x86_64 x86_64 x86_64 GNU/Linux | Linux XPS-13-9360 5.4.24-core2-rt15 #1~bionic1 SMP PREEMPT_RT Tue Mar 17 18:00:29 CET 2020 x86_64 x86_64 x86_64 GNU/Linux |
| |
4.8.15-core2-rt10 is the version number of the currently running kernel. The configuration file with which this kernel was created can be found in ''/boot/config-4.8.15-core2-rt10''. Open it, and check if it has the following characteristics: | 5.4.24-core2-rt15 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.4.24-core2-rt15''. Open it, and check if it has the following characteristics: |
| |
CONFIG_HZ_1000=y | CONFIG_HZ_1000=y |
== Debian == | == Debian == |
| |
Since Debian Wheezy an RT variant is also available in the [[https://packages.debian.org/search?suite=default§ion=all&arch=any&searchon=names&keywords=linux-image-rt|stock repositories]]; unfortunately its system timer is set to 250 Hz instead of 1000 Hz, so you'll probably want to recompile your own kernel anyway, especially if you use ALSA MIDI. These kernels incorporate [[http://pengutronix.de/software/linux-rt/debian_en.html|Pengutronix]] patches (see [[https://wiki.debian.org/DebianMultimedia#Realtime_kernel|DebianMultimedia Wiki]]). The [[http://www.64studio.com/|64 Studio]] real-time kernels are in the backports apt repository, so for Debian Squeeze you will have to add the following line to your apt sources list: | Since Debian Wheezy an RT variant is also available in the [[https://packages.debian.org/search?suite=default§ion=all&arch=any&searchon=names&keywords=linux-image-rt|stock repositories]]; unfortunately its system timer is set to 250 Hz instead of 1000 Hz, so you'll probably want to recompile your own kernel anyway, especially if you use ALSA MIDI. These kernels incorporate [[http://pengutronix.de/software/linux-rt/debian_en.html|Pengutronix]] patches (see [[https://wiki.debian.org/DebianMultimedia#Realtime_kernel|DebianMultimedia Wiki]]). |
| |
deb http://apt.64studio.com/backports squeeze-backports main | |
| |
== Arch == | == Arch == |
== Gentoo == | == Gentoo == |
| |
RT kernels are vailable in the pro-audio overlay (http://proaudio.tuxfamily.org/wiki/index.php?title=Main_Page). | RT kernels are available in the pro-audio overlay (http://proaudio.tuxfamily.org/wiki/index.php?title=Main_Page). |
| |
=== Build your own real-time kernel === | === Build your own real-time kernel === |
sudo apt-get install kernel-package fakeroot build-essential | sudo apt-get install kernel-package fakeroot build-essential |
| |
Download the kernel sources and the RT patchset (this example uses the 3.18 branch, you're free to use another kernel branch for which there is a RT patch set available): | Download the kernel sources and the RT patchset (this example uses the 4.8 branch, you're free to use another kernel branch for which there is a RT patch set available): |
mkdir -p ~/tmp/linux-rt | mkdir -p ~/tmp/linux-rt |
cd ~/tmp/linux-rt | cd ~/tmp/linux-rt |
=== DBus-controlled services === | === DBus-controlled services === |
| |
DBus is a solid standard used for a wide variety of services which need to be started automatically, but on demand only, in the background, not specifically at boot. One set of DBus services used extensively in Ubuntu is 'gvfs', the virtual filesystem for the Gnome desktop; if these are permitted to run, polling of hardware including the USB bus will occur, which is likely to interfere with USB MIDI interfaces, eat CPU power, and cause xruns in general. To disable gvfs, go as root to ''/usr/share/dbus-1/services'', rename ''gvfs-daemon.service'' to ''gvfs-daemon.service.disabled'', and rename ''gvfs-metadata.service'' to ''gvfs-metadata.service.disabled''. | DBus is a solid standard used for a wide variety of services which need to be started automatically, but on demand only, in the background, not specifically at boot. One set of DBus services used extensively in Ubuntu is 'gvfs', the virtual filesystem for the Gnome desktop; if these are permitted to run, polling of hardware including the USB bus will occur, which is likely to interfere with USB MIDI interfaces, eat CPU power, and cause xruns in general. To disable gvfs, become root and run the following two commands: |
| mv /usr/share/dbus-1/servicesgvfs-daemon.service /usr/share/dbus-1/servicesgvfs-daemon.service.disabled |
| mv /usr/share/dbus-1/services/gvfs-metadata.service /usr/share/dbus-1/servicesgvfs-metadata.service.disabled |
| |
=== Hardware support modules === | === Hardware support modules === |
recovery.//"((http://elinux.org/images/b/b6/EMMC-SSD_File_System_Tuning_Methodology_v1.0.pdf)) | recovery.//"((http://elinux.org/images/b/b6/EMMC-SSD_File_System_Tuning_Methodology_v1.0.pdf)) |
| |
You can't use this parameter in ''/etc/fstab'' for the root partition, you will have to set it as a kernel parameter. So when using Grub you can add the following parameter to the ''GRUB_CMDLINE_LINUX_DEFAULT'' line in ''/etc/default/grub'': | You can't use this parameter in ''/etc/fstab'' for the root partition, you will have to set it as a kernel parameter. So when using Grub you can add the following parameter to the ''GRUB_CMDLINE_LINUX'' line in ''/etc/default/grub'': |
rootflags=data=writeback | rootflags=data=writeback |
| |
@audio - memlock unlimited # maximum locked-in-memory address space (KB) | @audio - memlock unlimited # maximum locked-in-memory address space (KB) |
| |
Setting ''memlock'' to ''unlimited'' shouldn't be strictly necessary since most apps would work fine with lower values (such as ''500000'').\\ | Setting ''memlock'' to ''unlimited'' shouldn't be strictly necessary since most apps would work fine with lower values (such as ''500000''). However, certain applications have been reported to complain or even to crash with lower values than ''unlimited''. On the other hand, giving unlimited capability of locking memory can cause buggy applications to temporarily freeze the whole system. See http://www.linuxmusicians.com/viewtopic.php?f=10&t=2193 for more details. |
However, certain applications have been reported to complain or even to crash with lower values than ''unlimited''.\\ | |
On the other hand, giving unlimited capability of locking memory can cause buggy applications to temporarily freeze the whole system.\\ | |
See http://www.linuxmusicians.com/viewtopic.php?f=10&t=2193 for more details. | |
| |
You could also allow the audio group to renice processes with the help of the ''limits.conf'' file, but since nice uses SCHED_OTHER it basically does nothing to increase the performance of a low-latency real-time audio environment that relies on SCHED_FIFO/SCHED_RR. Consult the //sched_setscheduler// manpage for more info on this subject. | You could also allow the audio group to renice processes with the help of the ''limits.conf'' file, but since nice uses SCHED_OTHER it basically does nothing to increase the performance of a low-latency real-time audio environment that relies on SCHED_FIFO/SCHED_RR. Consult the //sched_setscheduler// manpage for more info on this subject. |