Blob Blame History Raw
From 93ed80181e0ce7b81bc88a67fabad1ad829fc460 Mon Sep 17 00:00:00 2001
From: Frediano Ziglio <frediano.ziglio@citrix.com>
Date: Wed, 2 Jul 2014 12:59:34 +0100
Subject: [PATCH 1/1] Balance correctly IRQs reappearing

If IRQ disappears and reappears later (this happens frequently for Xen)
the IRQ is not balanced correctly due to overflow in irq_count (as the
counter got smaller and difference cause overflow).
Rescan if this happens fix the problem.

Signed-off-by: Frediano Ziglio <frediano.ziglio@citrix.com>
---
 procinterrupts.c | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/procinterrupts.c b/procinterrupts.c
index 6a6bdaa..3476473 100644
--- a/procinterrupts.c
+++ b/procinterrupts.c
@@ -181,6 +181,14 @@ void parse_proc_interrupts(void)
 			break;
 		}
 
+		/* IRQ removed and reinserted, need restart or this will
+		 * cause an overflow and IRQ won't be rebalanced again
+		 */
+		if (count < info->irq_count) {
+			need_rescan = 1;
+			break;
+		}
+
 		info->last_irq_count = info->irq_count;		
 		info->irq_count = count;
 
-- 
2.16.1