115 lines
3.8 KiB
Diff
115 lines
3.8 KiB
Diff
From b697a97436dafa13f0ae3febde299bfc20498f9d Mon Sep 17 00:00:00 2001
|
|
From: liuchao173 <liuchao173@huawei.com>
|
|
Date: Wed, 23 Oct 2019 11:42:26 +0000
|
|
Subject: [PATCH] irqbalance: add the switch of printing log
|
|
|
|
add the switch of printing log
|
|
---
|
|
cputree.c | 16 ++++++++--------
|
|
irqbalance.c | 25 +++++++++++++++++++++++++-
|
|
2 files changed, 32 insertions(+), 9 deletions(-)
|
|
|
|
diff --git a/cputree.c b/cputree.c
|
|
index 99f14d2..1465103 100644
|
|
--- a/cputree.c
|
|
+++ b/cputree.c
|
|
@@ -432,23 +432,23 @@ static void dump_irq(struct irq_info *info, void *data)
|
|
indent[i] = log_indent[0];
|
|
|
|
indent[i] = '\0';
|
|
- log(TO_CONSOLE, LOG_INFO, "%sInterrupt %i node_num is %d (%s/%lu:%lu) \n", indent,
|
|
+ log(TO_ALL, LOG_INFO, "%sInterrupt %i node_num is %d (%s/%lu:%lu) \n", indent,
|
|
info->irq, irq_numa_node(info)->number, classes[info->class], info->load, (info->irq_count - info->last_irq_count));
|
|
free(indent);
|
|
}
|
|
|
|
static void dump_numa_node_num(struct topo_obj *p, void *data __attribute__((unused)))
|
|
{
|
|
- log(TO_CONSOLE, LOG_INFO, "%d ", p->number);
|
|
+ log(TO_ALL, LOG_INFO, "%d ", p->number);
|
|
}
|
|
|
|
static void dump_balance_obj(struct topo_obj *d, void *data __attribute__((unused)))
|
|
{
|
|
struct topo_obj *c = (struct topo_obj *)d;
|
|
- log(TO_CONSOLE, LOG_INFO, "%s%s%s%sCPU number %i numa_node is ",
|
|
+ log(TO_ALL, LOG_INFO, "%s%s%s%sCPU number %i numa_node is ",
|
|
log_indent, log_indent, log_indent, log_indent, c->number);
|
|
for_each_object(cpu_numa_node(c), dump_numa_node_num, NULL);
|
|
- log(TO_CONSOLE, LOG_INFO, "(load %lu)\n", (unsigned long)c->load);
|
|
+ log(TO_ALL, LOG_INFO, "(load %lu)\n", (unsigned long)c->load);
|
|
if (c->interrupts)
|
|
for_each_irq(c->interrupts, dump_irq, (void *)18);
|
|
}
|
|
@@ -457,10 +457,10 @@ static void dump_cache_domain(struct topo_obj *d, void *data)
|
|
{
|
|
char *buffer = data;
|
|
cpumask_scnprintf(buffer, 4095, d->mask);
|
|
- log(TO_CONSOLE, LOG_INFO, "%s%sCache domain %i: numa_node is ",
|
|
+ log(TO_ALL, LOG_INFO, "%s%sCache domain %i: numa_node is ",
|
|
log_indent, log_indent, d->number);
|
|
for_each_object(d->numa_nodes, dump_numa_node_num, NULL);
|
|
- log(TO_CONSOLE, LOG_INFO, "cpu mask is %s (load %lu) \n", buffer,
|
|
+ log(TO_ALL, LOG_INFO, "cpu mask is %s (load %lu) \n", buffer,
|
|
(unsigned long)d->load);
|
|
if (d->children)
|
|
for_each_object(d->children, dump_balance_obj, NULL);
|
|
@@ -472,9 +472,9 @@ static void dump_package(struct topo_obj *d, void *data)
|
|
{
|
|
char *buffer = data;
|
|
cpumask_scnprintf(buffer, 4096, d->mask);
|
|
- log(TO_CONSOLE, LOG_INFO, "Package %i: numa_node ", d->number);
|
|
+ log(TO_ALL, LOG_INFO, "Package %i: numa_node ", d->number);
|
|
for_each_object(d->numa_nodes, dump_numa_node_num, NULL);
|
|
- log(TO_CONSOLE, LOG_INFO, "cpu mask is %s (load %lu)\n",
|
|
+ log(TO_ALL, LOG_INFO, "cpu mask is %s (load %lu)\n",
|
|
buffer, (unsigned long)d->load);
|
|
if (d->children)
|
|
for_each_object(d->children, dump_cache_domain, buffer);
|
|
diff --git a/irqbalance.c b/irqbalance.c
|
|
index d41753c..7d8d15c 100644
|
|
--- a/irqbalance.c
|
|
+++ b/irqbalance.c
|
|
@@ -273,6 +273,29 @@ gboolean force_rescan(gpointer data __attribute__((unused)))
|
|
return TRUE;
|
|
}
|
|
|
|
+static int check_debug()
|
|
+{
|
|
+ char *line = NULL;
|
|
+ size_t size = 0;
|
|
+ FILE *file;
|
|
+
|
|
+ file = fopen("/etc/sysconfig/irqbalance_debug", "r");
|
|
+ if (!file)
|
|
+ return 0;
|
|
+ if (getline(&line, &size, file) <= 0) {
|
|
+ goto out;
|
|
+ }
|
|
+ if (line != NULL && strstr(line, "1") != NULL) {
|
|
+ fclose(file);
|
|
+ free(line);
|
|
+ return 1;
|
|
+ }
|
|
+out:
|
|
+ fclose(file);
|
|
+ free(line);
|
|
+ return 0;
|
|
+}
|
|
+
|
|
gboolean scan(gpointer data)
|
|
{
|
|
log(TO_CONSOLE, LOG_INFO, "\n\n\n-----------------------------------------------------------------------------\n");
|
|
@@ -305,7 +328,7 @@ gboolean scan(gpointer data)
|
|
calculate_placement();
|
|
activate_mappings();
|
|
|
|
- if (debug_mode)
|
|
+ if (debug_mode || check_debug())
|
|
dump_tree();
|
|
if (one_shot_mode)
|
|
keep_going = 0;
|
|
--
|
|
2.19.1
|
|
|