* [PATCH net] net/mlx5: Fix setting of irq->map.index for static IRQ case
@ 2023-05-30 14:13 Niklas Schnelle
2023-05-30 19:35 ` Simon Horman
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: Niklas Schnelle @ 2023-05-30 14:13 UTC (permalink / raw)
To: Shay Drory, Saeed Mahameed, Eli Cohen, Leon Romanovsky,
David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni
Cc: netdev, linux-kernel, linux-s390, linux-rdma
When dynamic IRQ allocation is not supported all IRQs are allocated up
front in mlx5_irq_table_create() instead of dynamically as part of
mlx5_irq_alloc(). In the latter dynamic case irq->map.index is set
via the mapping returned by pci_msix_alloc_irq_at(). In the static case
and prior to commit 1da438c0ae02 ("net/mlx5: Fix indexing of mlx5_irq")
irq->map.index was set in mlx4_irq_alloc() twice once initially to 0 and
then to the requested index before storing in the xarray. After this
commit it is only set to 0 which breaks all other IRQ mappins.
Fix this by setting irq->map.index to the requested index together with
irq->map.virq and improve the related comment to make it clearer which
cases it deals with.
Fixes: 1da438c0ae02 ("net/mlx5: Fix indexing of mlx5_irq")
Signed-off-by: Niklas Schnelle <schnelle@linux.ibm.com>
---
drivers/net/ethernet/mellanox/mlx5/core/pci_irq.c | 9 +++++----
1 file changed, 5 insertions(+), 4 deletions(-)
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/pci_irq.c b/drivers/net/ethernet/mellanox/mlx5/core/pci_irq.c
index db5687d9fec9..fd5b43e8f3bb 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/pci_irq.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/pci_irq.c
@@ -232,12 +232,13 @@ struct mlx5_irq *mlx5_irq_alloc(struct mlx5_irq_pool *pool, int i,
if (!irq)
return ERR_PTR(-ENOMEM);
if (!i || !pci_msix_can_alloc_dyn(dev->pdev)) {
- /* The vector at index 0 was already allocated.
- * Just get the irq number. If dynamic irq is not supported
- * vectors have also been allocated.
+ /* The vector at index 0 is always statically allocated. If
+ * dynamic irq is not supported all vectors are statically
+ * allocated. In both cases just get the irq number and set
+ * the index.
*/
irq->map.virq = pci_irq_vector(dev->pdev, i);
- irq->map.index = 0;
+ irq->map.index = i;
} else {
irq->map = pci_msix_alloc_irq_at(dev->pdev, MSI_ANY_INDEX, af_desc);
if (!irq->map.virq) {
--
2.39.2
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH net] net/mlx5: Fix setting of irq->map.index for static IRQ case
2023-05-30 14:13 [PATCH net] net/mlx5: Fix setting of irq->map.index for static IRQ case Niklas Schnelle
@ 2023-05-30 19:35 ` Simon Horman
2023-05-30 21:25 ` Mark Brown
2023-05-31 6:06 ` Eli Cohen
2 siblings, 0 replies; 4+ messages in thread
From: Simon Horman @ 2023-05-30 19:35 UTC (permalink / raw)
To: Niklas Schnelle
Cc: Shay Drory, Saeed Mahameed, Eli Cohen, Leon Romanovsky,
David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
netdev, linux-kernel, linux-s390, linux-rdma
On Tue, May 30, 2023 at 04:13:04PM +0200, Niklas Schnelle wrote:
> When dynamic IRQ allocation is not supported all IRQs are allocated up
> front in mlx5_irq_table_create() instead of dynamically as part of
> mlx5_irq_alloc(). In the latter dynamic case irq->map.index is set
> via the mapping returned by pci_msix_alloc_irq_at(). In the static case
> and prior to commit 1da438c0ae02 ("net/mlx5: Fix indexing of mlx5_irq")
> irq->map.index was set in mlx4_irq_alloc() twice once initially to 0 and
> then to the requested index before storing in the xarray. After this
> commit it is only set to 0 which breaks all other IRQ mappins.
>
> Fix this by setting irq->map.index to the requested index together with
> irq->map.virq and improve the related comment to make it clearer which
> cases it deals with.
>
> Fixes: 1da438c0ae02 ("net/mlx5: Fix indexing of mlx5_irq")
> Signed-off-by: Niklas Schnelle <schnelle@linux.ibm.com>
Reviewed-by: Simon Horman <simon.horman@corigine.com>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH net] net/mlx5: Fix setting of irq->map.index for static IRQ case
2023-05-30 14:13 [PATCH net] net/mlx5: Fix setting of irq->map.index for static IRQ case Niklas Schnelle
2023-05-30 19:35 ` Simon Horman
@ 2023-05-30 21:25 ` Mark Brown
2023-05-31 6:06 ` Eli Cohen
2 siblings, 0 replies; 4+ messages in thread
From: Mark Brown @ 2023-05-30 21:25 UTC (permalink / raw)
To: Niklas Schnelle
Cc: Shay Drory, Saeed Mahameed, Eli Cohen, Leon Romanovsky,
David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
netdev, linux-kernel, linux-s390, linux-rdma
[-- Attachment #1: Type: text/plain, Size: 848 bytes --]
On Tue, May 30, 2023 at 04:13:04PM +0200, Niklas Schnelle wrote:
> When dynamic IRQ allocation is not supported all IRQs are allocated up
> front in mlx5_irq_table_create() instead of dynamically as part of
> mlx5_irq_alloc(). In the latter dynamic case irq->map.index is set
> via the mapping returned by pci_msix_alloc_irq_at(). In the static case
> and prior to commit 1da438c0ae02 ("net/mlx5: Fix indexing of mlx5_irq")
> irq->map.index was set in mlx4_irq_alloc() twice once initially to 0 and
> then to the requested index before storing in the xarray. After this
> commit it is only set to 0 which breaks all other IRQ mappins.
s/mappins/mappings/
We were seeing the issue that this fixes on a Cavium ThunderX2 system
and the analysis looks good so:
Tested-by: Mark Brown <broonie@kernel.org>
Reviewed-by: Mark Brown <broonie@kernel.org>
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]
^ permalink raw reply [flat|nested] 4+ messages in thread
* RE: [PATCH net] net/mlx5: Fix setting of irq->map.index for static IRQ case
2023-05-30 14:13 [PATCH net] net/mlx5: Fix setting of irq->map.index for static IRQ case Niklas Schnelle
2023-05-30 19:35 ` Simon Horman
2023-05-30 21:25 ` Mark Brown
@ 2023-05-31 6:06 ` Eli Cohen
2 siblings, 0 replies; 4+ messages in thread
From: Eli Cohen @ 2023-05-31 6:06 UTC (permalink / raw)
To: Niklas Schnelle, Shay Drory, Saeed Mahameed, Leon Romanovsky,
David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni
Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org,
linux-s390@vger.kernel.org, linux-rdma@vger.kernel.org
> From: Niklas Schnelle <schnelle@linux.ibm.com>
> Sent: Tuesday, 30 May 2023 17:13
> To: Shay Drory <shayd@nvidia.com>; Saeed Mahameed
> <saeedm@nvidia.com>; Eli Cohen <elic@nvidia.com>; Leon Romanovsky
> <leon@kernel.org>; David S. Miller <davem@davemloft.net>; Eric Dumazet
> <edumazet@google.com>; Jakub Kicinski <kuba@kernel.org>; Paolo Abeni
> <pabeni@redhat.com>
> Cc: netdev@vger.kernel.org; linux-kernel@vger.kernel.org; linux-
> s390@vger.kernel.org; linux-rdma@vger.kernel.org
> Subject: [PATCH net] net/mlx5: Fix setting of irq->map.index for static IRQ case
>
> When dynamic IRQ allocation is not supported all IRQs are allocated up
> front in mlx5_irq_table_create() instead of dynamically as part of
> mlx5_irq_alloc(). In the latter dynamic case irq->map.index is set
> via the mapping returned by pci_msix_alloc_irq_at(). In the static case
> and prior to commit 1da438c0ae02 ("net/mlx5: Fix indexing of mlx5_irq")
> irq->map.index was set in mlx4_irq_alloc() twice once initially to 0 and
> then to the requested index before storing in the xarray. After this
> commit it is only set to 0 which breaks all other IRQ mappins.
>
s/mlx4_irq_alloc/mlx5_irq_alloc/
Reviewed-by: Eli Cohen <elic@nvidia.com>
> Fix this by setting irq->map.index to the requested index together with
> irq->map.virq and improve the related comment to make it clearer which
> cases it deals with.
>
> Fixes: 1da438c0ae02 ("net/mlx5: Fix indexing of mlx5_irq")
> Signed-off-by: Niklas Schnelle <schnelle@linux.ibm.com>
> ---
> drivers/net/ethernet/mellanox/mlx5/core/pci_irq.c | 9 +++++----
> 1 file changed, 5 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/net/ethernet/mellanox/mlx5/core/pci_irq.c
> b/drivers/net/ethernet/mellanox/mlx5/core/pci_irq.c
> index db5687d9fec9..fd5b43e8f3bb 100644
> --- a/drivers/net/ethernet/mellanox/mlx5/core/pci_irq.c
> +++ b/drivers/net/ethernet/mellanox/mlx5/core/pci_irq.c
> @@ -232,12 +232,13 @@ struct mlx5_irq *mlx5_irq_alloc(struct
> mlx5_irq_pool *pool, int i,
> if (!irq)
> return ERR_PTR(-ENOMEM);
> if (!i || !pci_msix_can_alloc_dyn(dev->pdev)) {
> - /* The vector at index 0 was already allocated.
> - * Just get the irq number. If dynamic irq is not supported
> - * vectors have also been allocated.
> + /* The vector at index 0 is always statically allocated. If
> + * dynamic irq is not supported all vectors are statically
> + * allocated. In both cases just get the irq number and set
> + * the index.
> */
> irq->map.virq = pci_irq_vector(dev->pdev, i);
> - irq->map.index = 0;
> + irq->map.index = i;
> } else {
> irq->map = pci_msix_alloc_irq_at(dev->pdev,
> MSI_ANY_INDEX, af_desc);
> if (!irq->map.virq) {
> --
> 2.39.2
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2023-05-31 6:06 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-05-30 14:13 [PATCH net] net/mlx5: Fix setting of irq->map.index for static IRQ case Niklas Schnelle
2023-05-30 19:35 ` Simon Horman
2023-05-30 21:25 ` Mark Brown
2023-05-31 6:06 ` Eli Cohen
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).