[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CA+55aFwYUDG01tYvpUFYz9RV2U9VREcso4Cdjtw63oJSYmq0QQ@mail.gmail.com>
Date: Wed, 29 Nov 2017 12:48:39 -0800
From: Linus Torvalds <torvalds@...ux-foundation.org>
To: David Laight <David.Laight@...lab.com>
Cc: Andy Lutomirski <luto@...nel.org>,
Peter Zijlstra <peterz@...radead.org>,
Ingo Molnar <mingo@...nel.org>,
Jarkko Nikula <jarkko.nikula@...ux.intel.com>,
linux-kernel <linux-kernel@...r.kernel.org>,
Thomas Gleixner <tglx@...utronix.de>,
Borislav Petkov <bp@...en8.de>
Subject: Re: [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@...lab.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
Powered by blists - more mailing lists