62 lines
2.2 KiB
Diff
62 lines
2.2 KiB
Diff
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
|
|
|