You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
153 lines
4.3 KiB
153 lines
4.3 KiB
6 years ago
|
From 7f072d94c93174d30eb18426ee8f8727a9081c40 Mon Sep 17 00:00:00 2001
|
||
|
From: Neil Horman <nhorman@tuxdriver.com>
|
||
|
Date: Fri, 16 May 2014 10:10:36 -0400
|
||
|
Subject: [PATCH] irqbalance: separate cmomand line banned irqs from listed
|
||
|
banned irqs
|
||
|
|
||
|
irqbalance was using one list for tracking banned irqs, but the list was being
|
||
|
used for disperate pruposes in different places. It was tracking command line
|
||
|
banned irqs and irqs that were banned via banscript and policyscript. The
|
||
|
former needs to be remembered accross db rebuilds, while the latter needs to be
|
||
|
rebuilt every time. This patch separates the two in to two lists, so that we
|
||
|
don't stop banning command line specified irqs after the first db rebuild.
|
||
|
|
||
|
Signed-off-by: Neil Horman <nhorman@tuxdriver.com>
|
||
|
---
|
||
|
classify.c | 38 +++++++++++++++++++++++++++++---------
|
||
|
irqbalance.c | 2 +-
|
||
|
irqbalance.h | 2 +-
|
||
|
3 files changed, 31 insertions(+), 11 deletions(-)
|
||
|
|
||
|
diff --git a/classify.c b/classify.c
|
||
|
index 94b53b8..8c7d482 100644
|
||
|
--- a/classify.c
|
||
|
+++ b/classify.c
|
||
|
@@ -59,8 +59,9 @@ struct user_irq_policy {
|
||
|
int numa_node;
|
||
|
};
|
||
|
|
||
|
-static GList *interrupts_db;
|
||
|
-static GList *banned_irqs;
|
||
|
+static GList *interrupts_db = NULL;
|
||
|
+static GList *banned_irqs = NULL;
|
||
|
+static GList *cl_banned_irqs = NULL;
|
||
|
|
||
|
#define SYSDEV_DIR "/sys/bus/pci/devices"
|
||
|
|
||
|
@@ -72,13 +73,13 @@ static gint compare_ints(gconstpointer a, gconstpointer b)
|
||
|
return ai->irq - bi->irq;
|
||
|
}
|
||
|
|
||
|
-void add_banned_irq(int irq)
|
||
|
+void add_banned_irq(int irq, GList **list)
|
||
|
{
|
||
|
struct irq_info find, *new;
|
||
|
GList *entry;
|
||
|
|
||
|
find.irq = irq;
|
||
|
- entry = g_list_find_custom(banned_irqs, &find, compare_ints);
|
||
|
+ entry = g_list_find_custom(*list, &find, compare_ints);
|
||
|
if (entry)
|
||
|
return;
|
||
|
|
||
|
@@ -91,10 +92,16 @@ void add_banned_irq(int irq)
|
||
|
new->irq = irq;
|
||
|
new->flags |= IRQ_FLAG_BANNED;
|
||
|
|
||
|
- banned_irqs = g_list_append(banned_irqs, new);
|
||
|
+ *list = g_list_append(*list, new);
|
||
|
return;
|
||
|
}
|
||
|
|
||
|
+void add_cl_banned_irq(int irq)
|
||
|
+{
|
||
|
+ add_banned_irq(irq, &cl_banned_irqs);
|
||
|
+}
|
||
|
+
|
||
|
+
|
||
|
static int is_banned_irq(int irq)
|
||
|
{
|
||
|
GList *entry;
|
||
|
@@ -324,10 +331,23 @@ static int check_for_irq_ban(char *path, int irq)
|
||
|
{
|
||
|
char *cmd;
|
||
|
int rc;
|
||
|
+ struct irq_info find;
|
||
|
+ GList *entry;
|
||
|
+
|
||
|
+ /*
|
||
|
+ * Check to see if we banned this irq on the command line
|
||
|
+ */
|
||
|
+ find.irq = irq;
|
||
|
+ entry = g_list_find_custom(cl_banned_irqs, &find, compare_ints);
|
||
|
+ if (entry)
|
||
|
+ return 1;
|
||
|
|
||
|
if (!banscript)
|
||
|
return 0;
|
||
|
|
||
|
+ if (!path)
|
||
|
+ return 0;
|
||
|
+
|
||
|
cmd = alloca(strlen(path)+strlen(banscript)+32);
|
||
|
if (!cmd)
|
||
|
return 0;
|
||
|
@@ -382,7 +402,7 @@ static void build_one_dev_entry(const char *dirname)
|
||
|
continue;
|
||
|
get_irq_user_policy(devpath, irqnum, &pol);
|
||
|
if ((pol.ban == 1) || (check_for_irq_ban(devpath, irqnum))) {
|
||
|
- add_banned_irq(irqnum);
|
||
|
+ add_banned_irq(irqnum, &banned_irqs);
|
||
|
continue;
|
||
|
}
|
||
|
new = add_one_irq_to_db(devpath, irqnum, &pol);
|
||
|
@@ -411,7 +431,7 @@ static void build_one_dev_entry(const char *dirname)
|
||
|
goto done;
|
||
|
get_irq_user_policy(devpath, irqnum, &pol);
|
||
|
if ((pol.ban == 1) || (check_for_irq_ban(path, irqnum))) {
|
||
|
- add_banned_irq(irqnum);
|
||
|
+ add_banned_irq(irqnum, &banned_irqs);
|
||
|
goto done;
|
||
|
}
|
||
|
|
||
|
@@ -497,8 +517,8 @@ struct irq_info *add_new_irq(int irq, struct irq_info *hint)
|
||
|
return NULL;
|
||
|
|
||
|
get_irq_user_policy("/sys", irq, &pol);
|
||
|
- if (pol.ban == 1) {
|
||
|
- add_banned_irq(irq);
|
||
|
+ if ((pol.ban == 1) || check_for_irq_ban(NULL, irq)) {
|
||
|
+ add_banned_irq(irq, &banned_irqs);
|
||
|
new = get_irq_info(irq);
|
||
|
} else
|
||
|
new = add_one_irq_to_db("/sys", irq, &pol);
|
||
|
diff --git a/irqbalance.c b/irqbalance.c
|
||
|
index 2532242..e0b3cbe 100644
|
||
|
--- a/irqbalance.c
|
||
|
+++ b/irqbalance.c
|
||
|
@@ -151,7 +151,7 @@ static void parse_command_line(int argc, char **argv)
|
||
|
usage();
|
||
|
exit(1);
|
||
|
}
|
||
|
- add_banned_irq((int)val);
|
||
|
+ add_cl_banned_irq((int)val);
|
||
|
break;
|
||
|
case 'l':
|
||
|
polscript = strdup(optarg);
|
||
|
diff --git a/irqbalance.h b/irqbalance.h
|
||
|
index 04cf9d8..cb648a5 100644
|
||
|
--- a/irqbalance.h
|
||
|
+++ b/irqbalance.h
|
||
|
@@ -106,7 +106,7 @@ extern int get_cpu_count(void);
|
||
|
*/
|
||
|
extern void rebuild_irq_db(void);
|
||
|
extern void free_irq_db(void);
|
||
|
-extern void add_banned_irq(int irq);
|
||
|
+extern void add_cl_banned_irq(int irq);
|
||
|
extern void for_each_irq(GList *list, void (*cb)(struct irq_info *info, void *data), void *data);
|
||
|
extern struct irq_info *get_irq_info(int irq);
|
||
|
extern void migrate_irq(GList **from, GList **to, struct irq_info *info);
|
||
|
--
|
||
|
2.4.3
|
||
|
|