From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933750AbdKAW6s (ORCPT ); Wed, 1 Nov 2017 18:58:48 -0400 Received: from mga06.intel.com ([134.134.136.31]:59169 "EHLO mga06.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754922AbdKAW6p (ORCPT ); Wed, 1 Nov 2017 18:58:45 -0400 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.44,331,1505804400"; d="scan'208";a="144856500" Subject: Re: [PATCH 01/23] x86, kaiser: prepare assembly for entry/exit CR3 switching To: Thomas Gleixner References: <20171031223146.6B47C861@viggo.jf.intel.com> <20171031223148.5334003A@viggo.jf.intel.com> Cc: linux-kernel@vger.kernel.org, linux-mm@kvack.org, moritz.lipp@iaik.tugraz.at, daniel.gruss@iaik.tugraz.at, michael.schwarz@iaik.tugraz.at, luto@kernel.org, torvalds@linux-foundation.org, keescook@google.com, hughd@google.com, x86@kernel.org, Borislav Petkov From: Dave Hansen Message-ID: <1417af11-44fc-e14c-9cfa-5938a18605e1@linux.intel.com> Date: Wed, 1 Nov 2017 15:58:43 -0700 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: 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/01/2017 02:01 PM, Thomas Gleixner wrote: > On Tue, 31 Oct 2017, Dave Hansen wrote: >> >> + pushq %rdi >> + SWITCH_TO_KERNEL_CR3 scratch_reg=%rdi >> + popq %rdi > > Can you please have a macro variant which does: > > SWITCH_TO_KERNEL_CR3_PUSH reg=%rdi > > So the pushq/popq is inside the macro. This has two reasons: > > 1) If KAISER=n the pointless pushq/popq go away > > 2) We need a boottime switch for that stuff, so we better have all > related code in the various macros in order to patch it in/out. After Boris's comments, these push/pops are totally unnecessary. We just delay the CR3 until after we stashed off pt_regs and are allowed to clobber things. > Also, please wrap these macros in #ifdef KAISER right away and provide the > stubs as well. It does not make sense to have them in patch 7 when patch 1 > introduces them. Will do.