Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751293AbeADXMZ (ORCPT + 1 other); Thu, 4 Jan 2018 18:12:25 -0500 Received: from mx1.redhat.com ([209.132.183.28]:46474 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751029AbeADXMX (ORCPT ); Thu, 4 Jan 2018 18:12:23 -0500 Date: Fri, 5 Jan 2018 00:12:21 +0100 From: Andrea Arcangeli To: Peter Zijlstra Cc: Tim Chen , Thomas Gleixner , Andy Lutomirski , Linus Torvalds , Greg KH , Dave Hansen , Andi Kleen , Arjan Van De Ven , linux-kernel@vger.kernel.org Subject: Re: [PATCH 3/7] x86/enter: Use IBRS on syscall and interrupts Message-ID: <20180104231221.GA13348@redhat.com> References: <0c525c4c6c817e9c42c7ed583d86dc591a86efde.1515086770.git.tim.c.chen@linux.intel.com> <20180104223321.GD32035@hirez.programming.kicks-ass.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20180104223321.GD32035@hirez.programming.kicks-ass.net> User-Agent: Mutt/1.9.2 (2017-12-15) X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.31]); Thu, 04 Jan 2018 23:12:23 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Return-Path: On Thu, Jan 04, 2018 at 11:33:21PM +0100, Peter Zijlstra wrote: > So not only did we add a CR3 write, we're now adding an MSR write to the > entry/exit paths. Please tell me that these are 'fast' MSRs? Given > people are already reporting stupid numbers with just the existing > PTI/CR3, what kind of pain are we going to get from adding this? On SkyLake it costs roughly the same as cr3 write with bit 63 set, but SkyLake then runs faster with IBRS enabled too. On earlier CPUs enabling IBRS slows down CPU quite a bit, so the primary concern is for older CPUs and the MSR write is the last worry there. ibrs 2 will set IBRS all the time (only guest mode will alter it and it'll always be restored to IBRS set during vmexit) so there will be no cost on kernel enter/exit (also no cost in vmenter vmexit if guest leaves it always set). Future silicon will like to run in ibrs 2 mode always, but current one runs faster at ibrs 1 despite the MSR write for most workloads (kernel builds etc..). Thanks, Andrea