Re: [PATCH v2 2/2] x86/hyperv: remove on-stack cpumask from hv_send_ipi_mask_allbutself

From: Wei Liu
Date: Sat Sep 11 2021 - 11:24:39 EST


On Sat, Sep 11, 2021 at 03:09:50PM +0000, Michael Kelley wrote:
> From: Wei Liu <wei.liu@xxxxxxxxxx> Sent: Friday, September 10, 2021 11:57 AM
[...]
> > -static bool __send_ipi_mask(const struct cpumask *mask, int vector)
> > +static bool __send_ipi_mask(const struct cpumask *mask, int vector,
> > + bool exclude_self)
> > {
> > - int cur_cpu, vcpu;
> > + int cur_cpu, vcpu, this_cpu = smp_processor_id();
> > struct hv_send_ipi ipi_arg;
> > u64 status;
> > + unsigned int weight;
> >
> > trace_hyperv_send_ipi_mask(mask, vector);
> >
> > - if (cpumask_empty(mask))
> > + weight = cpumask_weight(mask);
> > +
> > + /*
> > + * Do nothing if
> > + * 1. the mask is empty
> > + * 2. the mask only contains self when exclude_self is true
> > + */
> > + if (weight == 0 ||
> > + (exclude_self && weight == 1 && cpumask_first(mask) == this_cpu))
>
> Nit: cpumask_test_cpu(this_cpu, mask) would seem to be a better fit for this
> use case than cpumask_first(). But either works.

I will adjust the code when I commit this patch.

Wei.