Re: [PATCH] x86/entry/64: Fix native_load_gs_index() SWAPGS handling with IRQ state tracing enabled

From: Peter Zijlstra
Date: Wed Nov 29 2017 - 13:08:42 EST


On Wed, Nov 29, 2017 at 09:57:43AM -0800, Andy Lutomirski wrote:
> On Tue, Nov 28, 2017 at 11:09 PM, Ingo Molnar <mingo@xxxxxxxxxx> wrote:

> > On a related note, we should definitely extend the 'intended GS state' annotation
> > comments I did in this patch to all SWAPGS instances - this way code review has a
> > much higher chance of finding discrepancies between intent and actual code.
>
> Agreed. I'll send a patch.

Alternatively we could do something like:

SWITCH_TO_KERNEL_GS
SWITCH_TO_USER_GS

and have them do the SWAPGS with an (optional) assertion of the actual
GS.