Re: [PATCH 2/2] KVM: Guard cpusmask NULL check with CONFIG_CPUMASK_OFFSTACK

From: Sean Christopherson
Date: Wed Aug 25 2021 - 17:57:44 EST


On Wed, Aug 25, 2021, Lai Jiangshan wrote:
> On Sat, Aug 21, 2021 at 8:09 AM Sean Christopherson <seanjc@xxxxxxxxxx> wrote:
> > @@ -277,6 +277,14 @@ bool kvm_make_vcpus_request_mask(struct kvm *kvm, unsigned int req,
> > if (!(req & KVM_REQUEST_NO_WAKEUP) && kvm_vcpu_wake_up(vcpu))
> > continue;
> >
> > + /*
> > + * tmp can be NULL if cpumasks are allocated off stack, as
> > + * allocation of the mask is deliberately not fatal and is
> > + * handled by falling back to kicking all online CPUs.
> > + */
> > + if (IS_ENABLED(CONFIG_CPUMASK_OFFSTACK) && !tmp)
> > + continue;
> > +
>
> Hello, Sean
>
> I don't think it is a good idea to reinvent the cpumask_available().

Using cpumask_available() is waaaay better, thanks!

Vitaly / Paolo, take this one instead?