All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Madhani, Himanshu" <Himanshu.Madhani@cavium.com>
To: "Madhani, Himanshu" <Himanshu.Madhani@cavium.com>,
	"bhelgaas@google.com" <bhelgaas@google.com>,
	"linux-pci@vger.kernel.org" <linux-pci@vger.kernel.org>,
	"hch@lst.de" <hch@lst.de>
Subject: RE: [PATCH] PCI/MSI: Only disable affinity settings if pre and post vector count is equal to max_vecs and not min_vecs
Date: Tue, 28 Feb 2017 22:05:35 +0000	[thread overview]
Message-ID: <SN1PR0701MB1837A1C658B0AEF245917829F5560@SN1PR0701MB1837.namprd07.prod.outlook.com> (raw)
In-Reply-To: <1487883699-3528-1-git-send-email-himanshu.madhani@cavium.com>

Hi Christoph, Bjorn,=20

Does this updated patch looks good. Please review.=20

Thanks,
Himanshu


> -----Original Message-----
> From: Himanshu Madhani [mailto:himanshu.madhani@cavium.com]
> Sent: Thursday, February 23, 2017 1:02 PM
> To: bhelgaas@google.com; linux-pci@vger.kernel.org; hch@lst.de
> Cc: Madhani, Himanshu <Himanshu.Madhani@cavium.com>
> Subject: [PATCH] PCI/MSI: Only disable affinity settings if pre and post =
vector
> count is equal to max_vecs and not min_vecs
>=20
> From: Michael Hernandez <michael.hernandez@cavium.com>
>=20
> min_vecs is the minimum amount of vectors needed to operate in MSI-X
> mode which may just include the vectors that don't need affinity.
>=20
> Disabling affinity settings causes the qla2xxx driver scsi_add_host to fa=
il
> when blk_mq is enabled as the blk_mq_pci_map_queues expects affinity
> masks on each vector.
>=20
> v1 --> v2
>=20
> o Moved the check from pci_alloc_irq_vectors_affinity() to
>   __pci_enable_{msi|msix}_range()
>=20
> Fixes: dfef358 ("PCI/MSI: Don't apply affinity if there aren't enough vec=
tors
> left")
> Signed-off-by: Michael Hernandez <michael.hernandez@cavium.com>
> Signed-off-by: Himanshu Madhani <himanshu.madhani@cavium.com>
> Cc: Christoph Hellwig <hch@lst.de>
> Cc: stable@vger.kernel.org
> ---
>  drivers/pci/msi.c |   32 ++++++++++++++++++++++----------
>  1 files changed, 22 insertions(+), 10 deletions(-)
>=20
> diff --git a/drivers/pci/msi.c b/drivers/pci/msi.c index 7f73bac..c61039b
> 100644
> --- a/drivers/pci/msi.c
> +++ b/drivers/pci/msi.c
> @@ -1091,6 +1091,17 @@ static int __pci_enable_msi_range(struct pci_dev
> *dev, int minvec, int maxvec,
>=20
>  	for (;;) {
>  		if (affd) {
> +			if (affd->pre_vectors + affd->post_vectors > nvec)
> +				return -EINVAL;
> +			/*
> +			 * If there aren't any vectors left after applying the
> +			 * pre/post vectors don't bother with assigning
> +			 * affinity.
> +			 */
> +			if (affd->pre_vectors + affd->post_vectors =3D=3D nvec)
> +				affd =3D NULL;
> +		}
> +		if (affd) {
>  			nvec =3D irq_calc_affinity_vectors(nvec, affd);
>  			if (nvec < minvec)
>  				return -ENOSPC;
> @@ -1138,6 +1149,17 @@ static int __pci_enable_msix_range(struct pci_dev
> *dev,
>=20
>  	for (;;) {
>  		if (affd) {
> +			if (affd->pre_vectors + affd->post_vectors > nvec)
> +				return -EINVAL;
> +			/*
> +			 * If there aren't any vectors left after applying the
> +			 * pre/post vectors don't bother with assigning
> +			 * affinity.
> +			 */
> +			if (affd->pre_vectors + affd->post_vectors =3D=3D nvec)
> +				affd =3D NULL;
> +		}
> +		if (affd) {
>  			nvec =3D irq_calc_affinity_vectors(nvec, affd);
>  			if (nvec < minvec)
>  				return -ENOSPC;
> @@ -1206,16 +1228,6 @@ int pci_alloc_irq_vectors_affinity(struct pci_dev
> *dev, unsigned int min_vecs,
>  	if (flags & PCI_IRQ_AFFINITY) {
>  		if (!affd)
>  			affd =3D &msi_default_affd;
> -
> -		if (affd->pre_vectors + affd->post_vectors > min_vecs)
> -			return -EINVAL;
> -
> -		/*
> -		 * If there aren't any vectors left after applying the pre/post
> -		 * vectors don't bother with assigning affinity.
> -		 */
> -		if (affd->pre_vectors + affd->post_vectors =3D=3D min_vecs)
> -			affd =3D NULL;
>  	} else {
>  		if (WARN_ON(affd))
>  			affd =3D NULL;
> --
> 1.7.1

  reply	other threads:[~2017-03-01  1:46 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-02-23 21:01 [PATCH] PCI/MSI: Only disable affinity settings if pre and post vector count is equal to max_vecs and not min_vecs Himanshu Madhani
2017-02-28 22:05 ` Madhani, Himanshu [this message]
2017-03-01 15:20 ` Christoph Hellwig
2017-03-01 23:27   ` Madhani, Himanshu
  -- strict thread matches above, loose matches on Subject: below --
2017-04-18  1:19 Himanshu Madhani
2017-05-17 22:28 ` Bjorn Helgaas
2017-05-18 16:02   ` Himanshu Madhani
2017-04-17 21:26 Himanshu Madhani
2017-04-18  0:01 ` kbuild test robot
2017-03-01 23:31 Himanshu Madhani
2017-03-01 23:49 ` Christoph Hellwig
2017-03-07 19:00   ` Madhani, Himanshu
2017-03-07 21:08     ` Bjorn Helgaas
2017-03-23 17:29 ` Bjorn Helgaas
2017-03-30 23:21   ` Bjorn Helgaas
2017-03-30 23:25     ` Himanshu Madhani
2017-03-31  0:09       ` Bjorn Helgaas
2017-02-23  6:12 Himanshu Madhani
2017-02-23 10:30 ` Christoph Hellwig
2017-02-21 17:34 Himanshu Madhani
2017-02-23  0:27 ` Martin K. Petersen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=SN1PR0701MB1837A1C658B0AEF245917829F5560@SN1PR0701MB1837.namprd07.prod.outlook.com \
    --to=himanshu.madhani@cavium.com \
    --cc=bhelgaas@google.com \
    --cc=hch@lst.de \
    --cc=linux-pci@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.