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 v23 00/14] ALSA: virtio: serialize PCM recovery and capture accounting
Date: Tue, 10 Nov 2026 08:40:35 +0900	[thread overview]
Message-ID: <20261109234049.79534-1-mynameisjune111@gmail.com> (raw)

This series updates PCM error recovery, queue ownership and capture
accounting in virtio-snd. It also provides opt-in staged capture for
backends whose completion lengths need explicit compatibility handling.
The capture compatibility parameters remain disabled by default.

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

The v23 changes address the v22 automated review and a separate existing
linked-buffer locking problem. Linked prepare now commits member states
and driver admission under the group and member PCM locks. Suspended or
disconnected members keep their states, and a canceled successful driver
prepare returns an error to its caller. Failed prepares notify only the
attempted prefix and do not generate a stop-timer event.

A separate core patch closes every linked member's buffer-access gate
and takes buffer mutexes in the stable group order. The caller-first
ordering and caller-only access gate are already present in the upstream
base; this patch is distinct from the prepare-completion API change.

The failed-start patch owns the direction-independent error latch. The
later recovery code keeps native pause admission closed when a linked
resume rollback fails in PAUSED. Paused ordinary capture preserves the
accounting-error XRUN path. Staged capture rejects unaligned application
pointer deltas before changing policy or counters. The DMA lifetime and
staged-capture commit messages now describe their full source changes.

The order separates the ALSA core APIs and existing linked-buffer fix,
ACK propagation and failed-start recovery, message and control lifetime,
teardown waits, opt-in capture compatibility, work priority, and option
documentation. Each patch is represented by an independently checked
cumulative source stage.

Validation used ARM64 QEMU with KASAN and lockdep. The eleven changed
cumulative stages, 04 through 14, built with W=1 without compiler
warnings or errors. Applying all fourteen patches in order reproduces
every cumulative source stage and the exact final candidate.

A test PCM driver passed fourteen core scenarios, including linked
success and partial failure, atomic and nonatomic locks, suspend and
disconnect cancellation, overlapping DROP, an active sibling buffer
access, parallel group actions, and old-generation ACK retirement.
The stop-timer change was checked by source review; this run did not
attach a timer client to count timer notifications.

The instrumented virtio-snd tests passed definite START and STOP rejection,
RUNNING pause restoration, failed linked resume rollback, deferred group
XRUN, DROP, prepare, real playback and capture I/O, and reopen in RW and
MMAP modes. Actual SYNC_PTR calls checked rejected ACK rollback and
unaligned ACK policy preservation. The alignment and invalid-accounting
inputs are synthetic test geometry. A separate stage-07 test verified
four START failure/recovery cases and failed playback drain termination.

The pure final driver passed ordinary and staged RW and MMAP recording.
Each configuration included a seventy-second capture. RW checked three
reopen cycles; MMAP checked RESET and a reopened stream. All fourteen
captured segments matched SHA256 values generated independently on the host from recorded QEMU sequence
epochs. No KASAN or lockdep diagnostics were reported by the passing runs.

Additional tests used the same candidate with strict KCSAN and lockdep.
The runtime selftest and an isolated positive-control race confirmed
instrumentation. Fourteen core cases passed at both default and higher
sampling rates. Twenty-four driver control and accounting assertions
passed. Ordinary and staged RW/MMAP captures matched all fourteen
independent signal segments, including RESET and reopen.

The KCSAN campaign did report an ARM64 saved-PSTATE race outside ALSA:
copy_thread() races with spectre_v4_enable_task_mitigation(). I built the
pristine base with the identical config and ran the same fork workload
with all sound modules unloaded. It reproduced the original pair; the
ARM64 source and compiled objects are identical between the two kernels.
The report remains recorded, so this is not a globally KCSAN-clean result.
No ARM64 change is included in this series.

Physical tests on macOS VZ used Scarlett 2i2 input 1 at 48 kHz. Direct
ALSA RW and MMAP each recorded seventy seconds, with signal statistics
checked against a simultaneous host capture. Pause/RESET, the first open
after killing a running recorder, and capture after VM restart passed.
These tests enabled all five compatibility options. They do not establish
bit-exact physical sample continuity or Docker Desktop microphone support.

Two test-tool problems were corrected before the final runs: asynchronous
ACK snapshots could evict a control-error record, and truncating an old
capture file after START stalled the test client beyond its PCM ring.
The final MMAP test prepares RAM before START and writes output after
closing PCM. Source, config and data-oracle acceptance stayed unchanged.

Synthetic alignment checks do not represent an actual sub-byte capture
device. The stop-timer change remains source-reviewed without an attached
timer client. One-shot command rejection exercises a definite error path;
uncertain control timeouts can still require device reset or reprobe.
Heavy-load TCG scheduling limits remain outside this qualification.

The staged path and its backend compatibility options need maintainer
review before they can be recommended for a production deployment.

             reply	other threads:[~2026-11-09 23:40 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-09 23:40 Joonho Lee [this message]
2026-11-09 23:40 ` [PATCH v23 01/14] ALSA: pcm: mark stop-threshold accesses for capture policy sampling Joonho Lee
2026-11-09 23:40 ` [PATCH v23 02/14] ALSA: pcm: report partial progress under the stream lock Joonho Lee
2026-11-09 23:40 ` [PATCH v23 03/14] ALSA: pcm: add an optional reset operation " Joonho Lee
2026-11-09 23:40 ` [PATCH v23 04/14] ALSA: pcm: notify drivers after linked prepare completes Joonho Lee
2026-11-09 23:40 ` [PATCH v23 05/14] ALSA: pcm: serialize linked buffer actions Joonho Lee
2026-11-09 23:40 ` [PATCH v23 06/14] ALSA: virtio: propagate PCM send failures through ACK Joonho Lee
2026-11-09 23:40 ` [PATCH v23 07/14] ALSA: virtio: Recover PCM state after a failed start Joonho Lee
2026-11-09 23:40 ` [PATCH v23 08/14] ALSA: virtio: Retain queued messages through device reset Joonho Lee
2026-11-09 23:40 ` [PATCH v23 09/14] ALSA: virtio: bound PCM transfers and retain DMA buffers Joonho Lee
2026-11-09 23:40 ` [PATCH v23 10/14] ALSA: virtio: Keep control payloads alive through DMA completion Joonho Lee
2026-11-09 23:40 ` [PATCH v23 11/14] ALSA: virtio: wait through signals for PCM teardown Joonho Lee
2026-11-09 23:40 ` [PATCH v23 12/14] ALSA: virtio: add opt-in staged capture and recovery Joonho Lee
2026-11-09 23:40 ` [PATCH v23 13/14] ALSA: virtio: prioritize staged capture period work Joonho Lee
2026-11-09 23:40 ` [PATCH v23 14/14] docs: describe virtio-sound capture options 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=20261109234049.79534-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®