Re: [PATCH v4 7/8] KVM: Pre-allocate cpumasks for kvm_make_all_cpus_request_except()

From: Sean Christopherson
Date: Fri Sep 03 2021 - 10:54:55 EST


On Fri, Sep 03, 2021, Vitaly Kuznetsov wrote:
> Sean Christopherson <seanjc@xxxxxxxxxx> writes:
> >> @@ -5581,9 +5583,15 @@ int kvm_init(void *opaque, unsigned vcpu_size, unsigned vcpu_align,
> >> goto out_free_3;
> >> }
> >>
> >> + for_each_possible_cpu(cpu) {
> >> + if (!alloc_cpumask_var_node(&per_cpu(cpu_kick_mask, cpu),
> >> + GFP_KERNEL, cpu_to_node(cpu)))
> >> + goto out_free_4;
> >
> > 'r' needs to be explicitly set to -EFAULT, e.g. in the current code it's
> > guaranteed to be 0 here.
>
> Oops, yes. Any particular reason to avoid -ENOMEM? (hope not, will use
> this in v5)

Huh. Yes, -ENOMEM. I have no idea why I typed -EFAULT.