Re: [RESEND PATCH v6 04/12] x86/fsgsbase/64: Enable FSGSBASE instructions in the helper functions

From: Andi Kleen
Date: Mon Mar 25 2019 - 20:38:08 EST


> So on user space to kernel space transitions swapping in kernel GS should
> simply do:
> userGS = RDGSBASE()
> WRGSBASE(kernelGS)

This would also need to find kernelGS first, by doing RDPID and then
reading it from memory in the right index
(which might be a full cache miss if you're unlucky)

SWAPGS will be a lot faster, especially in these rare worst cases
because it has all its state inside the CPU.

-Andi

BTW you managed to only review after Chang went on a long vacation.

<rant>
I don't understand why it takes that long to review these changes
It's one of the largest performance improvements for the context
switch and the NMI in many years plus gives a new free register
to user space, but it only makes progress at a glacial pace.
The original patches for this were posted in 2016.
</rant>