From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752485AbdK0N3v (ORCPT ); Mon, 27 Nov 2017 08:29:51 -0500 Received: from mx1.redhat.com ([209.132.183.28]:37216 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752410AbdK0N3u (ORCPT ); Mon, 27 Nov 2017 08:29:50 -0500 Date: Mon, 27 Nov 2017 07:29:48 -0600 From: Josh Poimboeuf To: Ingo Molnar Cc: Borislav Petkov , linux-kernel@vger.kernel.org, Dave Hansen , Andy Lutomirski , Thomas Gleixner , "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 Message-ID: <20171127132948.36nbaaph3sazjljp@treble> References: <20171124172411.19476-1-mingo@kernel.org> <20171124172411.19476-23-mingo@kernel.org> <20171126115038.sfwpecgv6pdfzlbo@pd.tnic> <20171126145553.67lipggq7cdihuhw@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20171126145553.67lipggq7cdihuhw@gmail.com> User-Agent: Mutt/1.6.0.1 (2016-04-01) X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.38]); Mon, 27 Nov 2017 13:29:50 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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. -- Josh