> The RX callback holds the queue lock across a batch of completions. A > reader that has copied samples can wait for that lock in ACK before its > consumed bytes are removed from capture_ready. A later completion in the > same batch can then reject data using stale ring occupancy. > > Account the staged read under the substream lock before acquiring the RX > queue lock. Release that lock before taking the queue and substream locks > in their established order to refill requests. > > Once accounting is committed, latch refill errors as XRUN and return > success from ACK. A negative return would make ALSA restore appl_ptr while > the driver retained the consumed-byte accounting. Keep pre-commit errors, > ring-capacity checks, and normal period-work scheduling unchanged. > > Source-extracted host and kernel fixtures reproduce the stale-capacity > race and post-commit ALSA pointer rollback. The candidate preserves wrapped > data and pointer accounting. KASAN/lockdep QEMU lifecycle checks passed. > The fixtures substitute selected backend helpers and do not independently > establish physical-device acceptance. > > This follows pending staged capture support, whose introducing patch has > no upstream commit ID for a Fixes tag yet. > > Link: > https://lore.kernel.org/all/[email protected]/ > Assisted-by: LLM > Signed-off-by: Joonho Lee <[email protected]>
Sashiko has reviewed this patch and found no issues. -- Sashiko AI review ยท https://sashiko.dev/#/patchset/[email protected]?part=1
