> Since commit fe981e67568c ("ALSA: virtio: use ack callback"), an I/O
> message is only queued to the device once the application has filled
> the whole period: virtsnd_pcm_msg_send() accumulates the transferred
> bytes in msg->length and queues the message when it reaches
> period_bytes. msg->length is reset to 0 only when the device completes
> the message.
>
> If the substream is stopped (e.g. snd_pcm_drop()) while a period is
> only partially filled, the corresponding message is never queued and
> keeps its partial length. virtsnd_pcm_prepare() resets msg_count,
> hw_ptr and the indirect PCM state, but not msg->length. After the
> next start, the stale length is added to the new data, the sum never
> equals period_bytes, and the message is never sent again. Playback
> then stalls once hw_ptr reaches that period: writes fail with -EIO
> ("DMA or IRQ trouble") and drain fails with -EIO. Capture is affected the
> [ ... ]
> Found by code inspection, confirmed with the reproducer above.
>
> Fixes: fe981e67568c ("ALSA: virtio: use ack callback")
> Assisted-by: LLM
> Signed-off-by: Ting-Han Hou <[email protected]>
Sashiko has reviewed this patch and found no issues. It looks great!
--
Sashiko AI review ยท
https://sashiko.dev/#/patchset/[email protected]?part=1