DPDK patches and discussions
 help / color / mirror / Atom feed
* [PATCH] net/mlx5: fix the unlock mismatch issue
@ 2023-11-04  4:07 Weiguo Li
  2023-11-07  6:52 ` Slava Ovsiienko
  2023-11-12 14:23 ` Raslan Darawsheh
  0 siblings, 2 replies; 3+ messages in thread
From: Weiguo Li @ 2023-11-04  4:07 UTC (permalink / raw)
  To: akozyrev; +Cc: viacheslavo, dev, stable, Weiguo Li

The 'need_lock' parameter controls whether the function acquires and
releases the spinlock, but the first unlock operation occurs regardless
of the 'need_lock' parameter.

To fix this issue, the spin unlock operation should be invoked within
an 'if (need_lock)' block, ensuring that the function only unlocks the
spinlock if it has previously been acquired.

Fixes: 48fbb0e93d06 ("net/mlx5: support flow meter mark indirect action with HWS")
Cc: stable@dpdk.org

Signed-off-by: Weiguo Li <liweiguo@xencore.cn>
---
 drivers/net/mlx5/mlx5_flow_aso.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/net/mlx5/mlx5_flow_aso.c b/drivers/net/mlx5/mlx5_flow_aso.c
index 3c08da0614..f311443472 100644
--- a/drivers/net/mlx5/mlx5_flow_aso.c
+++ b/drivers/net/mlx5/mlx5_flow_aso.c
@@ -932,7 +932,8 @@ mlx5_aso_mtr_completion_handle(struct mlx5_aso_sq *sq, bool need_lock)
 		rte_spinlock_lock(&sq->sqsl);
 	max = (uint16_t)(sq->head - sq->tail);
 	if (unlikely(!max)) {
-		rte_spinlock_unlock(&sq->sqsl);
+		if (need_lock)
+			rte_spinlock_unlock(&sq->sqsl);
 		return;
 	}
 	do {
-- 
2.34.1


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

* RE: [PATCH] net/mlx5: fix the unlock mismatch issue
  2023-11-04  4:07 [PATCH] net/mlx5: fix the unlock mismatch issue Weiguo Li
@ 2023-11-07  6:52 ` Slava Ovsiienko
  2023-11-12 14:23 ` Raslan Darawsheh
  1 sibling, 0 replies; 3+ messages in thread
From: Slava Ovsiienko @ 2023-11-07  6:52 UTC (permalink / raw)
  To: Weiguo Li, Alexander Kozyrev; +Cc: dev, stable, Weiguo Li

Hi, Weiguo

Good catch, thank you.

With best regards,
Slava

> -----Original Message-----
> From: Weiguo Li <liwg06@foxmail.com>
> Sent: Saturday, November 4, 2023 6:08 AM
> To: Alexander Kozyrev <akozyrev@nvidia.com>
> Cc: Slava Ovsiienko <viacheslavo@nvidia.com>; dev@dpdk.org;
> stable@dpdk.org; Weiguo Li <liweiguo@xencore.cn>
> Subject: [PATCH] net/mlx5: fix the unlock mismatch issue
> 
> The 'need_lock' parameter controls whether the function acquires and
> releases the spinlock, but the first unlock operation occurs regardless of the
> 'need_lock' parameter.
> 
> To fix this issue, the spin unlock operation should be invoked within an 'if
> (need_lock)' block, ensuring that the function only unlocks the spinlock if it
> has previously been acquired.
> 
> Fixes: 48fbb0e93d06 ("net/mlx5: support flow meter mark indirect action
> with HWS")
> Cc: stable@dpdk.org
> 
> Signed-off-by: Weiguo Li <liweiguo@xencore.cn>
Acked-by: Viacheslav Ovsiienko <viacheslavo@nvidia.com>


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

* RE: [PATCH] net/mlx5: fix the unlock mismatch issue
  2023-11-04  4:07 [PATCH] net/mlx5: fix the unlock mismatch issue Weiguo Li
  2023-11-07  6:52 ` Slava Ovsiienko
@ 2023-11-12 14:23 ` Raslan Darawsheh
  1 sibling, 0 replies; 3+ messages in thread
From: Raslan Darawsheh @ 2023-11-12 14:23 UTC (permalink / raw)
  To: Weiguo Li, Alexander Kozyrev; +Cc: Slava Ovsiienko, dev, stable, Weiguo Li

Hi,

> -----Original Message-----
> From: Weiguo Li <liwg06@foxmail.com>
> Sent: Saturday, November 4, 2023 6:08 AM
> To: Alexander Kozyrev <akozyrev@nvidia.com>
> Cc: Slava Ovsiienko <viacheslavo@nvidia.com>; dev@dpdk.org;
> stable@dpdk.org; Weiguo Li <liweiguo@xencore.cn>
> Subject: [PATCH] net/mlx5: fix the unlock mismatch issue
> 
> The 'need_lock' parameter controls whether the function acquires and
> releases the spinlock, but the first unlock operation occurs regardless of the
> 'need_lock' parameter.
> 
> To fix this issue, the spin unlock operation should be invoked within an 'if
> (need_lock)' block, ensuring that the function only unlocks the spinlock if it
> has previously been acquired.
> 
> Fixes: 48fbb0e93d06 ("net/mlx5: support flow meter mark indirect action
> with HWS")
> Cc: stable@dpdk.org
> 
> Signed-off-by: Weiguo Li <liweiguo@xencore.cn>

Patch applied to next-net-mlx,

Kindest regards,
Raslan Darawsheh

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

end of thread, other threads:[~2023-11-12 14:23 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-11-04  4:07 [PATCH] net/mlx5: fix the unlock mismatch issue Weiguo Li
2023-11-07  6:52 ` Slava Ovsiienko
2023-11-12 14:23 ` Raslan Darawsheh

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).