diff --git a/Don-t-leak-socket-fd-on-connection-error.patch b/Don-t-leak-socket-fd-on-connection-error.patch index b0ea204..055ccff 100644 --- a/Don-t-leak-socket-fd-on-connection-error.patch +++ b/Don-t-leak-socket-fd-on-connection-error.patch @@ -48,6 +48,18 @@ index 0946603..364ca72 100644 close(sock); } +diff --git a/ui/irqbalance-ui.c b/ui/irqbalance-ui.c +index 5a76ddf..005eea4 100644 +--- a/ui/irqbalance-ui.c ++++ b/ui/irqbalance-ui.c +@@ -66,6 +66,7 @@ int init_connection() + memset(&addr, 0, sizeof(struct sockaddr_un)); + addr.sun_family = AF_UNIX; + if (connect(socket_fd, (struct sockaddr *)&addr, sizeof(addr)) < 0) { ++ close(socket_fd); + return 0; + } + -- 1.8.3.1 diff --git a/Fix-irqbalance-ui-failing-to-connect-to-irqbalance-d.patch b/Fix-irqbalance-ui-failing-to-connect-to-irqbalance-d.patch new file mode 100644 index 0000000..68afbc3 --- /dev/null +++ b/Fix-irqbalance-ui-failing-to-connect-to-irqbalance-d.patch @@ -0,0 +1,57 @@ +From ce806df0081cf09344197285e32bd2113d86f554 Mon Sep 17 00:00:00 2001 +From: Kairui Song +Date: Mon, 3 Sep 2018 00:30:14 +0800 +Subject: [PATCH 23/58] Fix irqbalance ui failing to connect to irqbalance + daemon + +irqbalance ui is faling due to the changes in commit 19c25dd. +This patch align irqbalance-ui's socket connecting routine with +irqbalance.c +--- + ui/irqbalance-ui.c | 16 +++++++++++----- + ui/irqbalance-ui.h | 1 + + 2 files changed, 12 insertions(+), 5 deletions(-) + +diff --git a/ui/irqbalance-ui.c b/ui/irqbalance-ui.c +index 47dd5dc..5a76ddf 100644 +--- a/ui/irqbalance-ui.c ++++ b/ui/irqbalance-ui.c +@@ -57,12 +57,18 @@ int init_connection() + } + addr.sun_family = AF_UNIX; + char socket_name[64]; +- snprintf(socket_name, 64, "%s%d.sock", SOCKET_PATH, irqbalance_pid); +- strncpy(addr.sun_path, socket_name, strlen(addr.sun_path)); + +- if(connect(socket_fd, (struct sockaddr *)&addr, +- sizeof(sa_family_t) + strlen(socket_name) + 1) < 0) { +- return 0; ++ snprintf(socket_name, 64, "%s/%s%d.sock", SOCKET_TMPFS, SOCKET_PATH, irqbalance_pid); ++ strncpy(addr.sun_path, socket_name, strlen(socket_name)); ++ ++ if(connect(socket_fd, (struct sockaddr *)&addr, sizeof(addr)) < 0) { ++ /* Try connect to abstract */ ++ memset(&addr, 0, sizeof(struct sockaddr_un)); ++ addr.sun_family = AF_UNIX; ++ if (connect(socket_fd, (struct sockaddr *)&addr, sizeof(addr)) < 0) { ++ return 0; ++ } ++ + } + + return socket_fd; +diff --git a/ui/irqbalance-ui.h b/ui/irqbalance-ui.h +index f97fcb1..b32d58a 100644 +--- a/ui/irqbalance-ui.h ++++ b/ui/irqbalance-ui.h +@@ -8,6 +8,7 @@ + #include + + #define SOCKET_PATH "irqbalance" ++#define SOCKET_TMPFS "/var/run" + + #define STATS "stats" + #define SET_SLEEP "settings sleep " +-- +1.8.3.1 + diff --git a/Fix-string-truncation-issues-detected-by-GCC-8.patch b/Fix-string-truncation-issues-detected-by-GCC-8.patch index c07ad53..7eecdbd 100644 --- a/Fix-string-truncation-issues-detected-by-GCC-8.patch +++ b/Fix-string-truncation-issues-detected-by-GCC-8.patch @@ -32,6 +32,23 @@ index 60d8a5e..c1a0e15 100644 if (bind(socket_fd, (struct sockaddr *)&addr, sizeof(addr)) < 0) { log(TO_ALL, LOG_WARNING, "Daemon couldn't be bound to the file-based socket.\n"); +diff --git a/ui/irqbalance-ui.c b/ui/irqbalance-ui.c +index 005eea4..1119665 100644 +--- a/ui/irqbalance-ui.c ++++ b/ui/irqbalance-ui.c +@@ -56,10 +56,9 @@ int init_connection() + return 0; + } + addr.sun_family = AF_UNIX; +- char socket_name[64]; + +- snprintf(socket_name, 64, "%s/%s%d.sock", SOCKET_TMPFS, SOCKET_PATH, irqbalance_pid); +- strncpy(addr.sun_path, socket_name, strlen(socket_name)); ++ snprintf(addr.sun_path, sizeof(addr.sun_path), "%s/%s%d.sock", SOCKET_TMPFS, ++ SOCKET_PATH, irqbalance_pid); + + if(connect(socket_fd, (struct sockaddr *)&addr, sizeof(addr)) < 0) { + /* Try connect to abstract */ -- 1.8.3.1 diff --git a/bugfix-delete-no-existing-banned-irq.patch b/bugfix-delete-no-existing-banned-irq.patch index d62a78c..d532f53 100644 --- a/bugfix-delete-no-existing-banned-irq.patch +++ b/bugfix-delete-no-existing-banned-irq.patch @@ -14,20 +14,6 @@ diff --git a/classify.c b/classify.c index 9f72ae8..585f2dc 100644 --- a/classify.c +++ b/classify.c -@@ -331,6 +331,13 @@ static int is_banned_irq(int irq) - return entry ? 1:0; - } - -+#ifdef TEST -+int stub_is_banned_irq(int irq) -+{ -+ return is_banned_irq(irq); -+} -+#endif -+ - gint substr_find(gconstpointer a, gconstpointer b) - { - if (strstr(b, a)) @@ -853,6 +860,9 @@ static void remove_no_existing_irq(struct irq_info *info, void *data __attribute void clear_no_existing_irqs(void) { diff --git a/bugfix-fix-new-irqs-in-hotplug-keep-stay-on-one-numa.patch b/bugfix-fix-new-irqs-in-hotplug-keep-stay-on-one-numa.patch index bf95445..0b07079 100644 --- a/bugfix-fix-new-irqs-in-hotplug-keep-stay-on-one-numa.patch +++ b/bugfix-fix-new-irqs-in-hotplug-keep-stay-on-one-numa.patch @@ -17,11 +17,11 @@ index 3681c48..54f27f0 100644 @@ -38,6 +38,7 @@ static GList *banned_irqs = NULL; GList *cl_banned_irqs = NULL; static GList *cl_banned_modules = NULL; - GList *vm_banned_irqs = NULL; + static GList *vm_banned_irqs = NULL; +extern int need_add_single; - pthread_mutex_t cl_banned_list_mutex = PTHREAD_MUTEX_INITIALIZER; - pthread_mutex_t vm_banned_list_mutex = PTHREAD_MUTEX_INITIALIZER; + #define SYSFS_DIR "/sys" + #define SYSPCI_DIR "/sys/bus/pci/devices" @@ -646,6 +647,21 @@ static int check_for_irq_ban(char *path __attribute__((unused)), int irq, GList return 0; } diff --git a/bugfix-irqbalance-fix-wrong-pid-value-in-pid-file.patch b/bugfix-irqbalance-fix-wrong-pid-value-in-pid-file.patch index 66807e2..3eb3108 100644 --- a/bugfix-irqbalance-fix-wrong-pid-value-in-pid-file.patch +++ b/bugfix-irqbalance-fix-wrong-pid-value-in-pid-file.patch @@ -84,7 +84,7 @@ index 18cd7de..467e968 100644 + goto error_close_unlink; + } + } -+ ++ close(lf); + return 0; + +error_close_unlink: diff --git a/bugfix-prevent-version-cmd-need-an-argument.patch b/bugfix-prevent-version-cmd-need-an-argument.patch new file mode 100644 index 0000000..baa481a --- /dev/null +++ b/bugfix-prevent-version-cmd-need-an-argument.patch @@ -0,0 +1,27 @@ +From cea147fc56b018266ac3235b82cdaf7d0ba74628 Mon Sep 17 00:00:00 2001 +From: hejingxian +Date: Fri, 10 Jan 2020 15:36:57 +0800 +Subject: [PATCH] prevent version cmd need an argument + +In order to prevent the version cmd need an argument, +the option 'V' can't be followed by ':'. +--- + irqbalance.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/irqbalance.c b/irqbalance.c +index 15fb0fe..f182b3c 100644 +--- a/irqbalance.c ++++ b/irqbalance.c +@@ -133,7 +133,7 @@ static void parse_command_line(int argc, char **argv) + unsigned long val; + + while ((opt = getopt_long(argc, argv, +- "odfji:p:s:c:b:l:m:t:V:h:v:r:ne:g:", ++ "odfjVni:p:s:c:b:l:m:t:h:v:r:e:g:", + lopts, &longind)) != -1) { + + switch(opt) { +-- +1.8.3.1 + diff --git a/feature-add-new-irq-migrate-rule-to-avoid-high-cpu-irq-load.patch b/feature-add-new-irq-migrate-rule-to-avoid-high-cpu-irq-load.patch new file mode 100644 index 0000000..07a8fed --- /dev/null +++ b/feature-add-new-irq-migrate-rule-to-avoid-high-cpu-irq-load.patch @@ -0,0 +1,121 @@ +From 84a2df1c9962a87f55e1c0d3bd2118fd754a4b48 Mon Sep 17 00:00:00 2001 +From: hejingxian +Date: Fri, 3 Jan 2020 16:43:28 +0800 +Subject: [PATCH] add new irq migrate rule to avoid high cpu irq load + +By the old irq migrate rule, the irqs cannot be moved if the adjustment_load will become smaller then +the min_load after moving irq. However, we can accept that the delta load become smaller after moving irq. +--- + irqbalance.c | 14 ++++++++++++-- + irqbalance.h | 3 ++- + irqlist.c | 15 ++++++++++++++- + 3 files changed, 28 insertions(+), 4 deletions(-) + +diff --git a/irqbalance.c b/irqbalance.c +index 1ca401e..15fb0fe 100644 +--- a/irqbalance.c ++++ b/irqbalance.c +@@ -69,6 +69,8 @@ int sleep_interval = SLEEP_INTERVAL; + int last_interval; + int hint_enabled = 0; + int poll_hint_interval = SLEEP_INTERVAL / 5; ++unsigned long migrate_val = 0; ++unsigned long load_limit = 0; + GMainLoop *main_loop; + + char *cpu_ban_string = NULL; +@@ -106,6 +108,8 @@ struct option lopts[] = { + {"verifyhint", 1, NULL, 'v'}, + {"rulesconfig", 1, NULL, 'r'}, + {"notclearhint", 0, NULL, 'n'}, ++ {"migrateval", 1, NULL, 'e'}, ++ {"loadlimit", 1, NULL, 'g'}, + {0, 0, 0, 0} + }; + +@@ -114,7 +118,7 @@ static void usage(void) + log(TO_CONSOLE, LOG_INFO, "irqbalance [--oneshot | -o] [--debug | -d] [--foreground | -f] [--journal | -j] [--hintpolicy | -h ]\n"); + log(TO_CONSOLE, LOG_INFO, " [--powerthresh= | -p | ] [--banirq= | -i ] [--banmod= | -m ] [--policyscript= | -l