@@ -2893,12 +2882,15 @@ static int svm_set_msr(struct kvm_vcpu *vcpu, struct msr_data *msr) return 1; /* - * This is rare, so we update the MSR here instead of using - * direct_access_msrs. Doing that would require a rdmsr in - * svm_vcpu_put. + * TSC_AUX is usually changed only during boot and never read + * directly. Intercept TSC_AUX instead of exposing it to the + * guest via direct_acess_msrs, and switch it via user return. */ 'direct_acess_msrs' should be 'direct_access_msrs'. svm->tsc_aux = data; - wrmsrl(MSR_TSC_AUX, svm->tsc_aux); + + preempt_disable(); + kvm_set_user_return_msr(TSC_AUX_URET_SLOT, data, -1ull); + preempt_enable(); break; One of the callers of svm_set_msr() is kvm_arch_vcpu_ioctl(KVM_SET_MSRS). Since calling kvm_set_user_return_msr() looks unnecessary for the ioctl case and makes extra things for the CPU to do when the CPU returns to userspace for the case, I'm wondering if it might be better to check svm->guest_state_loaded before calling kvm_set_user_return_msr() here. The patch looks good to me other than those two minor things. Thanks, Reiji