@michaelc@mastodon.gamedev.place
Post #2285610
2026-03-22 05:24 UTC
@rovarma@mastodon.gamedev.place Engaging read!
One lingering question: after the fixes, ringbuf_reserve in the NMI sampling event fails because the lock detects and rejects reentrancy, right? (Just quickly, instead of after 250ms.) That seems… scary?
I guess you just don’t get a sample, and that’s not the end of the world for a profiler? Are there other NMI you instrument where a failure like this might drop important information?
Replies (1)
-
@rovarma@mastodon.gamedev.place 2026-03-22 11:55
@michaelc@mastodon.gamedev.place Yep, that’s exactly what happens. It’s fine in this case because with the high sampling rate and the sporadic nature of the race, you’ll lose a few samples at most. And, the race is between the context switch and the sample, and we also collect stacks for cswitches, so the sample wouldn’t even give us any extra information since it would be the same stack (remember this is a same-CPU issue, so it effectively means you’d be sampling the cswitch).