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/[email protected]/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
