From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796041254; b=VCH8iWo041Tr1IAHGdEdd5clHrjj6AgiEdARoysHHKLivnV4Yi3d4sM5TTNhMFYQS63h rTdUzVthV/eavd8j1Qop3BQA18lmeIVlNJhANKRJc5VS9+AUtbMShUH6/338W3SLMJ9vk 48L/P7z/OyPCIUjNZYKJXoFQcjKe4AJD0Zs16oaYiyuAzpeT3wmlFLgJQcybnnj35A3on zkv9uyAzAMYgQx7CA926MyILdtCp1iRUx5pqXNr1eFcz7ZT+WLvjPorczLTgi2EORUpVk 2MwHIR8j8+1Fkq78QbAdP+Uka+14rWQWc5enuhcR08jtgDO01lYDzrP3q1YD4NHiM4g== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796041254; h=Received:DKIM-Signature:Message-ID:From:Subject:Reply-To:To:Cc: In-Reply-To:References:Content-Type:Content-Transfer-Encoding:Date; bh=IQ2++wF4X6lJT6JXFvg5RfBvOGU96VrPTTd3OM+JErs=; b=deVfuXZfLu6cOphZbfU++m6cacQkV+fxiprvFbtkr5CMZz8LLsKqX3LNxCrt7iWkSbJd +Uyymyt3TGrwXsbV4eN3pSF3YYLUdFVT3+jN+8oIdwI5Mu+VSAMI16j4HmVhyxAnXKDRH Q7/E4+8fhE665z4epuwbhgfsMM9rMyitp51Z9fm+vn1foOQe1FgCotrVgzkQpp+57y2Bf OOSbYEZibLVBkyiWtdGrzgVr4aK5mqFVJsrZnh+3PW0QMo5muU+mqTd8uHB69+U7FPcMu vKXNboE/pxBb6khIsPDAftC/MrE11RrmJtmJ2ZHvwoOArhqIqo/GThl78kuCdq+ZJ7Q== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=n49KYFBw; arc=none smtp.remote-ip=100.103.45.18 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id A25C5606A32E; Mon, 30 Nov 2026 12:20:54 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=n49KYFBw Received: by smtp.kernel.org (Postfix) with ESMTPSA id A53191F00896; Mon, 30 Nov 2026 12:20:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1796041253; bh=IQ2++wF4X6lJT6JXFvg5RfBvOGU96VrPTTd3OM+JErs=; h=From:Subject:Reply-To:To:Cc:In-Reply-To:References:Date; b=n49KYFBwcYZ6yf0bMbVjAA6Wwt+/UW0Haxqu4e0ZYr4xsm/v2B71zJaZzVSQXcQ+3 WmQWGBe3+eszMha66kyD/mtAmJllIobHB/gIOwqX00DmW7Y7A6BQhvRxA4z+jIrt+u v+WOapa/GZ2M2CK3Rnh8GcEPiFzZFL8Y3Qa6r+sQfadNNoLdsT9ioDU8hMriWv3Wpm jmjCjy40tAMQGzIm3JHUHvAvaR0z4I3frBxQ7gWLZIEYp0unmk55D62xphp4Wtb/8s EEYYePdlv/rmQtxhueZWp7FAuJk0xFjf/3gtPMyZayFXpsZeHvUPSgqr4B0SIUYVu6 bWxhS8m1B2cMg== Message-ID: From: sashiko-bot@kernel.org Subject: Re: [PATCH] ALSA: virtio: report an xrun when a whole buffer passed unseen Reply-To: sashiko-reviews@lists.linux.dev To: "Eric Curtin" Cc: virtualization@lists.linux.dev, linux-sound@vger.kernel.org, "Michael S. Tsirkin" , "Eugenio Perez" In-Reply-To: <20261130115939.434308-1-ericcurtin17@gmail.com> References: <20261130115939.434308-1-ericcurtin17@gmail.com> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Date: Mon, 30 Nov 2026 12:20:53 +0000 X-Mailing-List: virtualization@lists.linux.dev List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list Thank you for your contribution! Sashiko AI review found no new issues in this patch, but noticed 1 related pre-existing issue it does not introduce: - [High] ALSA: virtio: ignored xfer_xrun state in virtsnd_pcm_pb_pointer() [1] -- commit 8e4d30ac2cceb1e139c32d93ba83afe971b299a1 Author: Eric Curtin ALSA: virtio: report an xrun when a whole buffer passed unseen This commit tracks bytes completed since the last pointer callback in hw_unseen and reports SNDRV_PCM_POS_XRUN when an entire buffer passes unseen. > diff --git a/sound/virtio/virtio_pcm_ops.c b/sound/virtio/virtio_pcm_ops.c > index 1091100a4c982..c7fdd837d38fd 100644 > --- a/sound/virtio/virtio_pcm_ops.c > +++ b/sound/virtio/virtio_pcm_ops.c [ ... ] > @@ -430,6 +431,38 @@ static int virtsnd_pcm_sync_stop(struct snd_pcm_subs= tream *substream) > return 0; > } > =20 > +/* > + * The pointer callback can only report a position inside the buffer, an= d both > + * snd_pcm_indirect_{playback,capture}_pointer() and the PCM core derive= the > + * progress from it modulo the buffer size. A whole buffer completed sin= ce the > + * previous call (the elapsed-period work delayed by a buffer time or mo= re while > + * the device kept completing messages) therefore looks like no progress= : for > + * playback the bytes stay in pcm_indirect.hw_ready and the core's hw_pt= r stays a > + * buffer behind, so nothing more is ever transferred and the stream sta= lls with > + * a full buffer while still RUNNING. The device has then played (or cap= tured) > + * everything the application had provided for, which is an xrun: report= it. > + */ > +static snd_pcm_uframes_t > +virtsnd_pcm_pointer(struct snd_pcm_substream *substream, > + snd_pcm_uframes_t (*pointer)(struct snd_pcm_substream *, > + struct snd_pcm_indirect *, > + unsigned int)) > +{ > + struct virtio_pcm_substream *vss =3D snd_pcm_substream_chip(substream); > + size_t hw_ptr, unseen; > + > + scoped_guard(spinlock_irqsave, &vss->lock) { > + hw_ptr =3D vss->hw_ptr; > + unseen =3D vss->hw_unseen; > + vss->hw_unseen =3D 0; > + } > + > + if (unseen >=3D vss->buffer_bytes) > + return SNDRV_PCM_POS_XRUN; [Severity: High] This problem wasn't introduced by this patch, but should virtsnd_pcm_pointer() also check vss->xfer_xrun [1]? When VIRTIO_SND_PCM_F_EVT_XRUNS is negotiated and the device sends a VIRTIO_SND_EVT_PCM_XRUN event, virtsnd_pcm_event() sets vss->xfer_xrun =3D true under vss->lock. Commit fe981e67568c ("ALSA: virtio: use ack callback") dropped the vss->xfer_xrun check from the pointer callback, so device-reported xruns are silently ignored instead of returning SNDRV_PCM_POS_XRUN. [1] https://sashiko.dev/#/bug/linux-4c772c61-641e-49f3-a633-9a55f84dca60 --=20 Sashiko AI review =C2=B7 https://sashiko.dev/#/patchset/20261130115939.4343= 08-1-ericcurtin17@gmail.com?part=3D1