Jackd Preemption Check
since i’m a lazy bugger i just copy and paste my email conversation on this subject. it basically has all the info you need:
from: Robert Jonsson
To: linux-audio-dev@music.columbia.edu
Reply-To: “The Linux Audio Developers’ Mailing List”
Date: Tue, 12 Apr 2005 12:28:21 +0200
Sender: linux-audio-dev-bounces@music.columbia.edu
User-Agent: KMail/1.7.1
Hi,
I recall someone (Lee?) mentioning something along the lines of using a recent kernel with Ingos patches to get feedback on realtime problems of your own code. It sounded very interesting!
Now, I can’t for the life of me find the message, if someone knows anything about this I would very much appreciate some more information, are there any links?
Thanks in advance, Robert
– http://spamatica.se/musicsite/
From: Florian Schmidt
To: “The Linux Audio Developers’ Mailing List”
Date: Tue, 12 Apr 2005 13:01:58 +0200
Sender: linux-audio-dev-bounces@music.columbia.edu
X-Mailer: Sylpheed-Claws 1.0.4 (GTK+ 1.2.10; i386-pc-linux-gnu)
On Tue, 12 Apr 2005 12:28:21 +0200 Robert Jonsson
> Hi,
>
> I recall someone (Lee?) mentioning something along the lines of using a recent
> kernel with Ingos patches to get feedback on realtime problems of your own
> code. It sounded very interesting!
>
> Now, I can’t for the life of me find the message, if someone knows anything
> about this I would very much appreciate some more information, are there any
> links?
>
> Thanks in advance,
> Robert
Hi,
you need a realtime preemptive kernel. Read about them here (i just updated the RP-patch-script to create a current kernel (the realtime lsm version i use is a tad bit older. it should still work though, will update when i come home from university)):
http://www.affenbande.org/~tapas/wiki/index.php?Realtime%20Preemption
You will need to enable user triggered tracing in the kernel hacking section of the kernel config (i just patched up a recent RP kernel and i cannot find the option anymore - anyone please fill me in.. maybe you just need to enable the other tracing mechanisms there and then enable the user triggered tracing via one of the control in /proc/sys/kernel/. Ah damn, that’s what you get for not following kernel development closely)..
You also need to compile jackd (i think you need the CVS version for this) with the
–enable-preemption-check
flag during ./configure
If an app is preempted now during its process() callback it will receive a signal SIGUSR2 (iirc), and since most apps don’t handle this signal, they will exit.. The syslog will contain a report about what exactly triggered the preemption..
Note though that this check is not garanteed to trigger for possibly unsafe code.. It will trigger only if the process really is preempted.
Flo
P.S.: Please correct me and fill in missing details. I will then create a page on my site about this..
– Palimm Palimm! http://affenbande.org/~tapas/
From: Florian Schmidt
To: “The Linux Audio Developers’ Mailing List”
Date: Tue, 12 Apr 2005 18:55:27 +0200
Sender: linux-audio-dev-bounces@music.columbia.edu
X-Mailer: Sylpheed-Claws 1.0.4 (GTK+ 1.2.10; i386-pc-linux-gnu)
On Tue, 12 Apr 2005 13:01:58 +0200 Florian Schmidt
> cannot find the option anymore - anyone please fill me in.. maybe you
> just need to enable the other tracing mechanisms there and then enable
> the user triggered tracing via one of the control in /proc/sys/kernel/.
> Ah damn, that’s what you get for not following kernel development
> closely)..
The control is
/proc/sys/kernel/trace_user_triggered
enable it with
echo 1 > /proc/sys/kernel/trace_user_triggered
I _think_ the relevant kernel config option is “Latency tracing”. For this you need to enable the “Non-preemptible critical section latency timing”. Both in “Kernel hacking”..
Flo
– Palimm Palimm! http://affenbande.org/~tapas/
From: Lee Revell
To: “The Linux Audio Developers’ Mailing List”
Date: Tue, 12 Apr 2005 14:20:37 -0400
Sender: linux-audio-dev-bounces@music.columbia.edu
X-Mailer: Evolution 2.2.1.1
On Tue, 2005-04-12 at 13:01 +0200, Florian Schmidt wrote:
> You will need to enable user triggered tracing in the kernel hacking
> section of the kernel config (i just patched up a recent RP kernel and i
> cannot find the option anymore - anyone please fill me in.. maybe you
> just need to enable the other tracing mechanisms there and then enable
> the user triggered tracing via one of the control in /proc/sys/kernel/.
> Ah damn, that’s what you get for not following kernel development
> closely)
Right, according to Ingo it’s really cheap so is always enabled when tracing is on.
Lee
From: Florian Schmidt
To: “The Linux Audio Developers’ Mailing List”
Date: Tue, 12 Apr 2005 13:33:12 +0200
Sender: linux-audio-dev-bounces@music.columbia.edu
X-Mailer: Sylpheed-Claws 1.0.4 (GTK+ 1.2.10; i386-pc-linux-gnu)
On Tue, 12 Apr 2005 13:01:58 +0200 Florian Schmidt
> Note though that this check is not garanteed to trigger for possibly
> unsafe code.. It will trigger only if the process really is preempted.
This is a small client i once hacked up to test this feature.. As it does an explicit sleep() in the 100th process callback, not getting a preemption report means, that the feature is not enabled in either jack or the kernel. If you do get an output “signalled” then the check is working..
Flo
Compile with g++ -o jack_test jack_test.cc -ljack
Find the client here