From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751370AbdKUS5g (ORCPT ); Tue, 21 Nov 2017 13:57:36 -0500 Received: from mga01.intel.com ([192.55.52.88]:55862 "EHLO mga01.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750772AbdKUS5e (ORCPT ); Tue, 21 Nov 2017 13:57:34 -0500 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.44,432,1505804400"; d="scan'208";a="4366157" Subject: Re: [PATCH 11/16] x86/asm/64: Use a percpu trampoline stack for IDT entries To: Andy Lutomirski , X86 ML References: <3ff604702987cf6af1e191705fd937517ceeeeb7.1511195781.git.luto@kernel.org> Cc: Borislav Petkov , "linux-kernel@vger.kernel.org" , Brian Gerst , Linus Torvalds , Josh Poimboeuf From: Dave Hansen Message-ID: <3cd7d3eb-cf71-a015-b37f-4cb079ea3c00@intel.com> Date: Tue, 21 Nov 2017 10:57:31 -0800 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.4.0 MIME-Version: 1.0 In-Reply-To: <3ff604702987cf6af1e191705fd937517ceeeeb7.1511195781.git.luto@kernel.org> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 11/20/2017 09:07 AM, Andy Lutomirski wrote: > --- a/arch/x86/entry/entry_64.S > +++ b/arch/x86/entry/entry_64.S > @@ -560,6 +560,14 @@ END(irq_entries_start) > .macro interrupt func > cld > ALLOC_PT_GPREGS_ON_STACK > + > + testb $3, CS(%rsp) > + jz 1f > + SWAPGS > + call switch_to_thread_stack > + SWAPGS > +1: This looks really weird to me. SWAPGS, switch stack, and SWAPGS again? Is this so that we can use some per-cpu data in switch_to_thread_stack, and then put GS back so that the normal, non-trampoline entry code can do its normal SWAPGS voodoo?