Description: Prevent irqbalance from running on HP m800 server cartridge
 On certain platforms like the HP M800 Server cartridge (armhf) running
 irqbalance could cause significant deterioration of network performance.
 The patch disables irqbalance from running on HP m800 server cartridge.
Author: Manoj Iyer <manoj.iyer@canonical.com>
Bug: http://bugs.launchpad.net/bugs/1452875
Forwarded: not-needed
---
This patch header follows DEP-3: http://dep.debian.net/deps/dep3/
--- a/irqbalance.c
+++ b/irqbalance.c
@@ -56,6 +56,37 @@ char *banscript = NULL;
 char *polscript = NULL;
 long HZ;
 
+static int disable_on_hp_m800(void)
+{
+	char tmp[256] = {0x0};
+	const char *platform = "HP ProLiant m800 Server Cartridge";
+	const char *sys_file = "/proc/device-tree/model";
+	FILE *fp;
+
+	if ((fp = fopen(sys_file, "r")) == NULL ) {
+		return 1;
+	}
+
+	if (fread(tmp, 1, sizeof(tmp), fp) == 0) {
+		fclose(fp);
+		log(TO_ALL, LOG_WARNING,
+			"Failed to read file %s.\n", sys_file);
+		return 1;
+	}
+
+	if (strstr(tmp, platform)) {
+		fclose(fp);
+		log(TO_ALL, LOG_WARNING,
+			"Balancing causes degradation of network performance"
+			" on %s. Disabling irqbalance.\n", platform);
+		return 0;
+	}
+
+	if (fp != NULL)
+		fclose(fp);
+	return 1;
+}
+
 void sleep_approx(int seconds)
 {
 	struct timespec ts;
@@ -290,6 +321,10 @@ int main(int argc, char** argv)
 	if (debug_mode)
 		dump_object_tree();
 
+	/* On HP m800 server cartridge irqbalance causes degradation of network
+	 * performance. Prevent irqbalance from running on this platform. */
+	if (!disable_on_hp_m800())
+		exit(EXIT_SUCCESS);
 
 	/* On single core UP systems irqbalance obviously has no work to do */
 	if (core_count<2) {
