backport community patches
(cherry picked from commit c371535d450a2dff7f59c236261e3b7da14468c4)
This commit is contained in:
parent
d62aab053e
commit
24db4431c5
@ -0,0 +1,144 @@
|
||||
From f589bdced6e1fe885969f2833fc3cacdfb60ea79 Mon Sep 17 00:00:00 2001
|
||||
From: Robin Jarry <rjarry@redhat.com>
|
||||
Date: Tue, 11 Jul 2023 15:17:55 +0200
|
||||
Subject: [PATCH] activate_mapping: avoid use-after-free when affinity cannot
|
||||
be set
|
||||
|
||||
add_banned_irq appends the irq_info to the banned_irqs list.
|
||||
remove_one_irq_from_db removes it from the interrupts_db and free()s it.
|
||||
|
||||
This leaves an invalid pointer dangling in banned_irqs *and* potentially
|
||||
in rebalance_irq_list which can cause use-after-free errors.
|
||||
|
||||
Do not move the irq_info around. Only add a flag to indicate that this
|
||||
irq's affinity cannot be managed and ignore the irq when this flag is
|
||||
set.
|
||||
|
||||
Link: https://github.com/Irqbalance/irqbalance/issues/267
|
||||
Fixes: 55c5c321c73e ("arm64: Add irq aff change check For aarch64...")
|
||||
Signed-off-by: Robin Jarry <rjarry@redhat.com>
|
||||
---
|
||||
activate.c | 8 +++++---
|
||||
classify.c | 28 +++-------------------------
|
||||
irqbalance.h | 2 --
|
||||
types.h | 3 ++-
|
||||
4 files changed, 10 insertions(+), 31 deletions(-)
|
||||
|
||||
diff --git a/activate.c b/activate.c
|
||||
index 62cfd08..6f8af27 100644
|
||||
--- a/activate.c
|
||||
+++ b/activate.c
|
||||
@@ -60,6 +60,9 @@ static void activate_mapping(struct irq_info *info, void *data __attribute__((un
|
||||
if (!info->assigned_obj)
|
||||
return;
|
||||
|
||||
+ if (info->flags & IRQ_FLAG_AFFINITY_UNMANAGED)
|
||||
+ return;
|
||||
+
|
||||
/* activate only online cpus, otherwise writing to procfs returns EOVERFLOW */
|
||||
cpus_and(applied_mask, cpu_online_map, info->assigned_obj->mask);
|
||||
|
||||
@@ -77,9 +80,8 @@ static void activate_mapping(struct irq_info *info, void *data __attribute__((un
|
||||
cpumask_scnprintf(buf, PATH_MAX, applied_mask);
|
||||
ret = fprintf(file, "%s", buf);
|
||||
if (ret < 0) {
|
||||
- log(TO_ALL, LOG_WARNING, "cannot change irq %i's affinity, add it to banned list", info->irq);
|
||||
- add_banned_irq(info->irq);
|
||||
- remove_one_irq_from_db(info->irq);
|
||||
+ log(TO_ALL, LOG_WARNING, "cannot change IRQ %i affinity, will never try again\n", info->irq);
|
||||
+ info->flags |= IRQ_FLAG_AFFINITY_UNMANAGED;
|
||||
}
|
||||
fclose(file);
|
||||
info->moved = 0; /*migration is done*/
|
||||
diff --git a/classify.c b/classify.c
|
||||
index dac813c..1601a1e 100644
|
||||
--- a/classify.c
|
||||
+++ b/classify.c
|
||||
@@ -257,7 +257,7 @@ static gint compare_ints(gconstpointer a, gconstpointer b)
|
||||
return ai->irq - bi->irq;
|
||||
}
|
||||
|
||||
-static void __add_banned_irq(int irq, GList **list)
|
||||
+static void add_banned_irq(int irq, GList **list)
|
||||
{
|
||||
struct irq_info find, *new;
|
||||
GList *entry;
|
||||
@@ -281,14 +281,9 @@ static void __add_banned_irq(int irq, GList **list)
|
||||
return;
|
||||
}
|
||||
|
||||
-void add_banned_irq(int irq)
|
||||
-{
|
||||
- __add_banned_irq(irq, &banned_irqs);
|
||||
-}
|
||||
-
|
||||
void add_cl_banned_irq(int irq)
|
||||
{
|
||||
- __add_banned_irq(irq, &cl_banned_irqs);
|
||||
+ add_banned_irq(irq, &cl_banned_irqs);
|
||||
}
|
||||
|
||||
gint substr_find(gconstpointer a, gconstpointer b)
|
||||
@@ -392,23 +387,6 @@ get_numa_node:
|
||||
return new;
|
||||
}
|
||||
|
||||
-void remove_one_irq_from_db(int irq)
|
||||
-{
|
||||
- struct irq_info find, *tmp;
|
||||
- GList *entry = NULL;
|
||||
-
|
||||
- find.irq = irq;
|
||||
- entry = g_list_find_custom(interrupts_db, &find, compare_ints);
|
||||
- if (!entry)
|
||||
- return;
|
||||
-
|
||||
- tmp = entry->data;
|
||||
- interrupts_db = g_list_remove(interrupts_db, tmp);
|
||||
- free(tmp);
|
||||
- log(TO_CONSOLE, LOG_INFO, "IRQ %d was removed from db.\n", irq);
|
||||
- return;
|
||||
-}
|
||||
-
|
||||
static void parse_user_policy_key(char *buf, int irq, struct user_irq_policy *pol)
|
||||
{
|
||||
char *key, *value, *end;
|
||||
@@ -629,7 +607,7 @@ static void add_new_irq(char *path, struct irq_info *hint)
|
||||
/* Set NULL devpath for the irq has no sysfs entries */
|
||||
get_irq_user_policy(path, irq, &pol);
|
||||
if ((pol.ban == 1) || check_for_irq_ban(hint, mod)) { /*FIXME*/
|
||||
- __add_banned_irq(irq, &banned_irqs);
|
||||
+ add_banned_irq(irq, &banned_irqs);
|
||||
new = get_irq_info(irq);
|
||||
} else
|
||||
new = add_one_irq_to_db(path, hint, &pol);
|
||||
diff --git a/irqbalance.h b/irqbalance.h
|
||||
index e7f6b94..46e05ca 100644
|
||||
--- a/irqbalance.h
|
||||
+++ b/irqbalance.h
|
||||
@@ -109,8 +109,6 @@ extern struct irq_info *get_irq_info(int irq);
|
||||
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);
|
||||
-extern void add_banned_irq(int irq);
|
||||
-extern void remove_one_irq_from_db(int irq);
|
||||
#define irq_numa_node(irq) ((irq)->numa_node)
|
||||
|
||||
|
||||
diff --git a/types.h b/types.h
|
||||
index 9693cf4..c63cfea 100644
|
||||
--- a/types.h
|
||||
+++ b/types.h
|
||||
@@ -34,7 +34,8 @@
|
||||
/*
|
||||
* IRQ Internal tracking flags
|
||||
*/
|
||||
-#define IRQ_FLAG_BANNED 1
|
||||
+#define IRQ_FLAG_BANNED (1ULL << 0)
|
||||
+#define IRQ_FLAG_AFFINITY_UNMANAGED (1ULL << 1)
|
||||
|
||||
enum obj_type_e {
|
||||
OBJ_TYPE_CPU,
|
||||
--
|
||||
2.28.0.windows.1
|
||||
|
||||
@ -0,0 +1,51 @@
|
||||
From 470a64b190628574c28a266bdcf8960291463191 Mon Sep 17 00:00:00 2001
|
||||
From: Robin Jarry <rjarry@redhat.com>
|
||||
Date: Wed, 12 Jul 2023 08:51:08 +0200
|
||||
Subject: [PATCH] activate_mapping: make sure to catch all errors
|
||||
|
||||
Reference: https://github.com/Irqbalance/irqbalance/commit/470a64b190628574c28a266bdcf8960291463191
|
||||
Conflict: NA
|
||||
|
||||
fprintf() is buffered and may not report an error which may be deferred
|
||||
when fflush() is called (either explicitly or internally by fclose()).
|
||||
|
||||
Check for errors returned by fopen(), fprintf() and fclose() and add
|
||||
IRQ_FLAG_AFFINITY_UNMANAGED accordingly.
|
||||
|
||||
Fixes: 55c5c321c73e ("arm64: Add irq aff change check For aarch64, ...")
|
||||
Fixes: https://bugzilla.redhat.com/show_bug.cgi?id=2184735
|
||||
Signed-off-by: Robin Jarry <rjarry@redhat.com>
|
||||
---
|
||||
activate.c | 12 ++++++------
|
||||
1 file changed, 6 insertions(+), 6 deletions(-)
|
||||
|
||||
diff --git a/activate.c b/activate.c
|
||||
index 6f8af27..a4112e0 100644
|
||||
--- a/activate.c
|
||||
+++ b/activate.c
|
||||
@@ -75,16 +75,16 @@ static void activate_mapping(struct irq_info *info, void *data __attribute__((un
|
||||
sprintf(buf, "/proc/irq/%i/smp_affinity", info->irq);
|
||||
file = fopen(buf, "w");
|
||||
if (!file)
|
||||
- return;
|
||||
+ goto error;
|
||||
|
||||
cpumask_scnprintf(buf, PATH_MAX, applied_mask);
|
||||
ret = fprintf(file, "%s", buf);
|
||||
- if (ret < 0) {
|
||||
- log(TO_ALL, LOG_WARNING, "cannot change IRQ %i affinity, will never try again\n", info->irq);
|
||||
- info->flags |= IRQ_FLAG_AFFINITY_UNMANAGED;
|
||||
- }
|
||||
- fclose(file);
|
||||
+ if (fclose(file) || ret < 0)
|
||||
+ goto error;
|
||||
info->moved = 0; /*migration is done*/
|
||||
+error:
|
||||
+ log(TO_ALL, LOG_WARNING, "cannot change IRQ %i affinity, will never try again\n", info->irq);
|
||||
+ info->flags |= IRQ_FLAG_AFFINITY_UNMANAGED;
|
||||
}
|
||||
|
||||
void activate_mappings(void)
|
||||
--
|
||||
2.28.0.windows.1
|
||||
|
||||
67
backport-0003-activate_mapping-report-error-reason.patch
Normal file
67
backport-0003-activate_mapping-report-error-reason.patch
Normal file
@ -0,0 +1,67 @@
|
||||
From 9a1fd29a82c9762c3676f613075d44a8d1fcbe82 Mon Sep 17 00:00:00 2001
|
||||
From: Robin Jarry <rjarry@redhat.com>
|
||||
Date: Wed, 12 Jul 2023 08:59:45 +0200
|
||||
Subject: [PATCH] activate_mapping: report error reason
|
||||
|
||||
Reference: https://github.com/Irqbalance/irqbalance/commit/9a1fd29a82c9762c3676f613075d44a8d1fcbe82
|
||||
Conflict: NA
|
||||
|
||||
If a given IRQ affinity cannot be set, include strerror in the warning
|
||||
message.
|
||||
|
||||
Fixes: https://bugzilla.redhat.com/show_bug.cgi?id=2184735
|
||||
Signed-off-by: Robin Jarry <rjarry@redhat.com>
|
||||
---
|
||||
activate.c | 15 ++++++++++++---
|
||||
1 file changed, 12 insertions(+), 3 deletions(-)
|
||||
|
||||
diff --git a/activate.c b/activate.c
|
||||
index a4112e0..4418cda 100644
|
||||
--- a/activate.c
|
||||
+++ b/activate.c
|
||||
@@ -25,10 +25,12 @@
|
||||
* of interrupts to the kernel.
|
||||
*/
|
||||
#include "config.h"
|
||||
+#include <errno.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <unistd.h>
|
||||
#include <stdint.h>
|
||||
+#include <string.h>
|
||||
|
||||
#include "irqbalance.h"
|
||||
|
||||
@@ -48,7 +50,7 @@ static void activate_mapping(struct irq_info *info, void *data __attribute__((un
|
||||
{
|
||||
char buf[PATH_MAX];
|
||||
FILE *file;
|
||||
- int ret = 0;
|
||||
+ int errsave, ret;
|
||||
cpumask_t applied_mask;
|
||||
|
||||
/*
|
||||
@@ -79,11 +81,18 @@ static void activate_mapping(struct irq_info *info, void *data __attribute__((un
|
||||
|
||||
cpumask_scnprintf(buf, PATH_MAX, applied_mask);
|
||||
ret = fprintf(file, "%s", buf);
|
||||
- if (fclose(file) || ret < 0)
|
||||
+ errsave = errno;
|
||||
+ if (fclose(file)) {
|
||||
+ errsave = errno;
|
||||
+ goto error;
|
||||
+ }
|
||||
+ if (ret < 0)
|
||||
goto error;
|
||||
info->moved = 0; /*migration is done*/
|
||||
error:
|
||||
- log(TO_ALL, LOG_WARNING, "cannot change IRQ %i affinity, will never try again\n", info->irq);
|
||||
+ log(TO_ALL, LOG_WARNING,
|
||||
+ "Cannot change IRQ %i affinity: %s. Will never try again.\n",
|
||||
+ info->irq, strerror(errsave));
|
||||
info->flags |= IRQ_FLAG_AFFINITY_UNMANAGED;
|
||||
}
|
||||
|
||||
--
|
||||
2.28.0.windows.1
|
||||
|
||||
@ -0,0 +1,54 @@
|
||||
From eee7917ef5272691b9d4ee6341463f3c78f7f909 Mon Sep 17 00:00:00 2001
|
||||
From: Robin Jarry <rjarry@redhat.com>
|
||||
Date: Wed, 12 Jul 2023 17:49:13 +0200
|
||||
Subject: [PATCH] activate_mapping: only blacklist irq if error is considered
|
||||
permanent
|
||||
|
||||
Reference: https://github.com/Irqbalance/irqbalance/commit/eee7917ef5272691b9d4ee6341463f3c78f7f909
|
||||
Conflict: NA
|
||||
|
||||
Some errors reported when writing to smp_affinity are transient. For
|
||||
example, when a CPU interrupt controller does not have enough room to
|
||||
map the IRQ, the kernel will return "No space left on device".
|
||||
|
||||
This kind of situation can change over time. Do not mark the IRQ
|
||||
affinity as "unmanaged". Let irqbalance try again later.
|
||||
|
||||
Signed-off-by: Robin Jarry <rjarry@redhat.com>
|
||||
---
|
||||
activate.c | 18 ++++++++++++++++--
|
||||
1 file changed, 16 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/activate.c b/activate.c
|
||||
index 4418cda..7353692 100644
|
||||
--- a/activate.c
|
||||
+++ b/activate.c
|
||||
@@ -91,9 +91,23 @@ static void activate_mapping(struct irq_info *info, void *data __attribute__((un
|
||||
info->moved = 0; /*migration is done*/
|
||||
error:
|
||||
log(TO_ALL, LOG_WARNING,
|
||||
- "Cannot change IRQ %i affinity: %s. Will never try again.\n",
|
||||
+ "Cannot change IRQ %i affinity: %s\n",
|
||||
info->irq, strerror(errsave));
|
||||
- info->flags |= IRQ_FLAG_AFFINITY_UNMANAGED;
|
||||
+ switch (errsave) {
|
||||
+ case ENOSPC: /* Specified CPU APIC is full. */
|
||||
+ case EAGAIN: /* Interrupted by signal. */
|
||||
+ case EBUSY: /* Affinity change already in progress. */
|
||||
+ case EINVAL: /* IRQ would be bound to no CPU. */
|
||||
+ case ERANGE: /* CPU in mask is offline. */
|
||||
+ case ENOMEM: /* Kernel cannot allocate CPU mask. */
|
||||
+ /* Do not blacklist the IRQ on transient errors. */
|
||||
+ break;
|
||||
+ default:
|
||||
+ /* Any other error is considered permanent. */
|
||||
+ info->flags |= IRQ_FLAG_AFFINITY_UNMANAGED;
|
||||
+ log(TO_ALL, LOG_WARNING, "IRQ %i affinity is now unmanaged\n",
|
||||
+ info->irq);
|
||||
+ }
|
||||
}
|
||||
|
||||
void activate_mappings(void)
|
||||
--
|
||||
2.28.0.windows.1
|
||||
|
||||
@ -0,0 +1,31 @@
|
||||
From bc7794dc78474c463a26926749537f23abc4c082 Mon Sep 17 00:00:00 2001
|
||||
From: Robin Jarry <rjarry@redhat.com>
|
||||
Date: Thu, 13 Jul 2023 20:49:16 +0200
|
||||
Subject: [PATCH] activate_mapping: avoid logging error when there is none
|
||||
|
||||
Reference: https://github.com/Irqbalance/irqbalance/commit/bc7794dc78474c463a26926749537f23abc4c082
|
||||
Conflict: NA
|
||||
|
||||
Add missing return statement.
|
||||
|
||||
Fixes: 470a64b19062 ("activate_mapping: make sure to catch all errors")
|
||||
Signed-off-by: Robin Jarry <rjarry@redhat.com>
|
||||
---
|
||||
activate.c | 1 +
|
||||
1 file changed, 1 insertion(+)
|
||||
|
||||
diff --git a/activate.c b/activate.c
|
||||
index 7353692..548a401 100644
|
||||
--- a/activate.c
|
||||
+++ b/activate.c
|
||||
@@ -89,6 +89,7 @@ static void activate_mapping(struct irq_info *info, void *data __attribute__((un
|
||||
if (ret < 0)
|
||||
goto error;
|
||||
info->moved = 0; /*migration is done*/
|
||||
+ return;
|
||||
error:
|
||||
log(TO_ALL, LOG_WARNING,
|
||||
"Cannot change IRQ %i affinity: %s\n",
|
||||
--
|
||||
2.28.0.windows.1
|
||||
|
||||
@ -0,0 +1,40 @@
|
||||
From b4c377148dda6f10a5c25be535513eeab236141f Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?Stefan=20Br=C3=BCns?= <stefan.bruens@rwth-aachen.de>
|
||||
Date: Wed, 13 Dec 2023 20:09:34 +0100
|
||||
Subject: [PATCH] Avoid repeated affinity checks when no change is necessary
|
||||
|
||||
An IRQ may be migrated several times during one loop iteration, and end
|
||||
up with the same CPU affinity mask as before - the "moved" flag is merely
|
||||
a hint a affinity change may be necessary. This notably also happens
|
||||
during initial placement, but may happen also anytime later.
|
||||
|
||||
To avoid visiting each IRQ again and again unset the "moved" flag. This
|
||||
avoids the open/stat/read/close syscalls for unchanged interrupts.
|
||||
|
||||
Fixes: #285
|
||||
|
||||
Reference: https://github.com/Irqbalance/irqbalance/commit/b4c377148dda6f10a5c25be535513eeab236141f
|
||||
Conflict: NA
|
||||
---
|
||||
activate.c | 4 +++-
|
||||
1 file changed, 3 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/activate.c b/activate.c
|
||||
index 4830f34..724fbd5 100644
|
||||
--- a/activate.c
|
||||
+++ b/activate.c
|
||||
@@ -68,8 +68,10 @@ static void activate_mapping(struct irq_info *info, void *data __attribute__((un
|
||||
/*
|
||||
* Don't activate anything for which we have an invalid mask
|
||||
*/
|
||||
- if (check_affinity(info, applied_mask))
|
||||
+ if (check_affinity(info, applied_mask)) {
|
||||
+ info->moved = 0; /* nothing to do, mark as done */
|
||||
return;
|
||||
+ }
|
||||
|
||||
sprintf(buf, "/proc/irq/%i/smp_affinity", info->irq);
|
||||
file = fopen(buf, "w");
|
||||
--
|
||||
2.28.0.windows.1
|
||||
|
||||
@ -0,0 +1,84 @@
|
||||
From ad0ea2c4c09d6aa76e6c3f87587047cbaddf254e Mon Sep 17 00:00:00 2001
|
||||
From: StefanBruens <stefan.bruens@rwth-aachen.de>
|
||||
Date: Wed, 13 Dec 2023 01:28:59 +0100
|
||||
Subject: [PATCH] Slience "... rebalancing" messages for unmigratable IRQs
|
||||
|
||||
It is fairly pointless to try migrating an IRQ which is known
|
||||
to be unmigratable.
|
||||
|
||||
Instead of using an extra flag, set the `level` to BALANCE_NONE,
|
||||
which shortcuts quite some code, and implicitly also disables
|
||||
the misleading repeated log message:
|
||||
|
||||
```
|
||||
Dez 10 02:52:55 varm irqbalance[828]: Selecting irq 75 for rebalancing
|
||||
Dez 10 02:52:55 varm irqbalance[828]: Cannot change IRQ 75 affinity: Input/output error
|
||||
Dez 10 02:52:55 varm irqbalance[828]: IRQ 75 affinity is now unmanaged
|
||||
...
|
||||
Dez 10 02:52:55 varm irqbalance[828]: Selecting irq 75 for rebalancing
|
||||
...
|
||||
Dez 10 02:52:55 varm irqbalance[828]: Selecting irq 75 for rebalancing
|
||||
```
|
||||
|
||||
Reference: https://github.com/Irqbalance/irqbalance/commit/ad0ea2c4c09d6aa76e6c3f87587047cbaddf254e
|
||||
Conflict: The community patch set the info->level flag. However, the
|
||||
backport-feature-introduce-verifyhint-to-detect-hint-variatio.patch patch deletes the judgment of
|
||||
info->moved in the activate_mapping function. As a result, the irqbalance prints logs every 10 seconds.
|
||||
Therefore, the community patch is modified to add the judgment of info->level flag.
|
||||
---
|
||||
activate.c | 5 +++--
|
||||
irqlist.c | 2 +-
|
||||
types.h | 1 -
|
||||
3 files changed, 4 insertions(+), 4 deletions(-)
|
||||
|
||||
diff --git a/activate.c b/activate.c
|
||||
index 548a401..4830f34 100644
|
||||
--- a/activate.c
|
||||
+++ b/activate.c
|
||||
@@ -62,7 +62,7 @@ static void activate_mapping(struct irq_info *info, void *data __attribute__((un
|
||||
if (!info->assigned_obj)
|
||||
return;
|
||||
|
||||
- if (info->flags & IRQ_FLAG_AFFINITY_UNMANAGED)
|
||||
+ if (info->level == BALANCE_NONE)
|
||||
return;
|
||||
|
||||
/* activate only online cpus, otherwise writing to procfs returns EOVERFLOW */
|
||||
@@ -105,7 +102,8 @@ error:
|
||||
break;
|
||||
default:
|
||||
/* Any other error is considered permanent. */
|
||||
- info->flags |= IRQ_FLAG_AFFINITY_UNMANAGED;
|
||||
+ info->level = BALANCE_NONE;
|
||||
+ info->moved = 0; /* migration impossible, mark as done */
|
||||
log(TO_ALL, LOG_WARNING, "IRQ %i affinity is now unmanaged\n",
|
||||
info->irq);
|
||||
}
|
||||
diff --git a/irqlist.c b/irqlist.c
|
||||
index 4dd4a83..0ba411e 100644
|
||||
--- a/irqlist.c
|
||||
+++ b/irqlist.c
|
||||
@@ -78,7 +78,7 @@ static void move_candidate_irqs(struct irq_info *info, void *data)
|
||||
struct load_balance_info *lb_info = data;
|
||||
unsigned long delta_load = 0;
|
||||
|
||||
- /* Don't rebalance irqs that don't want it */
|
||||
+ /* Don't rebalance irqs that don't want or support it */
|
||||
if (info->level == BALANCE_NONE)
|
||||
return;
|
||||
|
||||
diff --git a/types.h b/types.h
|
||||
index c63cfea..ea1fae8 100644
|
||||
--- a/types.h
|
||||
+++ b/types.h
|
||||
@@ -35,7 +35,6 @@
|
||||
* IRQ Internal tracking flags
|
||||
*/
|
||||
#define IRQ_FLAG_BANNED (1ULL << 0)
|
||||
-#define IRQ_FLAG_AFFINITY_UNMANAGED (1ULL << 1)
|
||||
|
||||
enum obj_type_e {
|
||||
OBJ_TYPE_CPU,
|
||||
--
|
||||
2.28.0.windows.1
|
||||
|
||||
@ -0,0 +1,29 @@
|
||||
From f4d987f82e64fd53ae5646d39b5174fb3cc572d2 Mon Sep 17 00:00:00 2001
|
||||
From: liuchao173 <liuchao173@huawei.com>
|
||||
Date: Fri, 29 Dec 2023 10:30:44 +0800
|
||||
Subject: [PATCH] activate_mapping: set errsave before first jump to the error
|
||||
label
|
||||
|
||||
if the fopen fails, errsave is used uninitialized
|
||||
|
||||
Reference: https://github.com/Irqbalance/irqbalance/commit/f4d987f82e64fd53ae5646d39b5174fb3cc572d2
|
||||
Conflict: NA
|
||||
---
|
||||
activate.c | 1 +
|
||||
1 file changed, 1 insertion(+)
|
||||
|
||||
diff --git a/activate.c b/activate.c
|
||||
index 4830f34..b08d4b0 100644
|
||||
--- a/activate.c
|
||||
+++ b/activate.c
|
||||
@@ -73,6 +73,7 @@ static void activate_mapping(struct irq_info *info, void *data __attribute__((un
|
||||
|
||||
sprintf(buf, "/proc/irq/%i/smp_affinity", info->irq);
|
||||
file = fopen(buf, "w");
|
||||
+ errsave = errno;
|
||||
if (!file)
|
||||
goto error;
|
||||
|
||||
--
|
||||
2.28.0.windows.1
|
||||
|
||||
@ -0,0 +1,30 @@
|
||||
From f3282f4ddc10be44e6c423de6de8db600f748f85 Mon Sep 17 00:00:00 2001
|
||||
From: Neil Horman <nhorman@openssl.org>
|
||||
Date: Thu, 30 Nov 2023 16:55:30 -0500
|
||||
Subject: [PATCH] filter console only output when using journal mode
|
||||
|
||||
Fixes #281
|
||||
|
||||
Reference: https://github.com/Irqbalance/irqbalance/commit/f3282f4ddc10be44e6c423de6de8db600f748f85
|
||||
Conflict: NA
|
||||
---
|
||||
irqbalance.h | 3 ++-
|
||||
1 file changed, 2 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/irqbalance.h b/irqbalance.h
|
||||
index 46e05ca..7b47cd1 100644
|
||||
--- a/irqbalance.h
|
||||
+++ b/irqbalance.h
|
||||
@@ -138,7 +138,8 @@ extern unsigned int log_mask;
|
||||
#ifdef HAVE_LIBSYSTEMD
|
||||
#define log(mask, lvl, fmt, args...) do { \
|
||||
if (journal_logging) { \
|
||||
- sd_journal_print(lvl, fmt, ##args); \
|
||||
+ if (log_mask & mask & TO_SYSLOG) \
|
||||
+ sd_journal_print(lvl, fmt, ##args); \
|
||||
if (log_mask & mask & TO_CONSOLE) \
|
||||
printf(fmt, ##args); \
|
||||
} else { \
|
||||
--
|
||||
2.28.0.windows.1
|
||||
|
||||
@ -24,8 +24,8 @@ index 854282f..32c5e53 100644
|
||||
/* Note: Last entry is a catchall */
|
||||
static struct irq_match matches[] = {
|
||||
{ "eth.*" ,{NULL} ,NULL, IRQ_TYPE_LEGACY, IRQ_GBETH },
|
||||
+ { "hisi\\w*? *sas" ,{NULL} ,NULL, IRQ_TYPE_LEGACY, IRQ_SCSI},
|
||||
+ { "hisi\\w*? *sata" ,{NULL} ,NULL, IRQ_TYPE_LEGACY, IRQ_SCSI},
|
||||
+ { "hisi\\w*? *sas" ,{NULL}, NULL, IRQ_TYPE_LEGACY, IRQ_SCSI},
|
||||
+ { "hisi\\w*? *sata" ,{NULL}, NULL, IRQ_TYPE_LEGACY, IRQ_SCSI},
|
||||
{ "[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},
|
||||
{ ".*", {NULL}, NULL, IRQ_TYPE_LEGACY, IRQ_OTHER},
|
||||
|
||||
@ -46,7 +46,7 @@ index dac813c..7d7a933 100644
|
||||
+ memset(&pol, -1, sizeof(struct user_irq_policy));
|
||||
+ }
|
||||
if ((pol.ban == 1) || check_for_irq_ban(hint, mod)) { /*FIXME*/
|
||||
__add_banned_irq(irq, &banned_irqs);
|
||||
add_banned_irq(irq, &banned_irqs);
|
||||
new = get_irq_info(irq);
|
||||
- } else
|
||||
+ } else {
|
||||
|
||||
@ -38,7 +38,7 @@ index 62cfd08..774a3b2 100644
|
||||
--- a/activate.c
|
||||
+++ b/activate.c
|
||||
@@ -51,11 +51,6 @@ static void activate_mapping(struct irq_info *info, void *data __attribute__((un
|
||||
int ret = 0;
|
||||
int errsave, ret;
|
||||
cpumask_t applied_mask;
|
||||
|
||||
- /*
|
||||
@ -408,10 +408,10 @@ index 22940b4..710d496 100644
|
||||
|
||||
#ifdef __aarch64__
|
||||
#define AARCH64
|
||||
@@ -112,6 +113,10 @@ extern void free_cl_opts(void);
|
||||
@@ -111,6 +112,10 @@ extern void free_cl_opts(void);
|
||||
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);
|
||||
extern void add_banned_irq(int irq);
|
||||
extern void remove_one_irq_from_db(int irq);
|
||||
+extern void force_rebalance_irq(struct irq_info *info, void *data __attribute__((unused)));
|
||||
+extern gint compare_ints(gconstpointer a, gconstpointer b);
|
||||
+extern int hint_enabled, poll_hint_interval;
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
Summary: A dynamic adaptive IRQ balancing daemon
|
||||
Name: irqbalance
|
||||
Version: 1.9.2
|
||||
Release: 3
|
||||
Release: 4
|
||||
Epoch: 3
|
||||
License: GPLv2
|
||||
Source0: https://github.com/Irqbalance/irqbalance/archive/v%{version}.tar.gz#/irqbalance-%{version}.tar.gz
|
||||
@ -24,6 +24,15 @@ Requires: numactl-libs
|
||||
%define _hardened_build 1
|
||||
|
||||
Patch6000: backport-fix-memory-leak-in-irq-hotplug-path.patch
|
||||
Patch6001: backport-0001-activate_mapping-avoid-use-after-free-when-affinity-.patch
|
||||
Patch6002: backport-0002-activate_mapping-make-sure-to-catch-all-errors.patch
|
||||
Patch6003: backport-0003-activate_mapping-report-error-reason.patch
|
||||
Patch6004: backport-0004-activate_mapping-only-blacklist-irq-if-error-is-cons.patch
|
||||
Patch6005: backport-0005-activate_mapping-avoid-logging-error-when-there-is-n.patch
|
||||
Patch6006: backport-filter-console-only-output-when-using-journal-mode.patch
|
||||
Patch6007: backport-Slience-.-rebalancing-messages-for-unmigratable-IRQs.patch
|
||||
Patch6008: backport-Avoid-repeated-affinity-checks-when-no-change-is-nec.patch
|
||||
Patch6009: backport-activate_mapping-set-errsave-before-first-jump-to-th.patch
|
||||
|
||||
Patch9000: feature-aarch64-add-the-regular-to-get-the-correct-i.patch
|
||||
Patch9001: feature-add-new-user-irq-policy-config-rule.patch
|
||||
@ -120,6 +129,12 @@ fi
|
||||
/sbin/chkconfig --del %{name} >/dev/null 2>&1 || :
|
||||
|
||||
%changelog
|
||||
* Wed Mar 27 2024 langfei <langfei@huawei.com> - 3:1.9.2-4
|
||||
- Type:bugfix
|
||||
- ID:NA
|
||||
- SUG:restart
|
||||
- DESC: backport community patches
|
||||
|
||||
* Mon Feb 13 2023 qinyu <qinyu32@huawei.com> - 3:1.9.2-3
|
||||
- Type:bugfix
|
||||
- ID:NA
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user