Received: by 2002:a05:6a10:1d13:0:0:0:0 with SMTP id pp19csp2639807pxb; Tue, 24 Aug 2021 04:12:26 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwI7LATwJut84IO6/7CbHQ67JFvpMIfeo9h9yylVcU/kr9ei5Qq63lIT0Qjs+NVltPJhis0 X-Received: by 2002:a50:fd87:: with SMTP id o7mr43286992edt.289.1629803545965; Tue, 24 Aug 2021 04:12:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1629803545; cv=none; d=google.com; s=arc-20160816; b=TTNWMM81N/pVl8KAf9IgrScmHvdKoYv9QdStrI6MY7CnftXn9pmn0QM8nftraGfgqK fGmQQAXFw5XFlYrQeRmMpFFIqvtJOgHOWOenou0HuuD2X1XT6qYJHz58lN2Tqgek9k4v tL6MnRWcWTpyDYgEtJ7/8X+16yJrFyCN08a1TFm+SHM2KHPyMd/5gwg8IUZWgBfC185Z XMY8EUYG8n4v0cycFwAuoyyFXfSFklm2TD+S7M6VHZmdp9lcPvlOpCb1z7u3oxt+2m5T 7vdgbheR9efhPlhTUNlqNwsTFshGYrH14L5Mek5y02lVyxtz+2BAaMDTrvsv9z0nQCI/ KEgg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=IinTIiBtkNiRtBWMEyVHeGcikT9pjFHBIQaWWeFtTJ8=; b=SwLzF9j13NENluEuUJWBZqGRgkI/2fUjRkxv4mgcl605m+Ms51d0lHaY5XXbuQV59p ecco0DM3HX+42E7Dw6gFNm0gVLYpHt1kIBI2+mQXOxJlcYKAq1+0MRRv55b0v1LykMld f4tFjlSh1u5zfkXeisMBVW6Qmkw7VbaJiR7dOFEo9mlIKEAsBUwTl0/RvJkvQSalyPuh v/74iZnkAIK8Bh03ut+1YhPoRYeXwp//W0GNgDCiQHmarpuddW+gT2hQTSH9YwHc2oDa 9D2zQ97I4VxLUEvdoRkpHniF1NrJ7XJdvjbvF6cUzfm/c7G0UhiDjhl3KfCIDfsYg0JI BIkA== 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 s4si16647650edq.171.2021.08.24.04.12.02; Tue, 24 Aug 2021 04:12:25 -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 S236721AbhHXLJW (ORCPT + 99 others); Tue, 24 Aug 2021 07:09:22 -0400 Received: from mga18.intel.com ([134.134.136.126]:3702 "EHLO mga18.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236706AbhHXLJJ (ORCPT ); Tue, 24 Aug 2021 07:09:09 -0400 X-IronPort-AV: E=McAfee;i="6200,9189,10085"; a="204423835" X-IronPort-AV: E=Sophos;i="5.84,347,1620716400"; d="scan'208";a="204423835" Received: from fmsmga008.fm.intel.com ([10.253.24.58]) by orsmga106.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 24 Aug 2021 04:08:25 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.84,347,1620716400"; d="scan'208";a="493501638" Received: from lxy-dell.sh.intel.com ([10.239.159.31]) by fmsmga008.fm.intel.com with ESMTP; 24 Aug 2021 04:08:22 -0700 From: Xiaoyao Li To: Paolo Bonzini Cc: Xiaoyao Li , Sean Christopherson , Vitaly Kuznetsov , Wanpeng Li , Jim Mattson , Joerg Roedel , kvm@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 1/5] KVM: VMX: Restore host's MSR_IA32_RTIT_CTL when it's not zero Date: Tue, 24 Aug 2021 19:07:39 +0800 Message-Id: <20210824110743.531127-2-xiaoyao.li@intel.com> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20210824110743.531127-1-xiaoyao.li@intel.com> References: <20210824110743.531127-1-xiaoyao.li@intel.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org A minor optimation to WRMSR MSR_IA32_RTIT_CTL when necessary. Signed-off-by: Xiaoyao Li --- arch/x86/kvm/vmx/vmx.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/arch/x86/kvm/vmx/vmx.c b/arch/x86/kvm/vmx/vmx.c index fada1055f325..e0a9460e4dab 100644 --- a/arch/x86/kvm/vmx/vmx.c +++ b/arch/x86/kvm/vmx/vmx.c @@ -1075,7 +1075,8 @@ static void pt_guest_exit(struct vcpu_vmx *vmx) } /* Reload host state (IA32_RTIT_CTL will be cleared on VM exit). */ - wrmsrl(MSR_IA32_RTIT_CTL, vmx->pt_desc.host.ctl); + if (vmx->pt_desc.host.ctl) + wrmsrl(MSR_IA32_RTIT_CTL, vmx->pt_desc.host.ctl); } void vmx_set_host_fs_gs(struct vmcs_host_state *host, u16 fs_sel, u16 gs_sel, -- 2.27.0