Fix spice audio regression with qemu 9.1.1

Signed-off-by: Cole Robinson <crobinso@redhat.com>
This commit is contained in:
Cole Robinson 2024-11-05 10:55:33 -05:00
parent 1cf373a4c7
commit 9892915446
2 changed files with 59 additions and 1 deletions

View File

@ -0,0 +1,50 @@
From c867f21d7f49830e9243ef5bff35e45face18a49 Mon Sep 17 00:00:00 2001
Message-ID: <c867f21d7f49830e9243ef5bff35e45face18a49.1730821961.git.crobinso@redhat.com>
From: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= <marcandre.lureau@redhat.com>
Date: Tue, 5 Nov 2024 12:32:03 +0400
Subject: [PATCH] hw/audio/hda: avoid unnecessary re-open stream on
reconfiguration
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Content-type: text/plain
Closing and opening a stream too quickly during reconfiguration create
issues with Spice.
Note: the issue with Spice has been there before and still is. When the
audio stream is recreated, for example when using
`out.mixing-engine=false`.
Fixes: https://gitlab.com/qemu-project/qemu/-/issues/2639
Fixes: 6d6e23361f ("hw/audio/hda: fix memory leak on audio setup")
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Signed-off-by: Cole Robinson <crobinso@redhat.com>
---
hw/audio/hda-codec.c | 10 +++++++++-
1 file changed, 9 insertions(+), 1 deletion(-)
diff --git a/hw/audio/hda-codec.c b/hw/audio/hda-codec.c
index 4373565371..b3075b5d44 100644
--- a/hw/audio/hda-codec.c
+++ b/hw/audio/hda-codec.c
@@ -502,7 +502,15 @@ static void hda_audio_setup(HDAAudioStream *st)
trace_hda_audio_format(st->node->name, st->as.nchannels,
fmt2name[st->as.fmt], st->as.freq);
- hda_close_stream(st->state, st);
+ /*
+ * Do not hda_close_stream(st->state, st), AUD_open_() handles the logic for
+ * fixed_settings, and same format. This helps prevent race issues in Spice
+ * server & client code too. (see #2639)
+ */
+ if (use_timer) {
+ timer_free(st->buft);
+ st->buft = NULL;
+ }
if (st->output) {
if (use_timer) {
cb = hda_audio_output_cb;
--
2.46.2

View File

@ -367,7 +367,7 @@ Obsoletes: sgabios-bin <= 1:0.20180715git-10.fc38
%endif
# To prevent rpmdev-bumpspec breakage
%global baserelease 1
%global baserelease 2
Summary: QEMU is a FAST! processor emulator
Name: qemu
@ -413,6 +413,11 @@ Patch: 0001-linux-user-add-openat2-support-in-linux-user.patch
# removed (after v9.1.0)
Patch: 0001-linux-user-guard-openat2-with-if-defined-TARGET_NR_o.patch
# Fix spice audio with qemu 9.1.1
# https://lists.gnu.org/archive/html/qemu-devel/2024-11/msg00906.html
# https://gitlab.com/qemu-project/qemu/-/issues/2639
Patch: 0001-hw-audio-hda-avoid-unnecessary-re-open-stream-on-rec.patch
BuildRequires: gnupg2
BuildRequires: meson >= %{meson_version}
BuildRequires: bison
@ -3158,6 +3163,9 @@ useradd -r -u 107 -g qemu -G kvm -d / -s /sbin/nologin \
%changelog
* Tue Nov 05 2024 Cole Robinson <crobinso@redhat.com> - 9.1.1-2
- Fix spice audio regression with qemu 9.1.1
* Thu Oct 24 2024 Cole Robinson <crobinso@redhat.com> - 9.1.1-1
- Rebase to qemu 9.1.1 stable