linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] genirq/affinity: create affinity mask for single vector
@ 2019-08-05  1:19 Ming Lei
  2019-08-07 23:50 ` Ming Lei
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Ming Lei @ 2019-08-05  1:19 UTC (permalink / raw)
  To: Thomas Gleixner
  Cc: linux-kernel, Ming Lei, Marc Zyngier, Christoph Hellwig,
	Bjorn Helgaas, Jens Axboe, linux-block, Sagi Grimberg,
	linux-nvme, linux-pci, Keith Busch, Sumit Saxena, Kashyap Desai,
	Shivasharan Srikanteshwara

Since commit c66d4bd110a1f8 ("genirq/affinity: Add new callback for
(re)calculating interrupt sets"), irq_create_affinity_masks() returns
NULL in case of single vector. This change has caused regression on some
drivers, such as lpfc.

The problem is that single vector may be triggered in some generic cases:
1) kdump kernel 2) irq vectors resource is close to exhaustion.

If we don't create affinity mask for single vector, almost every caller
has to handle the special case.

So still create affinity mask for single vector, since irq_create_affinity_masks()
is capable of handling that.

Cc: Marc Zyngier <marc.zyngier@arm.com>
Cc: Christoph Hellwig <hch@lst.de>
Cc: Bjorn Helgaas <helgaas@kernel.org>
Cc: Jens Axboe <axboe@kernel.dk>
Cc: linux-block@vger.kernel.org
Cc: Sagi Grimberg <sagi@grimberg.me>
Cc: linux-nvme@lists.infradead.org
Cc: linux-pci@vger.kernel.org
Cc: Keith Busch <keith.busch@intel.com>
Cc: Sumit Saxena <sumit.saxena@broadcom.com>
Cc: Kashyap Desai <kashyap.desai@broadcom.com>
Cc: Shivasharan Srikanteshwara <shivasharan.srikanteshwara@broadcom.com>
Fixes: c66d4bd110a1f8 ("genirq/affinity: Add new callback for (re)calculating interrupt sets")
Signed-off-by: Ming Lei <ming.lei@redhat.com>
---
 kernel/irq/affinity.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/kernel/irq/affinity.c b/kernel/irq/affinity.c
index 4352b08ae48d..6fef48033f96 100644
--- a/kernel/irq/affinity.c
+++ b/kernel/irq/affinity.c
@@ -251,11 +251,9 @@ irq_create_affinity_masks(unsigned int nvecs, struct irq_affinity *affd)
 	 * Determine the number of vectors which need interrupt affinities
 	 * assigned. If the pre/post request exhausts the available vectors
 	 * then nothing to do here except for invoking the calc_sets()
-	 * callback so the device driver can adjust to the situation. If there
-	 * is only a single vector, then managing the queue is pointless as
-	 * well.
+	 * callback so the device driver can adjust to the situation.
 	 */
-	if (nvecs > 1 && nvecs > affd->pre_vectors + affd->post_vectors)
+	if (nvecs > affd->pre_vectors + affd->post_vectors)
 		affvecs = nvecs - affd->pre_vectors - affd->post_vectors;
 	else
 		affvecs = 0;
-- 
2.20.1


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] genirq/affinity: create affinity mask for single vector
  2019-08-05  1:19 [PATCH] genirq/affinity: create affinity mask for single vector Ming Lei
@ 2019-08-07 23:50 ` Ming Lei
  2019-08-08  6:52 ` [tip:irq/urgent] genirq/affinity: Create " tip-bot for Ming Lei
  2019-08-08 15:17 ` [PATCH] genirq/affinity: create " Keith Busch
  2 siblings, 0 replies; 4+ messages in thread
From: Ming Lei @ 2019-08-07 23:50 UTC (permalink / raw)
  To: Ming Lei
  Cc: Thomas Gleixner, Jens Axboe, Keith Busch, Sagi Grimberg,
	Marc Zyngier, linux-pci, Shivasharan Srikanteshwara,
	Linux Kernel Mailing List, linux-nvme, linux-block, Sumit Saxena,
	Bjorn Helgaas, Kashyap Desai, Christoph Hellwig

Hello Thomas and Guys,

On Mon, Aug 5, 2019 at 9:19 AM Ming Lei <ming.lei@redhat.com> wrote:
>
> Since commit c66d4bd110a1f8 ("genirq/affinity: Add new callback for
> (re)calculating interrupt sets"), irq_create_affinity_masks() returns
> NULL in case of single vector. This change has caused regression on some
> drivers, such as lpfc.
>
> The problem is that single vector may be triggered in some generic cases:
> 1) kdump kernel 2) irq vectors resource is close to exhaustion.
>
> If we don't create affinity mask for single vector, almost every caller
> has to handle the special case.
>
> So still create affinity mask for single vector, since irq_create_affinity_masks()
> is capable of handling that.
>
> Cc: Marc Zyngier <marc.zyngier@arm.com>
> Cc: Christoph Hellwig <hch@lst.de>
> Cc: Bjorn Helgaas <helgaas@kernel.org>
> Cc: Jens Axboe <axboe@kernel.dk>
> Cc: linux-block@vger.kernel.org
> Cc: Sagi Grimberg <sagi@grimberg.me>
> Cc: linux-nvme@lists.infradead.org
> Cc: linux-pci@vger.kernel.org
> Cc: Keith Busch <keith.busch@intel.com>
> Cc: Sumit Saxena <sumit.saxena@broadcom.com>
> Cc: Kashyap Desai <kashyap.desai@broadcom.com>
> Cc: Shivasharan Srikanteshwara <shivasharan.srikanteshwara@broadcom.com>
> Fixes: c66d4bd110a1f8 ("genirq/affinity: Add new callback for (re)calculating interrupt sets")
> Signed-off-by: Ming Lei <ming.lei@redhat.com>
> ---
>  kernel/irq/affinity.c | 6 ++----
>  1 file changed, 2 insertions(+), 4 deletions(-)
>
> diff --git a/kernel/irq/affinity.c b/kernel/irq/affinity.c
> index 4352b08ae48d..6fef48033f96 100644
> --- a/kernel/irq/affinity.c
> +++ b/kernel/irq/affinity.c
> @@ -251,11 +251,9 @@ irq_create_affinity_masks(unsigned int nvecs, struct irq_affinity *affd)
>          * Determine the number of vectors which need interrupt affinities
>          * assigned. If the pre/post request exhausts the available vectors
>          * then nothing to do here except for invoking the calc_sets()
> -        * callback so the device driver can adjust to the situation. If there
> -        * is only a single vector, then managing the queue is pointless as
> -        * well.
> +        * callback so the device driver can adjust to the situation.
>          */
> -       if (nvecs > 1 && nvecs > affd->pre_vectors + affd->post_vectors)
> +       if (nvecs > affd->pre_vectors + affd->post_vectors)
>                 affvecs = nvecs - affd->pre_vectors - affd->post_vectors;
>         else
>                 affvecs = 0;

Without this patch, kdump kernel may not work, so could you take a look
at this patch?

Thanks,
Ming Lei

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [tip:irq/urgent] genirq/affinity: Create affinity mask for single vector
  2019-08-05  1:19 [PATCH] genirq/affinity: create affinity mask for single vector Ming Lei
  2019-08-07 23:50 ` Ming Lei
@ 2019-08-08  6:52 ` tip-bot for Ming Lei
  2019-08-08 15:17 ` [PATCH] genirq/affinity: create " Keith Busch
  2 siblings, 0 replies; 4+ messages in thread
From: tip-bot for Ming Lei @ 2019-08-08  6:52 UTC (permalink / raw)
  To: linux-tip-commits; +Cc: linux-kernel, ming.lei, tglx, hpa, mingo

Commit-ID:  491beed3b102b6e6c0e7734200661242226e3933
Gitweb:     https://git.kernel.org/tip/491beed3b102b6e6c0e7734200661242226e3933
Author:     Ming Lei <ming.lei@redhat.com>
AuthorDate: Mon, 5 Aug 2019 09:19:06 +0800
Committer:  Thomas Gleixner <tglx@linutronix.de>
CommitDate: Thu, 8 Aug 2019 08:47:55 +0200

genirq/affinity: Create affinity mask for single vector

Since commit c66d4bd110a1f8 ("genirq/affinity: Add new callback for
(re)calculating interrupt sets"), irq_create_affinity_masks() returns
NULL in case of single vector. This change has caused regression on some
drivers, such as lpfc.

The problem is that single vector requests can happen in some generic cases:

  1) kdump kernel

  2) irq vectors resource is close to exhaustion.

If in that situation the affinity mask for a single vector is not created,
every caller has to handle the special case.

There is no reason why the mask cannot be created, so remove the check for
a single vector and create the mask.

Fixes: c66d4bd110a1f8 ("genirq/affinity: Add new callback for (re)calculating interrupt sets")
Signed-off-by: Ming Lei <ming.lei@redhat.com>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Cc: stable@vger.kernel.org
Link: https://lkml.kernel.org/r/20190805011906.5020-1-ming.lei@redhat.com

---
 kernel/irq/affinity.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/kernel/irq/affinity.c b/kernel/irq/affinity.c
index 4352b08ae48d..6fef48033f96 100644
--- a/kernel/irq/affinity.c
+++ b/kernel/irq/affinity.c
@@ -251,11 +251,9 @@ irq_create_affinity_masks(unsigned int nvecs, struct irq_affinity *affd)
 	 * Determine the number of vectors which need interrupt affinities
 	 * assigned. If the pre/post request exhausts the available vectors
 	 * then nothing to do here except for invoking the calc_sets()
-	 * callback so the device driver can adjust to the situation. If there
-	 * is only a single vector, then managing the queue is pointless as
-	 * well.
+	 * callback so the device driver can adjust to the situation.
 	 */
-	if (nvecs > 1 && nvecs > affd->pre_vectors + affd->post_vectors)
+	if (nvecs > affd->pre_vectors + affd->post_vectors)
 		affvecs = nvecs - affd->pre_vectors - affd->post_vectors;
 	else
 		affvecs = 0;

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] genirq/affinity: create affinity mask for single vector
  2019-08-05  1:19 [PATCH] genirq/affinity: create affinity mask for single vector Ming Lei
  2019-08-07 23:50 ` Ming Lei
  2019-08-08  6:52 ` [tip:irq/urgent] genirq/affinity: Create " tip-bot for Ming Lei
@ 2019-08-08 15:17 ` Keith Busch
  2 siblings, 0 replies; 4+ messages in thread
From: Keith Busch @ 2019-08-08 15:17 UTC (permalink / raw)
  To: Ming Lei
  Cc: Thomas Gleixner, linux-kernel, Marc Zyngier, Christoph Hellwig,
	Bjorn Helgaas, Jens Axboe, linux-block, Sagi Grimberg,
	linux-nvme, linux-pci, Keith Busch, Sumit Saxena, Kashyap Desai,
	Shivasharan Srikanteshwara

On Mon, Aug 05, 2019 at 09:19:06AM +0800, Ming Lei wrote:
> Since commit c66d4bd110a1f8 ("genirq/affinity: Add new callback for
> (re)calculating interrupt sets"), irq_create_affinity_masks() returns
> NULL in case of single vector. This change has caused regression on some
> drivers, such as lpfc.
> 
> The problem is that single vector may be triggered in some generic cases:
> 1) kdump kernel 2) irq vectors resource is close to exhaustion.
> 
> If we don't create affinity mask for single vector, almost every caller
> has to handle the special case.
> 
> So still create affinity mask for single vector, since irq_create_affinity_masks()
> is capable of handling that.

Hi Ming,

Looks good to me.

Reviewed-by: Keith Busch <keith.busch@intel.com>
 
> ---
>  kernel/irq/affinity.c | 6 ++----
>  1 file changed, 2 insertions(+), 4 deletions(-)
> 
> diff --git a/kernel/irq/affinity.c b/kernel/irq/affinity.c
> index 4352b08ae48d..6fef48033f96 100644
> --- a/kernel/irq/affinity.c
> +++ b/kernel/irq/affinity.c
> @@ -251,11 +251,9 @@ irq_create_affinity_masks(unsigned int nvecs, struct irq_affinity *affd)
>  	 * Determine the number of vectors which need interrupt affinities
>  	 * assigned. If the pre/post request exhausts the available vectors
>  	 * then nothing to do here except for invoking the calc_sets()
> -	 * callback so the device driver can adjust to the situation. If there
> -	 * is only a single vector, then managing the queue is pointless as
> -	 * well.
> +	 * callback so the device driver can adjust to the situation.
>  	 */
> -	if (nvecs > 1 && nvecs > affd->pre_vectors + affd->post_vectors)
> +	if (nvecs > affd->pre_vectors + affd->post_vectors)
>  		affvecs = nvecs - affd->pre_vectors - affd->post_vectors;
>  	else
>  		affvecs = 0;
> -- 

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2019-08-08 15:20 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-08-05  1:19 [PATCH] genirq/affinity: create affinity mask for single vector Ming Lei
2019-08-07 23:50 ` Ming Lei
2019-08-08  6:52 ` [tip:irq/urgent] genirq/affinity: Create " tip-bot for Ming Lei
2019-08-08 15:17 ` [PATCH] genirq/affinity: create " Keith Busch

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).