From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wr0-f195.google.com (mail-wr0-f195.google.com [209.85.128.195]) by dpdk.org (Postfix) with ESMTP id EAC832BAA for ; Thu, 3 May 2018 13:06:27 +0200 (CEST) Received: by mail-wr0-f195.google.com with SMTP id y15-v6so5410536wrg.11 for ; Thu, 03 May 2018 04:06:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=Rph9zD8Cu1EAZZ1racl0O8h1c9JhWAjxLqHvsTNPpHQ=; b=CrvcO/Lm/oMcf0ukyZY6tOajA+YfdW1x36EmHjDfXZazM4hubAlX4ufR9xWe0JQmBT F6J8igtCCG+3e48PqD7+97bR9JKJVOto7jaBhj21FdVNpUN//DIpky6+VJo/p1ERL5bb Qftm6uqU1MvVTLx1Vu8AEhqKJCNbs9E1WhG/Ti9w8Ar+VlQGgdv0T3v45xvqbnwwQRbp SGnQJEY8F5hmXCrK8GCWLfcFxuBmXEaL78PKYS2PSjRXs0J4F2sQj7w9f24Amfsa8s6t iJkQxg0eS6pfj5SQJOWUIt52u1h5Q+74ZnU6VX3kdZVGVNeGB/IEO3Sc59TtZ0pZ2hCR p6vQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=Rph9zD8Cu1EAZZ1racl0O8h1c9JhWAjxLqHvsTNPpHQ=; b=lrUQACDvPXMWNxofmQ4qRDLuPaemqEIau/4+qTmCW+/znU1HLMErgD+DIUxNnU1k7o CRNdPlwEUdzE5GUvtoa9kR8La+0ORS/Ltsl5mUg/x9AOCFwFTOY2lc6AbYb6EUsxZEqz 3zneVtxi85fcqza7fj2sRx1OuIfRxJGafmWnm/OPLndquPjc6nbF45zOl6Lebi7oPmTx /+b/76qPTuRj+8PYglQBsYil2jjAmUlYQnk9hKQ2kBM3+k7xRDcttPVwwSqMSUCRQJlo dck/WzSD5EtiHuvCpn1TWosDJf24R7L0Q5xa4kMaAROj+cfmYFTPKXLOtQl6AXpU0xtf Erow== X-Gm-Message-State: ALQs6tDeaZr6pDZA6/CYfJr0qw80dtG3zAWo93hDiZ951RTSpF+6xG7d YHZvWhqHgB7hHVdBphn7IzmehU8V X-Google-Smtp-Source: AB8JxZpK6JzPOAHKJrF5S78ihfFWLPNcfnA9EyW8ecKt7fHHrV6SgHkDIOWyUUME88sOB4+Lra4nhQ== X-Received: by 2002:adf:8827:: with SMTP id d36-v6mr17301043wrd.41.1525345587599; Thu, 03 May 2018 04:06:27 -0700 (PDT) Received: from localhost (slip139-92-244-193.lon.uk.prserv.net. [139.92.244.193]) by smtp.gmail.com with ESMTPSA id w6-v6sm16587809wra.16.2018.05.03.04.06.26 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 03 May 2018 04:06:26 -0700 (PDT) From: luca.boccassi@gmail.com To: Adrien Mazarguil Cc: dpdk stable Date: Thu, 3 May 2018 12:06:09 +0100 Message-Id: <20180503110612.12146-2-luca.boccassi@gmail.com> X-Mailer: git-send-email 2.14.2 In-Reply-To: <20180503110612.12146-1-luca.boccassi@gmail.com> References: <20180430145402.23057-42-luca.boccassi@gmail.com> <20180503110612.12146-1-luca.boccassi@gmail.com> Subject: [dpdk-stable] patch 'net/mlx4: fix Rx resource leak in case of error' has been queued to stable release 18.02.2 X-BeenThere: stable@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches for DPDK stable branches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 03 May 2018 11:06:28 -0000 Hi, FYI, your patch has been queued to stable release 18.02.2 Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable yet. It will be pushed if I get no objections before 05/04/18. So please shout if anyone has objections. Thanks. Luca Boccassi --- >>From ab8ddf5ac768b37212dd3a2963bfa45b6d797df7 Mon Sep 17 00:00:00 2001 From: Adrien Mazarguil Date: Thu, 26 Apr 2018 18:26:13 +0200 Subject: [PATCH] net/mlx4: fix Rx resource leak in case of error [ upstream commit 84a684862f502f2d885bc5fa112da26265d5a0f4 ] When creation of a flow rule fails during dev_start(), the usage count of the common RSS context is not decremented, which triggers an assertion failure in debug mode during dev_close(). This is addressed by tracking the initialization status of the common RSS context in order to add missing cleanup code. A similar issue exists in mlx4_rxq_attach(), where usage count is incremented on a Rx queue but not released in case of error. This may lead to the above issue since RSS contexts created by flow rules attach themselves to Rx queues, incrementing their usage count. Fixes: 5697a4142107 ("net/mlx4: relax Rx queue configuration order") Signed-off-by: Adrien Mazarguil --- drivers/net/mlx4/mlx4.c | 6 ++++-- drivers/net/mlx4/mlx4.h | 1 + drivers/net/mlx4/mlx4_rxq.c | 7 +++++++ 3 files changed, 12 insertions(+), 2 deletions(-) diff --git a/drivers/net/mlx4/mlx4.c b/drivers/net/mlx4/mlx4.c index fb8a8b848..c1f825e75 100644 --- a/drivers/net/mlx4/mlx4.c +++ b/drivers/net/mlx4/mlx4.c @@ -61,6 +61,8 @@ const char *pmd_mlx4_init_params[] = { NULL, }; +static void mlx4_dev_stop(struct rte_eth_dev *dev); + /** * DPDK callback for Ethernet device configuration. * @@ -143,8 +145,7 @@ mlx4_dev_start(struct rte_eth_dev *dev) dev->rx_pkt_burst = mlx4_rx_burst; return 0; err: - /* Rollback. */ - priv->started = 0; + mlx4_dev_stop(dev); return ret; } @@ -194,6 +195,7 @@ mlx4_dev_close(struct rte_eth_dev *dev) dev->tx_pkt_burst = mlx4_tx_burst_removed; rte_wmb(); mlx4_flow_clean(priv); + mlx4_rss_deinit(priv); for (i = 0; i != dev->data->nb_rx_queues; ++i) mlx4_rx_queue_release(dev->data->rx_queues[i]); for (i = 0; i != dev->data->nb_tx_queues; ++i) diff --git a/drivers/net/mlx4/mlx4.h b/drivers/net/mlx4/mlx4.h index 19c8a223d..0a50e785c 100644 --- a/drivers/net/mlx4/mlx4.h +++ b/drivers/net/mlx4/mlx4.h @@ -103,6 +103,7 @@ struct priv { uint32_t vf:1; /**< This is a VF device. */ uint32_t intr_alarm:1; /**< An interrupt alarm is scheduled. */ uint32_t isolated:1; /**< Toggle isolated mode. */ + uint32_t rss_init:1; /**< Common RSS context is initialized. */ uint32_t hw_csum:1; /**< Checksum offload is supported. */ uint32_t hw_csum_l2tun:1; /**< Checksum support for L2 tunnels. */ uint64_t hw_rss_sup; /**< Supported RSS hash fields (Verbs format). */ diff --git a/drivers/net/mlx4/mlx4_rxq.c b/drivers/net/mlx4/mlx4_rxq.c index 7a036ed83..47e19cb0d 100644 --- a/drivers/net/mlx4/mlx4_rxq.c +++ b/drivers/net/mlx4/mlx4_rxq.c @@ -336,6 +336,8 @@ mlx4_rss_init(struct priv *priv) unsigned int i; int ret; + if (priv->rss_init) + return 0; /* Prepare range for RSS contexts before creating the first WQ. */ ret = mlx4_glue->dv_set_context_attr (priv->ctx, @@ -418,6 +420,7 @@ wq_num_check: } wq_num_prev = wq_num; } + priv->rss_init = 1; return 0; error: ERROR("cannot initialize common RSS resources (queue %u): %s: %s", @@ -446,6 +449,8 @@ mlx4_rss_deinit(struct priv *priv) { unsigned int i; + if (!priv->rss_init) + return; for (i = 0; i != priv->dev->data->nb_rx_queues; ++i) { struct rxq *rxq = priv->dev->data->rx_queues[i]; @@ -454,6 +459,7 @@ mlx4_rss_deinit(struct priv *priv) mlx4_rxq_detach(rxq); } } + priv->rss_init = 0; } /** @@ -597,6 +603,7 @@ error: claim_zero(mlx4_glue->destroy_wq(wq)); if (cq) claim_zero(mlx4_glue->destroy_cq(cq)); + --rxq->usecnt; rte_errno = ret; ERROR("error while attaching Rx queue %p: %s: %s", (void *)rxq, msg, strerror(ret)); -- 2.14.2