netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Saeed Mahameed <saeed@kernel.org>
To: "David S. Miller" <davem@davemloft.net>,
	Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
	Eric Dumazet <edumazet@google.com>
Cc: Saeed Mahameed <saeedm@nvidia.com>,
	netdev@vger.kernel.org, Tariq Toukan <tariqt@nvidia.com>,
	Dragos Tatulea <dtatulea@nvidia.com>
Subject: [net-next 09/15] net/mlx5e: RX, Fix releasing page_pool pages twice for striding RQ
Date: Thu, 20 Apr 2023 18:38:44 -0700	[thread overview]
Message-ID: <20230421013850.349646-10-saeed@kernel.org> (raw)
In-Reply-To: <20230421013850.349646-1-saeed@kernel.org>

From: Dragos Tatulea <dtatulea@nvidia.com>

mlx5e_free_rx_descs is responsible for calling the dealloc_wqe op which
returns pages to the page_pool. This can happen during flush or close.
For XSK, the regular RQ is flushed (when replaced by the XSK RQ) and
also closed later. This is normally not a problem as the wqe list is
empty on a second call to mlx5e_free_rx_descs. However, for striding RQ,
the previously released wqes from the list will appear as missing
and will be released a second time by mlx5e_free_rx_missing_descs.

This patch sets the no release bits on the striding RQ wqes in the
dealloc_wqe op to prevent releasing the pages a second time.

Please note that the bits are set only in the control path during
close and not in the data path.

Fixes: 4c2a13236807 ("net/mlx5e: RX, Defer page release in striding rq for better recycling")
Signed-off-by: Dragos Tatulea <dtatulea@nvidia.com>
Reviewed-by: Tariq Toukan <tariqt@nvidia.com>
Signed-off-by: Saeed Mahameed <saeedm@nvidia.com>
---
 drivers/net/ethernet/mellanox/mlx5/core/en_rx.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_rx.c b/drivers/net/ethernet/mellanox/mlx5/core/en_rx.c
index a8c2ae389d6c..5dc907541094 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/en_rx.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/en_rx.c
@@ -861,6 +861,11 @@ static void mlx5e_dealloc_rx_mpwqe(struct mlx5e_rq *rq, u16 ix)
 	struct mlx5e_mpw_info *wi = mlx5e_get_mpw_info(rq, ix);
 	/* This function is called on rq/netdev close. */
 	mlx5e_free_rx_mpwqe(rq, wi);
+
+	/* Avoid a second release of the wqe pages: dealloc is called also
+	 * for missing wqes on an already flushed RQ.
+	 */
+	bitmap_fill(wi->skip_release_bitmap, rq->mpwqe.pages_per_wqe);
 }
 
 INDIRECT_CALLABLE_SCOPE bool mlx5e_post_rx_wqes(struct mlx5e_rq *rq)
-- 
2.39.2


  parent reply	other threads:[~2023-04-21  1:39 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-04-21  1:38 [pull request][net-next 00/15] mlx5 updates 2023-04-20 Saeed Mahameed
2023-04-21  1:38 ` [net-next 01/15] net/mlx5: DR, Fix dumping of legacy modify_hdr in debug dump Saeed Mahameed
2023-04-22  4:10   ` patchwork-bot+netdevbpf
2023-04-21  1:38 ` [net-next 02/15] net/mlx5: DR, Calculate sync threshold of each pool according to its type Saeed Mahameed
2023-04-21  1:38 ` [net-next 03/15] net/mlx5: DR, Add more info in domain dbg dump Saeed Mahameed
2023-04-21  1:38 ` [net-next 04/15] net/mlx5: DR, Add memory statistics for domain object Saeed Mahameed
2023-04-21  1:38 ` [net-next 05/15] Revert "net/mlx5: Expose steering dropped packets counter" Saeed Mahameed
2023-04-21  1:38 ` [net-next 06/15] Revert "net/mlx5: Expose vnic diagnostic counters for eswitch managed vports" Saeed Mahameed
2023-04-21  1:38 ` [net-next 07/15] net/mlx5: Add vnic devlink health reporter to PFs/VFs Saeed Mahameed
2023-04-21  1:38 ` [net-next 08/15] net/mlx5e: Add vnic devlink health reporter to representors Saeed Mahameed
2023-04-21  1:38 ` Saeed Mahameed [this message]
2023-04-21  1:38 ` [net-next 10/15] net/mlx5e: RX, Fix XDP_TX page release for legacy rq nonlinear case Saeed Mahameed
2023-04-21  1:38 ` [net-next 11/15] net/mlx5e: RX, Hook NAPIs to page pools Saeed Mahameed
2023-04-21  2:13   ` Jakub Kicinski
2023-04-24 11:59     ` Dragos Tatulea
2023-04-21  1:38 ` [net-next 12/15] net/mlx5: Include linux/pci.h for pci_msix_can_alloc_dyn() Saeed Mahameed
2023-04-21  1:38 ` [net-next 13/15] net/mlx5: E-Switch, Remove redundant dev arg from mlx5_esw_vport_alloc() Saeed Mahameed
2023-04-21  1:38 ` [net-next 14/15] net/mlx5: E-Switch, Remove unused mlx5_esw_offloads_vport_metadata_set() Saeed Mahameed
2023-04-21  1:38 ` [net-next 15/15] net/mlx5: Update op_mode to op_mod for port selection Saeed Mahameed

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=20230421013850.349646-10-saeed@kernel.org \
    --to=saeed@kernel.org \
    --cc=davem@davemloft.net \
    --cc=dtatulea@nvidia.com \
    --cc=edumazet@google.com \
    --cc=kuba@kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=saeedm@nvidia.com \
    --cc=tariqt@nvidia.com \
    /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 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).