* [dpdk-dev] [PATCH] net/mlx5: release spinlock before return from function
@ 2017-09-29 0:03 Pavlo Shcherbyna
2017-09-29 6:55 ` Nélio Laranjeiro
0 siblings, 1 reply; 2+ messages in thread
From: Pavlo Shcherbyna @ 2017-09-29 0:03 UTC (permalink / raw)
To: adrien.mazarguil, nelio.laranjeiro; +Cc: dev, Pavlo Shcherbyna, shahafs
If priv_ethtool_get_stats_n fails to retrieve statistics, lock
is not released. Next call of function, which uses the same
spinlock, will stuck trying to obtain it.
This patch addresses the issue.
Fixes: 4b2e6df26168 ("net/mlx5: fix extended statistics counters identification")
Cc: shahafs@mellanox.com
Signed-off-by: Pavlo Shcherbyna <pavlo.shcherbyna@harmonicinc.com>
---
drivers/net/mlx5/mlx5_stats.c | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/drivers/net/mlx5/mlx5_stats.c b/drivers/net/mlx5/mlx5_stats.c
index 703f48c..8764829 100644
--- a/drivers/net/mlx5/mlx5_stats.c
+++ b/drivers/net/mlx5/mlx5_stats.c
@@ -442,8 +442,10 @@ struct mlx5_counter_ctrl {
priv_lock(priv);
stats_n = priv_ethtool_get_stats_n(priv);
- if (stats_n < 0)
+ if (stats_n < 0) {
+ priv_unlock(priv);
return -1;
+ }
if (xstats_ctrl->stats_n != stats_n)
priv_xstats_init(priv);
ret = priv_xstats_get(priv, stats);
@@ -467,8 +469,10 @@ struct mlx5_counter_ctrl {
priv_lock(priv);
stats_n = priv_ethtool_get_stats_n(priv);
- if (stats_n < 0)
+ if (stats_n < 0) {
+ priv_unlock(priv);
return;
+ }
if (xstats_ctrl->stats_n != stats_n)
priv_xstats_init(priv);
priv_xstats_reset(priv);
--
1.7.10.4
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [dpdk-dev] [PATCH] net/mlx5: release spinlock before return from function
2017-09-29 0:03 [dpdk-dev] [PATCH] net/mlx5: release spinlock before return from function Pavlo Shcherbyna
@ 2017-09-29 6:55 ` Nélio Laranjeiro
0 siblings, 0 replies; 2+ messages in thread
From: Nélio Laranjeiro @ 2017-09-29 6:55 UTC (permalink / raw)
To: Pavlo Shcherbyna; +Cc: adrien.mazarguil, dev, shahafs
Hi Pavlo,
On Fri, Sep 29, 2017 at 03:03:56AM +0300, Pavlo Shcherbyna wrote:
> If priv_ethtool_get_stats_n fails to retrieve statistics, lock
> is not released. Next call of function, which uses the same
> spinlock, will stuck trying to obtain it.
>
> This patch addresses the issue.
>
> Fixes: 4b2e6df26168 ("net/mlx5: fix extended statistics counters identification")
> Cc: shahafs@mellanox.com
>
> Signed-off-by: Pavlo Shcherbyna <pavlo.shcherbyna@harmonicinc.com>
> ---
> drivers/net/mlx5/mlx5_stats.c | 8 ++++++--
> 1 file changed, 6 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/net/mlx5/mlx5_stats.c b/drivers/net/mlx5/mlx5_stats.c
> index 703f48c..8764829 100644
> --- a/drivers/net/mlx5/mlx5_stats.c
> +++ b/drivers/net/mlx5/mlx5_stats.c
> @@ -442,8 +442,10 @@ struct mlx5_counter_ctrl {
>
> priv_lock(priv);
> stats_n = priv_ethtool_get_stats_n(priv);
> - if (stats_n < 0)
> + if (stats_n < 0) {
> + priv_unlock(priv);
> return -1;
> + }
> if (xstats_ctrl->stats_n != stats_n)
> priv_xstats_init(priv);
> ret = priv_xstats_get(priv, stats);
> @@ -467,8 +469,10 @@ struct mlx5_counter_ctrl {
>
> priv_lock(priv);
> stats_n = priv_ethtool_get_stats_n(priv);
> - if (stats_n < 0)
> + if (stats_n < 0) {
> + priv_unlock(priv);
> return;
> + }
> if (xstats_ctrl->stats_n != stats_n)
> priv_xstats_init(priv);
> priv_xstats_reset(priv);
> --
> 1.7.10.4
This bug is already fixed in next-net/master [1][2].
Thanks for your contribution.
[1] http://dpdk.org/ml/archives/dev/2017-August/072864.html
[2] http://dpdk.org/ml/archives/dev/2017-August/073404.html
--
Nélio Laranjeiro
6WIND
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2017-09-29 6:55 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-09-29 0:03 [dpdk-dev] [PATCH] net/mlx5: release spinlock before return from function Pavlo Shcherbyna
2017-09-29 6:55 ` Nélio Laranjeiro
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).