Commit b184b35d authored by Sean Christopherson's avatar Sean Christopherson

KVM: VMX: Update PT MSR intercepts during filter change iff PT in host+guest

Update the Processor Trace (PT) MSR intercepts during a filter change if
and only if PT may be exposed to the guest, i.e. only if KVM is operating
in the so called "host+guest" mode where PT can be used simultaneously by
both the host and guest.  If PT is in system mode, the host is the sole
owner of PT and the MSRs should never be passed through to the guest.

Luckily the missed check only results in unnecessary work, as select RTIT
MSRs are passed through only when RTIT tracing is enabled "in" the guest,
and tracing can't be enabled in the guest when KVM is in system mode
(writes to guest.MSR_IA32_RTIT_CTL are disallowed).

Cc: Xiaoyao Li <xiaoyao.li@intel.com>
Signed-off-by: default avatarSean Christopherson <seanjc@google.com>
Reviewed-by: default avatarXiaoyao Li <xiaoyao.li@intel.com>
Link: https://lore.kernel.org/r/20220712015838.1253995-1-seanjc@google.comSigned-off-by: default avatarSean Christopherson <seanjc@google.com>
parent 3d5f8d03
...@@ -4004,6 +4004,8 @@ static void vmx_msr_filter_changed(struct kvm_vcpu *vcpu) ...@@ -4004,6 +4004,8 @@ static void vmx_msr_filter_changed(struct kvm_vcpu *vcpu)
vmx_disable_intercept_for_msr(vcpu, msr, MSR_TYPE_W); vmx_disable_intercept_for_msr(vcpu, msr, MSR_TYPE_W);
} }
/* PT MSRs can be passed through iff PT is exposed to the guest. */
if (vmx_pt_mode_is_host_guest())
pt_update_intercept_for_msr(vcpu); pt_update_intercept_for_msr(vcpu);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment