Re: Hardware latency of firewire controller

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Ismael Valladolid Torres wrote:
My colleague bought a Presonus FP10 firewire audio interface, which
reports working nice in Linux. Moreover he owns a firewire controller
made by Sunix with a Texas Instruments chipset. He tells us that for
having jackd working without xrun and no other artifacts he needs to
use 512 frame/periods, then latency is 34ms, which could be considered
awful as this card is able to work with 2ms latency using other
operating systems.

He checked IRQ and saw that the firewire controller shared IRQ with
the network interface. Check out output of lspci -v .

03:00.0 Ethernet controller: Realtek Semiconductor Co., Ltd.
RTL8111/8168B PCI Express Gigabit Ethernet controller (rev 01)
Subsystem: Giga-byte Technology Unknown device e000
Flags: bus master, fast devsel, latency 0, IRQ 17
I/O ports at a000 [size=256]
Memory at eb000000 (64-bit, non-prefetchable) [size=4K]
[virtual] Expansion ROM at 50000000 [disabled] [size=64K]
Capabilities: <access denied>

04:01.0 FireWire (IEEE 1394): Texas Instruments TSB43AB23
IEEE-1394a-2000 Controller (PHY/Link) (prog-if 10 [OHCI])
Flags: bus master, medium devsel, latency 32, IRQ 17
Memory at ec004000 (32-bit, non-prefetchable) [size=2K]
Memory at ec000000 (32-bit, non-prefetchable) [size=16K]
Capabilities: <access denied>

lspci lists 18 devices and every one of then reports 0 latency except
the firewire controller. And hardware latency is 32ms, very near the
34ms of audio latency reported by jackd. So one could think that if
the firewire controller added no latency, audio latency could be as
low as 2ms. Strange, isn't it?

So it looks that audio latency achievable by jackd is limited by
hardware latency achievable by the firewire controller.
PCI latency is a completely different thing. The 32 is not in milliseconds. For PCI devices that need good latency performance, one should set the PCI latency as high as possible.


He even tried locating a PCI slot that doesn't share IRQ and running
the kernel with the noapic and nolapic options so the system ends
reporting the sound card in the IRQ 11, which is nice. No change,
hardware latency is 32ms in any case.
IRQ sharing is not a good thing, so avoid it as you can. Again the "32" is not easy to interpret correctly. Read the following page to understand it: http://www.reric.net/linux/pci_latency.html


marcel@ubuntu:~$ uname -a
Linux ubuntu 2.6.22-14-rt #1 SMP PREEMPT RT Tue Feb 12 09:57:10 UTC
2008 i686 GNU/Linux

Anything else can be tested? Or should he put back the PCI firewire
controller and buy another? Which one? Any ideas welcome. Personal
answers not to the list also welcome.
The FireWire controller is OK, don't ditch it.

Can you please provide the following information:
1) the output of the attached script (python listirqinfo.py)
2) the full output of lspci -v
3) the jack command line used (if you use qjackctl you can run the following command in a terminal to get the last command line used: "cat ~/.jackdrc"
4) the versions of jack and freebob (assuming you're not using ffado)

That will probably help me fix your issues.

Greets,

Pieter
#!/usr/bin/python
#

#
# Copyright (C) 2008 Pieter Palmers
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, version 3 of the License.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program.  If not, see <http://www.gnu.org/licenses/>.
#

import os
import commands
import re

VERSION="0.2"

class IRQ:
	def __init__(self):
		self.number = None
		self.scheduling_class = None
		self.scheduling_priority = None
		self.process_id = None
		self.drivers = []
		self.cpu_counts = []
	def __str__(self):
		s = " IRQ %4s: PID: %5s, count: %18s, Sched %4s (priority %4s), drivers: %s" % \
		    (self.number, self.process_id, self.cpu_counts,
		     self.scheduling_class, self.scheduling_priority,
		     self.drivers)
		return s

class SoftIRQ:
	def __init__(self):
		self.name = None
		self.fullname = None
		self.scheduling_class = None
		self.scheduling_priority = None
		self.process_id = None
		self.cpu_counts = []
	def __str__(self):
		s = " SoftIRQ %12s: PID %6s, Sched %4s (priority %4s), name: %s" % \
		    (self.name, self.process_id ,self.scheduling_class, self.scheduling_priority, self.fullname)
		return s

def sortedDictValues(adict):
    items = adict.items()
    items.sort()
    return [value for key, value in items]

print ""
print "Interrupt list utility " + VERSION
print "=========================="
print "(C) 2008 Pieter Palmers"
print ""

# get PID info
(exitstatus, outtext) = commands.getstatusoutput('ps -eLo pid,cmd,class,rtprio | grep IRQ')

rawstr = r"""([0-9]+) +\[IRQ-([0-9]+)\] +([A-Z]{2}) +([-0-9]+)"""
compile_obj = re.compile(rawstr)

IRQs = {}
for line in outtext.splitlines():
	match_obj = compile_obj.search(line)
	if match_obj:
		irq = IRQ()
		irq.process_id = int(match_obj.group(1))
		irq.number = int(match_obj.group(2))
		irq.scheduling_class = match_obj.group(3)
		if match_obj.group(4) != '-':
			irq.scheduling_priority = int(match_obj.group(4))
		else:
			irq.scheduling_priority = None
		IRQs[irq.number] = irq

(exitstatus, outtext) = commands.getstatusoutput('ps -eLo pid,cmd,class,rtprio | grep softirq')

rawstr = r"""([0-9]+) +\[softirq-(.*)\] +([A-Z]+) +([-0-9]+)"""
compile_obj = re.compile(rawstr)

softIRQs = {}
for line in outtext.splitlines():
	match_obj = compile_obj.search(line)
	if match_obj:
		irq = SoftIRQ()
		irq.process_id = int(match_obj.group(1))
		irq.name = "%s-%s" % (match_obj.group(2),irq.process_id)
		irq.fullname = "softirq-%s" % match_obj.group(2)
		irq.scheduling_class = match_obj.group(3)
		if match_obj.group(4) != '-':
			irq.scheduling_priority = int(match_obj.group(4))
		else:
			irq.scheduling_priority = None
		softIRQs[irq.name] = irq

# get irq info
(exitstatus, outtext) = commands.getstatusoutput('cat /proc/interrupts')
lines = outtext.splitlines()
nb_cpus = len(lines[0].split())
str0 = "([0-9]+): +";
str_cpu = "([0-9]+) +"
str1="([\w\-]+) +([\w\-, :]+)"

rawstr = str0;
for i in range(nb_cpus):
	rawstr += str_cpu
rawstr += str1
compile_obj = re.compile(rawstr)

for line in outtext.splitlines():
	match_obj = compile_obj.search(line)
	if match_obj:
		irq_number = int(match_obj.group(1))
		if not irq_number in IRQs.keys():
			IRQs[irq_number] = IRQ()
			IRQs[irq_number].number = irq_number
		
		irq = IRQs[irq_number]
		cpu_counts = []
		for i in range(nb_cpus):
			cpu_counts.append(int(match_obj.group(1 + 1)))
		irq.cpu_counts = cpu_counts
		irq.type = match_obj.group(nb_cpus + 2)
		drivers = match_obj.group(nb_cpus + 3).split(',')
		for driver in drivers:
			irq.drivers.append(driver.strip())

		IRQs[irq.number] = irq

print "Hardware Interrupts:"
print "--------------------"

for irq in sortedDictValues(IRQs):
	print irq

print ""
print "Software Interrupts:"
print "--------------------"
for irq in sortedDictValues(softIRQs):
	print irq
	
print ""
_______________________________________________
Linux-audio-user mailing list
Linux-audio-user@xxxxxxxxxxxxxxxxxxxx
http://lists.linuxaudio.org/mailman/listinfo/linux-audio-user

[Index of Archives]     [Linux Sound]     [ALSA Users]     [Pulse Audio]     [ALSA Devel]     [Sox Users]     [Linux Media]     [Kernel]     [Photo Sharing]     [Gimp]     [Yosemite News]     [Linux Media]

  Powered by Linux