diff options
author | George Kiagiadakis <george.kiagiadakis@collabora.com> | 2021-07-01 12:44:58 +0300 |
---|---|---|
committer | Jan-Simon Moeller <jsmoeller@linuxfoundation.org> | 2021-08-25 12:50:36 +0000 |
commit | 0c3825a9a3e867c82834fdffd8f11ed8f5e283be (patch) | |
tree | 76c88b329af9ab60e3698769311a68f8437fe734 | |
parent | ab3c458cb39c87efc456762f6dff7c376c52bbce (diff) |
pipewire: fix timerfd deadlock issue
Bug-AGL: SPEC-3957
Signed-off-by: George Kiagiadakis <george.kiagiadakis@collabora.com>
[manual cherry-pick of 6da4a449 from lamprey]
Signed-off-by: Scott Murray <scott.murray@konsulko.com>
Change-Id: Iea0b75416c679009a089e6dee36fba03be8e601a
Reviewed-on: https://gerrit.automotivelinux.org/gerrit/c/AGL/meta-agl/+/26572
Tested-by: Jenkins Job builder account
ci-image-build: Jenkins Job builder account
ci-image-boot-test: Jenkins Job builder account
Reviewed-by: Jan-Simon Moeller <jsmoeller@linuxfoundation.org>
3 files changed, 88 insertions, 0 deletions
diff --git a/meta-pipewire/recipes-multimedia/pipewire/pipewire/0001-null-sink-make-the-timerfd-non-blocking.patch b/meta-pipewire/recipes-multimedia/pipewire/pipewire/0001-null-sink-make-the-timerfd-non-blocking.patch new file mode 100644 index 000000000..71e526f86 --- /dev/null +++ b/meta-pipewire/recipes-multimedia/pipewire/pipewire/0001-null-sink-make-the-timerfd-non-blocking.patch @@ -0,0 +1,43 @@ +From c633004bf310998580ff8944c59d94689d6fca87 Mon Sep 17 00:00:00 2001 +From: George Kiagiadakis <george.kiagiadakis@collabora.com> +Date: Thu, 1 Jul 2021 11:37:01 +0300 +Subject: [PATCH] null-sink: make the timerfd non-blocking + +Fixes #1377 + +Upstream-Status: Backport [from master/0.3.32] +Signed-off-by: George Kiagiadakis <george.kiagiadakis@collabora.com> +--- + spa/plugins/support/null-audio-sink.c | 8 ++++++-- + 1 file changed, 6 insertions(+), 2 deletions(-) + +diff --git a/spa/plugins/support/null-audio-sink.c b/spa/plugins/support/null-audio-sink.c +index e9588f1e2..12e671db8 100644 +--- a/spa/plugins/support/null-audio-sink.c ++++ b/spa/plugins/support/null-audio-sink.c +@@ -221,8 +221,11 @@ static void on_timeout(struct spa_source *source) + spa_log_trace(this->log, "timeout"); + + if (spa_system_timerfd_read(this->data_system, +- this->timer_source.fd, &expirations) < 0) ++ this->timer_source.fd, &expirations) < 0) { ++ if (errno == EAGAIN) ++ return; + perror("read timerfd"); ++ } + + nsec = this->next_time; + +@@ -818,7 +821,8 @@ impl_init(const struct spa_handle_factory *factory, + + this->timer_source.func = on_timeout; + this->timer_source.data = this; +- this->timer_source.fd = spa_system_timerfd_create(this->data_system, CLOCK_MONOTONIC, SPA_FD_CLOEXEC); ++ this->timer_source.fd = spa_system_timerfd_create(this->data_system, CLOCK_MONOTONIC, ++ SPA_FD_CLOEXEC | SPA_FD_NONBLOCK); + this->timer_source.mask = SPA_IO_IN; + this->timer_source.rmask = 0; + this->timerspec.it_value.tv_sec = 0; +-- +2.30.2 + diff --git a/meta-pipewire/recipes-multimedia/pipewire/pipewire/0002-node-driver-make-the-timerfd-non-blocking.patch b/meta-pipewire/recipes-multimedia/pipewire/pipewire/0002-node-driver-make-the-timerfd-non-blocking.patch new file mode 100644 index 000000000..5a59d8676 --- /dev/null +++ b/meta-pipewire/recipes-multimedia/pipewire/pipewire/0002-node-driver-make-the-timerfd-non-blocking.patch @@ -0,0 +1,43 @@ +From 5aa9c953909b936ba215ebca77461a17160f59fb Mon Sep 17 00:00:00 2001 +From: George Kiagiadakis <george.kiagiadakis@collabora.com> +Date: Thu, 1 Jul 2021 11:50:40 +0300 +Subject: [PATCH] node-driver: make the timerfd non-blocking + +Relates to #1377 + +Upstream-Status: Backport [from master/0.3.32] +Signed-off-by: George Kiagiadakis <george.kiagiadakis@collabora.com> +--- + spa/plugins/support/node-driver.c | 8 ++++++-- + 1 file changed, 6 insertions(+), 2 deletions(-) + +diff --git a/spa/plugins/support/node-driver.c b/spa/plugins/support/node-driver.c +index 34533d0d9..32964110d 100644 +--- a/spa/plugins/support/node-driver.c ++++ b/spa/plugins/support/node-driver.c +@@ -119,8 +119,11 @@ static void on_timeout(struct spa_source *source) + spa_log_trace(this->log, "timeout"); + + if (spa_system_timerfd_read(this->data_system, +- this->timer_source.fd, &expirations) < 0) ++ this->timer_source.fd, &expirations) < 0) { ++ if (errno == EAGAIN) ++ return; + perror("read timerfd"); ++ } + + nsec = this->next_time; + +@@ -349,7 +352,8 @@ impl_init(const struct spa_handle_factory *factory, + + this->timer_source.func = on_timeout; + this->timer_source.data = this; +- this->timer_source.fd = spa_system_timerfd_create(this->data_system, CLOCK_MONOTONIC, SPA_FD_CLOEXEC); ++ this->timer_source.fd = spa_system_timerfd_create(this->data_system, CLOCK_MONOTONIC, ++ SPA_FD_CLOEXEC | SPA_FD_NONBLOCK); + this->timer_source.mask = SPA_IO_IN; + this->timer_source.rmask = 0; + this->timerspec.it_value.tv_sec = 0; +-- +2.30.2 + diff --git a/meta-pipewire/recipes-multimedia/pipewire/pipewire_0.3.30.bbappend b/meta-pipewire/recipes-multimedia/pipewire/pipewire_0.3.30.bbappend index d45e0538b..85c9edab3 100644 --- a/meta-pipewire/recipes-multimedia/pipewire/pipewire_0.3.30.bbappend +++ b/meta-pipewire/recipes-multimedia/pipewire/pipewire_0.3.30.bbappend @@ -8,6 +8,8 @@ PACKAGECONFIG = "\ SRC_URI += "\ file://0001-alsa-plugin-allow-specifying-a-media.role-on-the-vir.patch \ + file://0001-null-sink-make-the-timerfd-non-blocking.patch \ + file://0002-node-driver-make-the-timerfd-non-blocking.patch \ " do_install_append() { |