From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933800AbdKAW2x (ORCPT ); Wed, 1 Nov 2017 18:28:53 -0400 Received: from mail-io0-f193.google.com ([209.85.223.193]:50896 "EHLO mail-io0-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933751AbdKAW2t (ORCPT ); Wed, 1 Nov 2017 18:28:49 -0400 X-Google-Smtp-Source: ABhQp+RXcn5risvLN7apWJnJhC7GsJici1L4/yuFIr5a0iEyCcaTpLhpgZNCrR+8PXp/ERk1vDU7gP6GTI4RbHoARJc= MIME-Version: 1.0 In-Reply-To: References: <20171031223146.6B47C861@viggo.jf.intel.com> <20171101085424.cwvc4nrrdhvjc3su@gmail.com> From: Linus Torvalds Date: Wed, 1 Nov 2017 15:28:48 -0700 X-Google-Sender-Auth: 5X3T0R0tR-HqPXS06iGvcBryJXU Message-ID: Subject: Re: [PATCH 00/23] KAISER: unmap most of the kernel from userspace page tables To: Dave Hansen Cc: Ingo Molnar , Linux Kernel Mailing List , linux-mm , Andy Lutomirski , Thomas Gleixner , Peter Zijlstra , "H. Peter Anvin" , borisBrian Gerst , Denys Vlasenko , Josh Poimboeuf , Thomas Garnier , Kees Cook Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Nov 1, 2017 at 3:14 PM, Dave Hansen wrote: > > I ran some quick tests. When CONFIG_KAISER=y, but "echo 0 > > kaiser-enabled", the tests that I ran were within the noise vs. a > vanilla kernel, and that's with *zero* optimization. I guess the optimal version just ends up switching between two different entrypoints for the on/off case. And the not-quite-as-aggressive, but almost-optimal version would just be a two-byte asm alternative with an unconditional branch to the movcr3 code and back, and is turned into a noop when it's off. But since 99%+ of the cost is going to be that cr3 write, even the stupid "just load value and branch over the cr3 conditionally" is going to make things hard to measure. Linus