!82 irqbalance: upgrade irqbalance to v1.9.2

From: @chinyu0704 
Reviewed-by: @SuperSix173 
Signed-off-by: @SuperSix173
This commit is contained in:
openeuler-ci-bot 2023-02-01 02:24:23 +00:00 committed by Gitee
commit d4db1b17a7
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
11 changed files with 145 additions and 273 deletions

View File

@ -1,31 +0,0 @@
From 522883505d3b02e3294f045f49007b61c00e2c31 Mon Sep 17 00:00:00 2001
From: Chao Liu <liuchao173@huawei.com>
Date: Wed, 8 Jun 2022 10:04:02 +0800
Subject: [PATCH] check whether savedptr is NULL before invoking strlen
Reference: https://github.com/Irqbalance/irqbalance/commit/522883505d3b02e3294f045f49007b61c00e2c31
Conflict: NA
savedptr can be null in musl libc, so the strlen(NULL) will segfault
Signed-off-by: Chao Liu <liuchao173@huawei.com>
---
procinterrupts.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/procinterrupts.c b/procinterrupts.c
index 9015177..57c8801 100644
--- a/procinterrupts.c
+++ b/procinterrupts.c
@@ -178,7 +178,7 @@ void init_irq_class_and_type(char *savedline, struct irq_info *info, int irq)
}
#ifdef AARCH64
- if (strlen(savedptr) > 0) {
+ if (savedptr && strlen(savedptr) > 0) {
snprintf(irq_fullname, PATH_MAX, "%s %s", last_token, savedptr);
tmp = strchr(irq_fullname, '\n');
if (tmp)
--
2.33.0

View File

@ -1,76 +0,0 @@
From bbcd9a42c3cec0935b960b7f2046f1fdfab4f7ef Mon Sep 17 00:00:00 2001
From: Vignesh Raghavendra <vigneshr@ti.com>
Date: Wed, 7 Dec 2022 19:46:19 +0530
Subject: [PATCH] procinterrupts: Fix IRQ name parsing on certain arm64 SoC
Reference: https://github.com/Irqbalance/irqbalance/commit/bbcd9a42c3cec0935b960b7f2046f1fdfab4f7ef
Conflict: NA
On arm64 SoCs like TI's K3 SoC and few other SoCs, IRQ names don't get
parsed correct due to which they end up being classified into wrong
class. Fix this by considering last token to contain IRQ name always.
Eg.: /proc/interrupt
cat /proc/interrupts
CPU0 CPU1 CPU2 CPU3
11: 7155 8882 7235 7791 GICv3 30 Level arch_timer
14: 0 0 0 0 GICv3 23 Level arm-pmu
15: 0 0 0 0 GICv3 208 Level 4b00000.spi
16: 0 0 0 0 GICv3 209 Level 4b10000.spi
116: 0 0 0 0 MSI-INTA 1716234 Level 485c0100.dma-controller chan6
134: 166 0 0 0 MSI-INTA 1970707 Level 8000000.ethernet-tx0
224: 149 0 0 0 MSI-INTA 1971731 Level 8000000.ethernet
W/o patch irqbalance -d
IRQ (11) guessed as class 0
IRQ (14) guessed as class 0
IRQ (15) guessed as class 0
IRQ (16) guessed as class 0
IRQ 485c0100.dma-controller chan6(116) guessed as class 0
IRQ (134) guessed as class 0
IRQ (224) guessed as class 0
W/ this patch
IRQ arch_timer(11) guessed as class 0
IRQ arm-pmu(14) guessed as class 0
IRQ 4b00000.spi(15) guessed as class 0
IRQ 4b10000.spi(16) guessed as class 0
IRQ 485c0100.dma-controller chan6(116) guessed as class 0
IRQ 8000000.ethernet-tx0(134) guessed as class 5
IRQ 8000000.ethernet(224) guessed as class 5
IRQ 8000000.ethernet(257) guessed as class 5
IRQ -davinci_gpio wl18xx(362) guessed as class
Signed-off-by: Vignesh Raghavendra <vigneshr@ti.com>
---
procinterrupts.c | 12 +++++++-----
1 file changed, 7 insertions(+), 5 deletions(-)
diff --git a/procinterrupts.c b/procinterrupts.c
index e91b203..ec7a52b 100644
--- a/procinterrupts.c
+++ b/procinterrupts.c
@@ -178,12 +178,14 @@ void init_irq_class_and_type(char *savedline, struct irq_info *info, int irq)
}
#ifdef AARCH64
- if (savedptr && strlen(savedptr) > 0) {
+ if (savedptr && strlen(savedptr) > 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);
+
+ tmp = strchr(irq_fullname, '\n');
+ if (tmp)
+ *tmp = 0;
#else
snprintf(irq_fullname, PATH_MAX, "%s", last_token);
#endif
--
2.33.0

View File

@ -1,26 +0,0 @@
From 028082a6a1ff650d5cdf796ac55ac26a3874372a Mon Sep 17 00:00:00 2001
From: Liu Chao <liuchao173@huawei.com>
Date: Sat, 25 Jun 2022 14:13:10 +0800
Subject: [PATCH] add keep_going check to prevent irqbalance from failing to
exit after SIGTERM
Signed-off-by: Liu Chao <liuchao173@huawei.com>
---
irqbalance.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/irqbalance.c b/irqbalance.c
index c520c11..5eae5b6 100644
--- a/irqbalance.c
+++ b/irqbalance.c
@@ -290,7 +290,7 @@ gboolean scan(gpointer data __attribute__((unused)))
/* cope with cpu hotplug -- detected during /proc/interrupts parsing */
- while (need_rescan || need_rebuild) {
+ while (keep_going && (need_rescan || need_rebuild)) {
int try_times = 0;
need_rescan = 0;
--
2.23.0

View File

@ -1,25 +0,0 @@
From 0a82dddbaf5702caded0d0d83a6eafaca743254d Mon Sep 17 00:00:00 2001
From: Andreas Schwab <schwab@suse.de>
Date: Mon, 27 Jun 2022 13:43:04 +0200
Subject: [PATCH] parse_proc_interrupts: fix parsing interrupt counts
The name of an interrupt chip can start with a number, stop before it.
---
procinterrupts.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/procinterrupts.c b/procinterrupts.c
index 57c8801..d90bf6d 100644
--- a/procinterrupts.c
+++ b/procinterrupts.c
@@ -331,7 +331,7 @@ void parse_proc_interrupts(void)
while (1) {
uint64_t C;
C = strtoull(c, &c2, 10);
- if (c==c2) /* end of numbers */
+ if (c==c2 || !strchr(" \t", *c2)) /* end of numbers */
break;
count += C;
c=c2;
--
2.23.0

View File

@ -8,14 +8,14 @@ the min_load after moving irq. However, we can accept that the delta load become
---
irqbalance.c | 8 +++++++-
irqbalance.h | 1 +
irqlist.c | 6 ++++-
3 files changed, 10 insertions(+), 2 deletions(-)
irqlist.c | 6 +++++-
3 files changed, 13 insertions(+), 2 deletions(-)
diff --git a/irqbalance.c b/irqbalance.c
index 9449e40..82ac3ea 100644
index de7f4e4..ee2c988 100644
--- a/irqbalance.c
+++ b/irqbalance.c
@@ -72,6 +72,7 @@ GMainLoop *main_loop;
@@ -71,6 +71,7 @@ GMainLoop *main_loop;
char *cpu_ban_string = NULL;
unsigned long migrate_ratio = 0;
@ -23,8 +23,7 @@ index 9449e40..82ac3ea 100644
#ifdef HAVE_IRQBALANCEUI
int socket_fd;
char socket_name[64];
@@ -106,6 +107,7 @@ struct option lopts[] = {
@@ -111,6 +112,7 @@ struct option lopts[] = {
{"hintpolicy", 1, NULL, 'h'},
{"verifyhint", 1, NULL, 'v'},
{"notclearhint", 0, NULL, 'n'},
@ -32,7 +31,7 @@ index 9449e40..82ac3ea 100644
{0, 0, 0, 0}
};
@@ -115,6 +117,7 @@ static void usage(void)
@@ -120,6 +122,7 @@ static void usage(void)
log(TO_CONSOLE, LOG_INFO, " [--powerthresh= | -p <off> | <n>] [--banirq= | -i <n>] [--banmod= | -m <module>] [--policyscript= | -l <script>]\n");
log(TO_CONSOLE, LOG_INFO, " [--pid= | -s <file>] [--deepestcache= | -c <n>] [--interval= | -t <n>] [--migrateval= | -e <n>]\n");
log(TO_CONSOLE, LOG_INFO, " [--rulesconfig= | -r <config>] [--hintpolicy | -h <subset>] [--verifyhint= | -v n] [--notclearhint | -n]\n");
@ -40,8 +39,8 @@ index 9449e40..82ac3ea 100644
}
static void version(void)
@@ -129,7 +132,7 @@ static void parse_command_line(int argc, char **argv)
unsigned long val;
@@ -135,7 +138,7 @@ static void parse_command_line(int argc, char **argv)
char *endptr;
while ((opt = getopt_long(argc, argv,
- "odfjVni:p:s:c:l:m:t:e:r:h:v:",
@ -49,7 +48,7 @@ index 9449e40..82ac3ea 100644
lopts, &longind)) != -1) {
switch(opt) {
@@ -223,6 +226,9 @@ static void parse_command_line(int argc, char **argv)
@@ -233,6 +236,9 @@ static void parse_command_line(int argc, char **argv)
case 'n':
clear_affinity_hint = 0;
break;
@ -60,7 +59,7 @@ index 9449e40..82ac3ea 100644
}
}
diff --git a/irqbalance.h b/irqbalance.h
index 4a73b83..9ff8f37 100644
index 710d496..e8f9fba 100644
--- a/irqbalance.h
+++ b/irqbalance.h
@@ -83,6 +83,7 @@ extern cpumask_t banned_cpus;
@ -72,7 +71,7 @@ index 4a73b83..9ff8f37 100644
/*
* Numa node access routines
diff --git a/irqlist.c b/irqlist.c
index 9ab321a..98a4224 100644
index 4dd4a83..be51c0f 100644
--- a/irqlist.c
+++ b/irqlist.c
@@ -97,7 +97,11 @@ static void move_candidate_irqs(struct irq_info *info, void *data)
@ -89,5 +88,5 @@ index 9ab321a..98a4224 100644
lb_info->min_load += info->load;
if (lb_info->min_load > lb_info->adjustment_load) {
--
2.23.0
2.33.0

View File

@ -8,36 +8,36 @@ Therefore, we introduce a new user irq policy config rule which avoid policy scr
for every irq.
---
Makefile.am | 2 +-
classify.c | 21 ++++--
irqbalance.c | 15 ++++-
classify.c | 13 ++-
irqbalance.c | 15 +++-
irqbalance.h | 1 +
placement.c | 3 +-
rules_config.c | 174 +++++++++++++++++++++++++++++++++++++++++++++++++
rules_config.h | 40 ++++++++++++
7 files changed, 246 insertions(+), 10 deletions(-)
rules_config.c | 217 +++++++++++++++++++++++++++++++++++++++++++++++++
rules_config.h | 40 +++++++++
7 files changed, 285 insertions(+), 6 deletions(-)
create mode 100644 rules_config.c
create mode 100644 rules_config.h
diff --git a/Makefile.am b/Makefile.am
index 73988b3..3086d67 100644
index 80d8fee..9f2be54 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -38,7 +38,7 @@ sbin_PROGRAMS += irqbalance-ui
@@ -42,7 +42,7 @@ irqbalance_LDFLAGS = -Wl,-Bstatic
endif
irqbalance_SOURCES = activate.c bitmap.c classify.c cputree.c irqbalance.c \
- irqlist.c numa.c placement.c procinterrupts.c
+ irqlist.c numa.c placement.c procinterrupts.c rules_config.c
irqbalance_LDADD = $(LIBCAP_NG_LIBS) $(GLIB2_LIBS) $(NUMA_LIBS)
if IRQBALANCEUI
irqbalance_ui_SOURCES = $(UI_DIR)/helpers.c $(UI_DIR)/irqbalance-ui.c \
if THERMAL
irqbalance_SOURCES += thermal.c
endif
diff --git a/classify.c b/classify.c
index 74103bf..254197e 100644
index 4ea4b44..0bbe608 100644
--- a/classify.c
+++ b/classify.c
@@ -625,12 +625,20 @@ static void add_new_irq(char *path, struct irq_info *hint, GList *proc_interrupt
return;
@@ -627,12 +627,20 @@ static void add_new_irq(char *path, struct irq_info *hint)
}
}
/* Set NULL devpath for the irq has no sysfs entries */
- get_irq_user_policy(path, irq, &pol);
+ if (user_policy_list == NULL) {
@ -45,44 +45,32 @@ index 74103bf..254197e 100644
+ } else {
+ memset(&pol, -1, sizeof(struct user_irq_policy));
+ }
if ((pol.ban == 1) || check_for_irq_ban(irq, proc_interrupts)) { /*FIXME*/
if ((pol.ban == 1) || check_for_irq_ban(hint, mod)) { /*FIXME*/
__add_banned_irq(irq, &banned_irqs);
new = get_irq_info(irq);
- } else
+ } else {
new = add_one_irq_to_db(path, hint, &pol);
+ if ((new != NULL) && (user_policy_list != NULL)) {
+ set_usr_irq_policy(hint->name, new);
+ set_usr_irq_policy(new);
+ }
+ }
if (!new)
log(TO_CONSOLE, LOG_WARNING, "add_new_irq: Failed to add irq %d\n", irq);
@@ -781,14 +787,15 @@ int proc_irq_hotplug(char *savedline, int irq, struct irq_info **pinfo)
{
struct irq_info tmp_info = {0};
- /* firstly, init irq info by read device info */
+ /* firstly, init irq info by parse savedline */
+ init_irq_class_and_type(savedline, &tmp_info, irq);
+ /* secondly, init irq info by read device info */
*pinfo = build_dev_irqs(interrupts_db, irq);
if (*pinfo == NULL) {
- /* secondly, init irq info by parse savedline */
- init_irq_class_and_type(savedline, &tmp_info, irq);
add_new_irq(NULL, &tmp_info, interrupts_db);
@@ -780,6 +788,7 @@ int proc_irq_hotplug(char *savedline, int irq, struct irq_info **pinfo)
add_new_irq(NULL, &tmp_info);
*pinfo = get_irq_info(irq);
- }
+ } else
+ set_usr_irq_policy(tmp_info.name, *pinfo);
}
+
if (*pinfo == NULL) {
return -1;
}
diff --git a/irqbalance.c b/irqbalance.c
index 10e2b13..ecc3eca 100644
index 2c9e3f3..0749f79 100644
--- a/irqbalance.c
+++ b/irqbalance.c
@@ -99,6 +99,7 @@ struct option lopts[] = {
@@ -104,6 +104,7 @@ struct option lopts[] = {
{"interval", 1 , NULL, 't'},
{"version", 0, NULL, 'V'},
{"migrateval", 1, NULL, 'e'},
@ -90,7 +78,7 @@ index 10e2b13..ecc3eca 100644
{0, 0, 0, 0}
};
@@ -107,6 +108,7 @@ static void usage(void)
@@ -112,6 +113,7 @@ static void usage(void)
log(TO_CONSOLE, LOG_INFO, "irqbalance [--oneshot | -o] [--debug | -d] [--foreground | -f] [--journal | -j]\n");
log(TO_CONSOLE, LOG_INFO, " [--powerthresh= | -p <off> | <n>] [--banirq= | -i <n>] [--banmod= | -m <module>] [--policyscript= | -l <script>]\n");
log(TO_CONSOLE, LOG_INFO, " [--pid= | -s <file>] [--deepestcache= | -c <n>] [--interval= | -t <n>] [--migrateval= | -e <n>]\n");
@ -98,8 +86,8 @@ index 10e2b13..ecc3eca 100644
}
static void version(void)
@@ -121,7 +123,7 @@ static void parse_command_line(int argc, char **argv)
unsigned long val;
@@ -127,7 +129,7 @@ static void parse_command_line(int argc, char **argv)
char *endptr;
while ((opt = getopt_long(argc, argv,
- "odfjVi:p:s:c:l:m:t:e:",
@ -107,9 +95,9 @@ index 10e2b13..ecc3eca 100644
lopts, &longind)) != -1) {
switch(opt) {
@@ -193,6 +195,9 @@ static void parse_command_line(int argc, char **argv)
case 'e':
migrate_ratio = strtoul(optarg, NULL, 10);
@@ -203,6 +205,9 @@ static void parse_command_line(int argc, char **argv)
exit(1);
}
break;
+ case 'r':
+ rules_config_file = strdup(optarg);
@ -117,7 +105,7 @@ index 10e2b13..ecc3eca 100644
}
}
}
@@ -661,6 +666,14 @@ int main(int argc, char** argv)
@@ -670,6 +675,14 @@ int main(int argc, char** argv)
}
}
@ -133,7 +121,7 @@ index 10e2b13..ecc3eca 100644
if (debug_mode)
dump_object_tree();
diff --git a/irqbalance.h b/irqbalance.h
index 618f254..78d0adc 100644
index e7f6b94..22940b4 100644
--- a/irqbalance.h
+++ b/irqbalance.h
@@ -14,6 +14,7 @@
@ -145,7 +133,7 @@ index 618f254..78d0adc 100644
#ifdef __aarch64__
#define AARCH64
diff --git a/placement.c b/placement.c
index 17a9f2e..bf27297 100644
index 9fde8cb..43ddb81 100644
--- a/placement.c
+++ b/placement.c
@@ -52,8 +52,7 @@ static void find_best_object(struct topo_obj *d, void *data)
@ -160,10 +148,10 @@ index 17a9f2e..bf27297 100644
if (d->powersave_mode)
diff --git a/rules_config.c b/rules_config.c
new file mode 100644
index 0000000..e32a31e
index 0000000..0471f30
--- /dev/null
+++ b/rules_config.c
@@ -0,0 +1,174 @@
@@ -0,0 +1,217 @@
+/*
+ * Copyright (C) 2019. Huawei Technologies Co., Ltd. All rights reserved.
+ *
@ -178,6 +166,7 @@ index 0000000..e32a31e
+ */
+#include <stdio.h>
+#include <stdlib.h>
+#include <ctype.h>
+#include "irqbalance.h"
+
+char *rules_config_file = NULL;
@ -192,14 +181,48 @@ index 0000000..e32a31e
+ user_policy_list = policy;
+}
+
+USER_IRQ_POLICY *get_usr_irq_policy(char *name)
+char *get_irq_line(int irq)
+{
+ USER_IRQ_POLICY *p = user_policy_list;
+ if (name == NULL) {
+ FILE *file;
+ char *line = NULL;
+ char *irq_line = NULL;
+ size_t size = 0;
+ char irq_str[20] = {0};
+ char *c = NULL;
+
+ snprintf(irq_str, 20, "%d:", irq);
+
+ file = fopen("/proc/interrupts", "r");
+ if (getline(&line, &size, file) <= 0) {
+ free(line);
+ fclose(file);
+ return NULL;
+ }
+ while (getline(&line, &size, file) > 0) {
+ c = line;
+ while (isblank(*(c)))
+ c++;
+ if (!isdigit(*c))
+ break;
+
+ if (!strncmp(irq_str, c, strnlen(irq_str, 20))) {
+ irq_line = line;
+ break;
+ }
+ }
+
+ if (!irq_line)
+ free(line);
+ fclose(file);
+ return irq_line;
+}
+
+USER_IRQ_POLICY *get_usr_irq_policy(char *irq_line)
+{
+ USER_IRQ_POLICY *p = user_policy_list;
+
+ while (p != NULL) {
+ if (strstr(name, p->irq_type) != NULL) {
+ if (strstr(irq_line, p->irq_type) != NULL) {
+ return p;
+ }
+ p = p->next;
@ -207,15 +230,22 @@ index 0000000..e32a31e
+ return NULL;
+}
+
+void set_usr_irq_policy(char *name, struct irq_info *info)
+void set_usr_irq_policy(struct irq_info *info)
+{
+ USER_IRQ_POLICY *user_policy;
+ int irq = info->irq;
+ char *irq_line = NULL;
+
+ if (user_policy_list == NULL) {
+ return;
+ }
+
+ user_policy = get_usr_irq_policy(name);
+ if (irq >= 0)
+ irq_line = get_irq_line(irq);
+ if (!irq_line)
+ return;
+
+ user_policy = get_usr_irq_policy(irq_line);
+ if (user_policy != NULL) {
+ if (user_policy->numa_node_set) {
+ info->numa_node = get_numa_node(user_policy->numa_node);
@ -229,6 +259,7 @@ index 0000000..e32a31e
+ }
+ }
+
+ free(irq_line);
+}
+
+int read_user_policy_config()
@ -340,7 +371,7 @@ index 0000000..e32a31e
+}
diff --git a/rules_config.h b/rules_config.h
new file mode 100644
index 0000000..edcac8a
index 0000000..42f539d
--- /dev/null
+++ b/rules_config.h
@@ -0,0 +1,40 @@
@ -381,9 +412,9 @@ index 0000000..edcac8a
+
+int read_user_policy_config();
+
+void set_usr_irq_policy(char *name, struct irq_info *info);
+void set_usr_irq_policy(struct irq_info *info);
+
+#endif
--
2.23.0
2.33.0

View File

@ -53,7 +53,7 @@ index 3492902..2f895be 100644
if (hint_has_changed) {
hint_has_changed = FALSE;
diff --git a/irqbalance.c b/irqbalance.c
index 5985d8d..9449e40 100644
index c7a1488..de7f4e4 100644
--- a/irqbalance.c
+++ b/irqbalance.c
@@ -54,6 +54,7 @@ int numa_avail;
@ -64,7 +64,7 @@ index 5985d8d..9449e40 100644
unsigned int log_mask = TO_ALL;
const char *log_indent;
unsigned long power_thresh = ULONG_MAX;
@@ -104,6 +105,7 @@ struct option lopts[] = {
@@ -109,6 +110,7 @@ struct option lopts[] = {
{"rulesconfig", 1, NULL, 'r'},
{"hintpolicy", 1, NULL, 'h'},
{"verifyhint", 1, NULL, 'v'},
@ -72,7 +72,7 @@ index 5985d8d..9449e40 100644
{0, 0, 0, 0}
};
@@ -112,7 +114,7 @@ static void usage(void)
@@ -117,7 +119,7 @@ static void usage(void)
log(TO_CONSOLE, LOG_INFO, "irqbalance [--oneshot | -o] [--debug | -d] [--foreground | -f] [--journal | -j]\n");
log(TO_CONSOLE, LOG_INFO, " [--powerthresh= | -p <off> | <n>] [--banirq= | -i <n>] [--banmod= | -m <module>] [--policyscript= | -l <script>]\n");
log(TO_CONSOLE, LOG_INFO, " [--pid= | -s <file>] [--deepestcache= | -c <n>] [--interval= | -t <n>] [--migrateval= | -e <n>]\n");
@ -81,8 +81,8 @@ index 5985d8d..9449e40 100644
}
static void version(void)
@@ -127,7 +129,7 @@ static void parse_command_line(int argc, char **argv)
unsigned long val;
@@ -133,7 +135,7 @@ static void parse_command_line(int argc, char **argv)
char *endptr;
while ((opt = getopt_long(argc, argv,
- "odfjVi:p:s:c:l:m:t:e:r:h:v:",
@ -90,7 +90,7 @@ index 5985d8d..9449e40 100644
lopts, &longind)) != -1) {
switch(opt) {
@@ -218,6 +220,9 @@ static void parse_command_line(int argc, char **argv)
@@ -228,6 +230,9 @@ static void parse_command_line(int argc, char **argv)
exit(1);
}
break;
@ -101,5 +101,5 @@ index 5985d8d..9449e40 100644
}
}
--
2.23.0
2.33.0

View File

@ -8,11 +8,11 @@ introduce the periodically affinity hint verify.
---
Makefile.am | 2 +-
activate.c | 14 ++++--
classify.c | 5 ++-
classify.c | 5 +-
cpumask.h | 7 +++
hint_verify.c | 136 ++++++++++++++++++++++++++++++++++++++++++++++++++
hint_verify.h | 21 ++++++++
irqbalance.c | 43 ++++++++++-----
irqbalance.c | 43 +++++++++++-----
irqbalance.h | 5 ++
placement.c | 14 ++++++
types.h | 1 +
@ -21,23 +21,23 @@ introduce the periodically affinity hint verify.
create mode 100644 hint_verify.h
diff --git a/Makefile.am b/Makefile.am
index 3086d67..aacb399 100644
index 9f2be54..bc6be1d 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -38,7 +38,7 @@ sbin_PROGRAMS += irqbalance-ui
@@ -42,7 +42,7 @@ irqbalance_LDFLAGS = -Wl,-Bstatic
endif
irqbalance_SOURCES = activate.c bitmap.c classify.c cputree.c irqbalance.c \
- irqlist.c numa.c placement.c procinterrupts.c rules_config.c
+ irqlist.c numa.c placement.c procinterrupts.c rules_config.c hint_verify.c
irqbalance_LDADD = $(LIBCAP_NG_LIBS) $(GLIB2_LIBS) $(NUMA_LIBS)
if IRQBALANCEUI
irqbalance_ui_SOURCES = $(UI_DIR)/helpers.c $(UI_DIR)/irqbalance-ui.c \
if THERMAL
irqbalance_SOURCES += thermal.c
endif
diff --git a/activate.c b/activate.c
index 93fde58..c5859bf 100644
index 62cfd08..774a3b2 100644
--- a/activate.c
+++ b/activate.c
@@ -78,11 +78,6 @@ static void activate_mapping(struct irq_info *info, void *data __attribute__((un
@@ -51,11 +51,6 @@ static void activate_mapping(struct irq_info *info, void *data __attribute__((un
int ret = 0;
cpumask_t applied_mask;
@ -49,7 +49,7 @@ index 93fde58..c5859bf 100644
if (!info->assigned_obj)
return;
@@ -90,6 +85,15 @@ static void activate_mapping(struct irq_info *info, void *data __attribute__((un
@@ -63,6 +58,15 @@ static void activate_mapping(struct irq_info *info, void *data __attribute__((un
/* activate only online cpus, otherwise writing to procfs returns EOVERFLOW */
cpus_and(applied_mask, cpu_online_map, info->assigned_obj->mask);
@ -66,10 +66,10 @@ index 93fde58..c5859bf 100644
* Don't activate anything for which we have an invalid mask
*/
diff --git a/classify.c b/classify.c
index 254197e..e9987ee 100644
index 77f4e3f..68a56f7 100644
--- a/classify.c
+++ b/classify.c
@@ -263,7 +263,7 @@ static int get_irq_class(const char *devpath)
@@ -249,7 +249,7 @@ static int get_irq_class(const char *devpath)
return irq_class;
}
@ -78,7 +78,7 @@ index 254197e..e9987ee 100644
{
const struct irq_info *ai = a;
const struct irq_info *bi = b;
@@ -397,6 +397,9 @@ get_numa_node:
@@ -388,6 +388,9 @@ get_numa_node:
process_one_line(path, get_mask_from_bitmap, &new->cpumask);
}
@ -89,7 +89,7 @@ index 254197e..e9987ee 100644
return new;
}
diff --git a/cpumask.h b/cpumask.h
index 5bebbeb..bc5f006 100644
index 2ec3f79..e0f0d58 100644
--- a/cpumask.h
+++ b/cpumask.h
@@ -30,6 +30,7 @@
@ -100,7 +100,7 @@ index 5bebbeb..bc5f006 100644
*
* int cpus_equal(mask1, mask2) Does mask1 == mask2?
* int cpus_intersects(mask1, mask2) Do mask1 and mask2 intersect?
@@ -142,6 +143,12 @@ static inline void __cpus_complement(cpumask_t *dstp,
@@ -143,6 +144,12 @@ static inline void __cpus_complement(cpumask_t *dstp,
bitmap_complement(dstp->bits, srcp->bits, nbits);
}
@ -283,7 +283,7 @@ index 0000000..7391b32
+
+#endif
diff --git a/irqbalance.c b/irqbalance.c
index 450a1ff..5985d8d 100644
index e2a59f5..c7a1488 100644
--- a/irqbalance.c
+++ b/irqbalance.c
@@ -64,6 +64,8 @@ char *polscript = NULL;
@ -295,7 +295,7 @@ index 450a1ff..5985d8d 100644
GMainLoop *main_loop;
char *cpu_ban_string = NULL;
@@ -100,6 +102,8 @@ struct option lopts[] = {
@@ -105,6 +107,8 @@ struct option lopts[] = {
{"version", 0, NULL, 'V'},
{"migrateval", 1, NULL, 'e'},
{"rulesconfig", 1, NULL, 'r'},
@ -304,7 +304,7 @@ index 450a1ff..5985d8d 100644
{0, 0, 0, 0}
};
@@ -108,7 +112,7 @@ static void usage(void)
@@ -113,7 +117,7 @@ static void usage(void)
log(TO_CONSOLE, LOG_INFO, "irqbalance [--oneshot | -o] [--debug | -d] [--foreground | -f] [--journal | -j]\n");
log(TO_CONSOLE, LOG_INFO, " [--powerthresh= | -p <off> | <n>] [--banirq= | -i <n>] [--banmod= | -m <module>] [--policyscript= | -l <script>]\n");
log(TO_CONSOLE, LOG_INFO, " [--pid= | -s <file>] [--deepestcache= | -c <n>] [--interval= | -t <n>] [--migrateval= | -e <n>]\n");
@ -313,8 +313,8 @@ index 450a1ff..5985d8d 100644
}
static void version(void)
@@ -123,7 +127,7 @@ static void parse_command_line(int argc, char **argv)
unsigned long val;
@@ -129,7 +133,7 @@ static void parse_command_line(int argc, char **argv)
char *endptr;
while ((opt = getopt_long(argc, argv,
- "odfjVi:p:s:c:l:m:t:e:r:",
@ -322,7 +322,7 @@ index 450a1ff..5985d8d 100644
lopts, &longind)) != -1) {
switch(opt) {
@@ -198,6 +202,22 @@ static void parse_command_line(int argc, char **argv)
@@ -208,6 +212,22 @@ static void parse_command_line(int argc, char **argv)
case 'r':
rules_config_file = strdup(optarg);
break;
@ -345,7 +345,7 @@ index 450a1ff..5985d8d 100644
}
}
}
@@ -261,6 +283,10 @@ void force_rebalance_irq(struct irq_info *info, void *data __attribute__((unused)))
@@ -270,6 +290,10 @@ void force_rebalance_irq(struct irq_info *info, void *data __attribute__((unused
if (info->level == BALANCE_NONE)
return;
@ -356,7 +356,7 @@ index 450a1ff..5985d8d 100644
if (info->assigned_obj == NULL)
rebalance_irq_list = g_list_append(rebalance_irq_list, info);
else
@@ -275,7 +299,7 @@ static int check_debug()
@@ -301,7 +325,7 @@ static int check_debug()
return ret;
}
@ -365,7 +365,7 @@ index 450a1ff..5985d8d 100644
{
log(TO_CONSOLE, LOG_INFO, "\n\n\n-----------------------------------------------------------------------------\n");
clear_work_stats();
@@ -325,17 +349,9 @@ out:
@@ -351,17 +375,9 @@ out:
keep_going = 0;
cycle_count++;
@ -383,10 +383,10 @@ index 450a1ff..5985d8d 100644
return FALSE;
}
}
@@ -720,9 +736,10 @@ int main(int argc, char** argv)
goto out;
}
@@ -733,9 +749,10 @@ int main(int argc, char** argv)
#endif
if (init_thermal())
log(TO_ALL, LOG_WARNING, "Failed to initialize thermal events.\n");
+ update_interval_and_count();
main_loop = g_main_loop_new(NULL, FALSE);
- last_interval = sleep_interval;
@ -397,7 +397,7 @@ index 450a1ff..5985d8d 100644
g_main_loop_quit(main_loop);
diff --git a/irqbalance.h b/irqbalance.h
index 78d0adc..4a73b83 100644
index 22940b4..710d496 100644
--- a/irqbalance.h
+++ b/irqbalance.h
@@ -15,6 +15,7 @@
@ -408,7 +408,7 @@ index 78d0adc..4a73b83 100644
#ifdef __aarch64__
#define AARCH64
@@ -114,6 +115,10 @@ extern void add_banned_irq(int irq);
@@ -112,6 +113,10 @@ extern void free_cl_opts(void);
extern void add_cl_banned_module(char *modname);
extern void add_banned_irq(int irq);
extern void remove_one_irq_from_db(int irq);
@ -420,7 +420,7 @@ index 78d0adc..4a73b83 100644
diff --git a/placement.c b/placement.c
index bf27297..db79b8b 100644
index 43ddb81..9414ed9 100644
--- a/placement.c
+++ b/placement.c
@@ -41,6 +41,7 @@ static void find_best_object(struct topo_obj *d, void *data)
@ -452,10 +452,10 @@ index bf27297..db79b8b 100644
if (newload < best->best_cost) {
best->best = d;
diff --git a/types.h b/types.h
index fa91561..3a04318 100644
index 9693cf4..62cc2bb 100644
--- a/types.h
+++ b/types.h
@@ -67,6 +67,7 @@ struct irq_info {
@@ -66,6 +66,7 @@ struct irq_info {
int flags;
struct topo_obj *numa_node;
cpumask_t cpumask;
@ -464,5 +464,5 @@ index fa91561..3a04318 100644
uint64_t last_irq_count;
uint64_t load;
--
2.23.0
2.33.0

Binary file not shown.

BIN
irqbalance-1.9.2.tar.gz Normal file

Binary file not shown.

View File

@ -1,7 +1,7 @@
Summary: A dynamic adaptive IRQ balancing daemon
Name: irqbalance
Version: 1.9.0
Release: 3
Version: 1.9.2
Release: 1
Epoch: 3
License: GPLv2
Source0: https://github.com/Irqbalance/irqbalance/archive/v%{version}.tar.gz#/irqbalance-%{version}.tar.gz
@ -23,9 +23,6 @@ Requires: numactl-libs
%define _hardened_build 1
Patch6000: bugfix-parse_proc_interrupts-fix-parsing-interrupt-counts.patch
Patch6001: bugfix-add-keep_going-check-to-prevent-irqbalance-from-failing-to-exit-after-SIGTERM.patch
Patch9000: feature-aarch64-add-the-regular-to-get-the-correct-i.patch
Patch9001: feature-add-new-user-irq-policy-config-rule.patch
Patch9002: feature-add-the-switch-of-printing-log.patch
@ -35,9 +32,6 @@ Patch9005: feature-add-new-irq-migrate-rule-to-avoid-high-cpu-i.patch
Patch9006: feature-enable-irqbalance-to-link-with-multiple-clie.patch
Patch9007: feature-add-ability-to-set-hintpolicy-during-runtime.patch
Patch9008: feature-encapsulate-and-compile-the-functions-in-irqbalance-ui.patch
Patch9010: bugfix-set-hint-name-in-add_new_irq-to-avoid-segment.patch
Patch9011: backport-check-whether-savedptr-is-NULL-before-invoking-strle.patch
Patch9012: backport-procinterrupts-Fix-IRQ-name-parsing-on-certain-arm64.patch
%description
Irqbalance is a daemon to help balance the cpu load generated by
@ -124,6 +118,12 @@ fi
/sbin/chkconfig --del %{name} >/dev/null 2>&1 || :
%changelog
* Tue Jan 31 2023 qinyu <qinyu32@huawei.com> - 3:1.9.2-1
- Type:bugfix
- ID:NA
- SUG:restart
- DESC: upgrade irqbalance to v1.9.2
* Thu Dec 8 2022 qinyu <qinyu32@huawei.com> - 3:1.9.0-3
- Type:bugfix
- ID:NA