Package: irqbalance
Version: 1.5.0-2
Severity: important
Tag: patch

irqbalance fails to build on hppa because of two reasons:

1.) irqbalance fails to correctly detect the actual CPU count, this is because 
on parisc file like 
/sys/devices/system/cpu/cpu0/online don't exist, instead 
/sys/devices/system/cpu/cpu0/hotplug/state needs to be examimend.

2.) On newer kernels you can't echo 0xfffffff into the files like 
/proc/irq/100/smp_affinity.
This returns EOVERFLOW on newer kernels, which is probably why it fails on 
parisc (we run latest
kernels on the buildd), while other architectures have older kernels.

Attached patch fixes both issues, and it should generate no issues on other 
architectures (instead
it fixes them too if their kernels gets updated),

Please apply for next upload,
Thanks!
Helge

diff -up ./activate.c.org ./activate.c
--- ./activate.c.org	2018-12-29 11:38:19.399024158 +0100
+++ ./activate.c	2018-12-29 11:49:51.929217483 +0100
@@ -88,6 +88,9 @@ static void activate_mapping(struct irq_
 	if (!file)
 		return;
 
+	/* mask only possible cpus, otherwise writing to procfs returns EOVERFLOW */
+	cpus_and(applied_mask, applied_mask, cpu_possible_map);
+
 	cpumask_scnprintf(buf, PATH_MAX, applied_mask);
 	fprintf(file, "%s", buf);
 	fclose(file);
diff -up ./classify.c.org ./classify.c
diff -up ./cputree.c.org ./cputree.c
--- ./cputree.c.org	2018-12-29 03:32:26.269546669 +0100
+++ ./cputree.c	2018-12-29 11:28:06.316150924 +0100
@@ -259,6 +259,10 @@ static void do_one_cpu(char *path)
 	/* skip offline cpus */
 	snprintf(new_path, ADJ_SIZE(path,"/online"), "%s/online", path);
 	file = fopen(new_path, "r");
+	if (!file) {
+		snprintf(new_path, ADJ_SIZE(path,"/hotplug/state"), "%s/hotplug/state", path);
+		file = fopen(new_path, "r");
+	}
 	if (file) {
 		char *line = NULL;
 		size_t size = 0;

Reply via email to