[PATCH v16 00/12] ALSA: virtio: fix capture lifetime and accounting

Joonho Lee posted 12 patches 2 hours ago
[PATCH v16 00/12] ALSA: virtio: fix capture lifetime and accounting
Posted by Joonho Lee 2 hours ago
Hi Takashi,

This revision addresses the two Sashiko findings on v15. The series keeps
its twelve-patch layout and the same base, a4311e9447bbb219044db38897f95be112f46a8a.

In patch 7, ordinary capture completions must match the next physical
ring slice before advancing the pointer. An empty STOP response retires
ownership without advancing it. A gap or out-of-order full completion
reports XRUN, and later completions only retire ownership. This path does
not reorder completions. Valid prefixes, empty tails and ring wrap remain
supported.

In patch 10, staged pointer and ACK callbacks require a prepared capture
epoch. DRAINING alone no longer permits access after RELEASE. The explicit
PAUSED/RELEASED pause-restart case remains supported.

I reproduced both problems and checked the fixes under ARM64 QEMU with
KASAN and lockdep. The completion tests cover seven cases at patch 7 and
the final stage, using real returned descriptors with test-only ordering
and status injection. The ACK test uses raw userspace SYNC_PTR calls in
the post-sync_stop window and after an injected prepare cancellation.
The pointer callback check is synthetic: ALSA HWSYNC skips that callback
for capture DRAINING. Prepared drain tails and paused/released access
still pass.

The six changed stages build with W=1. Stages 1-6 are unchanged from v15.
The combined build also passed 70-second RW and MMAP capture, RESET and
reopen tests in ordinary and staged modes. All fourteen captured segments
matched the QEMU sequence oracle. A separate v15 comparison confirmed
that staged paused RESET already discarded the old partial tail; this
revision makes no new claim about preserving that tail.

These runs did not exercise physical VZ devices, NOMMU or KCSAN. The new
reproduction fixtures are local and have not been uploaded yet.

Previous version:
https://lore.kernel.org/linux-sound/20261105000915.15177-1-mynameisjune111@gmail.com/

AI assistance was used for analysis, implementation and test preparation.
Assisted-by: LLM

Thanks,
Joonho

base-commit: a4311e9447bbb219044db38897f95be112f46a8a