genirq/affinity: create affinity mask for single vector
Subsystems (4)
PATCH 1/1 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 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.
--- kernel/irq/affinity.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-)
kernel/irq/affinity.c +2 -4
@@ -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 ;
Signature · 1 line
2.20.1
Hello Thomas and Guys,
Quoted 41 lines · Ming Lei
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 at arm.com>Cc Christoph Hellwig <hch at lst.de>Cc Bjorn Helgaas <helgaas at kernel.org>Cc Jens Axboe <axboe at kernel.dk>Cc linux-block at vger.kernel.orgCc Sagi Grimberg <sagi at grimberg.me>Cc linux-nvme at lists.infradead.orgCc linux-pci at vger.kernel.orgCc Keith Busch <keith.busch at intel.com>Cc Sumit Saxena <sumit.saxena at broadcom.com>Cc Kashyap Desai <kashyap.desai at broadcom.com>Cc Shivasharan Srikanteshwara <shivasharan.srikanteshwara at broadcom.com>Fixes c66d4bd110a1f8 ("genirq/affinity: Add new callback for (re)calculating interrupt sets")Signed-off-by Ming Lei <ming.lei at redhat.com>--- kernel/irq/affinity.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-)kernel/irq/affinity.c +0
-0@@ -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()
kernel/irq/affinity.c irq_create_affinity_masks(unsigned int nvecs, struct irq_affinity *affd) · line 259
Quoted 10 lines
kernel/irq/affinity.c +2
-4-* 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
tip-bot for Ming Lei
merge bot[tip:irq/urgent] genirq/affinity: Create affinity mask for single vector
In reply to Ming Leigenirq/affinity: Create affinity mask for single vector
Commit-ID: 491beed3b102b6e6c0e7734200661242226e3933 Gitweb: https://git.kernel.org/tip/491beed3b102b6e6c0e7734200661242226e3933 Author: Ming Lei <[email protected]> AuthorDate: Mon, 5 Aug 2019 09:19:06 +0800 Committer: Thomas Gleixner <[email protected]> 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.
--- kernel/irq/affinity.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-)
kernel/irq/affinity.c +2 -4
@@ -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 ;
Quoted 5 lines · Ming Lei
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.
Quoted 8 lines
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.
Quoted 23 lines
--- kernel/irq/affinity.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-)kernel/irq/affinity.c +2
-4@@ -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 ;