News for hackers. Stuff that matters.
Re:Seqlock-Based Atomic Memory Snapshots by loeg on Saturday August 26, 2023 @01:02PM (#37274611)
In Linux kernel context, you could plausibly prevent write stalls (other than NMIs) by masking interrupts for the write section. I guess there are some seriously slow NMIs though and we would prefer something that worked well despite those.
Re:Seqlock-Based Atomic Memory Snapshots by amluto on Saturday August 26, 2023 @02:25PM (#37275482)
This doesn’t work in a VM or if there’s an SMI or if there is any other glitch.

There’s a more fundamental and harder-to-solve issue, though: time (CLOCK_MONOTONIC or whatever) is a function of the underlying clock source (TSC, for example), and that function is defined piecewise (and must be if it changes in ways that are not known in advance). And, fundamentally, if the thread evaluating the function after some change gets ahead of the thread making the change in the first place, it’s awkward to get the right answer without waiting.

The best I’ve come up with is for the thread running the show to record that, for TSC values above t, a new function is used, and to do this well in advance of t. I don’t know a way to do an atomic commit of a change if and only iff TSC < some threshold.

Re:Seqlock-Based Atomic Memory Snapshots by loeg on Saturday August 26, 2023 @08:06PM (#37278074)
Yeah, SMIs are exactly the kind of very slow NMI I had in mind.