mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Joonho Lee <mynameisjune111@gmail.com>
To: linux-sound@vger.kernel.org
Cc: tiwai@suse.com, perex@perex.cz, anton.yakovlev@opensynergy.com,
	mst@redhat.com, virtualization@lists.linux.dev,
	linux-kernel@vger.kernel.org, corbet@lwn.net,
	skhan@linuxfoundation.org, rdunlap@infradead.org,
	linux-doc@vger.kernel.org
Subject: [PATCH v24 00/16] ALSA: virtio: serialize PCM recovery and preserve capture and playback progress
Date: Wed, 11 Nov 2026 09:05:27 +0900	[thread overview]
Message-ID: <20261111000543.28550-1-mynameisjune111@gmail.com> (raw)

This series updates ALSA PCM recovery and virtio-snd request ownership.
It also changes capture to request-owned RX buffers so a valid short
completion can be appended to the ALSA ring without leaving a gap.

The previous version is at:
https://lore.kernel.org/linux-sound/20261109234049.79534-1-mynameisjune111@gmail.com/T/

This replaces v23 in full. Apply all sixteen patches to the base commit
listed below; do not apply this series on top of v23.

Changes since v23:

Capture now retains frame-aligned short completions and handles empty
requests returned at STOP or PAUSE. The final tail can update capture
DRAINING. A paused RESET observes the last committed position, discards
samples through that point, and keeps subsequent data at the matching
ring offset. The earlier direct/staged capture split is removed.

The intermediate bounds patch accepts a bounded partial RX response.
Initial RX reservation, ACK validation and refill enter together with
request-owned capture. Earlier patches preserve legacy capture ACK and
completion behavior while adding bounded payload checks. This avoids a
partially converted PAUSE path between the ACK and RX conversion
patches.

Playback response validation and pause progress are separate patches. An
invalid used length or device error latches XRUN without publishing
successful progress. TX completion caches latency without dereferencing
the ALSA runtime. Resume and failed-pause recovery schedule pending
progress. Limiting the indirect queue to buffer_bytes - period_bytes
prevents an unobserved full-ring completion from looking like no
progress.

Matched pristine-base and v23 QEMU tests reproduced the capture
regression and the playback stalls. The playback missed wakeup and
modulo ambiguity also occur on the pristine base. This comparison does
not establish the first affected version within the earlier revisions of
this series.

The final candidate built with W=1 without warnings. Cumulative stages
12 through 16 were rebuilt after the DRAINING notification correction.
Unchanged stages 2 and 6 through 11 match the earlier build inputs
exactly; stages 0, 1 and 3 through 5 have no fresh build in this
preparation.

A delayed-RX comparison establishes DRAINING before returning the final
completion. The earlier local candidate left the cached pointer
unchanged for a full-period tail or a short tail crossing a period
boundary, and left an invalid response in DRAINING. These six failures
reproduce across RW and MMAP. A non-crossing partial tail succeeds in
both versions. The corrected candidate passes all eight cases, including
marker readback, XRUN delivery and reopen. Cached state is sampled with
SYNC_PTR using APPL and AVAIL_MIN flags, with HWSYNC disabled, so the
observer does not refresh the hardware pointer or invoke ACK. This
checks autonomous publication; blocked-reader wakeup timing is not
measured.

Earlier R5 tests cover partial, late, empty and overflow STOP,
PAUSE/resume, DROP, RESET and reopen, plus playback accepted/rejected
PAUSE, immediate HWSYNC, two-period queues, stop-threshold XRUN/POLLERR,
and malformed TX status/length. The R6 change is limited to capture
DRAINING dispatch; playback and running-capture notification paths are
unchanged. R6 repeats the partial STOP, PAUSE/resume and reopen checks
in RW/MMAP. Final-source RW and MMAP captures each ran for seventy
seconds with RESET/reopen checks. All seven segments, totaling 7,104,000
frames, matched the unchanged independent sample oracle. Eight
additional final-source cases with stop_threshold set to buffer_size
also pass in RW and MMAP. All completed R6 runs used ARM64 QEMU with
KASAN and lockdep without reports.

A delayed-TX test observed completion, close returning -EIO and
continued guest execution. Its buffered log does not establish
completion timing relative to close return, and its backend hook does
not read audio pages. It therefore does not establish post-close payload
DMA safety.

The default RX conversion adds request-owned memory and an IRQ-path
copy. The capture_staging, capture_allow_short and capture_allow_empty
options from v23 are removed. Existing configurations using them need
updating. Packed status and RELEASE/reprepare pause remain opt-in and
disabled by default. The new default path, removed options and cost need
maintainer review. CPU, IRQ lock-hold time and worst-case resource
overhead have not been qualified. The playback queue cap reduces
buffering tolerance, especially with two periods. This revision has no
new physical VZ or KCSAN qualification; the earlier v23 physical/KCSAN
results do not qualify this changed RX path. Uncertain control timeouts
can still require device reset or reprobe.

I would particularly appreciate feedback on using request-owned buffers
for ordinary capture and the playback queue-capacity tradeoff.
Preserving full-ring TX capacity would require a larger exact-progress
interface.

The new STOP and pause fixtures are local and have not been published.

The pause option documentation describes the STOP/START default and the
optional STOP/RELEASE followed by SET_PARAMS/PREPARE/START sequence.

base-commit: a4311e9447bbb219044db38897f95be112f46a8a

             reply	other threads:[~2026-11-11  0:05 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-11  0:05 Joonho Lee [this message]
2026-11-11  0:05 ` [PATCH v24 01/16] ALSA: pcm: mark stop-threshold accesses for capture policy sampling Joonho Lee
2026-11-11  0:05 ` [PATCH v24 02/16] ALSA: pcm: report partial progress under the stream lock Joonho Lee
2026-11-11  0:05 ` [PATCH v24 03/16] ALSA: pcm: add an optional reset operation " Joonho Lee
2026-11-11  0:05 ` [PATCH v24 04/16] ALSA: pcm: notify drivers after linked prepare completes Joonho Lee
2026-11-11  0:05 ` [PATCH v24 05/16] ALSA: pcm: serialize linked buffer actions Joonho Lee
2026-11-11  0:05 ` [PATCH v24 06/16] ALSA: virtio: propagate playback send failures through ACK Joonho Lee
2026-11-11  0:05 ` [PATCH v24 07/16] ALSA: virtio: Recover PCM state after a failed start Joonho Lee
2026-11-11  0:05 ` [PATCH v24 08/16] ALSA: virtio: Retain queued messages through device reset Joonho Lee
2026-11-11  0:05 ` [PATCH v24 09/16] ALSA: virtio: bound PCM transfers and retain DMA buffers Joonho Lee
2026-11-11  0:05 ` [PATCH v24 10/16] ALSA: virtio: Keep control payloads alive through DMA completion Joonho Lee
2026-11-11  0:05 ` [PATCH v24 11/16] ALSA: virtio: wait through signals for PCM teardown Joonho Lee
2026-11-11  0:05 ` [PATCH v24 12/16] ALSA: virtio: use request-owned capture and serialize recovery Joonho Lee
2026-11-11  0:05 ` [PATCH v24 13/16] ALSA: virtio: prioritize capture period work Joonho Lee
2026-11-11  0:05 ` [PATCH v24 14/16] docs: describe virtio-sound capture options Joonho Lee
2026-11-11  0:05 ` [PATCH v24 15/16] ALSA: virtio: reject invalid playback completions Joonho Lee
2026-11-11  0:05 ` [PATCH v24 16/16] ALSA: virtio: preserve playback progress across pause Joonho Lee

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20261111000543.28550-1-mynameisjune111@gmail.com \
    --to=mynameisjune111@gmail.com \
    --cc=anton.yakovlev@opensynergy.com \
    --cc=corbet@lwn.net \
    --cc=linux-doc@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-sound@vger.kernel.org \
    --cc=mst@redhat.com \
    --cc=perex@perex.cz \
    --cc=rdunlap@infradead.org \
    --cc=skhan@linuxfoundation.org \
    --cc=tiwai@suse.com \
    --cc=virtualization@lists.linux.dev \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®