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 AF3E145CD8; Mon, 18 Nov 2024 11:36:41 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 8121940263; Mon, 18 Nov 2024 11:36:41 +0100 (CET) Received: from NAM11-CO1-obe.outbound.protection.outlook.com (mail-co1nam11on2064.outbound.protection.outlook.com [40.107.220.64]) by mails.dpdk.org (Postfix) with ESMTP id 1498B40150 for ; Mon, 18 Nov 2024 11:36:39 +0100 (CET) ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=pGiO+f3IhYYfvvSMRWUcMAE6AeIXjI0lmhDk24Z2q6omDof7fC7xBy4JMSWYs5G1Kr09MspBrZjYalP+vaOy1OWHMEk5khjFAlnbieF4D9fxoNGB8/R+Z81n0HveFJaKFy3fSLlWXHrdsLKwlDAOZAkNUpo+XdpeH0BEmORJLOHoulA1N14iVA6tWuFDhnz/IcCZgGnHujcIW3wTNiCNAe1m6PMYIYGVEbcCAz1JgPGmQpvIu5Fa/h8p6qVawKMLKDa6mcbsxvg17C/3y6kQ1ztbEvdM8HxtXG/0CHwaidcYCzO0bi7XahzfdH6AdbmHcapMjFYPZ1A8cyp7BDXofg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=d/7iXJakqNoNQEwLCq32Gkh9pT6QnNxkKPJ27rum9rw=; b=gyZPDaylntDXnrE/pV6o/MXDfdclMQu/KgMM8SFRLEPwqZ8lY2oTHrqPAfNsJeVnfPwQR0M/mfgXR5ir3MDJeYAbN5d0GTKJwsLmMQZuhZPCsym2vF4j6VS/KrRrcnygeN8F2sco7vrFvNVu+iHHNCig03zTxWFEI0wOZpSE2+RV47BcidI1EK0OQdUS3Svpfh9imGUEpRFGwWdeOcEHwoSiIOtqd8QHSyp3HieN2ClPEfb3czfZxxQJZQXSA6WEILTWLWaXy1IZvU+kYx3oVJzAo5ptxjFsD4e01PH+WVk0g5TtE6rJBibqn4PSxeTOMU+nkKnLyRQqLvDXbEIxYQ== 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=d/7iXJakqNoNQEwLCq32Gkh9pT6QnNxkKPJ27rum9rw=; b=T6TXH2wS6aIPuO7ls+ggqbUuPGfT2QyQVumVmMYdMKCwSfQuAaXiKHWljjf0YgNvZNLJqFJta8CFR+FuNaoKLWhVOJlZNerYORWzxzyUjLZC1QYJy+Kl87yV58znmc7jptrs37PWGmelqjtjUJFkUff5syzXRCynNOfEXbhxeAhBkAoHjbMEzZh1EFSRxniBT+nLYzxfTnWmu3RMnRHIoGobh0rlzzGUkG7uAC2Vi3qJxFPao3VwbQtbtoyLcRzbgAXcf34ZoO0gw/mh5DelXo/WAVtM7pI18eHDMjF9QF266mBgtMi3m4FGEPC2InoYOJFf8xSYjNswx8hSsNrGoA== Received: from CH3PR12MB8460.namprd12.prod.outlook.com (2603:10b6:610:156::15) by CH3PR12MB7546.namprd12.prod.outlook.com (2603:10b6:610:149::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8158.24; Mon, 18 Nov 2024 10:36:34 +0000 Received: from CH3PR12MB8460.namprd12.prod.outlook.com ([fe80::2e9d:7265:3b84:59b5]) by CH3PR12MB8460.namprd12.prod.outlook.com ([fe80::2e9d:7265:3b84:59b5%5]) with mapi id 15.20.8158.023; Mon, 18 Nov 2024 10:36:34 +0000 From: Dariusz Sosnowski To: Bing Zhao , Slava Ovsiienko , "dev@dpdk.org" , Raslan Darawsheh CC: Ori Kam , Suanming Mou , Matan Azrad , Maayan Kashani Subject: RE: [PATCH] net/mlx5: fix the leak of action data list Thread-Topic: [PATCH] net/mlx5: fix the leak of action data list Thread-Index: AQHbOYaWpHsAhUidG0m5BaG+7mbqHrK8175A Date: Mon, 18 Nov 2024 10:36:34 +0000 Message-ID: References: <20241118065259.250538-1-bingz@nvidia.com> In-Reply-To: <20241118065259.250538-1-bingz@nvidia.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nvidia.com; x-ms-publictraffictype: Email x-ms-traffictypediagnostic: CH3PR12MB8460:EE_|CH3PR12MB7546:EE_ x-ms-office365-filtering-correlation-id: 45cbcea3-dd2c-413d-82e0-08dd07bcdf98 x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; ARA:13230040|376014|1800799024|366016|38070700018; x-microsoft-antispam-message-info: =?us-ascii?Q?Efxbd84+XqDxT+Y8REyopRmjef7fgUM70U3d1a7lXKegH8/NJEqBvizWWR7w?= =?us-ascii?Q?x2uAUD4nuuJFLDLH00cTn3dS2UapiI6RFNndARikdwhkE9Q87gmK42klUN4L?= =?us-ascii?Q?rA+33GcHh5Hl9LAY5YglQp9jDZWaw9xQUWRwc8irqU+MKw6JAPhlpx06BUFD?= =?us-ascii?Q?1byBUGGU5WzHdxlJG/4u90byFlzK8G4JTz4EeQ3IX1N4Y+rXJldf6A6iTqZn?= =?us-ascii?Q?6gS20VzKvYDouLBGly9W7Kwgdg+XquMy8pffFt0iFG4eY/CqGpinkKG/5JxE?= =?us-ascii?Q?Gq0OdsIJxkjUL0hlcEaEG9vc0i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ascii?Q?vZ8p6ncFZAEKAzj6M+XconEQD6W7Imb9aRiDYVVrfbOv470yEhKY9wopS7K2?= =?us-ascii?Q?aQ95jS4DCW7zENFn1LoXth0qZLQmJAijtPJNTbfeeMgbgrNhx1I/DCSqz0mB?= =?us-ascii?Q?hQxzebnpeanaIJErzen8zGgOAV8JhIw0YlzviyS4wkjl1J5v330vkRenowqj?= =?us-ascii?Q?EFMzIEc=3D?= x-forefront-antispam-report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:CH3PR12MB8460.namprd12.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230040)(376014)(1800799024)(366016)(38070700018); DIR:OUT; SFP:1101; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?us-ascii?Q?dsHVmuTA5YPaXhA4pRAaDlPW4XQV/FxfNYB21NucfwRhUG5YU9hzltIuEZr2?= =?us-ascii?Q?ECLvjjp/qsvPpama7l81S5FqcghxrNT1ufTOvMLGjKNyFR2boY4RkQsjyMjO?= =?us-ascii?Q?0sRDOMZ7qHpMYcGh/mluLMPvXgUwge2zBNHJJl7NCsZspQqJ1yzC2gyQnajW?= =?us-ascii?Q?V1lmVyX/5faXST+z9GO13BrEqId9Al2U/x4bN7zharutG26yp3dZFsuozmeD?= =?us-ascii?Q?xYtF6damry/KZxMVCipp1iqiqbkPz2Syeoj/AUDwzkIuxQmqHdOofDkYoI5d?= =?us-ascii?Q?Ggfpx15VeyFhNyOTC2FnWVBVXx5xvhocdaJT6qpyqUJ5R7py6qhP5dUH6sfk?= =?us-ascii?Q?mbDuXUW0hliWtXyRixmh4MgqN4a+xb29Cx6gPCbh1gLEojaPZoeyY2wjZ0dL?= =?us-ascii?Q?iEnpK+B/0d5paam1M4TmqcBXaHpP17JIDhPJl/kzP77Kx6a3549S57/Z9ofK?= =?us-ascii?Q?YaJ8LO1WN3xExguo2YjrNBve1JrGHUejRuNMmohJlpRImXUrSue8rj9naYgv?= =?us-ascii?Q?s11zGjKtwFqeouIw+IkvnrG35MaySWC1F5ulXU7Xd4GmJFthxo79/cZeyIST?= =?us-ascii?Q?Zl+h54zHugersei8nboH23a5mKIfsQtKFFuAsEw6H6BBrbZcCPa2n3uEKzyi?= =?us-ascii?Q?7oENyAPrTO0utEBd324fWtxK2UGTWvInpT4q57HClLYO3biEGYFFBLbdGpdZ?= =?us-ascii?Q?hu0gtgO8fKsmGZU1rwXlUTgV3cCe4VYZkrQxKO3/PnLEOAgrCfX++W7r5L+2?= =?us-ascii?Q?xoBrJRbKbxfgAIQNMSPTXNEjuSa54RDp679Rw21MmqlK9xhEN7O+ZPryvKwr?= =?us-ascii?Q?JJ5KxJXnviEIf2RT1EjDXsUxt0KL3q5vcJ5MPVlIPj4quXjKHqz++TNoRNyy?= =?us-ascii?Q?ehxm2Kn/mNGisnZwgRNN102tnnaPI108pPo3fk41s7kBpvKpL24CNL5hBPUm?= =?us-ascii?Q?IdgUEgUwVtsYFguk8bZY4f566JIXpjJEYYGk+5yCpMoJgAqxFIj57qFtExWV?= =?us-ascii?Q?KaQXe5nf7BgPwOpTFjMWkNgHFSOr3uX7MFj080Euxc++pcKFEAQoyEnpRSWQ?= =?us-ascii?Q?dV5PkynyOiRGzWAdlq6cXSD9ZKmNfMSmTg65P1pf1l9B7D/4SV7Jri6WdLoo?= =?us-ascii?Q?2S2ahVn+RB0Z29M2GPpK9v61Fvu2SxFoPzra6s9wp70yOC7MaQMQrbvVOErP?= =?us-ascii?Q?wOz1LL/m3D89T3ldSgl+D6OzKV2pluid+y/krT49ndrKNYxlkMSHxSFUFH+u?= =?us-ascii?Q?wLzq1DlAOB6V0BCHP/o147QopbhtGmxf84ZGU6kRKDonP/rLwycd6TV9BON0?= =?us-ascii?Q?RgbGsLtqsQ+lcWFK+R/jHEYRbfzUwM95wheoBdpvKTReNFvWvLy3773OvFZY?= =?us-ascii?Q?xfVVPFJcTNGazkUvZlD5CdMOmQos2wM0MR+BaYy9FFN8ghyJpD6pzFkS7UH8?= =?us-ascii?Q?HByvO5G8JpzSxKcA5JhtsXkUw8jmP1S0aHpG3lySqUaAOJPfQR9xzbb/bWbT?= =?us-ascii?Q?Vs7UyJEpcuMQSfUpg6p/lUQrjguInVfGXKH1KYHvH1uN+Qj8/tRcU7yFWii1?= =?us-ascii?Q?SQf1MUWawyxUeZ9SvNo=3D?= 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: CH3PR12MB8460.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 45cbcea3-dd2c-413d-82e0-08dd07bcdf98 X-MS-Exchange-CrossTenant-originalarrivaltime: 18 Nov 2024 10:36:34.2635 (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: nyBYVyHw2LVq4Bk7JjmYLQUq08WpDY4zPnKk5zXo9O77UrwXW0UTwk/x1Vrx3KYwM28MKLiKn2wJBJ5j8jY3iQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: CH3PR12MB7546 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 Hi, > -----Original Message----- > From: Bing Zhao > Sent: Monday, November 18, 2024 07:53 > To: Dariusz Sosnowski ; Slava Ovsiienko > ; dev@dpdk.org; Raslan Darawsheh > > Cc: Ori Kam ; Suanming Mou ; > Matan Azrad ; Maayan Kashani > > Subject: [PATCH] net/mlx5: fix the leak of action data list >=20 > In the actions construction of NT2HWS, the `masks` parameter is always se= t to > NULL and all the actions will be translated in the "construct" stage as n= on-fixed > ones. Please replace NT2HWS in commit message with "non-template flow API". >=20 > In the stage of translating actions template, the actions data would be > allocated from the pool and managed in a list. The list would be released= when > destroying the template with the actions. In the NT2HWS implementation, t= he > temporary template was freed directly and the actions will be destroyed w= ith > the flow rule deletion. No other rule would use this list anymore. >=20 > The actions data in the list should be freed when the actions constructio= n is > done. >=20 > Fixes: ff4064d5b1fe ("net/mlx5: support bulk actions in non-template flow= ") > Cc: mkashani@nvidia.com >=20 > Signed-off-by: Bing Zhao > --- > drivers/net/mlx5/mlx5_flow_hw.c | 63 ++++++++++++++++++++------------- > 1 file changed, 39 insertions(+), 24 deletions(-) >=20 > diff --git a/drivers/net/mlx5/mlx5_flow_hw.c > b/drivers/net/mlx5/mlx5_flow_hw.c index 50dbaa27ab..7233ac46c4 100644 > --- a/drivers/net/mlx5/mlx5_flow_hw.c > +++ b/drivers/net/mlx5/mlx5_flow_hw.c > @@ -966,18 +966,15 @@ __flow_hw_actions_release(struct rte_eth_dev > *dev, struct mlx5_hw_actions *acts) } >=20 > /** > - * Destroy DR actions created by action template. > - * > - * For DR actions created during table creation's action translate. > - * Need to destroy the DR action when destroying the table. > + * Release the action data back into the pool without destory any action= . > * > * @param[in] dev > * Pointer to the rte_eth_dev structure. > * @param[in] acts > * Pointer to the template HW steering DR actions. > */ > -static void > -__flow_hw_action_template_destroy(struct rte_eth_dev *dev, struct > mlx5_hw_actions *acts) > +static inline void > +__flow_hw_act_data_flush(struct rte_eth_dev *dev, struct > +mlx5_hw_actions *acts) > { > struct mlx5_priv *priv =3D dev->data->dev_private; > struct mlx5_action_construct_data *data; @@ -987,7 +984,23 @@ > __flow_hw_action_template_destroy(struct rte_eth_dev *dev, struct > mlx5_hw_action > LIST_REMOVE(data, next); > mlx5_ipool_free(priv->acts_ipool, data->idx); > } > +} >=20 > +/* > + * Destroy DR actions created by action template. > + * > + * For DR actions created during table creation's action translate. > + * Need to destroy the DR action when destroying the table. > + * > + * @param[in] dev > + * Pointer to the rte_eth_dev structure. > + * @param[in] acts > + * Pointer to the template HW steering DR actions. > + */ > +static void > +__flow_hw_action_template_destroy(struct rte_eth_dev *dev, struct > +mlx5_hw_actions *acts) { > + __flow_hw_act_data_flush(dev, acts); > __flow_hw_actions_release(dev, acts); > } >=20 > @@ -13492,14 +13505,14 @@ flow_nta_build_template_mask(const struct > rte_flow_action actions[], >=20 > static int > flow_hw_translate_flow_actions(struct rte_eth_dev *dev, > - const struct rte_flow_attr *attr, > - const struct rte_flow_action actions[], > - struct rte_flow_hw *flow, > - struct mlx5_flow_hw_action_params *ap, > - struct mlx5_hw_actions *hw_acts, > - uint64_t item_flags, uint64_t action_flags, > - bool external, > - struct rte_flow_error *error) > + const struct rte_flow_attr *attr, > + const struct rte_flow_action actions[], > + struct rte_flow_hw *flow, > + struct mlx5_flow_hw_action_params *ap, > + struct mlx5_hw_actions *hw_acts, > + uint64_t item_flags, uint64_t action_flags, > + bool external, > + struct rte_flow_error *error) > { > int ret =3D 0; > uint32_t src_group =3D 0; > @@ -13542,7 +13555,7 @@ flow_hw_translate_flow_actions(struct > rte_eth_dev *dev, > table =3D mlx5_malloc(MLX5_MEM_ZERO, sizeof(*table), 0, > SOCKET_ID_ANY); > if (!table) > return rte_flow_error_set(error, ENOMEM, > RTE_FLOW_ERROR_TYPE_ACTION, > - actions, "Failed to allocate dummy > table"); > + actions, "Failed to allocate > dummy table"); > at =3D __flow_hw_actions_template_create(dev, &template_attr, > actions, masks, true, error); > if (!at) { > ret =3D -rte_errno; > @@ -13556,27 +13569,29 @@ flow_hw_translate_flow_actions(struct > rte_eth_dev *dev, > memcpy(&table->cfg.attr.flow_attr, attr, sizeof(*attr)); > table->ats[0].action_template =3D at; > ret =3D __flow_hw_translate_actions_template(dev, &table->cfg, > hw_acts, at, > - &table->mpctx, true, error); > + &table->mpctx, true, > error); > if (ret) > goto end; > /* handle bulk actions register. */ > ret =3D flow_hw_encap_decap_resource_register(dev, table, hw_acts, > flow, error); > if (ret) > - goto clean_up; > + goto end; > ret =3D flow_hw_modify_hdr_resource_register(dev, table, hw_acts, > flow, error); > if (ret) > - goto clean_up; > + goto end; > table->ats[0].acts =3D *hw_acts; > ret =3D flow_hw_actions_construct(dev, flow, ap, > - &table->ats[0], item_flags, table, > - actions, hw_acts->rule_acts, 0, error); > + &table->ats[0], item_flags, table, > + actions, hw_acts->rule_acts, 0, > error); > if (ret) > - goto clean_up; > + goto end; > goto end; > -clean_up: > - /* Make sure that there is no garbage in the actions. */ > - __flow_hw_action_template_destroy(dev, hw_acts); > end: > + if (ret) > + /* Make sure that there is no garbage in the actions. */ > + __flow_hw_action_template_destroy(dev, hw_acts); > + else > + __flow_hw_act_data_flush(dev, hw_acts); > if (table) > mlx5_free(table); > if (at) > -- > 2.34.1 Best regards, Dariusz Sosnowski