Re-configure a kernel

Kernels & Hardware, configuring network, installing services

Re-configure a kernel

Postby banksidepoet » 2020-07-27 16:52

Hi.

I am attempting to use Rosegarden MIDI software.

Both the software itself, and a developer from the Rosegarden team, tell me my kernel is running at 250Hz timer frequency and needs to run at 1000Hz. This is true whether I use the default kernel (with Buster - 10.4) which is 4.19.0-9-amd64 or the rt version. I have tested this with the command: grep ^CONFIG_HZ /boot/config-`uname -r`

Is it possible to re-configure either the default or rt kernels to just change this single setting? If so, how?

Or do I need to build a custom kernel? Again, if so, how?

Thanks in advance.
banksidepoet
 
Posts: 9
Joined: 2017-10-16 13:27

Re: Re-configure a kernel

Postby Head_on_a_Stick » 2020-07-27 17:16

Black Lives Matter

Debian buster-backports ISO image: for new hardware support
User avatar
Head_on_a_Stick
 
Posts: 12316
Joined: 2014-06-01 17:46
Location: /dev/chair

Re: Re-configure a kernel

Postby banksidepoet » 2020-07-27 19:21

Thank you for that. I had actually found that while searching for a solution. It is a little over my head.

Ubuntu includes pre-built kernel packages with 1000Hz timer frequencies ("low-latency" kernels). I was hoping to find something like that as I'm unfamiliar with the process of rebuilding kernels but... alas.

As a fallback, I was hoping for a reconfigure option which possible provided a menu in which I could make that "single" adjustment. I'd appreciate some dumbed-down advice if it is as straight-forward as that.

Cheers
banksidepoet
 
Posts: 9
Joined: 2017-10-16 13:27

Re: Re-configure a kernel

Postby Head_on_a_Stick » 2020-07-27 19:36

The Liquorix kernels have
Code: Select all
CONFIG_HZ_1000=y
CONFIG_HZ=1000

https://liquorix.net/
Black Lives Matter

Debian buster-backports ISO image: for new hardware support
User avatar
Head_on_a_Stick
 
Posts: 12316
Joined: 2014-06-01 17:46
Location: /dev/chair

Re: Re-configure a kernel

Postby sunrat » 2020-07-27 22:42

I also highly recommend a Liquorix kernel. My audio setup currently has a Liquorix 5.6.x kernel and QJackctl reports latency of 2.8ms which is mostly stable. Can go lower at risk of xruns. I have a Novation MIDI keyboard controller which works well.
Yes you should use JACK for best MIDI performance although it's another layer of learning, albeit not difficult. If you're new to Linux audio you can still try without it to start.
Another option is to use a dedicated media production distro. I highly recommend AVLinux. It has a lot of tweaks to ensure best performance for audio/video production and is based on Debian Buster. It even runs well live straight from a USB drive. The creaky old Systemback installer from the latest version had problems with UEFI on my system though. The developer is currently exploring changing to an MX Linux base partly because MX has a much better snapshot/installer system.
“ computer users can be divided into 2 categories:
Those who have lost data
...and those who have not lost data YET ”
Remember to BACKUP!
User avatar
sunrat
 
Posts: 3125
Joined: 2006-08-29 09:12
Location: Melbourne, Australia

Re: Re-configure a kernel

Postby stevepusser » 2020-07-28 03:47

I also recommend a Liquorix kernel, as long as the user is aware that the 5.7 kernel that they get by default may require they get updates for any out-of-tree drivers they are using, i.e. Nvidia, broadcom-sta-common, Virtualbox, bbswitch, and so on.

The kernel frequency is set in the kernel config file before a build. There are a few GUIs for doing that, but it's easy to set that in a text editor, too. I do it for the MX 19 5.X kernels (AHS edition) and the MX 17/18 4.19 kernels I backport, or the ones I do here, for example: https://build.opensuse.org/package/show ... source-5.6

There's also a 5.7.10 Debian backported kernel there I just added.
The MX Linux repositories: Backports galore! If we don't have something, just ask and we'll try--we like challenges. New packages: LibreOffice 7.0.0, QMPlay2 20.07.04, Pale Moon 28.12.0, KeepassXC 2.6.0, Arqiver 0.6.0+git, Foliate 2.4.2
User avatar
stevepusser
 
Posts: 11891
Joined: 2009-10-06 05:53

Re: Re-configure a kernel

Postby banksidepoet » 2020-07-28 12:02

Thank you all for your replies.

The Liquorix kernel looks interesting. It seems to offer a mix of responsiveness and throughput, something I was concerned about as, when I installed the 4.19 Debian RT kernel, throughput was noticeably slower, to the point of being sluggish for general work).

I'm serious about learning Linux audio and am getting into it big time but it's early days for me. I'm coming into this as someone who has used Debian since "Woody" but have never dug around under the hood much. I use my laptop for my business work as well as my audio hobby and I like the solidity of it. I install "stable" and I stick to it because it NEVER fails me. I do a lot of server stuff: LAMP and graphics stuff. I like that productivity is high and messing with under the hood is low.

However, that said, from my early research into Linux audio I'm hearing again and again that the 250Hz kernel that I get with the standard Buster kernel (and event the rt kernel package) is not going to cut it and I'm going to have to get under that hood.

Here's what I've tried (with some help from Ted Felix):

***
apt-get install linux-source-4.19
cd /usr/src/linux-source-4.19
make defconfig
make nconfig
--> Timer frequency (x hz) --> 1000Hz
--> PREMPT low latency
F6 (save)
F9 (exit)
make deb-pkg
dpkg -i ../linux-headers-4.19.118_4.19.118-1_amd64.deb
dpkg -i ../linux-image-4.19.118_4.19.118-1_amd64.deb
shutdown -r now
***

This got me a kernel with 1000Hz. Didn't get me networking (not even ethernet).

I also tried the above but instead of running defconfig, copied the running config from boot to kernel source folder but then I had errors regarding certificate signing which I couldn't resolve: kernel signing was already disabled in nconfig menus.

Nightmare.

Is it really so awkward just to take a perfectly running kernel and alter a single setting in it?

If I use the Liqourix kernel, will I have the security updates and stability I get from Debian stable? And, if yes, can anyone give me some guidance on how to install it so that the functionality of my laptop (wireless, virtualbox, etc.) remains? In laymans language. If not (and I do understand these issues are not straightforward), I am, for the first time since Woody off to a different Linux distro. Apparently, these things are easy in Ubuntu. Or I may try AV Linux.
banksidepoet
 
Posts: 9
Joined: 2017-10-16 13:27

Re: Re-configure a kernel

Postby LE_746F6D617A7A69 » 2020-07-28 14:33

banksidepoet wrote:Both the software itself, and a developer from the Rosegarden team, tell me my kernel is running at 250Hz timer frequency and needs to run at 1000Hz. This is true whether I use the default kernel (with Buster - 10.4) which is 4.19.0-9-amd64 or the rt version. I have tested this with the command: grep ^CONFIG_HZ /boot/config-`uname -r`

That's not so simple - actually, the "HZ" config for default Debian kernel is:
Code: Select all
$>cat /boot/config-$(uname -r) | grep HZ
CONFIG_NO_HZ_COMMON=y
# CONFIG_HZ_PERIODIC is not set
CONFIG_NO_HZ_IDLE=y
# CONFIG_NO_HZ_FULL is not set
# CONFIG_NO_HZ is not set
# CONFIG_HZ_100 is not set
CONFIG_HZ_250=y
# CONFIG_HZ_300 is not set
# CONFIG_HZ_1000 is not set
CONFIG_HZ=250
CONFIG_MACHZ_WDT=m
You should read about what that other "HZ" options are doing, especially the CONFIG_NO_HZ_IDLE, CONFIG_HZ_PERIODIC and CONFIG_NO_HZ_COMMON, f.e.:
https://www.kernel.org/doc/html/latest/timers/no_hz.html

Setting scheduler interrupt timer to 1000Hz has little to do with the overall system latency - the result can be exactly opposite -> it depends on hardware used, drivers, number of CPU cores and the overall system load.

Did You actually measured the audio latency on Your current setup? - or are You trying to blow everything up just because somebody said that it's a cool idea? ;)

No doubt, the 1000Hz setting can help if You have a 15 years old single-core CPU...
Bill Gates: "(...) In my case, I went to the garbage cans at the Computer Science Center and I fished out listings of their operating system."
The_full_story and Nothing_have_changed
LE_746F6D617A7A69
 
Posts: 280
Joined: 2020-05-03 14:16

Re: Re-configure a kernel

Postby banksidepoet » 2020-07-28 16:13

LE_746F6D617A7A69,

Ah... gold dust to my ears.
No, I'm not trying to blow it up :) (chucking it in the bin did cross my mind...)

Well on that very point, I had a chat with a guy called Ted (a Rosegarden developer) and, while I won't be presumptuous and post what he had to say, I will attach some screenshots I sent him regarding latency values from Qjackctl and from Ardour.

OK, can't do that: "board attachment quota has been reached" - not my day...

The values:

Buster Default Kernel (250Hz)
*************************
Qjackctl
samplrate - 44100
frames - 128
periods - 3 (usb audio interface)
latency - 8.71ms
dsp Load - 1.9%

Ardour
latency - 2.9ms


Buster RT Kernel (250Hz)
*****************************
Qjackctl
samplrate - 44100
frames - 128
periods - 3 (usb audio interface)
latency - 8.71ms
dsp Load - 0.28% (different)

Ardour
latency - 2.9ms


Buster RT Kernel
*******************
Qjackctl
samplrate - 44100
frames - 64 (different)
periods - 3 (usb audio interface)
latency - 4.35ms (different)
dsp Load - 0.28%

Ardour
latency - 1.5ms (different)


How does that look? These values seem OK to me but, again, much disagreement on the Internet about what is acceptable. I've heard "some drummers can hear a delay of 5ms or lower but mere mortals won't" and "anything above 1ms is totally useless" and "anything under a max of 12ms won't be noticed!.

The RT kernel does seem to offer lower latency.

As far as my machine spec goes, it is getting on but reasonable, I think:
Alienware M18 R3
Intel Core i7-4900MQcpu@2.80Ghz
Power Profiling creates average CPU speed of 3.1 Ghz
Quad Core with virtualisation (8 cores)
16GB Ram
Don't know if any of that affects anything? It is what it is.

So... questions.
1. Are the standard kernel values good enough (mainly recording from amp/mic through my audio interface but with some midi keyboard work. Home studio stuff, not endless overlaying)
2. if not, are the RT values good enough (this kernel has slower throughput and slows everything else down a bit (tolerable but noticeable)

Cheers for input.
banksidepoet
 
Posts: 9
Joined: 2017-10-16 13:27

Re: Re-configure a kernel

Postby LE_746F6D617A7A69 » 2020-07-28 17:20

banksidepoet wrote:How does that look? These values seem OK to me but, again, much disagreement on the Internet about what is acceptable. I've heard "some drummers can hear a delay of 5ms or lower but mere mortals won't" and "anything above 1ms is totally useless" and "anything under a max of 12ms won't be noticed!.
Lets see how will it look when we measure the tempo instead of delay:
The worst case: 8.71ms == 0.00871s
Converting this to BPM (beats per minute): (60 * 1 / 0.00871) = 6888.6 BPM - or in other words: if You'll play Whiplash ~30 times faster than normal (*), You'll miss a single beat.

Now show me a drummer who can do this....

The Internet is full of jerks and fanboys - the numbers never lie ;)

(*) EDIT: I couldn't remember the exact BPM for Whiplash, but now I've checked that it was 215, so 6888.6/215=32.04 times faster ;)
Bill Gates: "(...) In my case, I went to the garbage cans at the Computer Science Center and I fished out listings of their operating system."
The_full_story and Nothing_have_changed
LE_746F6D617A7A69
 
Posts: 280
Joined: 2020-05-03 14:16

Re: Re-configure a kernel

Postby banksidepoet » 2020-07-29 09:34

LE_746F6D617A7A69 wrote:The Internet is full of jerks and fanboys


Well, yes. We are all aware of that but I am surprised that in an area such as this which requires a certain level of intelligence, it wouldn't be quite so bad. Poor, naive me.

Right, well that is good news. I can stick with my beloved Debian and make music. I'll chalk those hours of wasted life down to experience and take your advice.

Thanks, buddy.

:)
banksidepoet
 
Posts: 9
Joined: 2017-10-16 13:27


Return to System configuration

Who is online

Users browsing this forum: No registered users and 4 guests

fashionable