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 C1722A0C4D; Sun, 5 Sep 2021 10:53:59 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 8785340042; Sun, 5 Sep 2021 10:53:59 +0200 (CEST) Received: from NAM10-MW2-obe.outbound.protection.outlook.com (mail-mw2nam10on2078.outbound.protection.outlook.com [40.107.94.78]) by mails.dpdk.org (Postfix) with ESMTP id 13B264003D; Sun, 5 Sep 2021 10:53:58 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=CFnQPVfkdUjjpTtoOUoxFoGNB+lm9V2WE7olLAJfeKzU6MBV5rtL4LwkpYY0mnSNlvmI/ly7AgKkpIiFrm1F3G+czPKPEM3o6m/6HDCBMoG5vqMatv1sTpemPj8GUOnNfkAFWH5B4bdldW58ha3sDiB42OdKhtyL3btPjpfXzEhzghTQ81WTxPFHnlSf9X5bUkP0ufOCqgi8/efIj/3/7iZ3sCAD0GUcQZ+p7RWiWsGx35kD4xMkovpTp+yyNyJSBrlMFNbu+MCjVqiuojst1qBRIAiKONdP3/NE+QBiJRB/55V6Buh+xjAC2ACZc5nbE+quamyhf9+LNypcPU/Cow== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=Na12DQsAy7TZEeJRq1I3usUd0LTXQa+XOBbZQStAWdI=; b=ZDTB5Vn80+J+YB1HO1r7ZSp/4qyel2O/mTZTvfGUE8Ur6HNgpBvXeyz5rNvqWO0NY6Sk5A8fzH9lRhNFKdHAQVqd2OqGhcx/0gLF97CPXArH5bUy4DQpeavxXVwhkcpYlrpw8XHvR4qbqvarhm1qDldglxfPGWkLjgsU9ckTf0nx1aH2q0cQxGnjKLKAn4Acw/bnPlPY3UGX0UkF5FCJAZaC21FSLYhzAIy3d1Q7Vl1pvjMpaRjs06VQP9lVoB/SU1ozolYgjnHGR4iS3iiz6hO4pmNklzBZ5TeemFw2OeEbZ9m63P0dfrVvc39T4Xg3yERSiWGk6Hj7nGDkq7Mi/w== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nvidia.com; dmarc=pass action=none header.from=nvidia.com; dkim=pass header.d=nvidia.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Nvidia.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=Na12DQsAy7TZEeJRq1I3usUd0LTXQa+XOBbZQStAWdI=; b=CQGB6IoUUzZOg8mjVZCjHKFSTSBiyz9gz1uQLbJhDbM0GrdPgi0Pu1Uwoe5cMRV7plGS5NJTsl1shXPkzVfbhRBR4+yMwPPzSjjS/FUPrDbm/0OaFGhGDyzMYbjpEhSXpCNtP/eOBmpNBfH5RshoYISXIYOu1MoximaBHPmQDQog7rYN/7z1l3Lpv2M240KJUwSi+orHbVsFaSJ+n/vC3EsOKkp2GaEaFs2wpsa9ZMOjFjdOsEROpkvIph4yUg7XmDnB4UhwcZ4lzaJ9ro4gYqsgAab2anwxT7jDV9zN8I8CdGsOB78y2L9BF29d7nqQYcqrz23frSu9yoPmzcIf2g== Received: from DM4PR12MB5054.namprd12.prod.outlook.com (2603:10b6:5:389::24) by DM4PR12MB5247.namprd12.prod.outlook.com (2603:10b6:5:39b::8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4478.20; Sun, 5 Sep 2021 08:53:55 +0000 Received: from DM4PR12MB5054.namprd12.prod.outlook.com ([fe80::1938:4176:69c6:d14d]) by DM4PR12MB5054.namprd12.prod.outlook.com ([fe80::1938:4176:69c6:d14d%7]) with mapi id 15.20.4478.025; Sun, 5 Sep 2021 08:53:55 +0000 From: Raslan Darawsheh To: Michael Baum , "dev@dpdk.org" CC: Matan Azrad , Slava Ovsiienko , "stable@dpdk.org" Thread-Topic: [PATCH 2/6] net/mlx5: fix PCI probing error flow Thread-Index: AQHXnqgbFIFCScLBfEWbjTp9/5QyBauVJ7rA Date: Sun, 5 Sep 2021 08:53:55 +0000 Message-ID: References: <20210831203732.3411134-1-michaelba@nvidia.com> <20210831203732.3411134-3-michaelba@nvidia.com> In-Reply-To: <20210831203732.3411134-3-michaelba@nvidia.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: authentication-results: nvidia.com; dkim=none (message not signed) header.d=none;nvidia.com; dmarc=none action=none header.from=nvidia.com; x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: 125a6568-74f8-4c2f-b415-08d9704ab184 x-ms-traffictypediagnostic: DM4PR12MB5247: x-ms-exchange-transport-forked: True x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:2582; x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: bVoQ9FI4ny2cRwZ7Zl93MHcNnfmYsT9oHYcXvwsv9n7jva9E3D82dySp6SpsvQ/9rsYQR0t3+H5q/gsL3OYOhCN7gnIl+Z3lhh5XxHHoOOBjlSRKhfHeNNraYTBEg4VlkkntuJkjUqsJiYupfpxUtrzIq4oJpkG1389wERYCCkl7soLiVUhMkNsmal3yHATFjKScml090w98T8FrUySfikg7COxGQGtbwrM1yTwLvMJLAof1qrabp8vxe9TswD3K+vzOMnT/3TC7jVlxM5yKzPkdC9cMNY1ili48DxXByKjEGibY3iSUYUihua7mztN10CSl49y/O+HM6wZjGFJ/CU80Djtmcdidq/Gzsn5xKOnyWYooUI3RBOi62N9znZSP31fh2u1QbCCSJgrdNpngaqgGbX0FbFSX6yMcUejTqU/nUivqouUeTBhdE5lbzQQcgqcYMxzSGTILIS/kCzZuUaQnd4cArXlp6vQTvBpuXXEg9IIxpe60PPbGeD0jbcz3IS54hZf8SC4TmZ25zyM+aCrVD9fXYWkw4OHyM97MBuqmkkhNwXokU0TwwFJck7VOY234jmZYq8DTp29V5lyjcOmf0lIT87o8elnB36kyJsrY6ORcPIH9HvNA6fJVXrnMiEl3alStFUKXtJlJMEvrvQ/pU+lejPSiJm19yILocvx0nEzbz6pHljfR0RIA1Hk+uoK9PXfdgMaWLKHwXszfGw== x-forefront-antispam-report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:DM4PR12MB5054.namprd12.prod.outlook.com; PTR:; CAT:NONE; SFS:(4636009)(396003)(366004)(136003)(346002)(39860400002)(376002)(110136005)(7696005)(450100002)(66946007)(66476007)(55016002)(316002)(33656002)(52536014)(54906003)(4326008)(86362001)(53546011)(38100700002)(66446008)(186003)(9686003)(2906002)(26005)(478600001)(6506007)(38070700005)(76116006)(66556008)(122000001)(83380400001)(8676002)(64756008)(5660300002)(8936002)(71200400001); DIR:OUT; SFP:1101; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?us-ascii?Q?96jBl+i4Fg8EI/7OtNgu84KmpRJiyAYb1Xljfe/4EBA+EWGFkNkq8AMnXfhq?= =?us-ascii?Q?VHwC6QxRy81s40XF1rwROb1e92FE56blaFlRx2cOVlynAGXFd02JAcZWEumL?= =?us-ascii?Q?9YSmO3WO1pXGEzGhaCzAAbEhtxIbn7S3/HM/K8RHysp7EbbpLRnHC5w4BnEL?= =?us-ascii?Q?4zhJly52ExjHOsfgGUIWiP1C3AVbSA3yPo2Ure4CYzw2b+Jbb+siF1xf3j9j?= =?us-ascii?Q?5t37BDnOKjaLs6qI8fDxri3JT/Y7ALBNqmvEckYIAyDFaUc40RV8stUgk5Us?= =?us-ascii?Q?lOtQmWOPHTPIn/7aQn8cJsge3eaMOePHjRHwYOM5P9XZg3ZuqJ2nMJkjgTfl?= =?us-ascii?Q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0jHM33uC8TwYiC?= =?us-ascii?Q?wDHzzbABx8IKem5Uo4QNt0rUs+y9zmN+HowTNJVLKszu0ChKY2X0pYPzaPSq?= =?us-ascii?Q?96ziim91k9Ts6xwQ+66f/rJj?= Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: DM4PR12MB5054.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 125a6568-74f8-4c2f-b415-08d9704ab184 X-MS-Exchange-CrossTenant-originalarrivaltime: 05 Sep 2021 08:53:55.7014 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: ILpC7v5IdroooMJpFsmTOUPOcOh3iSaZd1NZMOrXOhm828l5MKkS6HmeMGhhpWUrwFUtGO1inUztYt44xt3bUw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM4PR12MB5247 Subject: Re: [dpdk-dev] [PATCH 2/6] net/mlx5: fix PCI probing error flow X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" Hi, > -----Original Message----- > From: Michael Baum > Sent: Tuesday, August 31, 2021 11:37 PM > To: dev@dpdk.org > Cc: Matan Azrad ; Raslan Darawsheh > ; Slava Ovsiienko ; > stable@dpdk.org > Subject: [PATCH 2/6] net/mlx5: fix PCI probing error flow >=20 How about changing to something like this: Fix memory leak in PCI prob > In PCI probing, there is internal probe function that is called several t= imes for > several PFs. During PCI probe, the internal probe function is called per PF. >=20 > When one of them fails, the previous PFs are not destroyed what may cause > a memory leak. If one of them fails, it was missing a prober destroy for the previously pr= obed PFs >=20 > Destroy them. This fixes the behavior by destroying all previously probed PF's >=20 > Fixes: 08c2772fc747 ("net/mlx5: support list of representor PF") > Cc: stable@dpdk.org >=20 > Signed-off-by: Michael Baum > --- > drivers/net/mlx5/linux/mlx5_os.c | 13 ++++++++++++- > drivers/net/mlx5/mlx5.c | 2 +- > drivers/net/mlx5/mlx5.h | 1 + > 3 files changed, 14 insertions(+), 2 deletions(-) >=20 > diff --git a/drivers/net/mlx5/linux/mlx5_os.c > b/drivers/net/mlx5/linux/mlx5_os.c > index 5f8766aa48..3d204f99f7 100644 > --- a/drivers/net/mlx5/linux/mlx5_os.c > +++ b/drivers/net/mlx5/linux/mlx5_os.c > @@ -2700,9 +2700,20 @@ mlx5_os_pci_probe(struct rte_pci_device > *pci_dev) >=20 > if (eth_da.nb_ports > 0) { > /* Iterate all port if devargs pf is range: "pf[0-1]vf[...]". */ > - for (p =3D 0; p < eth_da.nb_ports; p++) > + for (p =3D 0; p < eth_da.nb_ports; p++) { > ret =3D mlx5_os_pci_probe_pf(pci_dev, ð_da, > eth_da.ports[p]); > + if (ret) > + break; > + } > + if (ret) { > + DRV_LOG(ERR, "Probe of PCI device " PCI_PRI_FMT " > " > + "aborted due to proding failure of PF %u", > + pci_dev->addr.domain, pci_dev->addr.bus, > + pci_dev->addr.devid, pci_dev- > >addr.function, > + eth_da.ports[p]); > + mlx5_net_remove(&pci_dev->device); > + } > } else { > ret =3D mlx5_os_pci_probe_pf(pci_dev, ð_da, 0); > } > diff --git a/drivers/net/mlx5/mlx5.c b/drivers/net/mlx5/mlx5.c index > f0ec2d1279..02ea2e781e 100644 > --- a/drivers/net/mlx5/mlx5.c > +++ b/drivers/net/mlx5/mlx5.c > @@ -2386,7 +2386,7 @@ mlx5_eth_find_next(uint16_t port_id, struct > rte_device *odev) > * @return > * 0 on success, the function cannot fail. > */ > -static int > +int > mlx5_net_remove(struct rte_device *dev) { > uint16_t port_id; > diff --git a/drivers/net/mlx5/mlx5.h b/drivers/net/mlx5/mlx5.h index > e02714e231..3581414b78 100644 > --- a/drivers/net/mlx5/mlx5.h > +++ b/drivers/net/mlx5/mlx5.h > @@ -1483,6 +1483,7 @@ int mlx5_udp_tunnel_port_add(struct rte_eth_dev > *dev, > struct rte_eth_udp_tunnel *udp_tunnel); > uint16_t mlx5_eth_find_next(uint16_t port_id, struct rte_device *odev); = int > mlx5_dev_close(struct rte_eth_dev *dev); > +int mlx5_net_remove(struct rte_device *dev); > bool mlx5_is_hpf(struct rte_eth_dev *dev); bool mlx5_is_sf_repr(struct > rte_eth_dev *dev); void mlx5_age_event_prepare(struct > mlx5_dev_ctx_shared *sh); > -- > 2.25.1