On Mon, Oct 13, 2025 at 12:45 PM H. Peter Anvin hpa@zytor.com wrote:
On 2025-10-13 10:14, Andy Lutomirski wrote:
I don't actually remember whether the kernel ever used this. It's possible that there are ancient kernels where passing a wild, non-null pointer would blow up. But it's certainly safe to pass null, and it's certainly safe for the kernel to ignore the parameter.
One could imagine an architecture which would have to execute an actual system call wanting to use this, but on x86 it is pointless -- even the LSL trick is much faster than a system call, and once you account for whatever hassle you would have to deal with do make the cache make sense (probably having a global generation number and/or a timestamp to expire it) it well and truly makes no sense.
The global timestamp would just be some field in the vvar area, which we have plenty of anyway.
But I agree, accelerating getcpu is pointless. In any case, anything that historically thought it really really wanted accelerated getcpu can, and probably does, use rseq these days.
--Andy