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 4C1BBA00C2 for ; Thu, 17 Nov 2022 08:40:35 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 4647040DDC; Thu, 17 Nov 2022 08:40:35 +0100 (CET) Received: from smtp-relay-internal-1.canonical.com (smtp-relay-internal-1.canonical.com [185.125.188.123]) by mails.dpdk.org (Postfix) with ESMTP id 2E82C40DDA for ; Thu, 17 Nov 2022 08:40:34 +0100 (CET) Received: from mail-ot1-f70.google.com (mail-ot1-f70.google.com [209.85.210.70]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by smtp-relay-internal-1.canonical.com (Postfix) with ESMTPS id E9EDE3F0B5 for ; Thu, 17 Nov 2022 07:40:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=canonical.com; s=20210705; t=1668670833; bh=sMiqVUTD6jrEfja49O/iF+nnTdAPxxTF7jVVf2l4EnY=; h=MIME-Version:References:In-Reply-To:From:Date:Message-ID:Subject: To:Cc:Content-Type; b=R1eaku/g0EH6Hl2nUZ83M9qXX7crpujb+FusUYxL4zuNRTQu1BmVDyxOatLWCd8zF Y119ULjY9XK2eVnQoV5+zziSknXOCqdqYCEgy0BlR0wrdYfqA9kyGCqjgHuG7JgC/D KR1OWj2YDlOYFN85C59Ogn/5UL6yAW9lFhSW3b18B7dt0KDcox3Xb+2F5bkhYHS2W4 mdEv86wLdts4gzjgg5C9b8nT1aRcNn7/gKNhyGeuXiZ+NvepP00qTUj8l7pvwEVKT/ FccRGGSozQA2H0ZT+QwNys5mexwFA/ifpTOGQbcETEkiB2GSDYjwq3mcgbHuLqK0xn 0Vg9nWhQYWOnw== Received: by mail-ot1-f70.google.com with SMTP id 64-20020a9d0846000000b0066cba79be7aso444657oty.6 for ; Wed, 16 Nov 2022 23:40:33 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=sMiqVUTD6jrEfja49O/iF+nnTdAPxxTF7jVVf2l4EnY=; b=lvGcY0qWdA++ze4y86+XtFGYBoXzp2KJT4YqZCYpeJ4nIgHSjL7YotnpvqBh/I4l/b XGcmMawDHoAtxJISNqn362gvvnxM5wcGCE/Kc8HgbuZLMb9x6PkeYKL/44ASOxBdBpb+ jKTdm56HhVaAdYKrPReL0eqpSTw7ZfVTXfcFKlWZuIQwdKyKiux+GCBulgMA71NQNAtz 5Zk6anZqfVqWw2RrNA6YZ8AzPVHyipRSupihY0M+CTvAMwW0awiDYSfvFXUg9WCQkgHI fkRiPXuGcEkX42BSmM9GW+uR/Afw+jxOclg41kWPVvYotCPsCfoCgVvay3Brhyqv4ibY 0NpQ== X-Gm-Message-State: ANoB5pmefb6HqozJIm5H30F6/Ty0anFQ/TSP89dcLdtjD8ncyHRJg4pq YzamY6YRlTdhMBUnILzMyj85AAmK1CMio2oJwVe8b/7PD5IWhvHt8lzrVO4sP+tddbKlZpZtTm5 aLr5u2U5JPiHPMcb37YEvokLNYZdcDLu+BGC96k1J X-Received: by 2002:a9d:4b06:0:b0:66c:7fb3:dc66 with SMTP id q6-20020a9d4b06000000b0066c7fb3dc66mr817704otf.78.1668670832685; Wed, 16 Nov 2022 23:40:32 -0800 (PST) X-Google-Smtp-Source: AA0mqf5Vp36Pe7BaBnUtKVaAsBg00YAMvDIpefWci6PgHVocwsCWJWMh7OXIv7kZvKnPTOhzSNUGMIsiAiFJL03pOV8= X-Received: by 2002:a9d:4b06:0:b0:66c:7fb3:dc66 with SMTP id q6-20020a9d4b06000000b0066c7fb3dc66mr817692otf.78.1668670832442; Wed, 16 Nov 2022 23:40:32 -0800 (PST) MIME-Version: 1.0 References: <20221116121328.935537-1-michaelba@nvidia.com> In-Reply-To: <20221116121328.935537-1-michaelba@nvidia.com> From: Christian Ehrhardt Date: Thu, 17 Nov 2022 08:40:06 +0100 Message-ID: Subject: Re: [PATCH 19.11] net/mlx5: fix port event cleaning order To: Michael Baum Cc: stable@dpdk.org, Matan Azrad , Viacheslav Ovsiienko Content-Type: text/plain; charset="UTF-8" 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 On Wed, Nov 16, 2022 at 1:13 PM Michael Baum wrote: > > [ upstream commit 7ba5320baa3285bf8beca96cc025ff56b494060d ] Applied, thanks! > 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: 0906b984ff1f ("net/mlx5: fix initial link status detection") > > Signed-off-by: Michael Baum > Acked-by: Matan Azrad > --- > drivers/net/mlx5/mlx5.c | 9 +++++++++ > 1 file changed, 9 insertions(+) > > diff --git a/drivers/net/mlx5/mlx5.c b/drivers/net/mlx5/mlx5.c > index dee018bbba..ae3ba1885e 100644 > --- a/drivers/net/mlx5/mlx5.c > +++ b/drivers/net/mlx5/mlx5.c > @@ -1458,6 +1458,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->ibv_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; > /* > @@ -2883,6 +2889,9 @@ mlx5_dev_spawn(struct rte_device *dpdk_dev, > return eth_dev; > error: > if (priv) { > + priv->sh->port[priv->ibv_port - 1].nl_ih_port_id = > + RTE_MAX_ETHPORTS; > + rte_io_wmb(); > if (priv->mreg_cp_tbl) > mlx5_hlist_destroy(priv->mreg_cp_tbl, NULL, NULL); > if (priv->sh) > -- > 2.25.1 > -- Christian Ehrhardt Senior Staff Engineer, Ubuntu Server Canonical Ltd