Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
wiki:system_configuration [2023/10/15 17:06] – [How do I build a real-time audio workstation on Linux?] autostaticwiki:system_configuration [2025/04/13 18:42] (current) – [rtcqs] autostatic
Line 75: Line 75:
  
 === Disabling Spectre and Meltdown mitigations === === Disabling Spectre and Meltdown mitigations ===
-:!: Warning: disabling these mitigations will make your machine less secure! Use with caution!+:!: Warning: Using ''mitigations=off'' will make your machine less secure! Use with caution! For more information on the risks see https://meltdownattack.com/
  
 To work around the Spectre and Meltdown vulnerabilities several mitigations were built into the kernel. These mitigations can have a negative impact on the performance of your machine. To disable those mitigations and get the most out of your CPU's again you can add the following kernel parameter to your Grub configuration, add it to the value of either ''GRUB_CMDLINE_LINUX_DEFAULT'' or  ''GRUB_CMDLINE_LINUX'': To work around the Spectre and Meltdown vulnerabilities several mitigations were built into the kernel. These mitigations can have a negative impact on the performance of your machine. To disable those mitigations and get the most out of your CPU's again you can add the following kernel parameter to your Grub configuration, add it to the value of either ''GRUB_CMDLINE_LINUX_DEFAULT'' or  ''GRUB_CMDLINE_LINUX'':
Line 123: Line 123:
 You should check if the following daemons, services or processes are running, and if so, consider stopping them and/or resort to alternatives: You should check if the following daemons, services or processes are running, and if so, consider stopping them and/or resort to alternatives:
  
-  * CPU frequency scaling daemons that scale the frequency of the CPU depending on the CPU load could cause xruns in some cases. More recent versions of Jack1 (>= 0.118.0) are suffering less from xruns or run xrun free with CPU frequency scaling daemon enabled that's set to a scaling governor like ondemand. A specialized CPU scaling daemon is in the works that depends on the DSP-load instead of the CPU load: [[http://rg42.org/oss/jackfreqd/start|jackfreqd]].+  * CPU frequency scaling that scales the frequency of the CPU depending on the CPU load could cause xruns in some cases. More recent versions of Jack1 (>= 0.118.0) are suffering less from xruns or run xrun free with CPU frequency scaling enabled that's set to a scaling governor like ondemand. A specialized CPU scaling daemon is in the works that depends on the DSP-load instead of the CPU load: [[https://github.com/oleg68/jackfreqd|JackFreqD]].
   * Desktop Environments (DE): especially on less powerful machines it is recommended to use a lighter DE than Gnome, KDE or Unity. Possible alternatives include LXDE, XFCE or IceWM. Another option is to only use a lightweight Window Manager (WM) like Openbox or Fluxbox.   * Desktop Environments (DE): especially on less powerful machines it is recommended to use a lighter DE than Gnome, KDE or Unity. Possible alternatives include LXDE, XFCE or IceWM. Another option is to only use a lightweight Window Manager (WM) like Openbox or Fluxbox.
   * Compositing: same recommendation as for the DE you use. Try to avoid using a compositing manager like Compiz to lower the chance of running into xruns.   * Compositing: same recommendation as for the DE you use. Try to avoid using a compositing manager like Compiz to lower the chance of running into xruns.
Line 216: Line 216:
 The modules and processes differ of course on a per machine basis so first figure out which modules are loaded with ''lsmod'' for instance and then decide which ones you really need. Same for any processes running on your machine, ''ps -ef'' or even ''pstree -p'' could be helpful when looking for unneeded processes. The modules and processes differ of course on a per machine basis so first figure out which modules are loaded with ''lsmod'' for instance and then decide which ones you really need. Same for any processes running on your machine, ''ps -ef'' or even ''pstree -p'' could be helpful when looking for unneeded processes.
  
 +==== Simultaneous Multithreading ====
 +Simultaneous Multithreading (SMT) or hyper-threading can cause spikes in DSP load at higher DSP loads. In such cases it might be beneficial to disable SMT. This can be done by setting the SMT ''control'' flag to ''off''.
 +
 +  echo off | sudo tee /sys/devices/system/cpu/smt/control
 +  
 +See also https://manual.ardour.org/setting-up-your-system/the-right-computer-system-for-digital-audio/ and https://discourse.ardour.org/t/avoiding-hyperthreading/89367/3
 +
 +More information on SMT/hyper-threading: https://en.wikipedia.org/wiki/Simultaneous_multithreading
 ==== Solve IRQ conflicts by unbinding devices ==== ==== Solve IRQ conflicts by unbinding devices ====
  
Line 305: Line 313:
  
 === ext3/ext4 tuning options === === ext3/ext4 tuning options ===
 +
 +Tuning shouldn't be necessary unless you experience IO issues on slower disks.
  
 == noatime == == noatime ==
Line 366: Line 376:
 ==== audio group ==== ==== audio group ====
  
-It is generally good practice to have an ''audio'' group, and add any users that should be allowed to perform audio tasks to this group. This prevents some interference from non-audio-processes with audio tasks. To verify you're in the ''audio'' group, run the ''groups'' command. Remember, after adding yourself to new groups, you need to log out and back in again. Be careful when adding an ''audio'' group to your system: most systems come with a pre-configured ''audio'' group, and do not warn you when you add another group with the same name, leading to much confusion. When using Arch Linux the above is valid too except that Arch uses a different group name, i.e. ''realtime''((https://wiki.archlinux.org/title/Realtime_process_management#Configuring_PAM)).+It is generally good practice to have an ''audio'' group, and add any users that should be allowed to perform audio tasks to this group. This prevents some interference from non-audio-processes with audio tasks. To verify you're in the ''audio'' group, run the ''groups'' command. Remember, after adding yourself to new groups, it is best to log out and back in again. On systems that have an audio group you can add your user with the following command: 
 +  sudo usermod -a -G audio <username> 
 + 
 +Where ''<username>'' is your username. 
 + 
 +Be careful when adding an ''audio'' group to your system: most systems come with a pre-configured ''audio'' group, and do not warn you when you add another group with the same name, leading to much confusion. When using Arch Linux the above is valid too except that Arch uses a different group name, i.e. ''realtime''((https://wiki.archlinux.org/title/Realtime_process_management#Configuring_PAM)).
  
 ==== Timers ==== ==== Timers ====
Line 378: Line 393:
   $ ps axHo user,lwp,pid,rtprio,ni,command   $ ps axHo user,lwp,pid,rtprio,ni,command
  
-  $ ps -eLo pid,cls,rtprio,pri,nice,cmd | grep -i irq+  $ ps -eLo user,pid,cls,rtprio,cmd --sort rtprio
  
 Or if you have [[system_configuration#rtirq]] installed: Or if you have [[system_configuration#rtirq]] installed:
Line 540: Line 555:
 When using FireWire audio interfaces it is generally advised to use a real-time kernel. Of course this is not necessary, there are also users reporting success with generic kernels, but when you have trouble getting your system stable regarding xruns one of the first things besides installing [[system_configuration#rtirq|rtirq]] you might want to try is to [[system_configuration#the_kernel|install or compile a real-time kernel]]. When using FireWire audio interfaces it is generally advised to use a real-time kernel. Of course this is not necessary, there are also users reporting success with generic kernels, but when you have trouble getting your system stable regarding xruns one of the first things besides installing [[system_configuration#rtirq|rtirq]] you might want to try is to [[system_configuration#the_kernel|install or compile a real-time kernel]].
  
 +FireWire devices can be used with FFADO or ALSA, if supported.
  
-==== JuJu FireWire stack ==== 
  
-As of kernel 2.6.37 the legacy FireWire stack has been removed from the kernel sources in favor of the [[https://ieee1394.wiki.kernel.org/index.php/Juju_Migration|JuJu stack]]. If you have FFADO installed it should take care of properly setting up your device(s). Instead of creating a ''/dev/raw1394'' node, the JuJu stack creates nodes per device in ''/dev/'', first device is always ''/dev/fw0''. Take note that the first device is always your controller, not your soundcard. 
  
-To use JACK with your FireWire device(s), set the driver to 'firewire' in QjackCtl or use the ''-dfirewire'' option on the commandline.  
  
 ===== Troubleshooting ===== ===== Troubleshooting =====
Line 555: Line 568:
 The [[https://codeberg.org/rtcqs/rtcqs|rtcqs]] script automatically analyzes your current configuration. This script will make configuration suggestions based on your current setup and link to the relevant sections on this page for background information. The [[https://codeberg.org/rtcqs/rtcqs|rtcqs]] script automatically analyzes your current configuration. This script will make configuration suggestions based on your current setup and link to the relevant sections on this page for background information.
  
-  rtcqs - version 0.5.0+  rtcqs - version 0.6.6
      
   Root User   Root User
Line 561: Line 574:
   [ OK ] Not running as root.   [ OK ] Not running as root.
      
-  Audio Group +  Group Limits 
-  =========== +  ============ 
-  [ OK ] User music is in the audio group.+  [ OK ] User music is member of a group that has sufficient rtprio (95) and memlock (unlimited) limits set.
      
   CPU Frequency Scaling   CPU Frequency Scaling
   =====================   =====================
-  [ OK ] The scaling governor of all CPU'is set at performance.+  [ OK ] The scaling governor of all CPUs is set to performance
 +   
 +  Simultaneous Multithreading 
 +  =========================== 
 +  [ OK ] Simultaneous Multithreading (SMT, also called hyper-threading) is disabled.
      
   Kernel Configuration   Kernel Configuration
Line 583: Line 600:
   Preempt RT   Preempt RT
   ==========   ==========
-  [ OK ] Kernel 5.17.1-rt17 is a real-time kernel.+  [ OK ] Kernel 6.13.8-4-liquorix-amd64 is using threaded IRQs.
      
   Spectre/Meltdown Mitigations   Spectre/Meltdown Mitigations
Line 595: Line 612:
   Swappiness   Swappiness
   ==========   ==========
-  [ OK ] Swappiness is set at 10.+  [ OK ] Your system is configured without swap, setting swappiness does not apply.
      
   Filesystems   Filesystems
   ===========   ===========
-  [ OK ] The following mounts can be used for audio purposes: /, /mnt/data +  [ OK ] The following mounts can be used for audio purposes: /
-  [ WARNING ] The following mounts should be avoided for audio purposes: /run/user/1000/gvfs. See also https://wiki.linuxaudio.org/wiki/system_configuration#filesystems+
      
   IRQs   IRQs
   ====   ====
-  [ OK ] USB port ehci_hcd:usb1 with IRQ 16 does not share its IRQ. +  [ OK ] USB port xhci_hcd with IRQ 45 does not share its IRQ. 
-  USB port ehci_hcd:usb2 with IRQ 23 does not share its IRQ. +  [ OK ] Soundcard snd_hda_intel:card10 with IRQ 91 does not share its IRQ. 
-  USB port xhci_hcd with IRQ 25 does not share its IRQ. +  [ OK ] USB port xhci_hcd with IRQ 43 does not share its IRQ. 
-  Soundcard snd_hda_intel:card10 with IRQ 31 does not share its IRQ.+  [ OK ] Soundcard snd_hda_intel:card11 with IRQ 92 does not share its IRQ. 
 +  [ OK ] USB port xhci_hcd with IRQ 49 does not share its IRQ. 
 +  [ OK ] USB port xhci_hcd with IRQ 47 does not share its IRQ.
      
   Power Management   Power Management
   ================   ================
-  [ OK ] Power management can be controlled from user space. This enables DAW'like Ardour and Reaper to set CPU DMA latency which could help prevent xruns.+  [ OK ] Power management can be controlled from user space. This enables DAWs like Ardour and Reaper to set CPU DMA latency which could help prevent xruns.
  
 Discuss this script at the [[https://linuxmusicians.com/viewtopic.php?f=24&t=24000|LinuxMusicians Forum]] Discuss this script at the [[https://linuxmusicians.com/viewtopic.php?f=24&t=24000|LinuxMusicians Forum]]
wiki/system_configuration.1697382383.txt.gz · Last modified: 2023/10/15 17:06 by autostatic