diff --git a/0002-alsactl-don-t-exit-on-EINTR-from-epoll_wait.patch b/0002-alsactl-don-t-exit-on-EINTR-from-epoll_wait.patch new file mode 100644 index 0000000..a7ef2b5 --- /dev/null +++ b/0002-alsactl-don-t-exit-on-EINTR-from-epoll_wait.patch @@ -0,0 +1,32 @@ +From 5830fc726ac9294641592a8c007502d573f6dea1 Mon Sep 17 00:00:00 2001 +From: Zev Weiss +Date: Mon, 14 Oct 2019 23:36:50 -0500 +Subject: [PATCH] alsactl: don't exit on EINTR from epoll_wait(). + +Previously, things like attaching strace to a running 'alsactl monitor' +process would cause it to exit. + +Signed-off-by: Zev Weiss +Reviewed-by: Takashi Sakamoto +Tested-by: Takashi Sakamoto +Signed-off-by: Jaroslav Kysela +--- + alsactl/monitor.c | 2 ++ + 1 file changed, 2 insertions(+) + +diff --git a/alsactl/monitor.c b/alsactl/monitor.c +index 6b090e4f5c92..cf4167bee165 100644 +--- a/alsactl/monitor.c ++++ b/alsactl/monitor.c +@@ -342,6 +342,8 @@ static int run_dispatcher(int epfd, int sigfd, int infd, struct list_head *srcs, + + count = epoll_wait(epfd, epev, max_ev_count, 200); + if (count < 0) { ++ if (errno == EINTR) ++ continue; + err = count; + break; + } +-- +2.16.4 + diff --git a/0003-alsactl-avoid-needless-wakeups-in-monitor-loop.patch b/0003-alsactl-avoid-needless-wakeups-in-monitor-loop.patch new file mode 100644 index 0000000..d84b06a --- /dev/null +++ b/0003-alsactl-avoid-needless-wakeups-in-monitor-loop.patch @@ -0,0 +1,32 @@ +From 5fe6b866594c6d59d1960356590a00ccc4cdf4c7 Mon Sep 17 00:00:00 2001 +From: Zev Weiss +Date: Mon, 14 Oct 2019 23:38:02 -0500 +Subject: [PATCH] alsactl: avoid needless wakeups in monitor loop. + +The timeout wasn't really being used for anything; disabling it should +reduce idle energy consumption slightly. + +Signed-off-by: Zev Weiss +Reviewed-by: Takashi Sakamoto +Tested-by: Takashi Sakamoto +Signed-off-by: Jaroslav Kysela +--- + alsactl/monitor.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/alsactl/monitor.c b/alsactl/monitor.c +index cf4167bee165..fa6cd85d2ab2 100644 +--- a/alsactl/monitor.c ++++ b/alsactl/monitor.c +@@ -340,7 +340,7 @@ static int run_dispatcher(int epfd, int sigfd, int infd, struct list_head *srcs, + int count; + int i; + +- count = epoll_wait(epfd, epev, max_ev_count, 200); ++ count = epoll_wait(epfd, epev, max_ev_count, -1); + if (count < 0) { + if (errno == EINTR) + continue; +-- +2.16.4 + diff --git a/0004-alsactl-fix-error-handling-for-sched_setscheduler-ca.patch b/0004-alsactl-fix-error-handling-for-sched_setscheduler-ca.patch new file mode 100644 index 0000000..90de6db --- /dev/null +++ b/0004-alsactl-fix-error-handling-for-sched_setscheduler-ca.patch @@ -0,0 +1,38 @@ +From d2bf87608a1c3f2d62ceb9300a74e9006394c678 Mon Sep 17 00:00:00 2001 +From: Oscar65 +Date: Thu, 16 Apr 2020 12:35:21 +0200 +Subject: [PATCH] alsactl: fix error handling for sched_setscheduler() call +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +As man page says: "If successful, the sched_setparam() function shall return zero." + +Without update I got this output in the syslog (journalctl): +abr 16 09:25:30 mypc alsactl[1652]: alsactl 1.2.2 daemon started +abr 16 09:25:30 mypc alsactl[1652]: /usr/bin/alsactl: do_nice:165sched_setparam failed: No such file or directory + +If sched_setscheduler() returns 0, so it means that the call was successful. + +Signed-off-by: Oscar MegĂ­a +Signed-off-by: Jaroslav Kysela +--- + alsactl/alsactl.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/alsactl/alsactl.c b/alsactl/alsactl.c +index dfb1db7f4a83..60d39459dedf 100644 +--- a/alsactl/alsactl.c ++++ b/alsactl/alsactl.c +@@ -161,7 +161,7 @@ static void do_nice(int use_nice, int sched_idle) + if (sched_idle) { + if (sched_getparam(0, &sched_param) >= 0) { + sched_param.sched_priority = 0; +- if (!sched_setscheduler(0, SCHED_IDLE, &sched_param)) ++ if (sched_setscheduler(0, SCHED_IDLE, &sched_param) < 0) + error("sched_setparam failed: %s", strerror(errno)); + } else { + error("sched_getparam failed: %s", strerror(errno)); +-- +2.16.4 + diff --git a/alsa-utils.changes b/alsa-utils.changes index bb5a6de..a712618 100644 --- a/alsa-utils.changes +++ b/alsa-utils.changes @@ -1,3 +1,11 @@ +------------------------------------------------------------------- +Mon Apr 20 17:59:59 CEST 2020 - tiwai@suse.de + +- Backport upstream fixes for alsactl: + 0002-alsactl-don-t-exit-on-EINTR-from-epoll_wait.patch + 0003-alsactl-avoid-needless-wakeups-in-monitor-loop.patch + 0004-alsactl-fix-error-handling-for-sched_setscheduler-ca.patch + ------------------------------------------------------------------- Fri Mar 13 14:48:05 CET 2020 - tiwai@suse.de diff --git a/alsa-utils.spec b/alsa-utils.spec index 1b536c2..2b0c0c5 100644 --- a/alsa-utils.spec +++ b/alsa-utils.spec @@ -30,6 +30,9 @@ Source1: 01beep.conf Source2: sound-extra.service Source5: load-sound-modules.sh Patch1: 0001-alsaloop-reduce-cumulative-error-caused-by-non-atomi.patch +Patch2: 0002-alsactl-don-t-exit-on-EINTR-from-epoll_wait.patch +Patch3: 0003-alsactl-avoid-needless-wakeups-in-monitor-loop.patch +Patch4: 0004-alsactl-fix-error-handling-for-sched_setscheduler-ca.patch Patch101: alsa-utils-configure-version-revert.patch BuildRequires: alsa-devel BuildRequires: alsa-topology-devel @@ -71,6 +74,9 @@ and test audio before and after PM state changes. %prep %setup -q %patch1 -p1 +%patch2 -p1 +%patch3 -p1 +%patch4 -p1 %if 0%{?do_autoreconf} %patch101 -p1 # fix stupid automake's automatic action