# *Possible* problem with interrupts

## Cabalist

Hello All,  I think I *might* have a problem with the interrupts on my computer.  Amarok skips like mad and disk access nukes responsive-ness.  I have just kind of been living with it but after reading some posts on a different subject I thought I would post this and see if I even had a problem.  This is my /proc/interrupts:

```

# cat /proc/interrupts 

           CPU0       

  0:     467645          XT-PIC  timer

  1:       2966          XT-PIC  i8042

  2:          0          XT-PIC  cascade

  5:          0          XT-PIC  ohci_hcd:usb2

  8:          2          XT-PIC  rtc

 10:     117735          XT-PIC  ehci_hcd:usb1, ohci_hcd:usb3, uhci_hcd:usb4, uhci_hcd:usb5, EMU10K1, nvidia

 11:     115434          XT-PIC  acpi, ide2, eth0

 12:      29241          XT-PIC  i8042

 14:         61          XT-PIC  ide0

 15:      20215          XT-PIC  ide1

NMI:          0 

LOC:          0 

ERR:          2

MIS:          0

```

Is this all normal or am should I be worried that my video, audio, and USB2 card all share the same interrupt?

----------

## davidgurvich

The problem is more likely to be with amarok and your USE flags.

Try a different player, perhaps alsaplayer, and see if the problem persists.  If it stops

the problem is with amarok.  Your interrupt table doesn't look abnormal.

----------

## didymos

No, that's normal with PCI and USB, although that is quite a few devices for one interrupt. Can you alter PCI IRQ settings in your BIOS? If so, you can assign IRQs to individual PCI slots. I'm not sure how to handle it if you're dealing with devices built into the motherboard.  You can also disable things like parallel ports,etc. in the BIOS, but it looks like that's taken care of already. If you aren't using a lot of USB devices and the BIOS allows it, you can turn off individual USB controllers. My BIOS doesn't allow it, but yours might.  As a last resort, you can try physically unplugging your PCI cards and sticking them in different slots (although with an AGP card, that probably isn't an option).

But before you get into any of that, you might want to look into the PCI latency settings for your sound and video controllers. Use lspci -v | less at the prompt to find out what the latency of each device is. If you have something with a latency (probably the video card) over 100, that device is eating up a lot of the PCI bus bandwidth. You can either lower the that device's latency, which with a video card can reduce performance, or you can raise the latency of some or all of the other devices. I'd just up the sound controller's latency and see what happens. If other devices don't seem to have any problems, then they don't. If they do, you can up their latency settings. You need to use the setpci command for this:

setpci -v -f  xx:x.x latency_timer=yy

xx:x.x is the bus:slot.function, which you get from lspci. 

yy is the new latency in hexadecimal.

 Latency values range from 0 to 248 so in hex you have 00 to ff (ff is 256, but it'll round down).

 If the new settings work out, you'll want to run the setpci command at startup, otherwise they'll just reset whenever you restart or shutdown.

Thomas S. Howard

----------

## PaulBredbury

I had an issue with emu10k1 and nvidia sharing the same interrupt. The only solution was to physically move the sound card to a different slot. I now have:

```
18:    9127209   IO-APIC-level  ehci_hcd:usb1, uhci_hcd:usb2, uhci_hcd:usb3, uhci_hcd:usb4

19:   10420014   IO-APIC-level  nvidia

20:     712351   IO-APIC-level  EMU10K1

```

----------

## Cabalist

Thanks for all the replies!  After trying the lspci -v I found that most of my devices had a latency of 176(!) and a couple had 248(!!)  NONE of them were below 176.  What is up with that?  I have a modern board and a moderately fast processor.  I added: 

```

#"open up" the PCI bus by allowing fairly long bursts for all devices, increasing performance

setpci -v -d *:* latency_timer=b0

#maximize latency timers for network and audio, allowing them to transmit

#more data per burst, preventing buffer over/underrun conditions

setpci -v -s 00:0c.0 latency_timer=ff

setpci -v -s 00:0d.0 latency_timer=ff

```

to my /etc/conf.d/local.start (restarted) and noticed no change.  I did copy the file verbatim from the original post so I may have applied it to the wrong devices but ALL my card are laggy.  I think I will next try switching interrupts in my bios. Should I just choose them arbitrarilu? or are there certain IRQ numbers for certain things?

 So here is my lspci -v:

```

0000:00:00.0 Host bridge: VIA Technologies, Inc. VT8363/8365 [KT133/KM133] (rev 03)

   Flags: bus master, medium devsel, latency 176

   Memory at d0000000 (32-bit, prefetchable) [size=128M]

   Capabilities: [a0] AGP version 2.0

   Capabilities: [c0] Power Management version 2

0000:00:01.0 PCI bridge: VIA Technologies, Inc. VT8363/8365 [KT133/KM133 AGP] (prog-if 00 [Normal decode])

   Flags: bus master, 66Mhz, medium devsel, latency 0

   Bus: primary=00, secondary=01, subordinate=01, sec-latency=0

   Memory behind bridge: e0000000-e1ffffff

   Prefetchable memory behind bridge: d8000000-dfffffff

   Capabilities: [80] Power Management version 2

0000:00:07.0 ISA bridge: VIA Technologies, Inc. VT82C686 [Apollo Super South] (rev 40)

   Subsystem: VIA Technologies, Inc. VT82C686/A PCI to ISA Bridge

   Flags: bus master, stepping, medium devsel, latency 0

   Capabilities: [c0] Power Management version 2

0000:00:07.1 IDE interface: VIA Technologies, Inc. VT82C586A/B/VT82C686/A/B/VT823x/A/C PIPC Bus Master IDE (rev 06) (prog-if 8a [Master SecP PriP])

   Flags: bus master, medium devsel, latency 176

   I/O ports at 9000 [size=16]

   Capabilities: [c0] Power Management version 2

0000:00:07.2 USB Controller: VIA Technologies, Inc. VT82xxxxx UHCI USB 1.1 Controller (rev 16) (prog-if 00 [UHCI])

   Subsystem: VIA Technologies, Inc. (Wrong ID) USB Controller

   Flags: bus master, medium devsel, latency 176, IRQ 10

   I/O ports at 9400 [size=32]

   Capabilities: [80] Power Management version 2

0000:00:07.3 USB Controller: VIA Technologies, Inc. VT82xxxxx UHCI USB 1.1 Controller (rev 16) (prog-if 00 [UHCI])

   Subsystem: VIA Technologies, Inc. (Wrong ID) USB Controller

   Flags: bus master, medium devsel, latency 176, IRQ 10

   I/O ports at 9800 [size=32]

   Capabilities: [80] Power Management version 2

0000:00:07.4 Host bridge: VIA Technologies, Inc. VT82C686 [Apollo Super ACPI] (rev 40)

   Flags: medium devsel, IRQ 11

   Capabilities: [68] Power Management version 2

0000:00:07.5 Multimedia audio controller: VIA Technologies, Inc. VT82C686 AC97 Audio Controller (rev 50)

   Subsystem: Micro-Star International Co., Ltd. MS-6330 Onboard Audio

   Flags: medium devsel, IRQ 5

   I/O ports at 9c00 [size=256]

   I/O ports at a000 [size=4]

   I/O ports at a400 [size=4]

   Capabilities: [c0] Power Management version 2

0000:00:09.0 Mass storage controller: Promise Technology, Inc. PDC20268 (Ultra100 TX2) (rev 02) (prog-if 85)

   Subsystem: Promise Technology, Inc. Ultra100TX2

   Flags: bus master, 66Mhz, slow devsel, latency 176, IRQ 11

   I/O ports at ac00 [size=8]

   I/O ports at b000 [size=4]

   I/O ports at b400 [size=8]

   I/O ports at b800 [size=4]

   I/O ports at bc00 [size=16]

   Memory at e3000000 (32-bit, non-prefetchable) [size=16K]

   Expansion ROM at 20010000 [disabled] [size=16K]

   Capabilities: [60] Power Management version 1

0000:00:0a.0 USB Controller: NEC Corporation USB (rev 41) (prog-if 10 [OHCI])

   Subsystem: Unknown device 3083:0035

   Flags: bus master, medium devsel, latency 176, IRQ 5

   Memory at e300b000 (32-bit, non-prefetchable) [size=4K]

   Capabilities: [40] Power Management version 2

0000:00:0a.1 USB Controller: NEC Corporation USB (rev 41) (prog-if 10 [OHCI])

   Subsystem: Unknown device 3083:0035

   Flags: bus master, medium devsel, latency 176, IRQ 10

   Memory at e3008000 (32-bit, non-prefetchable) [size=4K]

   Capabilities: [40] Power Management version 2

0000:00:0a.2 USB Controller: NEC Corporation USB 2.0 (rev 02) (prog-if 20 [EHCI])

   Subsystem: Unknown device 3083:00e0

   Flags: bus master, medium devsel, latency 176, IRQ 10

   Memory at e3009000 (32-bit, non-prefetchable) [size=256]

   Capabilities: [40] Power Management version 2

0000:00:0c.0 Multimedia audio controller: Creative Labs SB Audigy (rev 03)

   Subsystem: Creative Labs SB0090 Audigy Player

   Flags: bus master, medium devsel, latency 248, IRQ 10

   I/O ports at c000 [size=32]

   Capabilities: [dc] Power Management version 2

0000:00:0c.1 Input device controller: Creative Labs SB Audigy MIDI/Game port (rev 03)

   Subsystem: Creative Labs SB Audigy MIDI/Game Port

   Flags: bus master, medium devsel, latency 176

   I/O ports at c400 [size=8]

   Capabilities: [dc] Power Management version 2

0000:00:0c.2 FireWire (IEEE 1394): Creative Labs SB Audigy FireWire Port (prog-if 10 [OHCI])

   Subsystem: Creative Labs SB Audigy FireWire Port

   Flags: bus master, medium devsel, latency 176, IRQ 11

   Memory at e300a000 (32-bit, non-prefetchable) [size=2K]

   Memory at e3004000 (32-bit, non-prefetchable) [size=16K]

   Capabilities: [44] Power Management version 2

0000:00:0d.0 Ethernet controller: 3Com Corporation 3c905 100BaseTX [Boomerang]

   Flags: bus master, medium devsel, latency 248, IRQ 11

   I/O ports at c800 [size=64]

   Expansion ROM at 20000000 [disabled] [size=64K]

0000:01:00.0 VGA compatible controller: nVidia Corporation NV20 [GeForce3 Ti 500] (rev a3) (prog-if 00 [VGA])

   Flags: bus master, 66Mhz, medium devsel, latency 176, IRQ 10

   Memory at e0000000 (32-bit, non-prefetchable) [size=16M]

   Memory at d8000000 (32-bit, prefetchable) [size=64M]

   Memory at dc000000 (32-bit, prefetchable) [size=512K]

   Expansion ROM at dc080000 [disabled] [size=64K]

   Capabilities: [60] Power Management version 2

   Capabilities: [44] AGP version 2.0

```

And emerge info for good measure:

```

Portage 2.0.51.22-r3 (default-linux/x86/2005.0, gcc-3.4.4, glibc-2.3.5-r2, 2.6.13-gentoo-r3 i686)

=================================================================

System uname: 2.6.13-gentoo-r3 i686 AMD Athlon(tm) XP

Gentoo Base System version 1.6.13

ccache version 2.3 [enabled]

dev-lang/python:     2.3.4-r1, 2.4.1-r1

sys-apps/sandbox:    1.2.12

sys-devel/autoconf:  2.13, 2.59-r6

sys-devel/automake:  1.4_p6, 1.5, 1.6.3, 1.7.9-r1, 1.8.5-r3, 1.9.6-r1

sys-devel/binutils:  2.15.92.0.2-r10

sys-devel/libtool:   1.5.20

virtual/os-headers:  2.6.11-r2

ACCEPT_KEYWORDS="x86"

AUTOCLEAN="yes"

CBUILD="i686-pc-linux-gnu"

CFLAGS="-O2 -march=athlon-xp -fomit-frame-pointer -pipe -fweb -mtune=athlon-xp -falign-functions=4"

CHOST="i686-pc-linux-gnu"

CONFIG_PROTECT="/etc /usr/kde/2/share/config /usr/kde/3.4/env /usr/kde/3.4/share/config /usr/kde/3.4/shutdown /usr/kde/3/share/config /usr/lib/X11/xkb /usr/share/config /var/qmail/control"

CONFIG_PROTECT_MASK="/etc/gconf /etc/splash /etc/terminfo /etc/env.d"

CXXFLAGS="-O2 -march=athlon-xp -fomit-frame-pointer -pipe -fweb -mtune=athlon-xp -falign-functions=4"

DISTDIR="/usr/portage/distfiles"

FEATURES="autoconfig candy ccache digest distlocks sandbox sfperms strict"

GENTOO_MIRRORS="http://gentoo.llarian.net/ http://open-systems.ufl.edu/mirrors/gentoo http://gentoo.osuosl.org/ http://gentoo.inode.at/"

LC_ALL="en_US.utf8"

LDFLAGS="-Wl,-O1 -Wl,--enable-new-dtags -Wl,--sort-common -z combreloc"

MAKEOPTS="-j3"

PKGDIR="/usr/portage/packages"

PORTAGE_TMPDIR="/var/tmp"

PORTDIR="/usr/portage"

PORTDIR_OVERLAY="/usr/local/portage"

SYNC="rsync://rsync.gentoo.org/gentoo-portage"

USE="x86 3dnow 3dnowext X aac alsa audiofile avi bash-completion bitmap-fonts browserplugin bzip2 cdparanoia cdr dga directfb divx4linux dmx dts dvd dvdread encode fam fbcon firefox flac font-server gdbm gif gpm gstreamer gtk gtk2 hal imlib jack jack-tmpfs java javascript jpeg libg++ libwww mad mikmod mmx mmxext motif mozilla mozsvg mp3 mpeg ncurses nls nptl nvidia offensive ogg oggvorbis opengl pam pcre pdflib perl pic png python quicktime readline real rtc sdl slp sox spell sse ssl svg svga symlink sysfs tcpd tiff truetype truetype-fonts type1-fonts ucs2 unicode usb userlocales vim-with-x visualization vorbis win32codecs wma123 wxwindows xml xml2 xosd xv xvid zlib userland_GNU kernel_linux elibc_glibc"

Unset:  ASFLAGS, CTARGET, LANG, LINGUAS

```

----------

## didymos

Actually, I'd lower the latency on most of your devices to 32 or 64, which is pretty much standard for most hardware. A lot of time, the latency can be 0 and you'll get away with it.  What the high latency setting does is allow a device to monopolize the PCI bus for (relatively speaking) a fairly long time.  Setting latency to lower values means a device will more easily give up it's "turn" on the bus.  I assumed most of your devices would be set to low or even 0 latency, with the sound card and video card having higher latencies. For example, the stuff on my motherboard, all of it built in, defaults to  zero latency. I have one device in a PCI slot,a NIC, and it defaults to 64. 

Thomas S. Howard

----------

## Janne Pikkarainen

Cabalist: It seems that your kernel is not configured to use APIC, LAPIC and/or ACPI. Maybe enabling them helps? Or did you intentionally disable them?

----------

## Cabalist

Well....  Hmm...  I wouldn't say Problem Solved but I am closer.  The increasing of the latency with the setpci commands in my /etc/conf.d/local.start seemed to HURT performance on my system.  After removing those my system skips MUCH less frequently.  Here is a little more info::

1)  Nowhere in BIOS (that I could find) was there a place to set individual IRQs for devices.  There was a check box in the BIOS about a PnP enabled Operating System.  I *thought* that Linux did NOT have Plug 'n Play but I have been enabling it in the kernel forever so I think I was operating on out-dated information and not puttting 2 and 2 together.  I am going to enable it next restart.  Anyone care to confirm this?  

2) I DO have APIC LAPIC IO-APIC and ACPI enabled on my sytem. 

Sound still skips occasionly, though.   Is it just a matter of playing with my setpci command until I find a good latency or is there something else that I can do to make sure my sound card doesn't get pushed to the bottom of the sdcheduler.  

I really appreciated your explanation on latency, didymo, that made things MUCH clearer.

Thanks again everyone for all the help.   :Smile: 

----------

## PaulBredbury

For a responsive & smooth desktop, compile the kernel with:

CONFIG_HZ_1000=y

CONFIG_PREEMPT_VOLUNTARY=y

CONFIG_IOSCHED_CFQ=y (and no other I/O schedulers enabled)In make menuconfig, you can press / to search for an option, to see its location and current setting.

----------

## bollucks

 *Cabalist wrote:*   

> Hello All,  I think I *might* have a problem with the interrupts on my computer.  Amarok skips like mad and disk access nukes responsive-ness.  I have just kind of been living with it but after reading some posts on a different subject I thought I would post this and see if I even had a problem.  This is my /proc/interrupts:
> 
> ```
> 
> # cat /proc/interrupts 
> ...

 

Ignoring interrupts discussion... have you checked dma is on your drives?

----------

## Cabalist

Hey Just wanted to follow up and it looks like the kernel stuff was the greatest help.  I noticed a big difference in the music from moving to 1000 from 250 alongside the voluntary preemption model.  Thanks everybody

----------

## thomas_nj

I can't find CONFIG_PREEMPT_VOLUNTARY in menuconfig. If I just enable it in the .config i get a warning: 

```

scripts/kconfig/mconf arch/i386/Kconfig

#

# using defaults found in .config

#

.config:139:warning: PREEMPT creates inconsistent choice state

*** End of Linux kernel configuration.

*** Execute 'make' to build the kernel or try 'make help'.

```

----------

## PaulBredbury

 *thomas_nj wrote:*   

> I can't find CONFIG_PREEMPT_VOLUNTARY in menuconfig.

 

Go into "make menuconfig". Press "/". Enter "PREEMPT_VOLUNTARY". It's there. The "CONFIG_" bit at the start is just there to confuse you  :Wink: 

----------

