1.5. PCI latency

To display information about all PCI buses in your system and all device connected to them, use the lspci utility :


$ lspci
[...]
00:1f.2 SATA controller: Intel Corporation 82801FR/FRW (ICH6R/ICH6RW) SATA Controller (rev 03)
00:1f.3 SMBus: Intel Corporation 82801FB/FBM/FR/FW/FRW (ICH6 Family) SMBus Controller (rev 03)
01:00.0 VGA compatible controller: nVidia Corporation NV41.1 [GeForce 6800] (rev a2)
02:00.0 Ethernet controller: Broadcom Corporation NetXtreme BCM5751 Gigabit Ethernet PCI Express (rev 01)
04:00.0 Multimedia audio controller: Creative Labs SB Audigy (rev 04)
04:00.1 Input device controller: Creative Labs SB Audigy Game Port (rev 04)
04:00.2 FireWire (IEEE 1394): Creative Labs SB Audigy FireWire Port (rev 04)
04:01.0 Multimedia audio controller: Xilinx Corporation RME Hammerfall DSP (rev 97)
      

To obtain information about latency for each bus, use the -v option:


# lspci -v
[...]
04:00.0 Multimedia audio controller: Creative Labs SB Audigy (rev 04)
        Subsystem: Creative Labs Unknown device 2006
        Flags: bus master, medium devsel, latency 176, IRQ 16
        I/O ports at dcc0 [size=64]
        Capabilities: [dc] Power Management version 2
[...]
04:01.0 Multimedia audio controller: Xilinx Corporation RME Hammerfall DSP (rev 97)
        Flags: bus master, medium devsel, latency 255, IRQ 17
        Memory at dcdf0000 (32-bit, non-prefetchable) [size=64K]
      

You can see here that the card I mainly use to work with audio (the RME) has the maximum latency priority.

To modify the priority of a PCI bus, use the setpci command. Pass it the device you want to control (to control my RME latency for example I use 04:01.0), followed by the latency_timer option and the value in hexadecimal notation.

To give the maximum priority to a bus, just do as root:


# setpci -v -s 04:01.0 latency_timer=ff
      

You can use a script like this one to automate this task. Just download it and put it in your /etc/init.d/ directory after updating it to fit you needs. On Debian, you can do the following :


# wget http://www.esaracco.fr/downloads/pcilatency
# vim pcilatency
# chmod 755 pcilatency
# mv pcilatency /etc/init.d/
# cd /etc/init.d/
# update-rc.d pcilatency defaults