On 11/17/21 22:09, David Woodhouse wrote:
  {
-       struct kvm_vcpu *vcpu = kvm_get_running_vcpu();
+       struct kvm_vcpu *running_vcpu = kvm_get_running_vcpu();

+       WARN_ON_ONCE(vcpu && vcpu != running_vcpu);
        WARN_ON_ONCE(vcpu->kvm != kvm);
Ah, that one needs to be changed to check running_vcpu instead. Or this
needs to go first:

I think I prefer making the vCPU a required argument. If anyone's going to
pull a vCPU pointer out of their posterior, let the caller do it.


I understand that feeling, but still using the running vCPU is by far the common case, and it's not worth adding a new function parameter to all call sites.

What about using a separate function, possibly __-prefixed, for the case where you have a very specific vCPU?

Paolo

Reply via email to