Queue CPU buffers before CLOSELOG. Drain the queue after close. Stop after 500 ms with no progress.
Sponsored by: AMD
Differential D60186
hwpmc: drain logs before close Authored by afscoelho_gmail.com on Sep 30 2026, 9:09 PM.
Details
Queue CPU buffers before CLOSELOG. Drain the queue after close. Stop after 500 ms with no progress. Sponsored by: AMD GENERIC with INVARIANTS on AMD, 160 CPUs.
Diff Detail
Event TimelineComment Actions I feel like this is a bit hacky of solution having them wait 500ms, instead shouldn't we allow the process to continue to drain events until its either terminated or closed? Comment Actions Thanks for looking at this Ali! The 500 ms isn't a hard cut in the whole drain. It keeps waiting as long as the helper thread is still writing buffers out. The timer only runs out if it gets stuck and writes nothing for 500 ms. I added the limit because I think there are cases where nothing will ever drain the log (and close holds pmc_sx the whole time). For example, pmcstat without -o writes the log into a pipe and reads the other end itself. When it closes the log, that same thread is stuck in the syscall, so nobody reads the pipe. If the pipe is full, the helper can't write and close can't finish and this can lead to a hang forever. Draining in the background after close returns would certainly be nicer, but it looks like a big change to me. In a scale, the 500 ms looked fine for me |