因为用的
Asterisk板卡太多,电脑的升级换代速度又如此之快的原因吧,经常遇到一些稀奇古怪的问题。中断资源(IRQ)问题是其中一个重要的值得关注的问题。
1、什么是中断IRQ(温习一下计算机原理课程)
IRQ 为 Interrupt
ReQuest的缩写,中文译为中断请求。因为计算机中每个组成组件都会拥有一个独立的IRQ,除了使用PCI总线的PCI卡之外,每一组件都会单独占用
一个 IRQ,且不能重复使用。 注意,这段话说明,PCI总线的PCI卡喜欢分享中断,而不是独占——这就是隐患所在。
中断的工作原理是:由于在计算机运行中,CPU是持续处于忙碌状态,而当硬件接口设备开始或结束收发信息,需要CPU处理信息运算时,便会透过IRQ对
CPU送出中断请求讯号,让CPU储存正在进行的工作,然后暂停手边的工作,先行处理周边硬件提出的需求,这便是中断请求的作用。
在
每个系统中会有两颗芯片来提供16个IRQ(资源有限啊),其中大多的IRQ都有固定的编排,比如 IRQ 0固定为系统定时器,IRQ
1则是键盘,IRQ3和IRQ4是给串口用。因为每一个IRQ只能让一种设备使用,而IRQ数目又十分有限,若计算机安装很多的配件,IRQ势必就会不敷
使用,所以可能会发生两个设备共占同一个IRQ的现象,此时也就会出现IRQ冲突问题,造成该设备无法使用。
最简单的解决方法就是到操作系统的硬件设备管理器中去手动调整IRQ的分配,或是在BIOS中作调整。如果是IRQ不敷使用的情形,可以利用其它的方式来解决此一窘境,像是PCI总线可以共享一个IRQ,所以基本上可以采增加PCI插卡的方式,就不会被IRQ 所限制。
2、Asterisk板卡的中断原理 Asterisk卡是每秒钟发生1000次中断的,每片卡每1ms申请一次中断。(现在新的卡已经可以调中断次数了)。其他语音卡也是类似的,中断次数可能各家不一样。
如果发生的中断次数少于1000次,就是Asterisk中断丢失.。你可以通过用'zttool',查看卡是否发生了中断丢失。
虽然IRQ缺失不会导致报警,但是发生IRQ缺失会出现一些症状,会导致Asterisk不同的问题发生:比如出现很差的声音质量或者PRI错误,DTMF检测不能正常工作等。
3、为什么我的卡有IRQ中断丢失? 导致IRQ丢失的一些常见的原因如下:
-运行 X window system
-共用了IRQs
-没有硬盘驱动器的DMA
-硬盘驱动器的DMA太高(达到udma3)
-运行串行终端或帧缓冲器
对于IRQs共用情况,可以用下面的命令来检查:
cat /proc/interrupts CPU0
引用
0 | 10756672 | XT-PIC timer |
2 | 0 | XT-PIC cascade |
5 | 10812879 | XT-PIC uhci_hcd, uhci_hcd, wctdm |
10 | 226219 | XT-PIC t1xxp, CS46XX |
11 | 1550046 | XT-PIC eth0, nvidia |
12 | 387234 | XT-PIC i8042 |
14 | 32641 | XT-PIC ide0 |
15 | 18 | XT-PIC ide1 |
NMI | 0 | |
LOC | 10757616 | |
ERR | 40481 | |
MIS | 0 | |
在这里您可以看到T100P卡和声卡共用了IRQ,TDM400P卡和USB controller共用了中断。这样很有可能会出问题。如果你不用USB设备倒是没什么。但是最好是disable USB或者让有自己单独的IRQ。
4、怎样解决Asterisk语音板卡的IRQ中断丢失问题 有以下几种方法让板卡有自己的IRQ:
-Turn on APIC
-Tweak BIOS settings
-Try a different PCI slot
-Use setpci
解决中断冲突的常见方法有:
1、调整硬件,能不用的尽量不接到电脑上。常用来解决中断冲突造成的死机和较难排除的IRQ冲突。这个办法就是在主板BIOS默认的IRQ资源分配下,通过调整板卡(声卡、Modem、网卡、电视卡、显卡等)于插槽的安装位置来避开IRQ冲突。
2、在BIOS里做设置,对于某些不太严重的冲突,可以通过调整BIOS设置的软着陆办法,通过调整BIOS中的“PNP/PCIConfiguration”设置项,重新分配IRQ资源,以避开IRQ冲突。
这里有一个英文的:
Verify that your Digium hardware is not sharing an IRQ on your
system. You can accomplish this by running "cat /proc/interrupts". Do
not solely rely on "cat /proc/interrupts" to determine whether your
Digium hardware is sharing an IRQ on your system. Make sure your Digium
hardware is on its own IRQ by itself and that it is taking interrupts.
You can determine whether it is taking interrupts from the 2nd column of
output from "cat /proc/interrupts". This should be something other
than zero. You will also need to verify that your Digium hardware is
not sharing an IRQ by examining the output after running"lspci -v" and
"lspci -vb". Using lspci is the best way to determine whether or not
your Digium hardware is sharing an IRQ on your system. Please verify
that all Digium hardware is on its very own IRQ by itself. You may need
to disable unnecessary hardware on your machine such as sound
controllers, USB controllers, extra ethernet controllers, firewire,
parallel ports, and/or serial ports. You should try moving and swapping
the Digium card to different PCI slots in order to get it on it's own IRQ.
Some BIOS's will allow you to specify an IRQ for each PCI slot and/or
onboard devices.
If you are running an IDE hard drive please verify that you are using
DMA mode with a UDMA setting of no lower than 2 or higher than 3. UDMA
mode 2 is ATA33. UDMA mode 3 is ATA44. This can be done using hdparm.
Digium suggests using "hdparm -d 1 -X udma2 -c 3 /dev/IDE Device". You
can check the status using "hdparm /dev/IDE Device" and "hdparm -i
/dev/IDE Device". If you make modifications to your IDE hard drive
settings they will only be kept until you reboot. You will need to add
the hdparm command you executed to one of your distribution's startup
scripts. This way the IDE hard drive settings will be updated on each
reboot.
You can check whether or not your Digium hardware on your system is
experiencing IRQ misses by using the zttest application which should be
located in yourzaptel source directory. Do not solely rely on zttest to
determine whether you are having IRQ misses with your Digium hardware on
your system. Optimally, we are looking for output of 100% from zttest.
Digium cards will function properly as long as they do not report back less
than 99.98%. Some people have reported no apparent problems with output
as low as 99.975%, while others will have many apparent problems with an
output as low 99.975%. You are almost guaranteed to have many apparent
problems with an output lower than 99.975%. Digium strongly suggest doing
everything possible in order to obtain at least 99.98% output from
zttest. I would watch the output over a 5 minutes period to check for
spikes on intervals. You may also look for IRQ misses using the zttool
application. Do not solely rely on zttool to determine whether you are
having IRQ misses with your Digium hardware on your system. This
application should be built while compiling zaptel. zttool requires the
libnewt development package to be installed on your system in order to
compile properly.
IRQ misses with your Digium hardware can be due to I/O problems on your
system. You may test if you are having I/O problems on your system by
running "hdparm -t /dev/Hard Drive Device". This will causes massive
amounts of I/O on your system. The symptoms of an I/O problem on your
system could be cracklingand/or static on the line while running "hdparm
-t /dev/Hard Drive Device". If you are having an I/O problem on your
system and run this command it could result in dropped calls
temporarily. If you are experiencing those symptoms while running
"hdparm -t /dev/Hard Drive Device" it is likely that you havean I/O
problem on your system. We would suggest using an IDE harddrive rather
than SCSI or SATA in order to configure your hard drive to UDMA2.
Configuring a SCSI or SATA hard drive to UDMA2 is not possible. This is
only possible on an IDE hard drive. Do not solely rely on "hdparm -t
/dev/Hard Drive Device" to determine whether or not you have an I/O
problem on your system.
Please ensure that you are not running X-Windows, frame-buffer, or
serial console, as these will cause problems with our hardware. You can
disable frame-buffer by supplying the "vga=normal" option to your kernel
at boot time. Frame-buffer may start your console with a high
resolution and a logo that is alongthe top of the screen.
如果还有中断丢失问题,你可以设置启动kernel的时候设置参数为 "acpi=off" 和/或者"noapic" ,这样可以禁用ACPI(电源管理)。这个也是常见的中断共享来源之一。
如果你的系统支持超线程(Hyper-Threading),你可以尝试在BIOS里面关掉它,看看是否会对中断冲突问题有改善。
http://www.51asterisk.com/read.php?tid=506&fpage=2