lkml.org 
[lkml]   [2017]   [Nov]   [29]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
Date
SubjectRe: [PATCH] x86/entry/64: Fix native_load_gs_index() SWAPGS handling with IRQ state tracing enabled
On Wed, Nov 29, 2017 at 8:51 AM, David Laight <David.Laight@aculab.com> wrote:
>
> SWAPGS is a PITA. The hardware designers should have tried to write
> all the interrupt handling code.

That's actually my biggest beef with x86-64. The kernel entry/exit is
completely misdesigned.

That was actually better in the original i386, which handles nesting
ok (modulo the NMI disable flag and the STI shadow bit which doesn't
save/restore properly).

Yes, the 386 model of infinite indirection through IDT/GDT/TSS is
broken and should have had a mode bit to just replace with a simple
"use this stack and address for kernel entry" MSR register - but that
simplified kernel entry/exit should have saved/restored _more_ info,
not less (eg "save/restore segment shadow state rather than the
descriptor number that needs the insane indirection" etc)

The problem was never the few push/pop instructions that kernel entry involved.

The entry/exit garbage admittedly started before x86-64 itself - all
those 'syscall' variants are equally broken. Not saving/restoring
state properly is just unbelievable sh*t. x86-64 then made things
worse with SWAPGS etc.

A lot of people hate x86 because of instruction decoding. No, if you
need a reason to dislike x86, it's because of exception handling and
iret.

Rant over.

Linus

\
 
 \ /
  Last update: 2017-11-29 21:49    [W:0.056 / U:0.040 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site