rename patch

This commit is contained in:
caomeng5@huawei.com 2019-12-26 09:42:32 +08:00
parent ad917abf90
commit f3207add3c
3 changed files with 68 additions and 109 deletions

View File

@ -0,0 +1,61 @@
From 07032f71ea956ca195c9b2386d09d24b07b7133f Mon Sep 17 00:00:00 2001
From: hejingxian <hejingxian@huawei.com>
Date: Tue, 12 Nov 2019 10:59:20 +0800
Subject: [PATCH] Prevent inserting a duplicate entry to avoid list chaos
Introduced by bugfix-force-irq-into-rebalance-list-when-irq-removed-and-reinserted.patch
and feature-introduce-verifyhint-to-detect-hint-variation.patch, irq may want be inserted to
rebalance list more then once, and we need to prevent this. we developped a solution in
bugfix-fix-two-same-irq-insert-to-list.patch, but we are likely to call irq_in_rebalance_list.
this patch remove the code in bugfix-fix-two-same-irq-insert-to-list.patch and add protection
in force_rebalance_irq instead.
---
classify.c | 2 +-
irqbalance.c | 4 ++++
irqbalance.h | 1 +
3 files changed, 6 insertions(+), 1 deletion(-)
diff --git a/classify.c b/classify.c
index f041054..5aed9e5 100644
--- a/classify.c
+++ b/classify.c
@@ -263,7 +263,7 @@ static int get_irq_class(const char *devpath)
return irq_class;
}
-static gint compare_ints(gconstpointer a, gconstpointer b)
+gint compare_ints(gconstpointer a, gconstpointer b)
{
const struct irq_info *ai = a;
const struct irq_info *bi = b;
diff --git a/irqbalance.c b/irqbalance.c
index 395669c..faa8e6a 100644
--- a/irqbalance.c
+++ b/irqbalance.c
@@ -251,6 +251,10 @@ void force_rebalance_irq(struct irq_info *info, void *data __attribute__((unused
if (info->level == BALANCE_NONE)
return;
+ /* Prevent inserting a duplicate entry to avoid list chaos */
+ if (g_list_find_custom(rebalance_irq_list, info, compare_ints))
+ return;
+
if (info->assigned_obj == NULL)
rebalance_irq_list = g_list_append(rebalance_irq_list, info);
else
diff --git a/irqbalance.h b/irqbalance.h
index c07a4fc..1befb46 100644
--- a/irqbalance.h
+++ b/irqbalance.h
@@ -113,6 +113,7 @@ extern void migrate_irq(GList **from, GList **to, struct irq_info *info);
extern void free_cl_opts(void);
extern void add_cl_banned_module(char *modname);
#define irq_numa_node(irq) ((irq)->numa_node)
+extern gint compare_ints(gconstpointer a, gconstpointer b);
extern struct irq_info *build_one_dev_entry(const char *dirname, GList *tmp_list);
extern void find_irq_dev_path(int irq, char *dirname, int length);
--
1.8.3.1

View File

@ -1,108 +0,0 @@
From 3eab5a9cee8a3641988778b676caa4cf9dcb14ab Mon Sep 17 00:00:00 2001
From: xiashuang <xiashuang1@huawei.com>
Date: Sun, 11 Aug 2019 23:48:50 -0400
Subject: [PATCH] Prevent inserting a duplicate entry to avoid list chaos
Introduced by huawei-bugfix-force-irq-into-rebalance-list-when-irq-removed-and-reinserted.patch
and huawei-feature-introduce-verifyhint-to-detect-hint-variation.patch, irq may want be inserted to
rebalance list more then once, and we need to prevent this. we developped a solution in
huawei-bugfix-fix-two-same-irq-insert-to-list.patch, but we are likely to call irq_in_rebalance_list.
this patch remove the code in huawei-bugfix-fix-two-same-irq-insert-to-list.patch and add protection
in force_rebalance_irq instead.
---
classify.c | 13 +------------
irqbalance.c | 4 ++++
irqbalance.h | 3 ++-
procinterrupts.c | 8 ++------
4 files changed, 9 insertions(+), 19 deletions(-)
diff --git a/classify.c b/classify.c
index 34a2e9f..65aeae2 100644
--- a/classify.c
+++ b/classify.c
@@ -260,7 +260,7 @@ static int get_irq_class(const char *devpath)
return irq_class;
}
-static gint compare_ints(gconstpointer a, gconstpointer b)
+gint compare_ints(gconstpointer a, gconstpointer b)
{
const struct irq_info *ai = a;
const struct irq_info *bi = b;
@@ -293,17 +293,6 @@ static void add_banned_irq(int irq, GList **list, int extra_flag)
return;
}
-int irq_in_rebalance_list(int irq)
-{
- GList *entry = NULL;
- struct irq_info find = {0};
-
- find.irq = irq;
- entry = g_list_find_custom(rebalance_irq_list, &find, compare_ints);
-
- return entry ? 1 : 0;
-}
-
#ifdef AARCH64
void add_banned_list_irq(int irq)
{
diff --git a/irqbalance.c b/irqbalance.c
index 6e9de88..fd72d44 100644
--- a/irqbalance.c
+++ b/irqbalance.c
@@ -314,6 +314,10 @@ void force_rebalance_irq(struct irq_info *info, void *data __attribute__((unused
if (info->level == BALANCE_NONE)
return;
+ /* Prevent inserting a duplicate entry to avoid list chaos */
+ if (g_list_find_custom(rebalance_irq_list, info, compare_ints))
+ return;
+
if (info->assigned_obj == NULL)
rebalance_irq_list = g_list_append(rebalance_irq_list, info);
else
diff --git a/irqbalance.h b/irqbalance.h
index b6bdebd..120bc9b 100644
--- a/irqbalance.h
+++ b/irqbalance.h
@@ -114,7 +114,8 @@ extern void free_cl_opts(void);
extern void add_cl_banned_module(char *modname);
#define irq_numa_node(irq) ((irq)->numa_node)
extern void force_rebalance_irq(struct irq_info *info, void *data __attribute__((unused)));
-int irq_in_rebalance_list(int irq);
+extern gint compare_ints(gconstpointer a, gconstpointer b);
+
/* huawei */
extern struct irq_info *build_one_dev_entry(const char *dirname, GList *tmp_list);
extern void find_irq_dev_path(int irq, char *dirname, int length);
diff --git a/procinterrupts.c b/procinterrupts.c
index 6b25fef..4bc68d7 100644
--- a/procinterrupts.c
+++ b/procinterrupts.c
@@ -446,9 +446,7 @@ void parse_proc_interrupts(void)
*/
if (count < info->irq_count) {
log(TO_CONSOLE, LOG_INFO, "Removed and reinserted IRQ %d added into rebalance list\n", number);
- if (!irq_in_rebalance_list(info->irq)) {
- force_rebalance_irq(info, NULL);
- }
+ force_rebalance_irq(info, NULL);
}
info->last_irq_count = info->irq_count;
@@ -702,9 +700,7 @@ void update_affinity_hint(struct irq_info *info, void *data __attribute__((unuse
cpumask_parse_user(line, len, current_affinity_hint);
if (!cpus_equal(current_affinity_hint, info->affinity_hint)) {
cpumask_copy(info->affinity_hint, current_affinity_hint);
- if (!irq_in_rebalance_list(info->irq)) {
- force_rebalance_irq(info, data);
- }
+ force_rebalance_irq(info, data);
log(TO_ALL, LOG_INFO, "IRQ(%d): affinity hint modified\n", info->irq);
}
}
--
1.8.3.1

View File

@ -1,7 +1,7 @@
Summary: A dynamic adaptive IRQ balancing daemon
Name: irqbalance
Version: 1.4.0
Release: 13
Release: 14
Epoch: 3
License: GPLv2
@ -133,6 +133,12 @@ fi
/sbin/chkconfig --del %{name} >/dev/null 2>&1 || :
%changelog
* Thu Dec 26 2019 caomeng<caomeng5@huawei.com> - 3:1.4.0-14
- Type:NA
- ID:NA
- SUG:restart
- DESC:rename the patch
* Fri Dec 20 2019 caomeng<caomeng5@huawei.com> - 3:1.4.0-13
- Type:NA
- ID:NA