From 0db203fb7579b3c784fc9cf26d91aba4179fc152 Mon Sep 17 00:00:00 2001 From: Norman Feske Date: Thu, 12 Sep 2013 21:19:04 +0200 Subject: [PATCH] dde_linux: Limit number of merged IRQs This change makes Irq_context::_handle_one robust against misbehaving IRQ handlers that always return IRQ_HANDLED, specifically dwc_otg. --- dde_linux/src/lib/usb/signal/irq.cc | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/dde_linux/src/lib/usb/signal/irq.cc b/dde_linux/src/lib/usb/signal/irq.cc index fc7072c540..3a7eb6d62e 100644 --- a/dde_linux/src/lib/usb/signal/irq.cc +++ b/dde_linux/src/lib/usb/signal/irq.cc @@ -97,16 +97,19 @@ class Irq_context : public Genode::List::Element bool handled = false; /* - * It might be that the next interrupt triggers right after the device has - * acknowledged the IRQ + * It might be that the next interrupt triggers right after the + * device has acknowledged the IRQ. To reduce per-IRQ context + * switches, we merge up to 'MAX_MERGED_IRQS' calls to the + * interrupt handler. */ - do { + enum { MAX_MERGED_IRQS = 8 }; + for (unsigned i = 0; i < MAX_MERGED_IRQS; i++) { if (h->handler(_irq, h->dev) != IRQ_HANDLED) - return handled; + break; handled = true; - - } while (true); + } + return handled; } /**