On Sun, 2017-01-29 at 10:07 +0100, h...@lst.de wrote:
> Hi Bart,
> 
> thanks for the analysis.  I think the main issue here is that we shouldn't
> try to assign affinity masks if there are not affinity vectors left to
> assign.
> 
> Does the patch below fix the issue for you?
> 
> diff --git a/drivers/pci/msi.c b/drivers/pci/msi.c
> index 50c5003..96c0713 100644
> --- a/drivers/pci/msi.c
> +++ b/drivers/pci/msi.c
> @@ -1206,6 +1206,11 @@ int pci_alloc_irq_vectors_affinity(struct pci_dev 
> *dev, unsigned int min_vecs,
>       if (flags & PCI_IRQ_AFFINITY) {
>               if (!affd)
>                       affd = &msi_default_affd;
> +
> +             if (affd->pre_vectors + affd->post_vectors > min_vecs)
> +                     return -EINVAL;
> +             if (affd->pre_vectors + affd->post_vectors == min_vecs)
> +                     flags &=~ PCI_IRQ_AFFINITY;
>       } else {
>               if (WARN_ON(affd))
>                       affd = NULL;

Hello Christoph,

Thanks for the quick reply. Sorry but the above patch didn't help - the
PCI_IRQ_AFFINITY isn't tested after the above code clears it. But after I
changed "flags &=~ PCI_IRQ_AFFINITY" into "affd = NULL" the memory
corruption complaint was gone and I/O through the qla2xxx adapter
was still working fine. If you want you can add the following to the above
patch with the aforementioned change:

Tested-by: Bart Van Assche <bart.vanass...@sandisk.com>

Bart.

Reply via email to