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

From: Vitaly Kuznetsov
Date: Thu Aug 26 2021 - 06:24:13 EST


Sean Christopherson <seanjc@xxxxxxxxxx> writes:

> 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?
>

Sure, putting this to my v3, thanks!

--
Vitaly