File balance_irqs_reappearing_correctly.patch of Package irqbalance.2192

From: Frediano Ziglio <frediano.ziglio@citrix.com>
Subject: Balance correctly IRQs reappearing
References: bsc#949276
Patch-Mainline: v1.0.8
Git-commit: 93ed80181e0ce7b81bc88a67fabad1ad829fc460
Git-repo: github.com/Irqbalance/irqbalance.git

Signed-off-by: Thomas Renninger <trenn@suse.de>

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>

Index: irqbalance-1.0.7/procinterrupts.c
===================================================================
--- irqbalance-1.0.7.orig/procinterrupts.c	2013-10-03 17:29:27.000000000 +0200
+++ irqbalance-1.0.7/procinterrupts.c	2016-04-06 12:19:19.266424248 +0200
@@ -180,6 +180,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;