Regarding storing the contexts, my additional tests show that when a context only has a part of xstate (with compacted save enabled and compaction mask covering only some of features), the missing part of xstate is preserved, so lacking state save on enter to NtSetContextThread will also make it reset the other state. But I also don't know that anything depends on accuracy here.
It depends on implementation details. Unless I'm missing something, we could just not touch them on restore which would preserve them for free.
So I don't know that simply ignoring avx512 for now (and returning init state when in syscall) won't work, I am just not sure why do we need to keep it for avx then, we could stop saving that as well?
The main difference is that avx is usually cheap to store (or, worst case, still much cheaper than avx512). I don't know if anything depends on it specifically, through.