1 From ff48ac9c84f0b318dfce665605d72e86dfcfe008 Mon Sep 17 00:00:00 2001
2 From: Chao Liu <liuchao173@huawei.com>
3 Date: Tue, 7 Jun 2022 15:15:15 +0800
4 Subject: [PATCH] get irq->module relationship from /sys/bus/pci/*/driver
6 Signed-off-by: Chao Liu <liuchao173@huawei.com>
8 classify.c | 19 +++++++++++++++++--
9 1 file changed, 17 insertions(+), 2 deletions(-)
19 #include "irqbalance.h"
21 @@ -578,7 +579,7 @@ static int check_for_module_ban(char *na
25 -static int check_for_irq_ban(int irq, GList *proc_interrupts)
26 +static int check_for_irq_ban(int irq, char *mod, GList *proc_interrupts)
28 struct irq_info find, *res;
30 @@ -594,6 +595,9 @@ static int check_for_irq_ban(int irq, GL
32 * Check to see if we banned module which the irq belongs to.
34 + if (mod != NULL && strlen(mod) > 0 && check_for_module_ban(mod))
37 entry = g_list_find_custom(proc_interrupts, &find, compare_ints);
40 @@ -609,14 +613,25 @@ static void add_new_irq(char *path, stru
42 struct user_irq_policy pol;
44 + char buf[PATH_MAX], drvpath[PATH_MAX];
48 new = get_irq_info(irq);
53 + sprintf(buf, "%s/driver", path);
54 + ret = readlink(buf, drvpath, PATH_MAX);
55 + if (ret > 0 && ret < PATH_MAX) {
56 + drvpath[ret] = '\0';
57 + mod = basename(drvpath);
60 /* Set NULL devpath for the irq has no sysfs entries */
61 get_irq_user_policy(path, irq, &pol);
62 - if ((pol.ban == 1) || check_for_irq_ban(irq, proc_interrupts)) { /*FIXME*/
63 + if ((pol.ban == 1) || check_for_irq_ban(irq, mod, proc_interrupts)) { /*FIXME*/
64 __add_banned_irq(irq, &banned_irqs);
65 new = get_irq_info(irq);