I use the Linux kernel v3.10. I have a question about the following code. After the action->handler() function is executed, why should the interruption be determined whether the interruption has been opened, and if it is not opened, it should be closed?
This function comes from Linux kernel v3.10.
irqreturn_t
handle_irq_event_percpu(struct irq_desc *desc, struct irqaction *action)
{
struct pt_regs *regs = get_irq_regs();
u64 ip = regs ? instruction_pointer(regs) : 0;
irqreturn_t retval = IRQ_NONE;
unsigned int flags = 0, irq = desc->irq_data.irq;
do {
irqreturn_t res;
trace_irq_handler_entry(irq, action);
res = action->handler(irq, action->dev_id);
trace_irq_handler_exit(irq, action, res);
/* here is my question */
if (WARN_ONCE(!irqs_disabled(),"irq %u handler %pF enabled interrupts\n",
irq, action->handler))
local_irq_disable();
switch (res) {
case IRQ_WAKE_THREAD:
/*
* Catch drivers which return WAKE_THREAD but
* did not set up a thread function
*/
if (unlikely(!action->thread_fn)) {
warn_no_thread(irq, action);
break;
}
irq_wake_thread(desc, action);
/* Fall through to add to randomness */
case IRQ_HANDLED:
flags |= action->flags;
break;
default:
break;
}
retval |= res;
action = action->next;
} while (action);
#ifndef CONFIG_PREEMPT_RT_FULL
add_interrupt_randomness(irq, flags, ip);
#else
desc->random_ip = ip;
#endif
if (!noirqdebug)
note_interrupt(irq, desc, retval);
return retval;
}
If this is the case, do I still need to add and turn off the interrupt operation in my interrupt callback function? However, the 3rd edition of LDD recommends not to prohibit interrupts as much as possible.