歡迎您光臨本站 註冊首頁

Linux中斷描述符分析

←手機掃碼閱讀     火星人 @ 2014-03-26 , reply:0

在Linux 2.6.19中,中斷描述符結構體irq_desc在include/linux/irq.h文件中定義,其源代碼如下:
QUOTE:
struct irq_desc {
irq_flow_handler_t handle_irq;
struct irq_chip *chip;
void *handler_data;
void *chip_data;
struct irqaction *action;
unsigned int status;

unsigned int depth;
unsigned int wake_depth;
unsigned int irq_count;
unsigned int irqs_unhandled;
spinlock_t lock;
#ifdef CONFIG_SMP
cpumask_t affinity;
unsigned int cpu;
#endif
#if defined(CONFIG_GENERIC_PENDING_IRQ) || defined(CONFIG_IRQBALANCE)
cpumask_t pending_mask;
#endif
#ifdef CONFIG_PROC_FS
struct proc_dir_entry *dir;
#endif
const char *name;
} ____cacheline_aligned;

其中,handle_irq指向該中斷請求的處理函數;chip、handler_data和chip_data用以訪問發出中斷請求的硬體;action指向響應該IRQ的動作鏈表中的第一項;status用以描述IRQ線的狀態;depth和wake_depth指出該IRQ線上的中斷嵌套深度;irq_count和irqs_unhandled指出該IRQ線上中斷請求的數目和未處理的中斷數目,如果最近10萬個中斷中僅處理了不超過100個,則內核會自動禁止來自該線的所有中斷請求;lock為訪問PIC的同步鎖;affinity和cpu在多處理器上使用,用以實現負載均衡;pending_mask用以掛起被負載均衡的中斷;dir指向/proc/irq目錄項;name為/proc/interrupts輸出項的目錄。

[火星人 ] Linux中斷描述符分析已經有194次圍觀

http://coctec.com/docs/linux/show-post-188932.html