From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753955AbdK0VBC (ORCPT ); Mon, 27 Nov 2017 16:01:02 -0500 Received: from merlin.infradead.org ([205.233.59.134]:37452 "EHLO merlin.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753863AbdK0VBA (ORCPT ); Mon, 27 Nov 2017 16:01:00 -0500 Date: Mon, 27 Nov 2017 22:00:54 +0100 From: Peter Zijlstra To: Thomas Gleixner Cc: Ingo Molnar , linux-kernel@vger.kernel.org, Dave Hansen , Andy Lutomirski , "H . Peter Anvin" , Borislav Petkov , Linus Torvalds Subject: Re: [PATCH 02/24] x86/mm/kaiser: Prepare the x86/entry assembly code for entry/exit CR3 switching Message-ID: <20171127210054.jrs4nls2zixyclqc@hirez.programming.kicks-ass.net> References: <20171127104923.14378-1-mingo@kernel.org> <20171127104923.14378-3-mingo@kernel.org> <20171127173146.plbdbiuzkv5ctgw6@hirez.programming.kicks-ass.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: NeoMutt/20170609 (1.8.3) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Nov 27, 2017 at 06:33:39PM +0100, Thomas Gleixner wrote: > On Mon, 27 Nov 2017, Peter Zijlstra wrote: > > On Mon, Nov 27, 2017 at 11:49:01AM +0100, Ingo Molnar wrote: > > > diff --git a/arch/x86/entry/entry_64.S b/arch/x86/entry/entry_64.S > > > index caf74a1bb3de..df0152bee8a8 100644 > > > > > @@ -198,6 +201,14 @@ ENTRY(entry_SYSCALL_64) > > > > > > swapgs > > > movq %rsp, PER_CPU_VAR(rsp_scratch) > > > + > > > + /* > > > + * The kernel CR3 is needed to map the process stack, but we > > > + * need a scratch register to be able to load CR3. %rsp is > > > + * clobberable right now, so use it as a scratch register. > > > + * %rsp will look crazy here for a couple instructions. > > > + */ > > > + SWITCH_TO_KERNEL_CR3 scratch_reg=%rsp > > > movq PER_CPU_VAR(cpu_current_top_of_stack), %rsp > > > > > > /* Construct struct pt_regs on stack */ > > > > I think we can do away with this one, on account of never getting here > > because of entry_SYSCALL_64_trampoline. > > It's on my list already. About 5 people noticed :) Hey, at least we all agree ;-)