Building your own real-time kernel

Optimize your system for ultimate performance.

Moderators: khz, MattKingUSA

User avatar
autostatic
Established Member
Posts: 1728
Joined: Wed Dec 09, 2009 5:26 pm
Location: Beverwijk, The Netherlands
Contact:

Building your own real-time kernel

Postby autostatic » Thu Sep 20, 2012 6:54 am

Anyone building their own real-time kernels here? If so I'd like to know if people make any changes to the kernel config and if those changes improve the Linux audio experience.

Thanks!

Jeremy

User avatar
khz
Established Member
Posts: 1154
Joined: Thu Apr 17, 2008 6:29 am
Location: German

Re: Building your own real-time kernel

Postby khz » Thu Sep 20, 2012 11:39 am

FZ - Does humor belongs in Music?
GNU/LINUX@AUDIO ~ /Wiki $ Howto.Info && GNU/Linux Debian installing >> Linux Audio Workstation LAW
    I don't care about the freedom of speech because I have nothing to say.

User avatar
autostatic
Established Member
Posts: 1728
Joined: Wed Dec 09, 2009 5:26 pm
Location: Beverwijk, The Netherlands
Contact:

Re: Building your own real-time kernel

Postby autostatic » Thu Sep 20, 2012 12:42 pm

Thanks khz!

Code: Select all

Processor type and features  --->
[*] Tickless System (Dynamic Ticks)

What does using a tickless kernel actually do?

User avatar
khz
Established Member
Posts: 1154
Joined: Thu Apr 17, 2008 6:29 am
Location: German

Re: Building your own real-time kernel

Postby khz » Thu Sep 20, 2012 4:08 pm

good question ^^
current @ my box i have

Code: Select all

[ ] Tickless System (Dynamic Ticks)


Tickless System (Dynamic Ticks) wrote:CONFIG_NO_HZ: │
│ │
│ This option enables a tickless system: timer interrupts will │
│ only trigger on an as-needed basis both when the system is │
│ busy and when the system is idle. │
│ │
│ Symbol: NO_HZ [=n] │
│ Type : boolean │
│ Prompt: Tickless System (Dynamic Ticks) │
│ Defined at kernel/time/Kconfig:7 │
│ Depends on: !ARCH_USES_GETTIMEOFFSET && GENERIC_CLOCKEVENTS [=y] │
│ Location: │
│ -> Processor type and features │
│ Selects: TICK_ONESHOT [=y]


http://elinux.org/Kernel_Timer_Systems#Dynamic_ticks
http://lwn.net/Articles/223185/
FZ - Does humor belongs in Music?
GNU/LINUX@AUDIO ~ /Wiki $ Howto.Info && GNU/Linux Debian installing >> Linux Audio Workstation LAW
    I don't care about the freedom of speech because I have nothing to say.

User avatar
autostatic
Established Member
Posts: 1728
Joined: Wed Dec 09, 2009 5:26 pm
Location: Beverwijk, The Netherlands
Contact:

Re: Building your own real-time kernel

Postby autostatic » Thu Sep 20, 2012 6:48 pm

Ah, it's actually a power saving thingamajig! I thought so already but the links made it clearer, thanks. So it's got almost nothing to do with performance.

User avatar
raboof
Established Member
Posts: 1635
Joined: Tue Apr 08, 2008 11:58 am
Location: Deventer, NL
Contact:

Re: Building your own real-time kernel

Postby raboof » Fri Sep 21, 2012 12:37 pm

AutoStatic wrote:Ah, it's actually a power saving thingamajig! I thought so already but the links made it clearer, thanks. So it's got almost nothing to do with performance.

Well, that's a bit of a bold statement :). For example frequency scaling can have a massive effect on xruns.

I haven't heard of problems with the tickless timer, but I haven't really done any measurements myself either.

User avatar
autostatic
Established Member
Posts: 1728
Joined: Wed Dec 09, 2009 5:26 pm
Location: Beverwijk, The Netherlands
Contact:

Re: Building your own real-time kernel

Postby autostatic » Fri Sep 21, 2012 1:27 pm

raboof wrote:Well, that's a bit of a bold statement :).
He he true, but I don't think it has such an impact as CPU frequency scaling.
raboof wrote:I haven't heard of problems with the tickless timer, but I haven't really done any measurements myself either.
There probably aren't problems with it (rg42 uses it for instance) but I get the idea that people mainly use it on {note,net,ultra}books.

User avatar
raboof
Established Member
Posts: 1635
Joined: Tue Apr 08, 2008 11:58 am
Location: Deventer, NL
Contact:

Re: Building your own real-time kernel

Postby raboof » Fri Sep 21, 2012 6:24 pm

AutoStatic wrote:I get the idea that people mainly use it on {note,net,ultra}books.

All the recent (3.x) debian kernels are built with it enabled, so it can't be too bad :).

User avatar
autostatic
Established Member
Posts: 1728
Joined: Wed Dec 09, 2009 5:26 pm
Location: Beverwijk, The Netherlands
Contact:

Re: Building your own real-time kernel

Postby autostatic » Fri Sep 21, 2012 7:08 pm

Good to know. TIme to check the Debian config :)

User avatar
bluebell
Established Member
Posts: 1130
Joined: Sat Sep 15, 2012 11:44 am
Location: Saarland & Frankfurt, Germany

Re: Building your own real-time kernel

Postby bluebell » Sun Sep 23, 2012 6:27 am

Some days ago I built a realtime kernel using the instructions at
http://joegiampaoli.blogspot.de/2011/06 ... linux.html

I didn't notice a difference to my old kernel (3.0.0 with HZ1000 as the only modification) exept for

- m-audio Fast Track Pro operated in 24 bit mode (but not more reliable). Since I switched to Focusrite Scarlett 2i2 this wasn't important for me.

- I had crashes in the VirtualBox-module. Since I use my PC to start virtual machines this new kernel was useless to me.
Linux – MOTU UltraLite AVB – Qtractor – https://soundcloud.com/suedwestlicht

User avatar
autostatic
Established Member
Posts: 1728
Joined: Wed Dec 09, 2009 5:26 pm
Location: Beverwijk, The Netherlands
Contact:

Re: Building your own real-time kernel

Postby autostatic » Sun Sep 23, 2012 9:29 am

Thanks for bringing that one up bluebell! The instructions to build a kernel are exactly the same but the article does contain some useful information.

User avatar
Michael Z Freeman
Established Member
Posts: 43
Joined: Thu Dec 17, 2009 1:49 pm
Location: England
Contact:

Re: Building your own real-time kernel

Postby Michael Z Freeman » Wed Sep 26, 2012 11:28 am

Did this recently. Spent some time thrashing around as I was approaching the build based on the last time I did this, in 1999 ! Eventually I followed the "Debian way" (see the official docs) of building a kernel based on their patched kernel code retrieved through the Debian package manager.

sudo apt-get source linux
sudo apt-get install build-essential fakeroot
sudo apt-get build-dep linux


(Above may differ depending on Debian OS version, check the official Debian kernel build docs)

Applying patches is easy using "test-patches". Any extra needed kernel symbols are set in "debian/config/featureset-rt/config" - no need to go through xconfig or whatever. I think "test-patches" can be used to build the kernel even if you don't have to apply patches.

bash debian/bin/test-patches -f 686-pae -s rt -j 4 ../alsa-snd-usb-audio-Replace-mixer-for-Electrix-Ebox-44.patch ../alsa-snd-usb-audio-Skip-un-parseable-mixer-units.patch

That will give you a nice debian package to install - your own custom kernel !

User avatar
Michael Z Freeman
Established Member
Posts: 43
Joined: Thu Dec 17, 2009 1:49 pm
Location: England
Contact:

Re: Building your own real-time kernel

Postby Michael Z Freeman » Wed Oct 03, 2012 12:57 pm

I need to follow up on the previous post. Don't know how it is for other distro's but I've had problems finding a SANE way of building the kernel that simply gets things WORKING in my professional production music system studio. But I've cracked it. I've found a SIMPLE way of doing this on a Debian system ...


Here is my email from the debian-user list in reply to the author of the above document ...

Soon after writing this message and after studying your document I
realised I'd forgotten something. As I found there are complexities
such as the revision string that need to be known about, as are
covered in your document, and your document will certainly come in
useful for any future problems !

The thing I forgot is that I originally used test-patches (in
debian/bin). I had the problem with the conflict of revision strings;
test-patches adds "a~test". So I thought, "why not remove this string"
? I ended up editing test-patches ...

# Append 'a~test' to Debian version; this should be less than any official
# successor and easily recognisable
# version="$(dpkg-parsechangelog | sed 's/^Version: //; t; d')"
# if [ "${version%a~test}" = "$version" ]; then
# version="$version"a~test
# dch -v "$version" --distribution UNRELEASED "Testing patches $*"
#fi

I commented out lines 50 to 56. Now test-patches builds the kernel
without the revision string mismatch. I proceeded to install Nvidia
DKMS without any problems (therefore fixing my original problem).

sudo apt-get source linux
cd linux-3.2.23
sudo chown -R djbarney.djbarney *
sudo chown -R djbarney.djbarney .*
Config options added to debian/config/featureset-rt/config
bash debian/bin/test-patches -f 686-pae -s rt -j 4
../alsa-snd-usb-audio-Replace-mixer-for-Electrix-Ebox-44.patch
../alsa-snd-usb-audio-Skip-un-parseable-mixer-units.patch

This builds ...

linux-headers-3.2.0-3-rt-686-pae_3.2.23-1_i386.deb
linux-image-3.2.0-3-rt-686-pae_3.2.23-1_i386.deb
linux-image-3.2.0-3-rt-686-pae-dbg_3.2.23-1_i386.deb

After installing the RT kernel and booting on it I run ...

sudo apt-get install --reinstall nvidia-kernel-dkms

I know this actually creates (I think) a revision string conflict with
official packages. But I can live with that. I just need to reinstall
after any future updates.

Testing currently shows qjackctl (Jack Audio) reporting a working
real-time system, with my external USB audio hardware (the patches for
ebox) with ZERO X-Runs and a 10.7ms latency.

So I seem to have stumbled upon a method that seems to be reserved by
Debian kernel developers for testing patches that actually makes this
process pretty painless. Of course some of this may be dependent on
the current state of Wheezy testing and other Debian kernel policies
that seem to be in flux. Hopefully what I've discovered here can help
other people who need to patch the kernel (to get hardware working,
etc) and encourage the development and documentation of procedures to
make all this a relatively painless process.

Barney Holmes


Quoted from my document.

User avatar
autostatic
Established Member
Posts: 1728
Joined: Wed Dec 09, 2009 5:26 pm
Location: Beverwijk, The Netherlands
Contact:

Re: Building your own real-time kernel

Postby autostatic » Wed Oct 03, 2012 1:25 pm


User avatar
Michael Z Freeman
Established Member
Posts: 43
Joined: Thu Dec 17, 2009 1:49 pm
Location: England
Contact:

Re: Building your own real-time kernel

Postby Michael Z Freeman » Wed Oct 03, 2012 3:36 pm

Yes, thanks. That's another way. My only comment would be that the Debian way basically avoids a lot of the little caveats and technical details that, personally start giving me tunnel vision after a while. Because I can leave most of that that to the Debian developers. The stock Debian kernel is built to run on any machine but it is carefully set up. Development decisions are made by experienced developers about things I probably don't want to know about (and might end up running from the room screaming if I did). This way the kernel is not fully optimised and cut down to size but its good enough. I'm getting good performance on my machine. No X-runs and 10.7ms latency. That's good enough for me and this way takes away a lot of the headaches that might otherwise come up. Hopefully that can help musicians just wanting to make music (and not be stuck fiddling around in config files).

Apologies if that sounds over critical in any way. Some may prefer the more technical path. But I'm concerned that I see some confusion out there about what is the major strength of Linux when it comes to music production ... real time capability, customisation, and on the most part up to date hardware support if one is prepared to wait a little for patches (or can write their own).


Return to “System Tuning and Configuration”

Who is online

Users browsing this forum: No registered users and 1 guest