From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752289AbdK0Ngx (ORCPT ); Mon, 27 Nov 2017 08:36:53 -0500 Received: from Galois.linutronix.de ([146.0.238.70]:55200 "EHLO Galois.linutronix.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751754AbdK0Ngv (ORCPT ); Mon, 27 Nov 2017 08:36:51 -0500 Date: Mon, 27 Nov 2017 14:36:47 +0100 (CET) From: Thomas Gleixner To: Josh Poimboeuf cc: Ingo Molnar , Borislav Petkov , linux-kernel@vger.kernel.org, Dave Hansen , Andy Lutomirski , "H . Peter Anvin" , Peter Zijlstra , Linus Torvalds Subject: Re: [PATCH v2] x86/mm/kaiser: Prepare the x86/entry assembly code for entry/exit CR3 switching In-Reply-To: <20171127132948.36nbaaph3sazjljp@treble> Message-ID: References: <20171124172411.19476-1-mingo@kernel.org> <20171124172411.19476-23-mingo@kernel.org> <20171126115038.sfwpecgv6pdfzlbo@pd.tnic> <20171126145553.67lipggq7cdihuhw@gmail.com> <20171127132948.36nbaaph3sazjljp@treble> User-Agent: Alpine 2.20 (DEB 67 2015-01-07) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, 27 Nov 2017, Josh Poimboeuf wrote: > On Sun, Nov 26, 2017 at 03:55:53PM +0100, Ingo Molnar wrote: > > @@ -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 > > I think it doesn't make sense to have a SWITCH_TO_KERNEL_CR3 here. This > code is the (future) kaiser-disabled path, where SWITCH_TO_KERNEL_CR3 is > a no-op anyway. Yes, Borislav noticed that as well. That's a left over from the early versions where the trampoline did not exist. Thanks, tglx