Glitch free / XRUN free stable workflow at 256 samples - TWEAKS

After days of trying to troubleshoot power/performance/glitching/xruns/memory issues on Fedora Linux Workstation (43, kernel 7), I have finally managed to allow for a musical workflow without worrying abouth technicalities. It took a lot of tweaking and reverting tweaks and searching. Here’s my checklist.
(intel core i7 - 4 physical, 4 virtual cores (4x2)).

I believe this could be translated to other systems easily, since this is a standard / generic minimal nowadays.

Desktop Environment

GNOME/Wayland fractional scaling (anything other than 100, 200, 300x magnification)

  • a source of MEMORY LEAK, which makes XWayland GUI interaction fill up shared memory, memfd and swap very quickly
  • disable and avoid at all costs
gsettings set org.gnome.mutter experimental-features "[]"

BIOS/Firmware

Intel TurboBoost - UEFI/BIOS firmware lock

  • make sure it’s CHECKED
    (incurs energy penalty)
  • coupled with kernel flag (only if firmware unlocked)
echo 0 | sudo tee /sys/devices/system/cpu/intel_pstate/no_turbo

(0 = turbo on)

Even with 8 cores, TurboBoost is the “default” way intel handles CPU performance, unless you really want to go down that rabbit hole

Process priority (permission-based)

rtprio

sudo vi /etc/security/limits.d/99-realtime.conf
sudo usermod -aG pipewire $(whoami)
sudo usermod -aG audio $(whoami)
# 99-realtime.conf
@pipewire   -  rtprio     95
@pipewire   -  memlock    unlimited
@pipewire   -  nice       -10

@audio      -  rtprio     95
@audio      -  memlock    unlimited
@audio      -  nice       -10
  • 70 is not enough
  • 95 is minimum (empirical)

Hardware I/O buffering

Pipewire latency/buffer hard set:

  • allows Ardour to default to managable tracking/recording latency (256 samples I can handle)
  • reasoning: changing latency/buffer on an already running JACK/Pipewire server might desync and/or destabilize the stream, resulting in unexpected behavior
vi ~/.config/pipewire/pipewire.conf.d/10-buffer-limit.conf
# 10-buffer-limit.conf
context.properties = {
    default.clock.quantum = 256
    default.clock.min-quantum = 128
    default.clock.max-quantum = 512
}

Power (tuned and profiles)

On Fedora/RHEL, tuned and tuned-ppd control global power configuration profiles. They replace power-profile-daemon service, although configuration profiles still reference “ppd” here and there.

They control

  1. power profile hints (UI “profile” selector - but only a hint)
  2. cpu governor (the actual CPU frequency bias control)
  3. couple of other settings

They allow for custom profiles, but there are very useful pre-builts such as

  1. throughput-performance (corresponds to default “performance” ppd profile)
  2. balanced (corresponds to default “balance” ppd profile)
tuned-adm list
  • custom profiles are defined under
    /etc/tuned/profiles/$PROFILEDIR/tuned.conf
  • this custom profile can reference a script if you need additional /proc /sys flags to be set (cpupower custom changes, loops, and whatever else scripts do)
    /etc/tuned/profiles/$PROFILEDIR/script.sh (convention)

Enable PERFORMANCE tuned/ppd profile in GNOME Power Mode selector
(naturally, with all of the above, incurs power consumption / thermal penalty)

Services

Disabling unnecessary services (goes without saying) but there are some main “offenders”:

a) plocate-updatedb - search indexer
b) cups - printer daemon
c) journald persistency (rsyslog equivalent) - set to volatile (incurs audit dmesg penalty) this one’s is more of a disk write optimization
d) any *.timer service units non-essential (equivalent to scheduled tasks)

Note that some services include *.socket, *.service and *.timer unit configuration files (editable by hand), but generally, *.service files are the main configuration.

When in doubt, use

systemctl edit $SOMESERVICE".service"

Multitasking

  • Web browsers consume resources - do you need them in the creative flow?
  • Accordingly, disabling radio antennaes (wifi in particular) is not going to hurt

If I missed anything, I’ll add.

Right now, on 9.7.2, for the first time, I got a GUI-glitch free, minimum XRUNS at 256 sample buffer at 48 kHz, with 50% average load in a session with

  • 3 synthesizer plugins
  • 1 FluidSynth plugin (ACE)
  • 1 MPC drum sampler plugin
    (all with elaborate GUIs)
  • 2 reverb busses
  • 2 audio busses for multichannel drum routing

(Removed section on multichannel drum routing; misplaced and incorrect information)


Sanity check

Apart from Ardour having its’ own SanityCheck tool to tell you if your system configuration meets minimum values for sustained workflow, I need to mention couple of things that are not so obvious

Ardour handles graph and policy/connections for the audio/MIDI backend internally

This means you should avoid external applications that create persistent backend patches (Jack, Pipewire graph nodes + connections, aka policy).

Simply patch everything in Ardour, per session, because it sees everything as it is (no internal virtual ports).

With PipeWire, there is a term thrown around called “pro-mode”. As far as I know, this simply means not connecting the main inputs/outputs to two different hardware devices.

This makes sense, since each interface (builtin or external) has its own clock, and it’s neither a good idea in general, nor will it help the backend or Ardour.

That said, there are cases where you would, for example, output everything to a Bluetooth speaker array for surround mixing, but that’s another story.


That’s about it!

2 Likes

Thanks! But do you use this with MIDI tracks or in a live setup? And disabling necessary services, I used to do that but not anymore, haven’t run into issues since. Same goes for WiFi, on my laptop it doesn’t get in the way of the USB audio interface.

From my own experience I’ve found setting the CPU governor to performance, disabling SMT and setting the CPU DMA latency to lowest in the Ardour performance preference window helps the most. And make sure your audio interface is connected to a USB bus that isn’t too crowded, best would be if it has the bus for itself.

Good write-up @ppqn
Setting up Fedora Linux for pro audio is actually fairly easy right out of the box (as you have shown) and very solid once done. There is still a lot of old inaccurate setup instructions out there for Fedora so this fits nicely with modern Fedora. One thing I do differently is I always stay with the Fedora Mate spin. No Wayland to worry about (yet anyway). Yay!

Edit: I always stay one version behind with Fedora (with weekly updates). So the latest bleeding edge release currently is F44. I am on F43 and will remain on it until F45 comes out, then I will upgrade to F44. The latest releases are sometimes “too bleeding edge” for my nerves, so staying one version behind usually provides a very stable experience.

Thanky you for the reply.
I still have some things to figure out, but I tried to keep things simple and distill over time…

a) what is your /dev/cpu_dma_latency POSIX permissions? I’m not sure how to check if cpu_dma_latency is in effect; and do the POSIX permissions persist across system upgrades?

b) you recommend disabling HyperThreading (afaik - SMT); what’s the reasoning/mechanism in short?

Yes, I’ve been seeing a lot of outdated advices, but this is understandable since PipeWire is changing fast. That IS why I relentlessly employed gpts to troubleshoot round and round and round, to the point of not knowing anymore what I actually did.

In short, we do need the latest, no frills configuration, accounting for PipeWire getting smarter on every iteration, and handling a lot of things on its own (this includes systemd service manager handling things in “no-tweaks-needed” mode)

And on Mate spin - I would very much like to get out of GNOME/Wayland, but it has its upsides. I’d do everything in WindowMaker, LOL.

Spot on! I’d say many of these settings are simply necessary to make in any distro(except audio-centric distros, already preconfigured ones).
(I’m running Debian13, xfce, x11 here).
For my old everyday laptop (Fujitsu e746, i5-6300U, 8GB ram,512GB SSD, sometimes integrated audio-sometimes ur22mkII) , there wasn’t even a chance of running Ardour without setting up memory limit, cpu governor and audio buffer (but setting up audio buffer is standard on any os) this way. Now everything works pretty much ok.

I set those with 99-cpu-dma-latency.rules.

And then the paragraph on hyperthreading.

1 Like

I have often wondered if this is only an Intel thing as HyperThreading is unique to Intel. However, AMD CPUs have SMT ( Simultaneous Multithreading). Are these essentially the exact same thing or is SMT safe to use?

The laptop I’m using has an AMD CPU (Ryzen 7 7840HS) and it’s more stable with SMT disabled. Especially at lower latencies.

Yes, they are: Simultaneous multithreading - Wikipedia

I have SMT turned on here and have not noticed any errors to speak of. I like keeping it on mostly so FFMpeg can take advantage of it. Seems I need to do a bit of testing on this.

FWIW I have the Ryzen 7 2700 Eight-Core Processor. Kinda old by now and should upgrade it soon.