From 1e826983ceef421d7047ed76581840b778294ad4 Mon Sep 17 00:00:00 2001 From: Paul Moses
Date: Tue, 20 Oct 2026 17:21:07 +0000 Subject: [PATCH] perf mmap: Preserve the consumed cursor in forward mode perf_mmap__read_event() updates prev as it consumes forward-buffer records. perf_mmap__read_done() then overwrites prev with a fresh producer head, even when unread records remain. perf_kvm__mmap_read_idx() stops after 25 records per mmap and calls read_done(). If more records are pending, prev advances past them. The next drain starts at that new position and skips the unread remainder. An event arriving after the last empty read_event() and before read_done() can also be skipped. read_done() does not itself update the kernel's data_tail. Only refresh prev for overwrite buffers, which need the current head as the end of the next backward read. Leave the forward cursor at the consumed position. Fixes: 53172f9057e92c9b ("perf kvm: Switch to new perf_mmap__read_event() interface") Signed-off-by: Paul Moses
Cc: Adrian Hunter