BruteFIR and JACK at high priorities?

Optimize your system for ultimate performance.

Moderators: MattKingUSA, khz

lich000king
Established Member
Posts: 7
Joined: Sun Jul 10, 2011 8:50 am

BruteFIR and JACK at high priorities?

Post by lich000king »

Hi

After a lot of trial and error I have managed to get brutefir and jack working together in SCHED_FIFO mode.
The brutefir realtime priorities are 6 (filter processes), 5 (callback process) and 3 (CLI). Jack is running at prio 5 and I have also set up MPD which is currently at prio 2.
This config is working very reliably, no xruns or anything. So there is no immediate need to change anything.

Still, my understanding is, for a system to be stable even at high CPU load, these priorities should be higher.
However, as soon as I compile brutefir with considerably higher prios (e.g. 98,90,75,60 as opposed to 4,3,2,1, but also with values below 50) and run jack at some higher prio (95, say) I get an infinite series of xruns. (I am using the same jack parameters.)

When I use larger period size for jack, xruns may not appear immediately, but they will after some time.

So what is going wrong here? I would expect to get less xruns at higher priorities, is this wrong?

Any help is appreciated!

Best regards
Oliver

P.S.
Currently I am running Linux from Scratch (SVN 20110624) with some bits of BLFS. The described behaviour also appears in VoyageMPD 0.7.0.
Jack is started with "jackd -dalsa -r44100 -dhw:0 -p64 &".
jack version: 0.120.1, brutefir version 1.0k, MPD version: 0.17 git, all built from source, all run as root
thorgal
Established Member
Posts: 739
Joined: Mon Apr 07, 2008 6:04 pm

Re: BruteFIR and JACK at high priorities?

Post by thorgal »

Hello Oliver,

The higher prios you want to set are actually way too high.

jackd should not run higher than ~ 70 (even this value is maybe too high).
If you are using an RT patched kernel or 2.6.39.x with threaded IRQs, you should prioritize your soundcard IRQs and the RTC IRQs as well (higher than sound card).
Here is my IRQ thread prio setting (using the rtirq script from rncbc) :

Code: Select all

  PID CLS RTPRIO  NI PRI %CPU STAT COMMAND
 1029 FF      90   - 130  0.0 S    irq/8-rtc0
 1059 FF      88   - 128  0.2 S    irq/22-hdsp
    3 TS       -   0  38  0.0 S    ksoftirqd/0
    9 TS       -   0  38  0.0 S    ksoftirqd/1
  126 TS       -   0  38  0.0 S    irq/9-acpi
  498 TS       -   0  38  0.0 S    irq/12-i8042
  499 TS       -   0  38  0.0 S    irq/1-i8042
  642 TS       -   0  38  0.0 S    irq/18-ehci_hcd
  652 TS       -   0  38  0.0 S    irq/23-ehci_hcd
  655 TS       -   0  38  0.0 S    irq/16-uhci_hcd
  656 TS       -   0  38  0.0 S    irq/21-uhci_hcd
  659 TS       -   0  38  0.0 S    irq/23-uhci_hcd
  662 TS       -   0  38  0.0 S    irq/19-uhci_hcd
  664 TS       -   0  38  0.0 S    irq/17-pata_mar
  670 TS       -   0  38  0.0 S    irq/18-uhci_hcd
  675 TS       -   0  38  0.0 S    irq/47-ahci
 1054 TS       -   0  38  0.0 S    irq/48-hda_inte
 1409 TS       -   0  37  0.0 S    irq/46-eth1
 1973 TS       -   0  38  0.0 S    irq/16-nvidia
As you can see, I enabled two IRQs to use SCHED_FIFO: the RTC and the soundcard (hdsp) and prioritized them quite high.

Now, if I inspect what process is running sched_fifo:

Code: Select all

~$ ps -Leo comm,class,rtprio | grep FF

migration/0     FF     100 # (don't know what this is, I just saw it ...)
migration/1     FF     100 # kernel (don't know what this is, I just saw it ...)
irq/8-rtc0        FF      90    # kernel
irq/22-hdsp     FF      88  # kernel

# userspace
das_watchdog    FF      99  # highest prio: ensures an RT process won't hang the PC 
das_watchdog    FF       1   # not so important thread in das_watchdog
jackd                   FF      70  # jackd main processing thread
a2jmidid              FF      65   # a2jmidi bridge
vsthost               FF      65   # some other stuff (all below jackd)
dssi-vst-server   FF       1
dssi-vst-server   FF       2
So for your BruteFiR setup, I suggest you revisit your prio settings.
User avatar
funkmuscle
Established Member
Posts: 2800
Joined: Mon Jun 02, 2008 2:30 pm
Has thanked: 129 times
Been thanked: 31 times

Re: BruteFIR and JACK at high priorities?

Post by funkmuscle »

off topic a bit here, just impressed!!
I'm impressed just at the fact of getting BruteFiR to work... WOW!!!... I don't even know where to start with it or even understand it... :shock:
User avatar
Capoeira
Established Member
Posts: 1321
Joined: Tue May 12, 2009 1:01 pm
Location: Brazil
Has thanked: 3 times
Been thanked: 2 times

Re: BruteFIR and JACK at high priorities?

Post by Capoeira »

for what task you use bruteFIR? i've tested it against jconvolver and as far as I can remember BruteFIR was a lot heavier for the CPU (and thus, more x-runs). And jconvolver programed to work with jack. unless you have a specific reason to use BruteFIR try jconvolver, its so easy to configure and works great.
lich000king
Established Member
Posts: 7
Joined: Sun Jul 10, 2011 8:50 am

Re: BruteFIR and JACK at high priorities?

Post by lich000king »

thorgal,

Thank you! I will study this and try it out.
I should have mentioned: I am running kernel 2.6.39.2, compiled with Preemption model: Preemptible Kernel (low latency desktop) and with the threadirqs bootflag set.
Jack runs successfully at -p64, which is the lowest possible latency the soundcard (HDSP 9652) will support. So I guess preemption from the kernel is working reasonably well.

@ Capoeira
BruteFIR is used to do XO/DRC. At present I am running 22 filters (65k taps, double presicion) with 4096,16 partitions at 18 % CPU load (C2D, 1.8Ghz, 1GB RAM). I can go down to 1024,64 which gives 40 % load (not quite sure if this is absolutely stable). 512,128 gives broken pipe.
Actually, I am very satisfied with brutefir, it works really well with jackd1 (once you have figured out how to set it up). I was under the impression brutefir was unbeaten when it comes to high throughput, though I may be wrong.
Maybe I will try jconvolver some time. Right now I would like to tweak the rt priorities to their optimum values. In order to do this I will also have to learn how this whole realtime stuff really works. It's hard to find in-depth information on this.

@ funcmuscle
It's not so hard if you have some linux knowledge and enough time. Have a look at this, if you are interested:
http://www.megaupload.com/?d=KJARAMBX
User avatar
funkmuscle
Established Member
Posts: 2800
Joined: Mon Jun 02, 2008 2:30 pm
Has thanked: 129 times
Been thanked: 31 times

Re: BruteFIR and JACK at high priorities?

Post by funkmuscle »

got the knowledge, just not the time but thanx food the guide... just curious about it as before jconvolver, I tried it but by the time I was starting to figure things out, the creative edge was gone...
User avatar
Capoeira
Established Member
Posts: 1321
Joined: Tue May 12, 2009 1:01 pm
Location: Brazil
Has thanked: 3 times
Been thanked: 2 times

Re: BruteFIR and JACK at high priorities?

Post by Capoeira »

lich000king wrote: BruteFIR is used to do XO/DRC. At present I am running 22 filters
ok, I can't speak for this scenario, as I only use 1 DRC-filter at one time... :D
lich000king
Established Member
Posts: 7
Joined: Sun Jul 10, 2011 8:50 am

Re: BruteFIR and JACK at high priorities?

Post by lich000king »

Ok, I tried rtirq. Unfortunately, it doesn't help.

The output of ps -Leo comm,class,rtprio | grep FF before:

Code: Select all

migration/0     FF      99
migration/1     FF      99
irq/9-acpi      FF      50
irq/14-ata_piix FF      50
irq/15-ata_piix FF      50
irq/18-ehci_hcd FF      50
irq/23-ehci_hcd FF      50
irq/22-uhci_hcd FF      50
irq/21-uhci_hcd FF      50
irq/23-uhci_hcd FF      50
irq/20-uhci_hcd FF      50
irq/21-uhci_hcd FF      50
irq/12-i8042    FF      50
irq/1-i8042     FF      50
irq/8-rtc0      FF      50
irq/20-hdsp     FF      50
irq/42-eth0     FF      50
jackd           FF       5
jackd           FF      20
jackd           FF      10
brutefir        FF       5
brutefir        FF       5
brutefir        FF       6
brutefir        FF       6
brutefir        FF       3
mpd             FF       2
and after:

Code: Select all

migration/0     FF      99
migration/1     FF      99
irq/9-acpi      FF      50
irq/14-ata_piix FF      50
irq/15-ata_piix FF      50
irq/18-ehci_hcd FF      80
irq/23-ehci_hcd FF      79
irq/22-uhci_hcd FF      78
irq/21-uhci_hcd FF      79
irq/23-uhci_hcd FF      77
irq/20-uhci_hcd FF      80
irq/21-uhci_hcd FF      78
irq/12-i8042    FF      74
irq/1-i8042     FF      75
irq/8-rtc0      FF      90
irq/20-hdsp     FF      85
irq/42-eth0     FF      50
rtirt's output:

Code: Select all

Setting IRQ priorities: start [rtc] irq=8 pid=864 prio=90: OK.
Setting IRQ priorities: start [RME Hammerfall HDSP 9652] irq=20 pid=905 prio=85: OK.
Setting IRQ priorities: start [uhci_hcd] irq=20 pid=834 prio=80: OK.
Setting IRQ priorities: start [uhci_hcd] irq=21 pid=826 prio=79: OK.
Setting IRQ priorities: start [uhci_hcd] irq=21 pid=838 prio=78: OK.
Setting IRQ priorities: start [uhci_hcd] irq=22 pid=822 prio=78: OK.
Setting IRQ priorities: start [uhci_hcd] irq=23 pid=830 prio=77: OK.
Setting IRQ priorities: start [ehci_hcd] irq=18 pid=812 prio=80: OK.
Setting IRQ priorities: start [ehci_hcd] irq=23 pid=816 prio=79: OK.
Setting IRQ priorities: start [i8042] irq=1 pid=852 prio=75: OK.
Setting IRQ priorities: start [i8042] irq=12 pid=851 prio=74: OK.
Also, it doesn't help starting/running brutefir/jack at lower priority. The problem appears also when I use prios between 21 and 24! As soon as brutefir starts: nothing but xruns.
User avatar
Capoeira
Established Member
Posts: 1321
Joined: Tue May 12, 2009 1:01 pm
Location: Brazil
Has thanked: 3 times
Been thanked: 2 times

Re: BruteFIR and JACK at high priorities?

Post by Capoeira »

lich000king wrote: and after:

Code: Select all

migration/0     FF      99
migration/1     FF      99
irq/9-acpi      FF      50
irq/14-ata_piix FF      50
irq/15-ata_piix FF      50
irq/18-ehci_hcd FF      80
irq/23-ehci_hcd FF      79
irq/22-uhci_hcd FF      78
irq/21-uhci_hcd FF      79
irq/23-uhci_hcd FF      77
irq/20-uhci_hcd FF      80
irq/21-uhci_hcd FF      78
irq/12-i8042    FF      74
irq/1-i8042     FF      75
irq/8-rtc0      FF      90
irq/20-hdsp     FF      85
irq/42-eth0     FF      50
so your card has the highest prio right after RTC and those migration things.

you got a USB-port at the same IRQ as your card. you tried to isolate you card on a IRQ?
lich000king
Established Member
Posts: 7
Joined: Sun Jul 10, 2011 8:50 am

Re: BruteFIR and JACK at high priorities?

Post by lich000king »

Capoeira wrote: you got a USB-port at the same IRQ as your card. you tried to isolate you card on a IRQ?
Just to be sure, I disabled USB completely in BIOS. Doesn't help...
User avatar
Capoeira
Established Member
Posts: 1321
Joined: Tue May 12, 2009 1:01 pm
Location: Brazil
Has thanked: 3 times
Been thanked: 2 times

Re: BruteFIR and JACK at high priorities?

Post by Capoeira »

I may be wrong but I would try to make priorities like this: RTC0 higher t. SOUNDCARD higher t. JACKD higher t. BruteFIR higher than the rest
lich000king
Established Member
Posts: 7
Joined: Sun Jul 10, 2011 8:50 am

Re: BruteFIR and JACK at high priorities?

Post by lich000king »

Capoeira wrote:I may be wrong but I would try to make priorities like this: RTC0 higher t. SOUNDCARD higher t. JACKD higher t. BruteFIR higher than the rest
I agree. But it doesn't work. As soon as jackd has a priority higher than 6, the xruns start.
If I start jackd with, say -p512 instead of -p64, I get no xruns, at least not immediately.
But I have seen that the system will not be stable anymore, the xruns can kick in any time.

How can raising jack's priority cause these xruns?
Also, raising brutefirs priorities by the same amount doesn't help either. It seems, something is going wrong between brutefir and jack at higher prios.
User avatar
Capoeira
Established Member
Posts: 1321
Joined: Tue May 12, 2009 1:01 pm
Location: Brazil
Has thanked: 3 times
Been thanked: 2 times

Re: BruteFIR and JACK at high priorities?

Post by Capoeira »

sorry, I have no clue

have you tried BruteFIR or home-theater forums?

you could still try jconvolver, it's very fast to set up
lich000king
Established Member
Posts: 7
Joined: Sun Jul 10, 2011 8:50 am

Re: BruteFIR and JACK at high priorities?

Post by lich000king »

sorry, I have no clue
Never mind. I guess I will ask in another place.
Thanks a lot for trying to help!
User avatar
Capoeira
Established Member
Posts: 1321
Joined: Tue May 12, 2009 1:01 pm
Location: Brazil
Has thanked: 3 times
Been thanked: 2 times

Re: BruteFIR and JACK at high priorities?

Post by Capoeira »

btw, why do we have i8042 and USB in our rtirq.config? shouldn't we just have RTC0 and PCI/firewire/USB?
Post Reply