From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 5043AA00C4 for ; Fri, 18 Nov 2022 00:10:06 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 4C20D4067B; Fri, 18 Nov 2022 00:10:06 +0100 (CET) Received: from mail-wm1-f45.google.com (mail-wm1-f45.google.com [209.85.128.45]) by mails.dpdk.org (Postfix) with ESMTP id 396534021F for ; Fri, 18 Nov 2022 00:10:05 +0100 (CET) Received: by mail-wm1-f45.google.com with SMTP id j5-20020a05600c410500b003cfa9c0ea76so2809396wmi.3 for ; Thu, 17 Nov 2022 15:10:05 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=cmdCP5o088EcXk2HI8lpphL8bI4KoMgsPm+lW2GdrGs=; b=V2HN0Wt6UNbLbwfvlYIos91E9leWkI352b0QPzghTgxrMuoVMCP+m7d2gjXMaIFm1P 2M5mD5e8Oc6A2NrEDYTk2elUCKX6aUna/H6A5Ngh1N+CGt0hlNko124lyP8O7oOMTxZj nMEcy3FA8NFm2NxIPjeyxQZLrvt/jk007rA8/5VNXWDGJEyuvhJsa4rK5ZGjZ9lRxDfv SmlBUDHcgRirlqGUXMYRLR26PBcubLL/++7xR262T2O3eH8jSkS11WzB43VXmcAZO7II GfXdf7XZUFC9gPUpkvsn5GN+DW/O0XJldlnT4IfXmplL+NvQCf3UbFbJn3LbueFIYVDh +96Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=cmdCP5o088EcXk2HI8lpphL8bI4KoMgsPm+lW2GdrGs=; b=rXeRETsaimwVyW1Liu2ptKVjAgu4wyPrAnJJhJCGvEXO3SzvuHoG4Hhhmv/ancFRTV ccZfh9Bm4KAVnpdm7c4v1krPkPDurVFQIRfuYl/Xp4qz/tH9oIXpae89wrHzjYwW/j5e rQ4vinsspWkqYcEYAWB/MxMfzPEHdy/hZF0trvlXRhzaUNx1sOzsPha0Ya0ozS6+m9Gz sXQU3WB1Krd/6JuRt5fkAqtYH65pj3vssAQ27ZP/in5Yolwxzg7IsgK7RDQUZr8FL6QZ t7hMYCS5pJ5j3OQRR5H69bXaHtuj/ceNhtdgfNmy2cinBoBQk5QXug6/oCLMDanZJaBW JW1Q== X-Gm-Message-State: ANoB5pmgD0fCbkpLt1MwLnG+94eH2nxnobAW6XXaTFjJu7B0oP4qF6Lb 9zwgEmMsR5x7q0Wi5a9jXko= X-Google-Smtp-Source: AA0mqf74i7gsk7Z5mVON21S/e+abCYWm/ZlCdrukzaTPhd/eKBlY7pfWCL5bDrOBbYIoNcS+nrxzDA== X-Received: by 2002:a05:600c:314f:b0:3cf:9efc:a9b7 with SMTP id h15-20020a05600c314f00b003cf9efca9b7mr3235901wmo.10.1668726604873; Thu, 17 Nov 2022 15:10:04 -0800 (PST) Received: from localhost ([2a01:4b00:d307:1000:f1d3:eb5e:11f4:a7d9]) by smtp.gmail.com with ESMTPSA id n21-20020a05600c4f9500b003cfd64b6be1sm9177973wmq.27.2022.11.17.15.10.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 17 Nov 2022 15:10:04 -0800 (PST) From: luca.boccassi@gmail.com To: Michael Baum Cc: Matan Azrad , dpdk stable Subject: patch 'net/mlx5: fix port event cleaning order' has been queued to stable release 20.11.7 Date: Thu, 17 Nov 2022 23:08:40 +0000 Message-Id: <20221117230859.611465-16-luca.boccassi@gmail.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20221117230859.611465-1-luca.boccassi@gmail.com> References: <20221105171146.1520039-47-luca.boccassi@gmail.com> <20221117230859.611465-1-luca.boccassi@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-BeenThere: stable@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: patches for DPDK stable branches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: stable-bounces@dpdk.org Hi, FYI, your patch has been queued to stable release 20.11.7 Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable yet. It will be pushed if I get no objections before 11/19/22. So please shout if anyone has objections. Also note that after the patch there's a diff of the upstream commit vs the patch applied to the branch. This will indicate if there was any rebasing needed to apply to the stable branch. If there were code changes for rebasing (ie: not only metadata diffs), please double check that the rebase was correctly done. Queued patches are on a temporary branch at: https://github.com/kevintraynor/dpdk-stable This queued commit can be viewed at: https://github.com/kevintraynor/dpdk-stable/commit/79c37d65d2ff68ccd8dd2ad99340f54c80232918 Thanks. Luca Boccassi --- >From 79c37d65d2ff68ccd8dd2ad99340f54c80232918 Mon Sep 17 00:00:00 2001 From: Michael Baum Date: Thu, 10 Nov 2022 00:29:38 +0200 Subject: [PATCH] net/mlx5: fix port event cleaning order [ upstream commit 13c5c093905c09bb6207ee1c6a4f05d39f8badcd ] The shared IB device (sh) has per port data with filed for interrupt handler port_id. It used by shared interrupt handler to find the corresponding rte_eth device by IB port index. If value is equal or greater RTE_MAX_ETHPORTS it means there is no subhandler installed for specified IB port index. When a few ports are created under same sh, the sh is created with the first port and the interrupt handler port_id is initialized to RTE_MAX_ETHPORTS for each port. In port creation, the interrupt handler port_id is updated with the correct value. Since this updating, the mlx5_dev_interrupt_nl_cb function uses this port and its priv structure. However, when the ports are closed, this filed isn't updated and the interrupt handler continue working until it is uninstalled in SH destruction. If mlx5_dev_interrupt_nl_cb is called between port closing and SH destruction, it uses invalid port causing a crash. This patch adds interrupt handler port_id updating to the close function and add memory barrier to make sure it is done before priv reset. Fixes: 655c3c26c11e ("net/mlx5: fix initial link status detection") Signed-off-by: Michael Baum Acked-by: Matan Azrad --- drivers/net/mlx5/linux/mlx5_os.c | 3 +++ drivers/net/mlx5/mlx5.c | 6 ++++++ 2 files changed, 9 insertions(+) diff --git a/drivers/net/mlx5/linux/mlx5_os.c b/drivers/net/mlx5/linux/mlx5_os.c index af19b54b7e..e79b1a275c 100644 --- a/drivers/net/mlx5/linux/mlx5_os.c +++ b/drivers/net/mlx5/linux/mlx5_os.c @@ -1640,6 +1640,9 @@ err_secondary: return eth_dev; error: if (priv) { + priv->sh->port[priv->dev_port - 1].nl_ih_port_id = + RTE_MAX_ETHPORTS; + rte_io_wmb(); if (priv->mreg_cp_tbl) mlx5_hlist_destroy(priv->mreg_cp_tbl); if (priv->sh) diff --git a/drivers/net/mlx5/mlx5.c b/drivers/net/mlx5/mlx5.c index 90985479de..22d3ecace2 100644 --- a/drivers/net/mlx5/mlx5.c +++ b/drivers/net/mlx5/mlx5.c @@ -1453,6 +1453,12 @@ mlx5_dev_close(struct rte_eth_dev *dev) if (!c) claim_zero(rte_eth_switch_domain_free(priv->domain_id)); } + priv->sh->port[priv->dev_port - 1].nl_ih_port_id = RTE_MAX_ETHPORTS; + /* + * The interrupt handler port id must be reset before priv is reset + * since 'mlx5_dev_interrupt_nl_cb' uses priv. + */ + rte_io_wmb(); memset(priv, 0, sizeof(*priv)); priv->domain_id = RTE_ETH_DEV_SWITCH_DOMAIN_ID_INVALID; /* -- 2.34.1 --- Diff of the applied patch vs upstream commit (please double-check if non-empty: --- --- - 2022-11-17 23:07:56.193400526 +0000 +++ 0016-net-mlx5-fix-port-event-cleaning-order.patch 2022-11-17 23:07:55.492330367 +0000 @@ -1 +1 @@ -From 13c5c093905c09bb6207ee1c6a4f05d39f8badcd Mon Sep 17 00:00:00 2001 +From 79c37d65d2ff68ccd8dd2ad99340f54c80232918 Mon Sep 17 00:00:00 2001 @@ -5,0 +6,2 @@ +[ upstream commit 13c5c093905c09bb6207ee1c6a4f05d39f8badcd ] + @@ -28 +29,0 @@ -Cc: stable@dpdk.org @@ -38 +39 @@ -index 2b6741396d..a71474c90a 100644 +index af19b54b7e..e79b1a275c 100644 @@ -41 +42 @@ -@@ -1676,6 +1676,9 @@ err_secondary: +@@ -1640,6 +1640,9 @@ err_secondary: @@ -48,3 +49,3 @@ - #ifdef HAVE_MLX5_HWS_SUPPORT - if (eth_dev && - priv->sh && + if (priv->mreg_cp_tbl) + mlx5_hlist_destroy(priv->mreg_cp_tbl); + if (priv->sh) @@ -52 +53 @@ -index 1cf6df6049..95b0151fbc 100644 +index 90985479de..22d3ecace2 100644 @@ -55 +56 @@ -@@ -2137,6 +2137,12 @@ mlx5_dev_close(struct rte_eth_dev *dev) +@@ -1453,6 +1453,12 @@ mlx5_dev_close(struct rte_eth_dev *dev)