Re: [PATCH v4 4/4] KVM: x86: Drop "cache" from user return MSR setter that skips WRMSR

Chao Gao
2025-10-17T02:53:14Z

>+void __kvm_set_user_return_msr(unsigned int slot, u64 value)
>+{
>+ struct kvm_user_return_msrs *msrs = this_cpu_ptr(user_return_msrs);
>+
>+ msrs->values[slot].curr = value;
>+ kvm_user_return_register_notifier(msrs);
>+}
>+EXPORT_SYMBOL_GPL(__kvm_set_user_return_msr);

nit: s/EXPORT_SYMBOL_GPL/EXPORT_SYMBOL_FOR_KVM_INTERNAL

>+
> int kvm_set_user_return_msr(unsigned slot, u64 value, u64 mask)
> {
> struct kvm_user_return_msrs *msrs = this_cpu_ptr(user_return_msrs);
>@@ -667,21 +676,11 @@ int kvm_set_user_return_msr(unsigned slot, u64 value, u64 mask)
> if (err)
> return 1;
>
>- msrs->values[slot].curr = value;
>- kvm_user_return_register_notifier(msrs);
>+ __kvm_set_user_return_msr(slot, value);
> return 0;
> }
> EXPORT_SYMBOL_FOR_KVM_INTERNAL(kvm_set_user_return_msr);
>
>-void kvm_user_return_msr_update_cache(unsigned int slot, u64 value)
>-{
>- struct kvm_user_return_msrs *msrs = this_cpu_ptr(user_return_msrs);
>-
>- msrs->values[slot].curr = value;
>- kvm_user_return_register_notifier(msrs);
>-}
>-EXPORT_SYMBOL_FOR_KVM_INTERNAL(kvm_user_return_msr_update_cache);
>-
> u64 kvm_get_user_return_msr(unsigned int slot)
> {
> return this_cpu_ptr(user_return_msrs)->values[slot].curr;
>--
>2.51.0.858.gf9c4a03a3a-goog
>
>