backport community patches

Signed-off-by: langfei <langfei@huawei.com>
(cherry picked from commit 932ebb5b1d1eb8ca9cdf61de0f1e356577f588a8)
This commit is contained in:
lihaoxiang 2024-05-07 08:22:03 -04:00 committed by openeuler-sync-bot
parent d947502db0
commit 3945c42f79
4 changed files with 139 additions and 1 deletions

View File

@ -0,0 +1,44 @@
From 8301666f3029ff4d9089a273a45ec47671d964c1 Mon Sep 17 00:00:00 2001
From: Andrew Zaborowski <andrew.zaborowski@intel.com>
Date: Fri, 29 Mar 2024 18:43:55 -0700
Subject: [PATCH] Check fflush() return value
Since fprintf() may buffer output, as noted in 470a64b19062, fclose()'s
error value was also being checked for the write errors. However in
8d7c78304fb9 an fflush() was added in between meaning that these
buffered write errors were again unchecked. Some actual errors were
not being logged, in my case -ENOSPCs.
Make the fclose and fflush branches look similar.
Fixes: 8d7c78304fb9 ("Flush file before closing")
Reference:https://github.com/Irqbalance/irqbalance/commit/8301666f3029ff4d9089a273a45ec47671d964c1
Conflict:NA
---
activate.c | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/activate.c b/activate.c
index e30d0f0..0c1e7a1 100644
--- a/activate.c
+++ b/activate.c
@@ -82,10 +82,13 @@ static void activate_mapping(struct irq_info *info, void *data __attribute__((un
cpumask_scnprintf(buf, PATH_MAX, applied_mask);
ret = fprintf(file, "%s", buf);
errsave = errno;
- fflush(file);
+ if (ret >= 0 && fflush(file)) {
+ ret = -1;
+ errsave = errno;
+ }
if (fclose(file)) {
+ ret = -1;
errsave = errno;
- goto error;
}
if (ret < 0)
goto error;
--
2.28.0.windows.1

View File

@ -0,0 +1,52 @@
From de0fe4a799c0bd62afcaf11b0ff5fc85f0b24c3e Mon Sep 17 00:00:00 2001
From: Etienne Champetier <e.champetier@ateme.com>
Date: Wed, 13 Mar 2024 15:28:37 -0400
Subject: [PATCH] Fix socket API being blocked for 10s
Instead of sleeping in scan() and blocking the main loop,
return and let the main loop call back scan().
Signed-off-by: Etienne Champetier <e.champetier@ateme.com>
---
irqbalance.c | 18 +-----------------
1 file changed, 1 insertion(+), 17 deletions(-)
diff --git a/irqbalance.c b/irqbalance.c
index f5f2c51..12302d7 100644
--- a/irqbalance.c
+++ b/irqbalance.c
@@ -75,20 +75,6 @@ char socket_name[64];
char *banned_cpumask_from_ui = NULL;
#endif
-static void sleep_approx(int seconds)
-{
- struct timespec ts;
- struct timeval tv;
- gettimeofday(&tv, NULL);
- ts.tv_sec = seconds;
- ts.tv_nsec = -tv.tv_usec*1000;
- while (ts.tv_nsec < 0) {
- ts.tv_sec--;
- ts.tv_nsec += 1000000000;
- }
- nanosleep(&ts, NULL);
-}
-
#ifdef HAVE_GETOPT_LONG
struct option lopts[] = {
{"oneshot", 0, NULL, 'o'},
@@ -317,9 +303,7 @@ gboolean scan(gpointer data __attribute__((unused)))
for_each_irq(NULL, force_rebalance_irq, NULL);
parse_proc_interrupts();
parse_proc_stat();
- sleep_approx(sleep_interval);
- clear_work_stats();
- parse_proc_interrupts();
+ return TRUE;
}
parse_proc_stat();
--
2.28.0.windows.1

View File

@ -0,0 +1,31 @@
From 8d7c78304fb994a519e2709024b196841e84238a Mon Sep 17 00:00:00 2001
From: Robert Malz <robert.malz@canonical.com>
Date: Thu, 14 Mar 2024 13:36:15 +0100
Subject: [PATCH] Flush file before closing
After writing to file, before closing, flush is required.
Without it fclose can randomly return IO error.
Signed-off-by: Robert Malz <robert.malz@canonical.com>
Reference:https://github.com/Irqbalance/irqbalance/commit/8d7c78304fb994a519e2709024b196841e84238a
Conflict:NA
---
activate.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/activate.c b/activate.c
index d3f99f7..e30d0f0 100644
--- a/activate.c
+++ b/activate.c
@@ -82,6 +82,7 @@ static void activate_mapping(struct irq_info *info, void *data __attribute__((un
cpumask_scnprintf(buf, PATH_MAX, applied_mask);
ret = fprintf(file, "%s", buf);
errsave = errno;
+ fflush(file);
if (fclose(file)) {
errsave = errno;
goto error;
--
2.28.0.windows.1

View File

@ -1,7 +1,7 @@
Summary: A dynamic adaptive IRQ balancing daemon
Name: irqbalance
Version: 1.9.2
Release: 4
Release: 5
Epoch: 3
License: GPLv2
Source0: https://github.com/Irqbalance/irqbalance/archive/v%{version}.tar.gz#/irqbalance-%{version}.tar.gz
@ -33,6 +33,9 @@ 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
Patch6010: backport-Fix-socket-API-being-blocked-for-10s.patch
Patch6011: backport-Flush-file-before-closing.patch
Patch6012: backport-Check-fflush-return-value.patch
Patch9000: feature-aarch64-add-the-regular-to-get-the-correct-i.patch
Patch9001: feature-add-new-user-irq-policy-config-rule.patch
@ -129,6 +132,14 @@ fi
/sbin/chkconfig --del %{name} >/dev/null 2>&1 || :
%changelog
* Tue May 07 2024 langfei <langfei@huawei.com> - 3:1.9.2-5
- Type:bugfix
- ID:NA
- SUG:restart
- DESC: Fix socket API being blocked for 10s;
- Flush file brfore closing;
- Check fflush() return value.
* Wed Mar 27 2024 langfei <langfei@huawei.com> - 3:1.9.2-4
- Type:bugfix
- ID:NA