From 358c2293fabe8c12baa4b9d9788790594cc606a4 Mon Sep 17 00:00:00 2001 From: Hannu Nyman Date: Sun, 12 Jun 2022 20:24:36 +0300 Subject: [PATCH] irqbalance: upstream patch to fix irq-module relation Apply post-1.9.0 patch from upstream to fix the irq-->module relation detection. Signed-off-by: Hannu Nyman --- .../0001-post-190-fix-get-irq-module.patch | 66 +++++++++++++++++++ 1 file changed, 66 insertions(+) create mode 100644 utils/irqbalance/patches/0001-post-190-fix-get-irq-module.patch diff --git a/utils/irqbalance/patches/0001-post-190-fix-get-irq-module.patch b/utils/irqbalance/patches/0001-post-190-fix-get-irq-module.patch new file mode 100644 index 0000000000..5c6cb4ec64 --- /dev/null +++ b/utils/irqbalance/patches/0001-post-190-fix-get-irq-module.patch @@ -0,0 +1,66 @@ +From ff48ac9c84f0b318dfce665605d72e86dfcfe008 Mon Sep 17 00:00:00 2001 +From: Chao Liu +Date: Tue, 7 Jun 2022 15:15:15 +0800 +Subject: [PATCH] get irq->module relationship from /sys/bus/pci/*/driver + +Signed-off-by: Chao Liu +--- + classify.c | 19 +++++++++++++++++-- + 1 file changed, 17 insertions(+), 2 deletions(-) + +--- a/classify.c ++++ b/classify.c +@@ -7,6 +7,7 @@ + #include + #include + #include ++#include + + #include "irqbalance.h" + #include "types.h" +@@ -578,7 +579,7 @@ static int check_for_module_ban(char *na + return 0; + } + +-static int check_for_irq_ban(int irq, GList *proc_interrupts) ++static int check_for_irq_ban(int irq, char *mod, GList *proc_interrupts) + { + struct irq_info find, *res; + GList *entry; +@@ -594,6 +595,9 @@ static int check_for_irq_ban(int irq, GL + /* + * Check to see if we banned module which the irq belongs to. + */ ++ if (mod != NULL && strlen(mod) > 0 && check_for_module_ban(mod)) ++ return 1; ++ + entry = g_list_find_custom(proc_interrupts, &find, compare_ints); + if (entry) { + res = entry->data; +@@ -609,14 +613,25 @@ static void add_new_irq(char *path, stru + struct irq_info *new; + struct user_irq_policy pol; + int irq = hint->irq; ++ char buf[PATH_MAX], drvpath[PATH_MAX]; ++ char *mod = NULL; ++ int ret; + + new = get_irq_info(irq); + if (new) + return; + ++ if (path) { ++ sprintf(buf, "%s/driver", path); ++ ret = readlink(buf, drvpath, PATH_MAX); ++ if (ret > 0 && ret < PATH_MAX) { ++ drvpath[ret] = '\0'; ++ mod = basename(drvpath); ++ } ++ } + /* Set NULL devpath for the irq has no sysfs entries */ + get_irq_user_policy(path, irq, &pol); +- if ((pol.ban == 1) || check_for_irq_ban(irq, proc_interrupts)) { /*FIXME*/ ++ if ((pol.ban == 1) || check_for_irq_ban(irq, mod, proc_interrupts)) { /*FIXME*/ + __add_banned_irq(irq, &banned_irqs); + new = get_irq_info(irq); + } else -- 2.30.2