!106 [sync] PR-97: backport community patches

From: @openeuler-sync-bot 
Reviewed-by: @SuperSix173 
Signed-off-by: @SuperSix173
This commit is contained in:
openeuler-ci-bot 2024-05-07 09:36:47 +00:00 committed by Gitee
commit b9257076de
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
5 changed files with 195 additions and 1 deletions

View File

@ -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

View File

@ -0,0 +1,82 @@
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: NA
---
activate.c | 6 ++----
irqlist.c | 2 +-
types.h | 1 -
3 files changed, 3 insertions(+), 6 deletions(-)
diff --git a/activate.c b/activate.c
index 548a401..4830f34 100644
--- a/activate.c
+++ b/activate.c
@@ -62,9 +62,6 @@ 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);
@@ -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

View File

@ -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

View File

@ -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

View File

@ -1,7 +1,7 @@
Summary: A dynamic adaptive IRQ balancing daemon
Name: irqbalance
Version: 1.8.0
Release: 11
Release: 12
Epoch: 3
License: GPLv2
Source0: https://github.com/Irqbalance/irqbalance/archive/v%{version}.tar.gz#/irqbalance-%{version}.tar.gz
@ -35,6 +35,10 @@ Patch6010: backport-0003-activate_mapping-report-error-reason.patch
Patch6011: backport-0004-activate_mapping-only-blacklist-irq-if-error-is-cons.patch
Patch6012: backport-0005-activate_mapping-avoid-logging-error-when-there-is-n.patch
Patch6013: backport-remove-no-existing-irq-in-banned_irqs.patch
Patch6014: backport-filter-console-only-output-when-using-journal-mode.patch
Patch6015: backport-Slience-.-rebalancing-messages-for-unmigratable-IRQs.patch
Patch6016: backport-Avoid-repeated-affinity-checks-when-no-change-is-nec.patch
Patch6017: backport-activate_mapping-set-errsave-before-first-jump-to-th.patch
%description
Irqbalance is a daemon to help balance the cpu load generated by
@ -92,6 +96,15 @@ fi
/sbin/chkconfig --del %{name} >/dev/null 2>&1 || :
%changelog
* Tue Feb 20 2024 langfei <langfei@huawei.com> - 3:1.8.0-12
- Type:bugfix
- ID:NA
- SUG:restart
- DESC: filter console only output when using journal mode;
- Slience ... rebalancing messages for unmigratable IRQs;
- Avoid repeated affinity checks when no change is necessary;
- activate_mapping:set errsave before first jump to the error label.
* Sun Feb 04 2024 Paul Thomas <paulthomas100199@gmail.com> - 3:1.8.0-11
- Type:bugfix
- ID:NA