!71 upgrade to v1.9.0

From: @SuperSix173 
Reviewed-by: @wangbin224 
Signed-off-by: @wangbin224
This commit is contained in:
openeuler-ci-bot 2022-07-07 03:33:03 +00:00 committed by Gitee
commit e7f36dd076
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
11 changed files with 19 additions and 262 deletions

View File

@ -1,52 +0,0 @@
From a9f0290a6754a475eb95818dd38dc401370da071 Mon Sep 17 00:00:00 2001
From: liuchao173 <55137861+liuchao173@users.noreply.github.com>
Date: Mon, 23 Aug 2021 19:40:41 +0800
Subject: [PATCH] fix opendir fails in check_platform_device
When irq name does not contain spaces, savedptr is an empty string and irq_fullname will have a extra space at the end like "
LNRO0005:00 ".
So opendir in check_platform_device will fail, and irqbalance prints log:
"No directory /sys/devices/platform/LNRO0005:00 /: No such file or directory"
---
procinterrupts.c | 25 +++++++++++--------------
1 file changed, 11 insertions(+), 14 deletions(-)
diff --git a/procinterrupts.c b/procinterrupts.c
index 32c5e53..2bd201b 100644
--- a/procinterrupts.c
+++ b/procinterrupts.c
@@ -183,20 +183,17 @@ void init_irq_class_and_type(char *savedline, struct irq_info *info, int irq)
}
#ifdef AARCH64
- irq_name = last_token;
- tmp = strchr(irq_name, '\n');
- if (tmp)
- *tmp = 0;
-
- if (strlen(irq_name) + strlen(savedptr) + 1 < PATH_MAX) {
- strcat(irq_fullname, irq_name);
- strcat(irq_fullname, " ");
- strcat(irq_fullname, savedptr);
- tmp = strchr(irq_fullname, '\n');
- if (tmp)
- *tmp = 0;
- } else {
- irq_fullname_valid = 0;
+ if (strlen(savedptr) > 0) {
+ if (strlen(irq_name) + strlen(savedptr) + 1 < PATH_MAX) {
+ strcat(irq_fullname, irq_name);
+ strcat(irq_fullname, " ");
+ strcat(irq_fullname, savedptr);
+ tmp = strchr(irq_fullname, '\n');
+ if (tmp)
+ *tmp = 0;
+ } else {
+ irq_fullname_valid = 0;
+ }
}
#endif
irq_mod = last_token;
--
1.8.3.1

View File

@ -1,26 +0,0 @@
From 2a66a666d3e202dec5b1a4309447e32d5f292871 Mon Sep 17 00:00:00 2001
From: liuchao173 <55137861+liuchao173@users.noreply.github.com>
Date: Tue, 24 Aug 2021 20:50:18 +0800
Subject: [PATCH] fix unsigned integer subtraction sign overflow
Min_load, adjustment_load and load are unsigned integers, so it overflows when (lb_info->min_load + info->load) < (lb_info->adjustment_load - info->load). The result will be greater than zero. Therefore the irq cannot be selected to rebalanced.
---
irqlist.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/irqlist.c b/irqlist.c
index 9ab321a..4dd4a83 100644
--- a/irqlist.c
+++ b/irqlist.c
@@ -97,7 +97,7 @@ static void move_candidate_irqs(struct irq_info *info, void *data)
}
/* If we can migrate an irq without swapping the imbalance do it. */
- if ((lb_info->min_load + info->load) - (lb_info->adjustment_load - info->load) < delta_load) {
+ if ((lb_info->min_load + info->load) < delta_load + (lb_info->adjustment_load - info->load)) {
lb_info->adjustment_load -= info->load;
lb_info->min_load += info->load;
if (lb_info->min_load > lb_info->adjustment_load) {
--
1.8.3.1

View File

@ -1,80 +0,0 @@
From f8bdd0e64284d841544fd3ebe22f4652902ba8d2 Mon Sep 17 00:00:00 2001
From: Sergei Trofimovich <slyich@gmail.com>
Date: Tue, 9 Nov 2021 22:24:17 +0000
Subject: [PATCH] ui/ui.c: always use "%s"-style format for printf()-style
functions
`ncuses-6.3` added printf-style function attributes and now makes
it easier to catch cases when user input is used in palce of format
string when built with CFLAGS=-Werror=format-security:
ui/ui.c:714:16: error: format not a string literal and no format arguments [-Werror=format-security]
714 | printw(copy_to);
| ^~~~~~~
Let's wrap all the missing places with "%s" format.
---
ui/ui.c | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/ui/ui.c b/ui/ui.c
index 1be8f95..6ff3305 100644
--- a/ui/ui.c
+++ b/ui/ui.c
@@ -26,7 +26,7 @@ void show_frame()
while(strlen(top) != (size_t)COLS - 1) {
snprintf(top + strlen(top), COLS - strlen(top), " ");
}
- mvprintw(0, 0, top);
+ mvprintw(0, 0, "%s", top);
for(i = 0; i < LINES; i++) {
mvprintw(i, 0, " ");
mvprintw(i, COLS - 1, " ");
@@ -42,7 +42,7 @@ void show_footer()
snprintf(footer + strlen(footer), COLS - strlen(footer), " ");
}
attrset(COLOR_PAIR(4));
- mvprintw(LINES - 1, 0, footer);
+ mvprintw(LINES - 1, 0, "%s", footer);
}
char * check_control_in_sleep_input(int max_len, int column_offest, int line_offset)
@@ -331,7 +331,7 @@ void print_assigned_objects_string(irq_t *irq, int *line_offset)
char assigned_to[128] = "\0";
for_each_int(irq->assigned_to, copy_assigned_obj, assigned_to);
assigned_to[strlen(assigned_to) - 2] = '\0';
- mvprintw(*line_offset, 36, assigned_to);
+ mvprintw(*line_offset, 36, "%s", assigned_to);
}
void print_irq_line(irq_t *irq, void *data)
@@ -566,7 +566,7 @@ void settings()
uint8_t sleep_input_offset = strlen(info) + 3;
snprintf(info + strlen(info), 128 - strlen(info), "%" PRIu64 "\n", setup.sleep);
attrset(COLOR_PAIR(1));
- mvprintw(2, 3, info);
+ mvprintw(2, 3, "%s", info);
print_all_cpus();
int user_input = 1;
@@ -664,7 +664,7 @@ void display_tree_node_irqs(irq_t *irq, void *data)
char indent[32] = " \0";
snprintf(indent + strlen(indent), 32 - strlen(indent), "%s", (char *)data);
attrset(COLOR_PAIR(3));
- printw("%sIRQ %lu, IRQs since last rebalance %lu\n",
+ printw("%sIRQ %u, IRQs since last rebalance %lu\n",
indent, irq->vector, irq->diff);
}
@@ -711,7 +711,7 @@ void display_tree_node(cpu_node_t *node, void *data)
default:
break;
}
- printw(copy_to);
+ printw("%s", copy_to);
if(g_list_length(node->irqs) > 0) {
for_each_irq(node->irqs, display_tree_node_irqs, indent);
}
--
2.23.0

View File

@ -13,8 +13,8 @@ open community rule) by keywords group hisi & sas or hisi & sata.
Signed-off-by: wanghaibin <wanghaibin.wang@huawei.com> Signed-off-by: wanghaibin <wanghaibin.wang@huawei.com>
--- ---
procinterrupts.c | 33 ++++++++++++++++++++++++++++++++- procinterrupts.c | 2 ++
1 file changed, 32 insertions(+), 1 deletion(-) 1 file changed, 2 insertions(+)
diff --git a/procinterrupts.c b/procinterrupts.c diff --git a/procinterrupts.c b/procinterrupts.c
index 854282f..32c5e53 100644 index 854282f..32c5e53 100644
@ -29,65 +29,6 @@ index 854282f..32c5e53 100644
{ "[A-Z0-9]{4}[0-9a-f]{4}", {NULL} ,check_platform_device, IRQ_TYPE_LEGACY, IRQ_OTHER}, { "[A-Z0-9]{4}[0-9a-f]{4}", {NULL} ,check_platform_device, IRQ_TYPE_LEGACY, IRQ_OTHER},
{ "PNP[0-9a-f]{4}", {NULL} ,check_platform_device, IRQ_TYPE_LEGACY, IRQ_OTHER}, { "PNP[0-9a-f]{4}", {NULL} ,check_platform_device, IRQ_TYPE_LEGACY, IRQ_OTHER},
{ ".*", {NULL}, NULL, IRQ_TYPE_LEGACY, IRQ_OTHER}, { ".*", {NULL}, NULL, IRQ_TYPE_LEGACY, IRQ_OTHER},
@@ -155,6 +157,8 @@ void init_irq_class_and_type(char *savedline, struct irq_info *info, int irq)
int is_xen_dyn = 0;
#ifdef AARCH64
char *tmp = NULL;
+ int irq_fullname_valid = 1;
+ char irq_fullname[PATH_MAX] = {0};
#endif
irq_name = strtok_r(savedline, " ", &savedptr);
@@ -166,6 +170,16 @@ 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
@@ -173,6 +187,17 @@ void init_irq_class_and_type(char *savedline, struct irq_info *info, int irq)
tmp = strchr(irq_name, '\n');
if (tmp)
*tmp = 0;
+
+ if (strlen(irq_name) + strlen(savedptr) + 1 < PATH_MAX) {
+ strcat(irq_fullname, irq_name);
+ strcat(irq_fullname, " ");
+ strcat(irq_fullname, savedptr);
+ tmp = strchr(irq_fullname, '\n');
+ if (tmp)
+ *tmp = 0;
+ } else {
+ irq_fullname_valid = 0;
+ }
#endif
irq_mod = last_token;
info->irq = irq;
@@ -182,7 +207,13 @@ void init_irq_class_and_type(char *savedline, struct irq_info *info, int irq)
info->class = IRQ_VIRT_EVENT;
} else {
#ifdef AARCH64
- guess_arm_irq_hints(irq_name, info);
+ if (irq_fullname_valid) {
+ irq_name = irq_fullname;
+ guess_arm_irq_hints(irq_name, info);
+ } else {
+ info->type = IRQ_TYPE_LEGACY;
+ info->class = IRQ_OTHER;
+ }
#else
info->type = IRQ_TYPE_LEGACY;
info->class = IRQ_OTHER;
-- --
2.23.0 2.23.0

View File

@ -16,13 +16,14 @@ index 9449e40..82ac3ea 100644
--- a/irqbalance.c --- a/irqbalance.c
+++ b/irqbalance.c +++ b/irqbalance.c
@@ -72,6 +72,7 @@ GMainLoop *main_loop; @@ -72,6 +72,7 @@ GMainLoop *main_loop;
char *cpu_ban_string = NULL; char *cpu_ban_string = NULL;
char *banned_cpumask_from_ui = NULL;
unsigned long migrate_ratio = 0; unsigned long migrate_ratio = 0;
+unsigned long load_limit = 0; +unsigned long load_limit = 0;
static void sleep_approx(int seconds) #ifdef HAVE_IRQBALANCEUI
{ int socket_fd;
char socket_name[64];
@@ -106,6 +107,7 @@ struct option lopts[] = { @@ -106,6 +107,7 @@ struct option lopts[] = {
{"hintpolicy", 1, NULL, 'h'}, {"hintpolicy", 1, NULL, 'h'},
{"verifyhint", 1, NULL, 'v'}, {"verifyhint", 1, NULL, 'v'},

View File

@ -28,7 +28,7 @@ index 73988b3..3086d67 100644
irqbalance_SOURCES = activate.c bitmap.c classify.c cputree.c irqbalance.c \ 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
+ irqlist.c numa.c placement.c procinterrupts.c rules_config.c + irqlist.c numa.c placement.c procinterrupts.c rules_config.c
irqbalance_LDADD = $(LIBCAP_NG_LIBS) $(GLIB2_LIBS) irqbalance_LDADD = $(LIBCAP_NG_LIBS) $(GLIB2_LIBS) $(NUMA_LIBS)
if IRQBALANCEUI if IRQBALANCEUI
irqbalance_ui_SOURCES = $(UI_DIR)/helpers.c $(UI_DIR)/irqbalance-ui.c \ irqbalance_ui_SOURCES = $(UI_DIR)/helpers.c $(UI_DIR)/irqbalance-ui.c \
diff --git a/classify.c b/classify.c diff --git a/classify.c b/classify.c

View File

@ -14,10 +14,8 @@ Signed-off-by: He Jingxian <hejingxian@huawei.com>
irqbalance.h | 1 + irqbalance.h | 1 +
ui/Makefile | 29 ++++ ui/Makefile | 29 ++++
ui/client.c | 435 +++++++++++++++++++++++++++++++++++++++++++++++++ ui/client.c | 435 +++++++++++++++++++++++++++++++++++++++++++++++++
ui/irqbalance-ui.c | 4 +-
ui/irqbalance-ui.h | 1 +
ui/irqbalance_client.h | 111 +++++++++++++ ui/irqbalance_client.h | 111 +++++++++++++
7 files changed, 581 insertions(+), 4 deletions(-) 5 files changed, 578 insertions(+), 2 deletions(-)
create mode 100644 ui/Makefile create mode 100644 ui/Makefile
create mode 100644 ui/client.c create mode 100644 ui/client.c
create mode 100644 ui/irqbalance_client.h create mode 100644 ui/irqbalance_client.h
@ -27,7 +25,7 @@ index 1af23c6..7c79087 100644
--- a/irqbalance.c --- a/irqbalance.c
+++ b/irqbalance.c +++ b/irqbalance.c
@@ -452,12 +452,12 @@ void get_object_stat(struct topo_obj *object, void *data) @@ -452,12 +452,12 @@ void get_object_stat(struct topo_obj *object, void *data)
#ifdef HAVE_IRQBALANCEUI
gboolean sock_handle(gint fd, GIOCondition condition, gpointer user_data __attribute__((unused))) gboolean sock_handle(gint fd, GIOCondition condition, gpointer user_data __attribute__((unused)))
{ {
- char buff[500]; - char buff[500];
@ -529,33 +527,6 @@ index 0000000..027404b
+ return ret_str; + return ret_str;
+} +}
+ +
diff --git a/ui/irqbalance-ui.c b/ui/irqbalance-ui.c
index 943f008..f0deaf8 100644
--- a/ui/irqbalance-ui.c
+++ b/ui/irqbalance-ui.c
@@ -120,8 +120,8 @@ char * get_data(char *string)
* With a select, ioctl to determine size, and malloc based
* on that
*/
- char *data = malloc(8192);
- int len = recv(socket_fd, data, 8192, 0);
+ char *data = malloc(RECV_BUF_SIZE);
+ int len = recv(socket_fd, data, RECV_BUF_SIZE, 0);
close(socket_fd);
data[len] = '\0';
free(msg->msg_control);
diff --git a/ui/irqbalance-ui.h b/ui/irqbalance-ui.h
index b32d58a..503c0c5 100644
--- a/ui/irqbalance-ui.h
+++ b/ui/irqbalance-ui.h
@@ -26,6 +26,7 @@
#define IRQ_10GBETH 6
#define IRQ_VIRT_EVENT 7
+#define RECV_BUF_SIZE (4096 * 8)
/* Typedefs */
diff --git a/ui/irqbalance_client.h b/ui/irqbalance_client.h diff --git a/ui/irqbalance_client.h b/ui/irqbalance_client.h
new file mode 100644 new file mode 100644
index 0000000..8f18b79 index 0000000..8f18b79

View File

@ -30,7 +30,7 @@ index 3086d67..aacb399 100644
irqbalance_SOURCES = activate.c bitmap.c classify.c cputree.c irqbalance.c \ 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
+ irqlist.c numa.c placement.c procinterrupts.c rules_config.c hint_verify.c + irqlist.c numa.c placement.c procinterrupts.c rules_config.c hint_verify.c
irqbalance_LDADD = $(LIBCAP_NG_LIBS) $(GLIB2_LIBS) irqbalance_LDADD = $(LIBCAP_NG_LIBS) $(GLIB2_LIBS) $(NUMA_LIBS)
if IRQBALANCEUI if IRQBALANCEUI
irqbalance_ui_SOURCES = $(UI_DIR)/helpers.c $(UI_DIR)/irqbalance-ui.c \ irqbalance_ui_SOURCES = $(UI_DIR)/helpers.c $(UI_DIR)/irqbalance-ui.c \
diff --git a/activate.c b/activate.c diff --git a/activate.c b/activate.c
@ -384,9 +384,9 @@ index 450a1ff..5985d8d 100644
} }
} }
@@ -720,9 +736,10 @@ int main(int argc, char** argv) @@ -720,9 +736,10 @@ int main(int argc, char** argv)
ret = EXIT_FAILURE;
goto out; goto out;
} }
#endif
+ update_interval_and_count(); + update_interval_and_count();
main_loop = g_main_loop_new(NULL, FALSE); main_loop = g_main_loop_new(NULL, FALSE);
- last_interval = sleep_interval; - last_interval = sleep_interval;

Binary file not shown.

BIN
irqbalance-1.9.0.tar.gz Normal file

Binary file not shown.

View File

@ -1,7 +1,7 @@
Summary: A dynamic adaptive IRQ balancing daemon Summary: A dynamic adaptive IRQ balancing daemon
Name: irqbalance Name: irqbalance
Version: 1.8.0 Version: 1.9.0
Release: 6 Release: 1
Epoch: 3 Epoch: 3
License: GPLv2 License: GPLv2
Source0: https://github.com/Irqbalance/irqbalance/archive/v%{version}.tar.gz#/irqbalance-%{version}.tar.gz 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 %define _hardened_build 1
Patch6000: bugfix-fix-unsigned-integer-subtraction-sign-overflow.patch
Patch6001: bugfix-ui-ui.c-always-use-s-style-format-for-printf-style-f.patch
Patch9000: feature-aarch64-add-the-regular-to-get-the-correct-i.patch Patch9000: feature-aarch64-add-the-regular-to-get-the-correct-i.patch
Patch9001: feature-add-new-user-irq-policy-config-rule.patch Patch9001: feature-add-new-user-irq-policy-config-rule.patch
Patch9002: feature-add-the-switch-of-printing-log.patch Patch9002: feature-add-the-switch-of-printing-log.patch
@ -35,7 +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 Patch9006: feature-enable-irqbalance-to-link-with-multiple-clie.patch
Patch9007: feature-add-ability-to-set-hintpolicy-during-runtime.patch Patch9007: feature-add-ability-to-set-hintpolicy-during-runtime.patch
Patch9008: feature-encapsulate-and-compile-the-functions-in-irqbalance-ui.patch Patch9008: feature-encapsulate-and-compile-the-functions-in-irqbalance-ui.patch
Patch9009: bugfix-fix-opendir-fails-in-check_platform_device.patch
Patch9010: bugfix-set-hint-name-in-add_new_irq-to-avoid-segment.patch Patch9010: bugfix-set-hint-name-in-add_new_irq-to-avoid-segment.patch
%description %description
@ -123,6 +119,12 @@ fi
/sbin/chkconfig --del %{name} >/dev/null 2>&1 || : /sbin/chkconfig --del %{name} >/dev/null 2>&1 || :
%changelog %changelog
* Thu Jul 7 2022 Liu Chao <liuchao173@huawei.com> - 3:1.9.0-1
- Type:enhanced
- ID:NA
- SUG:restart
- DESC: upgrade to v1.9.0
* Thu Jun 2 2022 Liu Chao <liuchao173@huawei.com> - 3:1.8.0-6 * Thu Jun 2 2022 Liu Chao <liuchao173@huawei.com> - 3:1.8.0-6
- Type:bugfix - Type:bugfix
- ID:NA - ID:NA