[SOLVED] Linux Mint 18.3 : installed lowlatency kernel not running

What other apps and distros do you use to round out your studio?

Moderators: MattKingUSA, khz

jonetsu
Established Member
Posts: 1168
Joined: Sat Jun 11, 2016 12:05 am

[SOLVED] Linux Mint 18.3 : installed lowlatency kernel not running

Postby jonetsu » Fri Jan 11, 2019 12:03 am

It used to work in previous LM versions. Like LM 18, LM 17, LM 16. Install the lowlatency package, reboot, and you're running the lowlatency kernel.

Some people have decided this was not a good idea. So in LM 18.3 they changed that so that when a lowlatency kernel is installed it becomes an entry in a grub submenu. Not even shown on the first grub boot options. Have to select Advanced options then the choice will be offered to run several flavours of the low-latency kernel you've just installed.

I guess it makes sense. To support all those flavours (regular, upstart and recovery mode). They couldn't just put at the top of grub's config the same flavour as the currently running kernel when the package is installed to provide a smooth, expected transition.

So even though it is written 'DO NOT EDIT THIS FILE', I copied the relevant, buried, lowlatency grub entry to the very first position so now the default boot is automatically the recent lowlatency kernel. I presume a proper way would be to put it somehow in a grub default file in /etc although at this point I do not really want to learn about how a default grub config works. I am aware that the grub config file can be reworked next time updates are installed. I ran an update earlier today and found out that it has modified the grub.cfg file. IMHO this is not a so nice thing to do when runnign general updates that does not include a kernel update.

varpa
Established Member
Posts: 432
Joined: Fri Feb 25, 2011 6:40 pm

Re: [SOLVED] Linux Mint 18.3 : installed lowlatency kernel not running

Postby varpa » Fri Jan 11, 2019 3:12 am

I'm running Linux Mint 19 and installed the low-latency kernel and it appears as the first grub entry automatically. So maybe behavior is changed since 18.3(?). I installed kxstudio repositories to get all the the audio apps. I find Mint to be a very nice general OS, but not such a good audio machine. I get a fair number of x-runs, which I believe are due to various processes interrupting audio (like maybe doing a network scan or something). I'll need to spend some time to figure out what the problem(s) are. In contrast my old AVLinux laptop has very few x-runs with no extra tuning. I did not install AVLinux on the new laptop because AVLinux cannot handle the new GPT partition table the new laptop has. If you have any suggestions how to improve Mint audio performance I'd be glad to hear them. Of course, I can go through the LM check list, which I have partly.

jonetsu
Established Member
Posts: 1168
Joined: Sat Jun 11, 2016 12:05 am

Re: [SOLVED] Linux Mint 18.3 : installed lowlatency kernel not running

Postby jonetsu » Fri Jan 11, 2019 3:20 pm

It's nice to know they fixed the problem. At the same time it's a bit distressing that such a problem found its way in the release of a major Open Source project. As if they did not checked it out before releasing, such a basic thing as to choose another kernel provided by them. I did a 18.3 update using the 18.3 Update Manager, update that did not include the kernel, and it messed up the grub configuration regarding something I did that had to do with moving LM17 away from a failing drive. Anyway I'm back at making my own Linux system like I use to do years ago, just to get back into that groove. Those systems where on the minimal side although hopefully I'll be able to build a system up to a major desktop environment and have a 'modern' audio production system running on it.

Haven't customized yet 18.3 to run all audio apps. I do not have xruns on LM 18. Or perhaps one in a while. I started to run LM for audio years ago and at that time I went through optimization with one goal being able to use headphones while recording acoustic guitar w/o any latency problems. So I checked it out by running an audio cable from one output of the soundcard to one of it's input and by running jack_iodelay to measure the latency. That was the first step, to see what's going on. After that there were a series of 'optimizations' and I can't tell presently which one would be more important than the other and how much of an interaction all of these produce to optimize the system. OTOH, I wrote notes at that time.

I'll take this opportunity to quickly go over these notes as I will be doing the same soon for the new LM 18.3. These are provided 'as is'.

The computer is i5-3570 CPU @ 3.40GHz, 16GB RAM, M-Audio 1010LT interface.

For jack_iodelay, if you want to test, some test examples:

Code: Select all

apt-get install jdelay
jack_iodelay
use qjackctl to connect jack_iodelay input and output

Use a RCA cable, only one, mono.  Connect one end to a playback port
and the other end to a capture port.  Launch jack_iodelay.  Connect
using qjackctl.  In this case, the RCA connection is from the
headphone white output jack to the # 6 red input jack of the 1010LT card.

Measurements for kernel 3.13.0-24-generic

stop qjackctl
/usr/bin/jackd -T -ndefault -dalsa -dhw:M1010LT -r44100 -p1024 -n2
configuring for 44100Hz, period = 1024 frames (23.2 ms), buffer = 2 periods
start qjackctl
make connections
jack_iodelay
 3133.532 frames     71.055 ms total roundtrip latency

stop qjackctl
/usr/bin/jackd -T -ndefault -dalsa -dhw:M1010LT -r44100 -p512 -n2
configuring for 44100Hz, period = 512 frames (11.6 ms), buffer = 2 periods
start qjackctl
make connections
jack_iodelay
  1597.528 frames     36.225 ms total roundtrip latency

stop qjackctl
/usr/bin/jackd -T -ndefault -dalsa -dhw:M1010LT -r44100 -p256 -n2
configuring for 44100Hz, period = 256 frames (5.8 ms), buffer = 2 periods
start qjackctl
make connections
jack_iodelay
  829.529 frames     18.810 ms total roundtrip latency


And then a series of customizations.

This one is outdated but the principle might still remain today.

Code: Select all

% apt install linux-tools-common
% apt install linux-tools-4.4.0-72-lowlatency

% cpupower frequency-set -g performance
  Setting cpu: 0
  Setting cpu: 1
  Setting cpu: 2
  Setting cpu: 3


And other customizations:

Code: Select all

3a) Adjustements scaling governor

echo -n performance > /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor
echo -n performance > /sys/devices/system/cpu/cpu1/cpufreq/scaling_governor
echo -n performance > /sys/devices/system/cpu/cpu2/cpufreq/scaling_governor
echo -n performance > /sys/devices/system/cpu/cpu3/cpufreq/scaling_governor


Code: Select all

4) Add real time IRQ prcoessing for the sound card 1010LT

4a) install rtirq-init

4b) In /etc/default/rtirq, put the name of the sound card

   #RTIRQ_NAME_LIST="rtc snd usb i8042"
   #modification, commented above, added below
   RTIRQ_NAME_LIST="snd_ice1712"

4c) check priority (this will be executed automatically at each boot)

   % /etc/init.d/rtirq start
   Setting IRQ priorities: start [snd_ice1712] irq=18 pid=547 prio=90: OK.


This is for using pulse audio along with jackd. I guess it could be optional.

Code: Select all

6a) Install Pulseaudio-module-jack, pavucontrol
   Add to /etc/pulse/default.pa :

   ### Load audio drivers statically
   load-module module-jack-sink
   load-module module-jack-source

6b) Create a ~/.jackdrc file that contains the command line to execute jackd:

      /usr/bin/jackd --sync -T -P95 -ndefault -dalsa -dhw:M1010LT -r44100 -p64 -n4

    It is the loading of these modules by pulseaudio that will result
    in launching jackd automatically at startup


Code: Select all

- In /etc/security/limits.d/audio.conf :
   @audio   -  rtprio     95
   @audio   -  memlock    unlimited

- dpkg-reconfigure -p high jackd

- User is part of the audio group:

   % cat /etc/group | grep audio
   audio:x:29:pulse,mevla


Test example, for priority settings using 'top -H' :

Code: Select all

PR  NI    VIRT    RES    SHR S %CPU %MEM     TIME+ COMMAND
 -6   0 5782316 2,825g 133576 S 18,9 18,4  41:52.87 mixbus-3.1.66
 -6   0 5782316 2,825g 133576 S 18,6 18,4  41:49.34 mixbus-3.1.66
 -6   0 5782316 2,825g 133576 S 18,6 18,4  41:54.50 mixbus-3.1.66
 20   0 1223108 339364 103676 S  5,6  2,1   9:29.98 renoise
 20   0 5782316 2,825g 133576 S  4,0 18,4  11:51.23 mixbus-3.1.66
  9 -11  219472  90804  83556 S  2,7  0,6   5:31.81 jackd
 -6   0 5782316 2,825g 133576 S  2,0 18,4   3:50.16 mixbus-3.1.66


Code: Select all

Installation of rtirq-init

Change the following in /etc/default/rtirq:

#RTIRQ_NAME_LIST="rtc snd usb i8042"
#RTIRQ_NAME_LIST="rtc snd_ice1712"
RTIRQ_NAME_LIST="snd_ice1712"

Then run:
% cd /etc/init.d/
% ./rtirq start
Setting IRQ priorities: start [snd_ice1712] irq=18 pid=547 prio=90: OK.

% chrt -f -p 85 547


Code: Select all

Current:
% cat /proc/irq/18/smp_affinity
f

Modified:
% echo 2 > /proc/irq/18/smp_affinity

% cat /proc/interrupts
        CPU0     CPU1     CPU2    CPU3       
  0:     28        0        0       0  edge      timer
  1:      3        0        0       0  edge      i8042
  4:      0        0        0       2  edge   
  8:      0        1        0       0  edge      rtc0
  9:      0        3        0       0  fasteoi   acpi
 12:      3        1        0       0  edge      i8042
 18: 476281   151882   127790   60568  fasteoi   snd_ice1712
 23:    117    12720     2133      42  fasteoi   ehci_hcd:usb1, ehci_hcd:usb2


% ./rtirq status

  PID CLS RTPRIO  NI PRI %CPU STAT COMMAND
   87 FF      90   - 130  0.0 S    irq/8-rtc0
  547 FF      90   - 130  1.2 S    irq/18-snd_ice1


Misc.

Code: Select all

Identifications

  Sound card

    % lspci
    05:01.0 Multimedia audio controller: VIA Technologies Inc. ICE1712
    [Envy24] PCI Multi-Channel I/O Controller (rev 02)

  Driver
   
   % lsmod | grep -i ICE1712
  snd_ice1712            77824  2

  snd_ice1712 is used in configuring rtirq

varpa
Established Member
Posts: 432
Joined: Fri Feb 25, 2011 6:40 pm

Re: [SOLVED] Linux Mint 18.3 : installed lowlatency kernel not running

Postby varpa » Fri Jan 11, 2019 7:15 pm

Thanks for all the notes. Lots to chew on.


Return to “Linux Distributions & Other Software”

Who is online

Users browsing this forum: No registered users and 1 guest