问题描述
当我们使用irq_set_chained_handler时,在为相关处理程序提供服务时(例如request_irq),irq行将不会被禁用.
When we use irq_set_chained_handler the irq line will not be disabled or not, when we are servicing the associated handler, as in case of request_irq.
推荐答案
中断的设置方式无关紧要.当发生任何中断时,将在中断处理程序期间禁用所有中断(对于此CPU).例如,在ARM体系结构中,发现中断处理的C代码中第一位是asm_do_IRQ()
函数(在arch/arm/kernel/irq.c
中定义).它是从汇编代码中调用的.对于任何中断(无论是request_irq()
还是irq_set_chained_handler()
请求的),都调用相同的asm_do_IRQ()
函数,并且ARM CPU自动禁用中断.参见此答案了解详情.
It doesn't matter how the interrupt was setup. When any interrupt occurred, all interrupts (for this CPU) will be disabled during the interrupt handler. For example, on ARM architecture first place in C code where interrupt handling is found is asm_do_IRQ()
function (defined in arch/arm/kernel/irq.c
). It's being called from assembler code. For any interrupt (whether it was requested by request_irq()
or by irq_set_chained_handler()
) the same asm_do_IRQ()
function is called, and interrupts are disabled automatically by ARM CPU. See this answer for details.
另外,值得一提的是,不久前Linux内核提供了两种类型的中断:快速"中断和慢速"中断.快速中断(使用IRQF_DISABLED
或SA_INTERRUPT
标志时)与禁用的中断一起运行,并且那些处理程序应该非常短而快速.另一方面,慢速中断与重新启用的中断一起运行,因为慢速中断的处理程序可能需要花费很多时间来处理.
Also, it worth to be mentioned that some time ago Linux kernel was providing two types of interrupts: "fast" and "slow" ones. Fast interrupts (when using IRQF_DISABLED
or SA_INTERRUPT
flag) were running with disabled interrupts, and those handlers supposed to be very short and quick. Slow interrupts, on the other hand, were running with re-enabled interrupts, because handlers for slow interrupts may take much of time to be handled.
在现代版本的Linux内核上,所有中断都被认为是快速"中断,并且在禁用中断的情况下运行.具有大型处理程序的中断必须以线程方式实现(或使用local_irq_enable_in_hardirq()
在ISR中手动启用中断).
On modern versions of Linux kernel all interrupts are considered as "fast" and are running with interrupts disabled. Interrupts with huge handlers must be implemented as threaded (or enable interrupts manually in ISR using local_irq_enable_in_hardirq()
).
在Linux内核v2.6.35中,该行为已通过此提交.您可以在此处找到更多详细信息.
That behavior was changed in Linux kernel v2.6.35 by this commit. You can find more details about this here.
这篇关于当我们使用irq_set_chained_handler时,irq行是否被禁用?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!