Re: [PATCH 2/2] PCI: hv: Refactor hv_irq_unmask() to use cpumask_to_vpset()

From: Maya Nakamura
Date: Fri Jan 25 2019 - 19:22:57 EST


On Thu, Jan 24, 2019 at 03:29:18PM +0300, Dan Carpenter wrote:
> On Wed, Jan 23, 2019 at 01:02:12PM -0800, Maya Nakamura wrote:
> > @@ -908,12 +906,12 @@ static void hv_irq_unmask(struct irq_data *data)
> > struct retarget_msi_interrupt *params;
> > struct hv_pcibus_device *hbus;
> > struct cpumask *dest;
> > + cpumask_var_t tmp;
> > struct pci_bus *pbus;
> > struct pci_dev *pdev;
> > unsigned long flags;
> > u32 var_size = 0;
> > - int cpu_vmbus;
> > - int cpu;
> > + int cpu, nr_bank = 0;
> ^^^^^
> No need to initialize this to a bogus value. It's misleading and it
> turns off GCC's uninitialized variable warning so it can lead to bugs.
>
Thank you for pointing that out. I will remove its initialization in v2.

> > @@ -953,29 +951,28 @@ static void hv_irq_unmask(struct irq_data *data)
> > */
> > params->int_target.flags |=
> > HV_DEVICE_INTERRUPT_TARGET_PROCESSOR_SET;
> > - params->int_target.vp_set.valid_bank_mask =
> > - (1ull << HV_VP_SET_BANK_COUNT_MAX) - 1;
> > +
> > + if (!alloc_cpumask_var(&tmp, GFP_KERNEL)) {
> > + dev_err(&hbus->hdev->device, "out of memory");
>
>
> No need for this error message. alloc_cpumask_var() already has better
> debug messages built in.
>
I will delete this dev_err() in v2.

> > + return;
>
> We can't return directly. We need to unlock first.
>
I will unlock in v2.

> > + if (!nr_bank) {
> > + dev_err(&hbus->hdev->device, "too high CPU");
>
> This error message is not useful.
>
I will delete this dev_err() in v2.

Maya
>
> regards,
> dan carpenter
>