Re: [PATCH 4/5] KVM: vmx: implement MSR_IA32_TSX_CTRL disable RTM functionality

From: Paolo Bonzini
Date: Wed Nov 20 2019 - 07:21:43 EST


On 19/11/19 22:06, Jim Mattson wrote:
>> + switch (index) {
>> + case MSR_IA32_TSX_CTRL:
>> + /* No need to pass TSX_CTRL_CPUID_CLEAR through. */
>> + vmx->guest_msrs[j].mask = ~(u64)TSX_CTRL_CPUID_CLEAR;
>> + break;
> Why even bother with the special case here? Does this make the wrmsr faster?
>

No, but it can avoid the wrmsr altogether if the guest uses the same
DISABLE_RTM setting but a different value for CPUID_CLEAR.

More important, while I am confident re-enabling TSX while in the kernel
and only restoring MSR_IA32_TSX_CTRL on return to userspace, I'm more
wary of changing CPUID bits while the kernel is running. I will update
the comment.

Paolo