From 4e87047d4a43df3a35460bd4757c7c185d8aedfe Mon Sep 17 00:00:00 2001 From: qinyu Date: Thu, 5 Jan 2023 15:19:38 +0800 Subject: [PATCH] irqbalance: Fix irqbalance cannot obtain the full name of irq Fix irqbalance cannot obtain the full name of irq Signed-off-by: qinyu --- ...e-cannot-obtain-the-full-name-of-irq.patch | 87 +++++++++++++++++++ irqbalance.spec | 9 +- 2 files changed, 95 insertions(+), 1 deletion(-) create mode 100644 backport-Fix-irqbalance-cannot-obtain-the-full-name-of-irq.patch diff --git a/backport-Fix-irqbalance-cannot-obtain-the-full-name-of-irq.patch b/backport-Fix-irqbalance-cannot-obtain-the-full-name-of-irq.patch new file mode 100644 index 0000000..5e50311 --- /dev/null +++ b/backport-Fix-irqbalance-cannot-obtain-the-full-name-of-irq.patch @@ -0,0 +1,87 @@ +From d17bcc953c513f93553f531e5444553f2bf6ca46 Mon Sep 17 00:00:00 2001 +From: liuchao173 <55137861+liuchao173@users.noreply.github.com> +Date: Tue, 27 Apr 2021 15:36:30 +0800 +Subject: [PATCH] Fix irqbalance cannot obtain the full name of irq + +I find some irqs are not banned when I use --banmod. Because the irq desc name in AARCH64 contains space, for example: + 43: 1 0 0 0 ITS-MSI 16384 Edge PCIe PME, aerdrv, pciehp +info->name is "pciehp", so check_for_module_ban returns 0 when I use "--bannmod=aerdrv" + +Reference:https://github.com/Irqbalance/irqbalance/commit/d17bcc953c513f93553f531e5444553f2bf6ca46 +Conflict:NA +--- + procinterrupts.c | 30 ++++++++++++++++++++---------- + 1 file changed, 20 insertions(+), 10 deletions(-) + +diff --git a/procinterrupts.c b/procinterrupts.c +index 854282f..8673f2d 100644 +--- a/procinterrupts.c ++++ b/procinterrupts.c +@@ -148,13 +148,13 @@ static void guess_arm_irq_hints(char *name, struct irq_info *info) + void init_irq_class_and_type(char *savedline, struct irq_info *info, int irq) + { + char *irq_name = NULL; +- char *irq_mod = NULL; + char *savedptr = NULL; + char *last_token = NULL; + char *p = NULL; +- int is_xen_dyn = 0; ++ int is_xen_dyn = 0; + #ifdef AARCH64 + char *tmp = NULL; ++ char irq_fullname[PATH_MAX] = {0}; + #endif + + irq_name = strtok_r(savedline, " ", &savedptr); +@@ -166,30 +166,40 @@ void init_irq_class_and_type(char *savedline, struct irq_info *info, int irq) + if (strstr(irq_name, "xen-dyn") != NULL) + is_xen_dyn = 1; + last_token = p; ++#ifdef AARCH64 ++ /* ++ * /proc/interrupts format defined, after of interrupt type ++ * the reset string is mark the irq desc name. ++ */ ++ if (strncmp(irq_name, "Level", strlen("Level")) == 0 || ++ strncmp(irq_name, "Edge", strlen("Edge")) == 0) ++ break; ++#endif + } + + #ifdef AARCH64 +- irq_name = last_token; +- tmp = strchr(irq_name, '\n'); +- if (tmp) +- *tmp = 0; ++ snprintf(irq_fullname, PATH_MAX, "%s %s", last_token, savedptr); ++ tmp = strchr(irq_fullname, '\n'); ++ if (tmp) ++ *tmp = 0; ++#else ++ snprintf(irq_fullname, PATH_MAX, "%s", last_token); + #endif +- irq_mod = last_token; + info->irq = irq; + +- if (strstr(irq_name, "-event") != NULL && is_xen_dyn == 1) { ++ if (strstr(irq_fullname, "-event") != NULL && is_xen_dyn == 1) { + info->type = IRQ_TYPE_VIRT_EVENT; + info->class = IRQ_VIRT_EVENT; + } else { + #ifdef AARCH64 +- guess_arm_irq_hints(irq_name, info); ++ guess_arm_irq_hints(irq_fullname, info); + #else + info->type = IRQ_TYPE_LEGACY; + info->class = IRQ_OTHER; + #endif + } + info->numa_node = get_numa_node(0); +- info->name = strdup(irq_mod); ++ info->name = strdup(irq_fullname); + } + + GList* collect_full_irq_list() +-- +2.23.0 + diff --git a/irqbalance.spec b/irqbalance.spec index 68b910f..74999fc 100644 --- a/irqbalance.spec +++ b/irqbalance.spec @@ -1,7 +1,7 @@ Summary: A dynamic adaptive IRQ balancing daemon Name: irqbalance Version: 1.7.0 -Release: 11 +Release: 12 Epoch: 3 License: GPLv2 Source0: https://github.com/Irqbalance/irqbalance/archive/irqbalance-%{version}.tar.gz @@ -30,6 +30,7 @@ Patch6005: backport-Add-hot-pull-method-for-irqbalance.patch Patch6006: backport-Also-fetch-node-info-for-non-PCI-devices.patch Patch6007: backport-Hotplug-may-occur-again-during-sleep-so-wait-until-t.patch Patch6008: backport-Add-return-value-check-of-opendir-in-do_one_cpu.patch +Patch6009: backport-Fix-irqbalance-cannot-obtain-the-full-name-of-irq.patch %description Irqbalance is a daemon to help balance the cpu load generated by @@ -87,6 +88,12 @@ fi /sbin/chkconfig --del %{name} >/dev/null 2>&1 || : %changelog +* Thu Jan 5 2023 qinyu - 3:1.7.0-12 +- Type:bugfix +- ID:NA +- SUG:restart +- DESC: Fix irqbalance cannot obtain the full name of irq + * Thu Jan 5 2023 qinyu - 3:1.7.0-11 - Type:bugfix - ID:NA