[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20190124122918.GL4482@kadam>
Date: Thu, 24 Jan 2019 15:29:18 +0300
From: Dan Carpenter <dan.carpenter@...cle.com>
To: Maya Nakamura <m.maya.nakamura@...il.com>
Cc: lorenzo.pieralisi@....com, bhelgaas@...gle.com,
linux-pci@...r.kernel.org, kys@...rosoft.com,
sthemmin@...rosoft.com, olaf@...fle.de, apw@...onical.com,
jasowang@...hat.com, mikelley@...rosoft.com,
Alexander.Levin@...rosoft.com, marcelo.cerri@...onical.com,
vkuznets@...hat.com, haiyangz@...rosoft.com,
driverdev-devel@...uxdriverproject.org,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH 2/2] PCI: hv: Refactor hv_irq_unmask() to use
cpumask_to_vpset()
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.
> u64 res;
>
> dest = irq_data_get_effective_affinity_mask(data);
> @@ -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.
> + return;
We can't return directly. We need to unlock first.
> + }
> +
> + cpumask_and(tmp, dest, cpu_online_mask);
> + nr_bank = cpumask_to_vpset(¶ms->int_target.vp_set, tmp);
> + free_cpumask_var(tmp);
> +
> + if (!nr_bank) {
> + dev_err(&hbus->hdev->device, "too high CPU");
This error message is not useful.
> + res = 1;
> + goto exit_unlock;
> + }
regards,
dan carpenter
Powered by blists - more mailing lists