0fc4969b86
Marcin Slusarz reported a ne2k-pci "hung network interface" regression. delayed disable relies on the ability to re-trigger the interrupt in the case that a real interrupt happens after the software disable was set. In this case we actually disable the interrupt on the hardware level _after_ it occurred. On enable_irq, we need to re-trigger the interrupt. On i386 this relies on a hardware resend mechanism (send_IPI_self()). Actually we only need the resend for edge type interrupts. Level type interrupts come back once enable_irq() re-enables the interrupt line. I assume that the interrupt in question is level triggered because it is shared and above the legacy irqs 0-15: 17: 12 IO-APIC-fasteoi eth1, eth0 Looking into the IO_APIC code, the resend via send_IPI_self() happens unconditionally. So the resend is done for level and edge interrupts. This makes the problem more mysterious. The code in question lib8390.c does disable_irq(); fiddle_with_the_network_card_hardware() enable_irq(); The fiddle_with_the_network_card_hardware() might cause interrupts, which are cleared in the same code path again, Marcin found that when he disables the irq line on the hardware level (removing the delayed disable) the card is kept alive. So the difference is that we can get a resend on enable_irq, when an interrupt happens during the time, where we are in the disabled region. Signed-off-by: Ingo Molnar <mingo@elte.hu> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
87 lines
2.0 KiB
C
87 lines
2.0 KiB
C
/*
|
|
* linux/kernel/irq/resend.c
|
|
*
|
|
* Copyright (C) 1992, 1998-2006 Linus Torvalds, Ingo Molnar
|
|
* Copyright (C) 2005-2006, Thomas Gleixner
|
|
*
|
|
* This file contains the IRQ-resend code
|
|
*
|
|
* If the interrupt is waiting to be processed, we try to re-run it.
|
|
* We can't directly run it from here since the caller might be in an
|
|
* interrupt-protected region. Not all irq controller chips can
|
|
* retrigger interrupts at the hardware level, so in those cases
|
|
* we allow the resending of IRQs via a tasklet.
|
|
*/
|
|
|
|
#include <linux/irq.h>
|
|
#include <linux/module.h>
|
|
#include <linux/random.h>
|
|
#include <linux/interrupt.h>
|
|
|
|
#include "internals.h"
|
|
|
|
#ifdef CONFIG_HARDIRQS_SW_RESEND
|
|
|
|
/* Bitmap to handle software resend of interrupts: */
|
|
static DECLARE_BITMAP(irqs_resend, NR_IRQS);
|
|
|
|
/*
|
|
* Run software resends of IRQ's
|
|
*/
|
|
static void resend_irqs(unsigned long arg)
|
|
{
|
|
struct irq_desc *desc;
|
|
int irq;
|
|
|
|
while (!bitmap_empty(irqs_resend, NR_IRQS)) {
|
|
irq = find_first_bit(irqs_resend, NR_IRQS);
|
|
clear_bit(irq, irqs_resend);
|
|
desc = irq_desc + irq;
|
|
local_irq_disable();
|
|
desc->handle_irq(irq, desc);
|
|
local_irq_enable();
|
|
}
|
|
}
|
|
|
|
/* Tasklet to handle resend: */
|
|
static DECLARE_TASKLET(resend_tasklet, resend_irqs, 0);
|
|
|
|
#endif
|
|
|
|
/*
|
|
* IRQ resend
|
|
*
|
|
* Is called with interrupts disabled and desc->lock held.
|
|
*/
|
|
void check_irq_resend(struct irq_desc *desc, unsigned int irq)
|
|
{
|
|
unsigned int status = desc->status;
|
|
|
|
/*
|
|
* Make sure the interrupt is enabled, before resending it:
|
|
*/
|
|
desc->chip->enable(irq);
|
|
|
|
/*
|
|
* Temporary hack to figure out more about the problem, which
|
|
* is causing the ancient network cards to die.
|
|
*/
|
|
if (desc->handle_irq != handle_edge_irq) {
|
|
WARN_ON_ONCE(1);
|
|
return;
|
|
}
|
|
|
|
if ((status & (IRQ_PENDING | IRQ_REPLAY)) == IRQ_PENDING) {
|
|
desc->status = (status & ~IRQ_PENDING) | IRQ_REPLAY;
|
|
|
|
if (!desc->chip || !desc->chip->retrigger ||
|
|
!desc->chip->retrigger(irq)) {
|
|
#ifdef CONFIG_HARDIRQS_SW_RESEND
|
|
/* Set it pending and activate the softirq: */
|
|
set_bit(irq, irqs_resend);
|
|
tasklet_schedule(&resend_tasklet);
|
|
#endif
|
|
}
|
|
}
|
|
}
|