update code

This commit is contained in:
zhuchunyi 2019-11-06 19:34:16 +08:00
parent aa0afbee66
commit 02658ac8c8
3 changed files with 177 additions and 4 deletions

View File

@ -0,0 +1,29 @@
From 73c26ac2d6e856c5a9ffd1c48ed7c1abc85de3df Mon Sep 17 00:00:00 2001
From: liuchao <liuchao173@huawei.com>
Date: Sat, 12 Oct 2019 03:34:44 +0000
Subject: [PATCH] irqbalance: change irq ban check path to devpath
keep the parameters 'path' of check_for_irq_ban function consistent with line 699.
In check_for_irq_ban,
sprintf(cmd, "%s %s %d > /dev/null",banscript, path, irq);
the banscript is unique, so the path should keep consistent.
---
classify.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/classify.c b/classify.c
index 7c97d47..3681c48 100644
--- a/classify.c
+++ b/classify.c
@@ -719,7 +719,7 @@ struct irq_info *build_one_dev_entry(const char *dirname, GList *tmp_list)
if (user_policy_list == NULL) {
get_irq_user_policy(devpath, irqnum, &pol);
}
- if ((pol.ban == 1) || (check_for_irq_ban(path, irqnum, tmp_list))) {
+ if ((pol.ban == 1) || (check_for_irq_ban(devpath, irqnum, tmp_list))) {
add_banned_irq(irqnum, &banned_irqs, 0);
goto done;
}
--
2.19.1

View File

@ -0,0 +1,127 @@
From 74970054568728d11dbbb160e0c5cacdfeb07ff3 Mon Sep 17 00:00:00 2001
From: liuchao <liuchao173@huawei.com>
Date: Fri, 11 Oct 2019 07:49:55 +0000
Subject: [PATCH] irqbalance: make the return value of getline() handled correct
getline() will return -1 when fail, so make the return value handle correct.
---
activate.c | 2 +-
cputree.c | 8 ++++----
procinterrupts.c | 12 ++++++------
3 files changed, 11 insertions(+), 11 deletions(-)
diff --git a/activate.c b/activate.c
index ad60fde..87336f4 100644
--- a/activate.c
+++ b/activate.c
@@ -47,7 +47,7 @@ static int check_affinity(struct irq_info *info, cpumask_t applied_mask)
file = fopen(buf, "r");
if (!file)
return 1;
- if (getline(&line, &size, file)==0) {
+ if (getline(&line, &size, file)<=0) {
free(line);
fclose(file);
return 1;
diff --git a/cputree.c b/cputree.c
index 0dbb5c8..51ef357 100644
--- a/cputree.c
+++ b/cputree.c
@@ -279,7 +279,7 @@ static void do_one_cpu(char *path)
if (file) {
char *line = NULL;
size_t size = 0;
- if (getline(&line, &size, file)==0)
+ if (getline(&line, &size, file)<=0)
return;
fclose(file);
if (line && line[0]=='0') {
@@ -324,7 +324,7 @@ static void do_one_cpu(char *path)
if (file) {
char *line = NULL;
size_t size = 0;
- if (getline(&line, &size, file))
+ if (getline(&line, &size, file) > 0)
cpumask_parse_user(line, strlen(line), package_mask);
fclose(file);
free(line);
@@ -336,7 +336,7 @@ static void do_one_cpu(char *path)
if (file) {
char *line = NULL;
size_t size = 0;
- if (getline(&line, &size, file))
+ if (getline(&line, &size, file) > 0)
packageid = strtoul(line, NULL, 10);
fclose(file);
free(line);
@@ -369,7 +369,7 @@ static void do_one_cpu(char *path)
if (file) {
char *line = NULL;
size_t size = 0;
- if (getline(&line, &size, file))
+ if (getline(&line, &size, file) > 0)
cpumask_parse_user(line, strlen(line), cache_mask);
fclose(file);
free(line);
diff --git a/procinterrupts.c b/procinterrupts.c
index 18b3ceb..c32c1b2 100644
--- a/procinterrupts.c
+++ b/procinterrupts.c
@@ -262,7 +262,7 @@ GList* collect_full_irq_list()
return NULL;
/* first line is the header we don't need; nuke it */
- if (getline(&line, &size, file)==0) {
+ if (getline(&line, &size, file)<=0) {
free(line);
fclose(file);
return NULL;
@@ -274,7 +274,7 @@ GList* collect_full_irq_list()
char *c;
char *savedline = NULL;
- if (getline(&line, &size, file)==0)
+ if (getline(&line, &size, file)<=0)
break;
/* lines with letters in front are special, like NMI count. Ignore */
@@ -349,7 +349,7 @@ void parse_proc_interrupts(void)
return;
/* first line is the header we don't need; nuke it */
- if (getline(&line, &size, file)==0) {
+ if (getline(&line, &size, file)<=0) {
free(line);
fclose(file);
return;
@@ -365,7 +365,7 @@ void parse_proc_interrupts(void)
char savedline[1024];
char dirname[PATH_MAX] = {'\0'};
- if (getline(&line, &size, file)==0)
+ if (getline(&line, &size, file)<=0)
break;
if (!proc_int_has_msi)
@@ -579,7 +579,7 @@ void parse_proc_stat(void)
}
/* first line is the header we don't need; nuke it */
- if (getline(&line, &size, file)==0) {
+ if (getline(&line, &size, file)<=0) {
free(line);
log(TO_ALL, LOG_WARNING, "WARNING read /proc/stat. balancing is broken\n");
fclose(file);
@@ -588,7 +588,7 @@ void parse_proc_stat(void)
cpucount = 0;
while (!feof(file)) {
- if (getline(&line, &size, file)==0)
+ if (getline(&line, &size, file)<=0)
break;
if (!strstr(line, "cpu"))
--
2.19.1

View File

@ -1,7 +1,7 @@
Summary: A dynamic adaptive IRQ balancing daemon Summary: A dynamic adaptive IRQ balancing daemon
Name: irqbalance Name: irqbalance
Version: 1.4.0 Version: 1.4.0
Release: 6 Release: 8
Epoch: 3 Epoch: 3
License: GPLv2 License: GPLv2
@ -23,8 +23,6 @@ Requires: numactl-libs
%define _hardened_build 1 %define _hardened_build 1
ExcludeArch: s390 s390x
Patch0: add-a-catchall-guessing-mechanis.patch Patch0: add-a-catchall-guessing-mechanis.patch
Patch1: irq_db-don-t-fail-entirely-if-we-don-t-have-a-pci-bu.patch Patch1: irq_db-don-t-fail-entirely-if-we-don-t-have-a-pci-bu.patch
Patch2: cputree-adjust-snprintf-sizes-to-avoid-gcc-warnings.patch Patch2: cputree-adjust-snprintf-sizes-to-avoid-gcc-warnings.patch
@ -56,6 +54,8 @@ Patch9012: bugfix-fgets-will-get-a-redundant-new-line.patch
Patch9013: bugfix-prevent-inserting-a-duplicate-entry-to-avoid-list-ch.patch Patch9013: bugfix-prevent-inserting-a-duplicate-entry-to-avoid-list-ch.patch
Patch9014: bugfix-guess_arm_irq_hints.patch Patch9014: bugfix-guess_arm_irq_hints.patch
Patch9015: feature-add-new-user-irq-policy-config-rule.patch Patch9015: feature-add-new-user-irq-policy-config-rule.patch
Patch9016: bugfix-make-the-return-value-of-getline-handled-correct.patch
Patch9017: bugfix-change-irq-ban-check-path-to-devpath.patch
%description %description
Irqbalance is a daemon to help balance the cpu load generated by Irqbalance is a daemon to help balance the cpu load generated by
@ -65,6 +65,8 @@ single unique cpu, so that load is spread as much as possible over
an entire processor set, while minimizing cache miss rates for irq an entire processor set, while minimizing cache miss rates for irq
handlers. handlers.
%package_help
%prep %prep
%autosetup -p1 %autosetup -p1
@ -90,11 +92,14 @@ make check
%doc COPYING AUTHORS %doc COPYING AUTHORS
%{_sbindir}/%{name} %{_sbindir}/%{name}
%{_unitdir}/%{name}.service %{_unitdir}/%{name}.service
%{_mandir}/man1/*
%config(noreplace) %{_sysconfdir}/sysconfig/%{name} %config(noreplace) %{_sysconfdir}/sysconfig/%{name}
%{_sysconfdir}/sysconfig/%{name}.rules %{_sysconfdir}/sysconfig/%{name}.rules
%{_sbindir}/irq_balancer %{_sbindir}/irq_balancer
%files help
%{_mandir}/man1/*
%post %post
%systemd_post %{name}.service %systemd_post %{name}.service
@ -111,6 +116,18 @@ fi
/sbin/chkconfig --del %{name} >/dev/null 2>&1 || : /sbin/chkconfig --del %{name} >/dev/null 2>&1 || :
%changelog %changelog
* Thu Oct 17 2019 caomeng<caomeng5@huawei.com> - 3:1.4.0-8
- Type:other
- ID:NA
- SUG:NA
- DESC: add help package
* Mon Oct 14 2019 liuchao<liuchao173@huawei.com> - 3:1.4.0-7
- Type: bugfix
- ID:NA
- SUG:NA
- DESC: make the return value of getline handled correct and change irq ban check path to devpath
* Mon Sep 23 2019 hejingxian<hejingxian@huawei.com> - 3:1.4.0-6 * Mon Sep 23 2019 hejingxian<hejingxian@huawei.com> - 3:1.4.0-6
- Type: enhancement - Type: enhancement
- ID:NA - ID:NA