Re: [RFC PATCH] Add Hyperv extended hypercall support in KVM

Vipin Sharma
2022-10-24T22:12:22Z

On Mon, Oct 24, 2022 at 12:36 PM Sean Christopherson <seanjc@google.com> wrote:
>
> On Mon, Oct 24, 2022, Vipin Sharma wrote:
> > On Mon, Oct 24, 2022 at 8:22 AM Sean Christopherson <seanjc@google.com> wrote:
> > >
> > > On Mon, Oct 24, 2022, Vitaly Kuznetsov wrote:
> > > enable():
> > >
> > > case KVM_CAP_HYPERV_EXT_CALL:
> > > r = -EINVAL;
> > > if (mask & ~KVM_SUPPORTED_HYPERV_EXT_CALL)
> > > break;
> > >
> > > mutex_lock(&kvm->lock);
> > > if (!kvm->created_vcpus) {
> >
> > Any reason for setting capability only after vcpus are created?
>
> This only allows setting the capability _before_ vCPUs are created. Attempting
> to set the cap after vCPUs are created gets rejected with -EINVAL. This
> requirement means vCPUs don't need to take a lock to consume per-VM state, as KVM
> prevents the state from changing once vCPUs are created.

I totally misread the condition and didn't notice the '!' in the if()
statement.

Thanks for the feedback.