Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752953AbeADU0q (ORCPT + 1 other); Thu, 4 Jan 2018 15:26:46 -0500 Received: from mga03.intel.com ([134.134.136.65]:18813 "EHLO mga03.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751829AbeADU0p (ORCPT ); Thu, 4 Jan 2018 15:26:45 -0500 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.46,315,1511856000"; d="scan'208";a="18269119" Subject: Re: [PATCH 3/7] x86/enter: Use IBRS on syscall and interrupts To: Greg KH Cc: Thomas Gleixner , Andy Lutomirski , Linus Torvalds , Dave Hansen , Andrea Arcangeli , Andi Kleen , Arjan Van De Ven , linux-kernel@vger.kernel.org References: <0c525c4c6c817e9c42c7ed583d86dc591a86efde.1515086770.git.tim.c.chen@linux.intel.com> <20180104200036.GB30228@kroah.com> From: Tim Chen Message-ID: <03ee75fb-8903-948e-66c6-0c1dc54d8cff@linux.intel.com> Date: Thu, 4 Jan 2018 12:26:43 -0800 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.1.0 MIME-Version: 1.0 In-Reply-To: <20180104200036.GB30228@kroah.com> 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 Return-Path: On 01/04/2018 12:00 PM, Greg KH wrote: > On Thu, Jan 04, 2018 at 09:56:44AM -0800, Tim Chen wrote: >> >> That is a minor inefficiency only, but we can eliminate it by saving >> the MSR when entering the NMI in save_paranoid and restoring it when >> exiting the NMI. > > Any hints as to what exactly "minor" means in cycles here? :) > The current implementation does not have this inefficiency. The comment is to explain why we need to save the IBRS state in save_paranoid. The issue is if we don't save the IBRS state for NMI, For nested interrupts, it is hard to figure out when we are returning from NMI, whether we are returning to user space or kernel space. And if we do the safe thing by leaving IBRS on, there is a possibility that we may return to user space with IBRS enabled, which will affect performance. The possibility of hitting this is minor, but still we want to eliminate it. Thanks. Tim