Received: by 2002:a25:e74b:0:0:0:0:0 with SMTP id e72csp1730898ybh; Thu, 23 Jul 2020 16:43:33 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwrI3jHvJLsMlYDAy1UgE/eyiQXiVEItWW8GsVS6XaJyyIngv1AbbP6z9l3oSJJLiLiG+hr X-Received: by 2002:a17:906:2e06:: with SMTP id n6mr6619816eji.34.1595547812847; Thu, 23 Jul 2020 16:43:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1595547812; cv=none; d=google.com; s=arc-20160816; b=zwCGfjnr9VnjTpGtmGD058EQ0RtBx10l5Iq+zcEG7a+4+i4sec+MXgTFHtMlATtP+H 3+yNvRU6MzbUI8X+6WlU9ffwjne7xCed+pNr1bUNmonwNH9EqRVRLb6d0X3fO2rlMJxm 5dIf/s3Yiz+looOs0hB/hOuGCbCUqrwUAlRFdW9btWeWNjkBpbpEM7S3XS0ttY3FtN26 x9uSR4IEAyOUhPaGRWQS/ZSQPNuvdQG2BmEpy3fCuPw+swfvHTWRpPwyc/L/M+co22/4 Wy1H2ThH5kEiJcyVtkPr2uRAmK//TkY+8uOV7cuRqo+QYzqGHnLBZq1U3J4VQXoGrMvD gTBQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:ironport-sdr:ironport-sdr; bh=RsjAXI0Cyho1cJlTytk+fdZGbnVB3ukmewBbFqhjk30=; b=p8K6byw1ufBUZOTty/aUdt0reD/gTQ3bSQ1di8UumzMXqGW2Bc886R3NlJM9veYdx1 0cQZOJKyvyaWjLuSeBP68bqy/tznjF+/jI5J/Y86wRCEGxKinBqS7nINmj5gCUqZVl6U 2QtwRo1I6BfyOt7Ytc+KHHglB5O5y8aDhOPZyrUk66AQTANmiue+wdpSDe5xaCTT9eK7 zD/GWaFKBq52Uv6QQP7xgxC5QrOPzfgKb39xVXVa5YKNMugcePD9dvAqeWKkJQYfsl4M hlGiaZC5OwJ2MMJoamFJTGQiAkO0HpM9GmBCULuxuw2J7/E6NBPlgYssjXm6mzvlzMgv A1ew== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id bi24si2944696ejb.514.2020.07.23.16.43.10; Thu, 23 Jul 2020 16:43:32 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728087AbgGWXlN (ORCPT + 99 others); Thu, 23 Jul 2020 19:41:13 -0400 Received: from mga12.intel.com ([192.55.52.136]:33453 "EHLO mga12.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727783AbgGWXlN (ORCPT ); Thu, 23 Jul 2020 19:41:13 -0400 IronPort-SDR: bexZn88eOt8+lqqfi9shkMOnsyLC6DJ5J2DMYj+ycIVmlnwLis6yJ/olbuVKGvioqVfucjWzAC paQqTXDgqCkg== X-IronPort-AV: E=McAfee;i="6000,8403,9691"; a="130199797" X-IronPort-AV: E=Sophos;i="5.75,388,1589266800"; d="scan'208";a="130199797" X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga002.jf.intel.com ([10.7.209.21]) by fmsmga106.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 23 Jul 2020 16:41:11 -0700 IronPort-SDR: ICl9mgStiUUD/7UH+Kc2+eojWglyclCDDkUGQAAjpjA/mPm4pmzkAPxio+t1ahqQIU2AdsR+4b 4GK4HVqXdTxA== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.75,388,1589266800"; d="scan'208";a="302485243" Received: from sjchrist-coffee.jf.intel.com (HELO linux.intel.com) ([10.54.74.152]) by orsmga002.jf.intel.com with ESMTP; 23 Jul 2020 16:41:11 -0700 Date: Thu, 23 Jul 2020 16:41:11 -0700 From: Sean Christopherson To: Thomas Gleixner Cc: LKML , x86@kernel.org, linux-arch@vger.kernel.org, Will Deacon , Arnd Bergmann , Mark Rutland , Kees Cook , Keno Fischer , Paolo Bonzini , kvm@vger.kernel.org, Gabriel Krisman Bertazi Subject: Re: [patch V5 08/15] x86/entry: Move user return notifier out of loop Message-ID: <20200723234111.GJ21891@linux.intel.com> References: <20200722215954.464281930@linutronix.de> <20200722220520.159112003@linutronix.de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200722220520.159112003@linutronix.de> User-Agent: Mutt/1.5.24 (2015-08-30) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Jul 23, 2020 at 12:00:02AM +0200, Thomas Gleixner wrote: > From: Thomas Gleixner > > Guests and user space share certain MSRs. KVM sets these MSRs to guest > values once and does not set them back to user space values on every VM > exit to spare the costly MSR operations. > > User return notifiers ensure that these MSRs are set back to the correct > values before returning to user space in exit_to_usermode_loop(). > > There is no reason to evaluate the TIF flag indicating that user return > notifiers need to be invoked in the loop. The important point is that they > are invoked before returning to user space. > > Move the invocation out of the loop into the section which does the last > preperatory steps before returning to user space. That section is not > preemptible and runs with interrupts disabled until the actual return. > > Signed-off-by: Thomas Gleixner Reviewed-and-tested-by: Sean Christopherson