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 3FD23A0544 for ; Fri, 18 Nov 2022 15:27:42 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 0A0964021F; Fri, 18 Nov 2022 15:27:42 +0100 (CET) Received: from mail-wr1-f50.google.com (mail-wr1-f50.google.com [209.85.221.50]) by mails.dpdk.org (Postfix) with ESMTP id 405254003F for ; Fri, 18 Nov 2022 15:27:40 +0100 (CET) Received: by mail-wr1-f50.google.com with SMTP id w14so9504551wru.8 for ; Fri, 18 Nov 2022 06:27:40 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=mime-version:user-agent:content-transfer-encoding:references :in-reply-to:date:cc:to:from:subject:message-id:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=1OAzqfYOqeTdhRHaFSesY+DsOsmHo1Ls72LnTSn/Cc4=; b=Odi+R/DCalsHtWnwz9vPWX4589E3ZQda5djxWp456ia/dxxT1u4TV3VMRi9/yNKjdA va9T7NOp7lRYMOSjLuegYbzlz0qcRCcSw2iRdk3l77EWGoFjCU8OHfXCEhKKdyxHMnJg z/wZ+0Uc58pdF9IAG/L8rxwlvnJIpSHk3ZR7YEY0D71H18ED/XUDAlx1yHbRyxxgaC0Z vP/K9q/SLuRp7PmTHeM43nhGaUzswDOkatmHBK3bi7trqiXTIPbAxS0YscRr91f7yVGl EQG57HiRZL18elyPwsBPG58w28FYpDQkTfqJPrRZrwn1WVQr6T+RuGhkNarNdYhH/wDp cdVQ== X-Gm-Message-State: ANoB5pmrj5r4YDSy2H+fA3xZPBzUgP/YRMY9AWCL2pzjmB5ib1iuDy5Y KHc0odlrrNnHdKt7iiOeorncJwi86pt1559g X-Google-Smtp-Source: AA0mqf7WrFz2+t20kQJhmofeUX7HHAdQpRhezP47bPt9yFAev7deM4pcV1sVfHZdoEYPzGHcnMmvMg== X-Received: by 2002:a5d:574c:0:b0:236:71ce:a49e with SMTP id q12-20020a5d574c000000b0023671cea49emr4496152wrw.257.1668781659581; Fri, 18 Nov 2022 06:27:39 -0800 (PST) Received: from localhost ([137.220.119.58]) by smtp.gmail.com with ESMTPSA id o5-20020a05600c510500b003a3442f1229sm9764726wms.29.2022.11.18.06.27.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 18 Nov 2022 06:27:39 -0800 (PST) Message-ID: <8ed59648a36cc2d55db9a822f3cf9023d7805c92.camel@debian.org> Subject: Re: patch 'net/mlx5: fix port event cleaning order' has been queued to stable release 20.11.7 From: Luca Boccassi To: Michael Baum Cc: Matan Azrad , dpdk stable Date: Fri, 18 Nov 2022 14:27:38 +0000 In-Reply-To: References: <20221105171146.1520039-47-luca.boccassi@gmail.com> <20221117230859.611465-1-luca.boccassi@gmail.com> <20221117230859.611465-16-luca.boccassi@gmail.com> Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable User-Agent: Evolution 3.38.3-1+plugin MIME-Version: 1.0 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 Fri, 2022-11-18 at 12:53 +0000, Michael Baum wrote: > Hi Luca, >=20 > This patch causes another issue, so I have sent another patch to squash i= nto. >=20 > The title of this patch is: " [PATCH 20.11] net/mlx5: fix invalid memory = access in port closing" >=20 > Thanks, > Michael Baum Is it a backport gone wrong (or an issue specific to 20.11), or is it an issue also in the same change that went in main? If the latter, what's the commit id of the fix? > > -----Original Message----- > > From: luca.boccassi@gmail.com > > Sent: Friday, 18 November 2022 1:09 > > To: Michael Baum > > Cc: Matan Azrad ; dpdk stable > > Subject: patch 'net/mlx5: fix port event cleaning order' has been queue= d to > > stable release 20.11.7 > >=20 > > External email: Use caution opening links or attachments > >=20 > >=20 > > Hi, > >=20 > > FYI, your patch has been queued to stable release 20.11.7 > >=20 > > 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 sho= ut if > > anyone has objections. > >=20 > > 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 nee= ded 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. > >=20 > > Queued patches are on a temporary branch at: > > https://github.com/kevintraynor/dpdk-stable > >=20 > > This queued commit can be viewed at: > > https://github.com/kevintraynor/dpdk- > > stable/commit/79c37d65d2ff68ccd8dd2ad99340f54c80232918 > >=20 > > Thanks. > >=20 > > Luca Boccassi > >=20 > > --- > > 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 > >=20 > > [ upstream commit 13c5c093905c09bb6207ee1c6a4f05d39f8badcd ] > >=20 > > The shared IB device (sh) has per port data with filed for interrupt ha= ndler > > 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 subh= andler > > installed for specified IB port index. > >=20 > > 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 fo= r each > > port. > > In port creation, the interrupt handler port_id is updated with the cor= rect value. > > Since this updating, the mlx5_dev_interrupt_nl_cb function uses this po= rt and its > > priv structure. > > However, when the ports are closed, this filed isn't updated and the in= terrupt > > handler continue working until it is uninstalled in SH destruction. > > If mlx5_dev_interrupt_nl_cb is called between port closing and SH destr= uction, it > > uses invalid port causing a crash. > >=20 > > This patch adds interrupt handler port_id updating to the close functio= n and add > > memory barrier to make sure it is done before priv reset. > >=20 > > Fixes: 655c3c26c11e ("net/mlx5: fix initial link status detection") > >=20 > > Signed-off-by: Michael Baum > > Acked-by: Matan Azrad > > --- > > =C2=A0drivers/net/mlx5/linux/mlx5_os.c | 3 +++ > > =C2=A0drivers/net/mlx5/mlx5.c | 6 ++++++ > > =C2=A02 files changed, 9 insertions(+) > >=20 > > 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: > > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0return eth_dev; > > =C2=A0error: > > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0if (priv) { > > + priv->sh->port[priv->dev_port - 1].nl_ih_port_id =3D > > + RTE_MAX_= ETHPORTS; > > + rte_io_wmb(); > > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0if (priv->mreg_cp_tbl) > > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= mlx5_hlist_destroy(priv->mreg_cp_tbl); > > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0if (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) > > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0if (!c) > > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= claim_zero(rte_eth_switch_domain_free(priv->domain_id)); > > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0} > > + priv->sh->port[priv->dev_port - 1].nl_ih_port_id =3D RTE_MAX_ET= HPORTS; > > + /* > > + * The interrupt handler port id must be reset before priv is r= eset > > + * since 'mlx5_dev_interrupt_nl_cb' uses priv. > > + */ > > + rte_io_wmb(); > > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0memset(priv, 0, sizeof(= *priv)); > > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0priv->domain_id =3D RTE= _ETH_DEV_SWITCH_DOMAIN_ID_INVALID; > > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0/* > > -- > > 2.34.1 > >=20 > > --- > > =C2=A0=C2=A0Diff 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)