From mboxrd@z Thu Jan 1 00:00:00 1970 From: =?iso-8859-1?Q?N=E9lio?= Laranjeiro Subject: Re: [PATCH] net/mlx5: release spinlock before return from function Date: Fri, 29 Sep 2017 08:55:12 +0200 Message-ID: <20170929065511.GR7279@autoinstall.dev.6wind.com> References: <1506643436-15561-1-git-send-email-pavlo.shcherbyna@harmonicinc.com> Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 8bit Cc: adrien.mazarguil@6wind.com, dev@dpdk.org, shahafs@mellanox.com To: Pavlo Shcherbyna Return-path: Received: from mail-wm0-f52.google.com (mail-wm0-f52.google.com [74.125.82.52]) by dpdk.org (Postfix) with ESMTP id 769E15592 for ; Fri, 29 Sep 2017 08:55:23 +0200 (CEST) Received: by mail-wm0-f52.google.com with SMTP id i124so1326599wmf.3 for ; Thu, 28 Sep 2017 23:55:23 -0700 (PDT) Content-Disposition: inline In-Reply-To: <1506643436-15561-1-git-send-email-pavlo.shcherbyna@harmonicinc.com> List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" 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 > --- > 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