All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v11 00/14] ALSA: virtio: staged capture recovery and PCM RESET synchronization
@ 2026-10-31  2:08 Joonho Lee
  2026-10-31  2:08 ` [PATCH v11 01/14] ALSA: virtio: Propagate PCM send failures through ACK Joonho Lee
                   ` (13 more replies)
  0 siblings, 14 replies; 29+ messages in thread
From: Joonho Lee @ 2026-10-31  2:08 UTC (permalink / raw)
  To: linux-sound
  Cc: tiwai, perex, anton.yakovlev, mst, virtualization, linux-kernel,
	corbet, skhan, rdunlap, linux-doc

Hi Takashi,

This revision supersedes v10 and includes the unmerged prerequisites.
Apply patches 1-14 to sound.git for-next at
a4311e9447bbb219044db38897f95be112f46a8a. Targeting 7.5 or later still
works for me.

Previous revision:
https://lore.kernel.org/linux-sound/20261030052629.27742-1-mynameisjune111@gmail.com/T/

The series adds staged capture accounting for shared clients such as
dsnoop, lifecycle recovery, and synchronized PCM RESET accounting. The
capture compatibility options remain opt-in and disabled by default.

Changes since v10

Sashiko raised nine findings in patches 4, 9, 12 and 14. This revision
folds the corrections into the relevant patches and carries the queue
retirement checks from patch 3.

Patch 4 seeds ordinary RX once per prepare. Native STOP leaves requests
and unread samples owned by the current ring, so resume preserves them.
Consumed or discarded space returns through ACK and RESET. This avoids
inflated pending lengths and resubmission of unread DMA slots.

Patch 9 restores notifications after rejected native pause and handles
both success and failure on the already-running START path. Ordinary
capture now honors the XRUN latch in ACK. Its monotonic completion count
also detects a whole unobserved ring and reports XRUN for prepare
recovery. Capture completions preserve the latch from this patch onward.

A first version of the recovery notification exposed an old ring of
samples after paused RESET. Passing every wakeup through period_elapsed
let ALSA infer a wrap without a newly completed period. The worker now
uses the partial-progress helper for synthetic wakeups and retains PCM
timer notifications for actual new periods. The sample comparison and
a periodic PCM timer test both reproduce the candidate regression and
pass with this separation.

Patch 12 removes the second appl_ptr assignment after a callback member
has completed prepare. A linked member's prepare can sleep while the
first member accepts SYNC_PTR. The callback path now preserves that
acknowledgment under its PCM lock. Explicit RESET retains playback
silence handling; prepare leaves filling to the normal START path.

Patch 14 checks the existing XRUN and lifecycle state before mutating
paused indirect accounting. The RX queue and substream locks cover its
pointer observation, temporary accounting and refill. The notification
floor follows the RESET observation. Refill failure retains the existing
zero-return policy while the worker reports XRUN and prepare recovers it.

Patch 3 retires each queue wrapper under the detach lock and checks queue
identity in PCM, control and event callbacks. The proposed detached-ring
IRQ failure was not reproduced on the tested PCI transport: forced
callback tests passed on both versions. This part strengthens teardown
ownership boundaries; the transport reset callback synchronization
contract still applies.

Patch layout

  1-6: ACK errors, START/RELEASE recovery and request/DMA lifetime.
  7:   Core stop-threshold accesses used by capture policy sampling.
  8:   Partial-progress notification under the PCM stream lock.
  9:   Staged capture, shared capture policy and lifecycle recovery.
  10:  Staged capture work priority.
  11:  Capture compatibility option documentation.
  12:  Optional PCM reset operation under the stream lock.
  13:  Staged capture RESET accounting.
  14:  Ordinary capture RESET accounting.

The core API additions remain separate from their driver users. Drivers
without a reset callback retain the ioctl path. Linked RESET and prepare
retain their first-error, partial-completion contract. A zero RESET
return allows the core rebase to finish; later I/O can report -EPIPE and
require prepare or reopen. The internal snd_pcm_ops addition requires
out-of-tree modules using it to be rebuilt.

Validation

The functional candidate passed 23 ARM64 QEMU runs with KASAN and lockdep,
covering error injection, recovery, reopen and compatibility tests.
The core fixtures covered 72 atomic/nonatomic, callback/legacy and linked
failure cases, including playback silence. snd-dummy and virtio-snd each
passed three playback/capture cycles. Additional timer comparisons kept
real period ticks and removed the synthetic resume tick.

For both ordinary and staged capture, an uninstrumented kernel recorded
70 seconds through RW and another 70 seconds through MMAP after
PAUSE, RESET and resume, followed by reopen. All 14 segments,
14,208,000 S16 mono frames at 48 kHz, matched independently generated
SHA-256 values from QEMU sequence metadata. The oracle includes the
intended RESET discard and backend epoch boundaries. The earlier failing
candidate and its sample comparison remain in the local evidence.

The paused interleaving test verifies the new atomic observation
boundary; it does not establish sample loss in the original code.
ARM64 W=1 Image/modules and ARM32 LLVM object builds passed. Test hooks
remain separate from the submitted code. Each mail patch is applied to
the pinned baseline and compared with its expected intermediate source.

Fresh v11 postimages at stages 3-14 built without compiler warnings.
Nine additional stage VMs passed, including eight injected recovery cases
at patch 9, staged native and pause-restart capture, and paused RESET at
patches 13 and 14. All six additional MMAP segments matched the sequence
oracle. Neighboring patches have refreshed contexts where earlier changes
moved their code.

Packaging also adds braces to one existing staged if arm. The new module's
executable, relocation, data and symbol sections match the tested module
byte for byte. The fresh stage tests above use this formatted source.

These results cover QEMU synthetic input. Physical VZ/MOTU acceptance,
an independent KCSAN run and broader format/multichannel and ARM32
runtime testing remain pending. The high-load TCG scheduling results
from earlier revisions still limit performance conclusions. The new
ordinary full-ring check reports -EPIPE where the modulo-only path could
wait indefinitely. The core progress helper and linked RESET contract
still need maintainer review.

Coding assistance was used for analysis, implementation, fixtures and
this explanation. The patches carry Assisted-by: LLM.

Thanks,
Joonho

base-commit: a4311e9447bbb219044db38897f95be112f46a8a

^ permalink raw reply	[flat|nested] 29+ messages in thread

end of thread, other threads:[~2026-10-31  2:51 UTC | newest]

Thread overview: 29+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-10-31  2:08 [PATCH v11 00/14] ALSA: virtio: staged capture recovery and PCM RESET synchronization Joonho Lee
2026-10-31  2:08 ` [PATCH v11 01/14] ALSA: virtio: Propagate PCM send failures through ACK Joonho Lee
2026-10-31  2:29   ` sashiko-bot
2026-10-31  2:08 ` [PATCH v11 02/14] ALSA: virtio: Recover PCM state after a failed start Joonho Lee
2026-10-31  2:31   ` sashiko-bot
2026-10-31  2:08 ` [PATCH v11 03/14] ALSA: virtio: Retain queued messages through device reset Joonho Lee
2026-10-31  2:40   ` sashiko-bot
2026-10-31  2:08 ` [PATCH v11 04/14] ALSA: virtio: Keep PCM DMA buffers alive through device ownership Joonho Lee
2026-10-31  2:33   ` sashiko-bot
2026-10-31  2:08 ` [PATCH v11 05/14] ALSA: virtio: Keep control payloads alive through DMA completion Joonho Lee
2026-10-31  2:20   ` sashiko-bot
2026-10-31  2:08 ` [PATCH v11 06/14] ALSA: virtio: wait through signals for PCM teardown Joonho Lee
2026-10-31  2:27   ` sashiko-bot
2026-10-31  2:08 ` [PATCH v11 07/14] ALSA: pcm: mark stop-threshold accesses for capture policy sampling Joonho Lee
2026-10-31  2:14   ` sashiko-bot
2026-10-31  2:08 ` [PATCH v11 08/14] ALSA: pcm: report partial progress under the stream lock Joonho Lee
2026-10-31  2:13   ` sashiko-bot
2026-10-31  2:08 ` [PATCH v11 09/14] ALSA: virtio: add staged capture accounting and lifecycle recovery Joonho Lee
2026-10-31  2:51   ` sashiko-bot
2026-10-31  2:08 ` [PATCH v11 10/14] ALSA: virtio: prioritize staged capture period work Joonho Lee
2026-10-31  2:15   ` sashiko-bot
2026-10-31  2:08 ` [PATCH v11 11/14] docs: describe virtio-sound capture options Joonho Lee
2026-10-31  2:16   ` sashiko-bot
2026-10-31  2:08 ` [PATCH v11 12/14] ALSA: pcm: add an optional reset operation under the stream lock Joonho Lee
2026-10-31  2:20   ` sashiko-bot
2026-10-31  2:08 ` [PATCH v11 13/14] ALSA: virtio: synchronize staged capture accounting during RESET Joonho Lee
2026-10-31  2:42   ` sashiko-bot
2026-10-31  2:08 ` [PATCH v11 14/14] ALSA: virtio: rebase ordinary capture accounting on RESET Joonho Lee
2026-10-31  2:40   ` sashiko-bot

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.