From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wr0-f177.google.com (mail-wr0-f177.google.com [209.85.128.177]) by dpdk.org (Postfix) with ESMTP id A8FAF1AEE8 for ; Thu, 5 Oct 2017 14:50:31 +0200 (CEST) Received: by mail-wr0-f177.google.com with SMTP id u5so10596725wrc.5 for ; Thu, 05 Oct 2017 05:50:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=6wind-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references :in-reply-to:references; bh=kz6Ar+hd9gGZTaPiloYYS4H347fTBJ/Jpwj8IVtGXxE=; b=VzS3iEWvLtcb1ALtvoauwnQbH5d6nvK2s7VhB7hVIEOrxtMTVoymgCdVxORml8EKW5 frGenj5Yu6QOe/FuOh044EVhTgxkQqXMKgvLP+3KD/e7VvULYyzeUCivM4/9qtNi3sKJ wSPdMLaUEI0rz5zRI6PtHimv8aCIMikkcW2zCnCdmpA9N8A4MFviFcZ4y7iM0OeMaEbI DgQuOzDbi8DGobmS6y9pI9ob8sTwnukTX5PYgdhbmYLHGOcD0S2DH5byZ+dIo6bBgB8N 1F4w1WmyP8S+C762ZIqETkr37n6aTv3Q3j2wdZ/UBSFImG7Dxi5AGATumsF/4h/sgR+s 25og== 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:in-reply-to:references; bh=kz6Ar+hd9gGZTaPiloYYS4H347fTBJ/Jpwj8IVtGXxE=; b=JbyXVa2UaKGVoJ2BJTeTDEC4QqJJB5czPqfpbqrZ9lIgDsudnLyXYoi0Pi/BLr/oMp HgHNIZX087vtiCM9gAEgEHlURf33kev+iK81Ro8ewdxqUYwE5BsDA4FRB72cc+lKaFAB jph4iINj+hVa6lFRQOr5O0/7vuGmMx7uAtsOkXbijGjjFApjJCNbj8zSKM2oN664+rgD 2R/6imDo95pgbaZq26NgH6FEuLue7w+8QYn/3k+WAmSg5nqXFmE89hNOKHfTZpQdpzon bE1Za9Vsoijvbm7JHNmx2IFN9P3Y7+Z10Erpfy8iOPYDsN5Y2mSMcmDGq8Qcewi7rDq/ 8sKQ== X-Gm-Message-State: AMCzsaVZsYC60PysBeX0/T+uXpLhrh7J9O6VRayXq1lZyUPSsB9uBv/C /cOH2yVBecMKMYz0qzsLq9RP+aRmdw== X-Google-Smtp-Source: AOwi7QC5+39KHpddyU6C2uecMiW1epG079kgI5GdQmOLOHULd4Wz35up9irDnp9PasA/1bA4zlHVhQ== X-Received: by 10.223.141.139 with SMTP id o11mr9706395wrb.20.1507207831071; Thu, 05 Oct 2017 05:50:31 -0700 (PDT) Received: from ping.dev.6wind.com (host.78.145.23.62.rev.coltfrance.com. [62.23.145.78]) by smtp.gmail.com with ESMTPSA id k9sm26405823wrk.27.2017.10.05.05.50.30 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 05 Oct 2017 05:50:30 -0700 (PDT) From: Nelio Laranjeiro To: dev@dpdk.org Cc: adrien.mazarguil@6wind.com, yskoh@mellanox.com, ferruh.yigit@intel.com, stable@dpdk.org Date: Thu, 5 Oct 2017 14:49:39 +0200 Message-Id: X-Mailer: git-send-email 2.1.4 In-Reply-To: References: In-Reply-To: References: Subject: [dpdk-dev] [PATCH v2 07/30] net/mlx5: fix reta update can segfault X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 05 Oct 2017 12:50:32 -0000 Reta update needs to stop/start the port but stopping the port does not disable the polling functions which may end in a segfault if a core is polling the queue while the control thread is modifying it. This patch changes the sequences to an order where such situation cannot happen. Fixes: aa13338faf5e ("net/mlx5: rebuild flows on updating RETA") Cc: yskoh@mellanox.com Cc: stable@dpdk.org Signed-off-by: Nelio Laranjeiro --- drivers/net/mlx5/mlx5_rss.c | 9 +++++---- drivers/net/mlx5/mlx5_trigger.c | 7 +++++++ 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/drivers/net/mlx5/mlx5_rss.c b/drivers/net/mlx5/mlx5_rss.c index d3d2603..8942879 100644 --- a/drivers/net/mlx5/mlx5_rss.c +++ b/drivers/net/mlx5/mlx5_rss.c @@ -351,11 +351,12 @@ mlx5_dev_rss_reta_update(struct rte_eth_dev *dev, struct priv *priv = dev->data->dev_private; assert(!mlx5_is_secondary()); - mlx5_dev_stop(dev); priv_lock(priv); ret = priv_dev_rss_reta_update(priv, reta_conf, reta_size); priv_unlock(priv); - if (ret) - return -ret; - return mlx5_dev_start(dev); + if (dev->data->dev_started) { + mlx5_dev_stop(dev); + mlx5_dev_start(dev); + } + return -ret; } diff --git a/drivers/net/mlx5/mlx5_trigger.c b/drivers/net/mlx5/mlx5_trigger.c index 212b4df..eeb9585 100644 --- a/drivers/net/mlx5/mlx5_trigger.c +++ b/drivers/net/mlx5/mlx5_trigger.c @@ -30,6 +30,7 @@ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ +#include #include #include @@ -118,6 +119,12 @@ mlx5_dev_stop(struct rte_eth_dev *dev) return; priv_lock(priv); + dev->data->dev_started = 0; + /* Prevent crashes when queues are still in use. */ + dev->rx_pkt_burst = removed_rx_burst; + dev->tx_pkt_burst = removed_tx_burst; + rte_wmb(); + usleep(1000 * priv->rxqs_n); DEBUG("%p: cleaning up and destroying hash RX queues", (void *)dev); priv_special_flow_disable_all(priv); priv_mac_addrs_disable(priv); -- 2.1.4