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 9F3A9A0C41; Wed, 17 Nov 2021 15:44:32 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 8AE2E4113D; Wed, 17 Nov 2021 15:44:32 +0100 (CET) Received: from NAM10-DM6-obe.outbound.protection.outlook.com (mail-dm6nam10on2072.outbound.protection.outlook.com [40.107.93.72]) by mails.dpdk.org (Postfix) with ESMTP id 0371040040; Wed, 17 Nov 2021 15:44:31 +0100 (CET) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Wx2PLQ4K2DIHT/n0NKJn1LXGaeDuf+8OeM72Es3egytSUG6SrGPnozo0M7dsxSyVXif3jbwZGQ48eULTz4awJlPyZUPiS8TuUgC3JCk5vtASLIJYI6vB5ciR8sdmKLuUujLX1H8JevNLKWTFiHzXmvH5hV1mpAOEM9cTrHmilJo8LHVm323AjGT83lcsUCOkLnluP/lpbeBO7hhM65vkOwmVoi6FqLIKuUSOaBbXKqAG0rM9keqVEpiYP0rq0SmyoFUxIIZkZdAvspviDJ2xG0pvY+gPbZ5zPwYRZrnDJcJpkqEE9qLUA8+73Ys+2cy2zcj+7LcjZWzm31A54419hw== 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:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=ENvtiQ7m3XeDBT7B+/t9dy4ZGrY5MXuGEyn7/Pj14sY=; b=gFO9RNpcdOPlijKEbDACIOBXmS0rhoxcS7nrMl0JAfrIHE6NZwRBu+QxoJGwFsdR5DM3zpKG0QJv/h3RncFV6k0Yjg14q3JWWebiFVzCosPmFTy2bP+Q0SXhP5PYACDSlTz7Nbr8fjyS2ggrhqIOQ23rZTlOT3OZq4UZxtH/4c2LQX1rc+zKu3L0v0rV7v8H79hjPNDBVO5HWnQj5YL2Cj0O8VbMkdHnWKnJuNDgTKiCYwGiHY256L3M2rzhzis4RN83PCEvid955Td2upekhJUn7OaeRqIH36fI5OTqHOj/wpwnblA/3G+rSkhIbYJuYTzNJA3u0WITmfT2KnxCZg== 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=ENvtiQ7m3XeDBT7B+/t9dy4ZGrY5MXuGEyn7/Pj14sY=; b=S+CAk1M1fpQiyiPf8tW6G9nmO9oq9E0uWRlzbz9LrLHTarKcXge1PFdDcy3e4bOf+LWKMsahgUmrXW5dFw0hmqv0b5U0XpWr3u5iNJgXkMcbORR2ZKVFTD1oAHCQDvpTV/WI00NLzx2cteK+aumm3tTW5Zltma592IDWWC08mDvVMmIqms0HYcNCkY7XvUrk+wwhfe6aO6a1jaUDQoh9D69FqN7NNijmoCv1LosEGbvvk9p3XS1vztJvhAmYnTyRqrUd6MT3GUdTTHEkq7HqWlHFLuFNJtaEbO8QNxlrBiUU26v4zf04GJwamO4NADJLtzssIauXwnXFC4gl53BQSA== Received: from DM4PR12MB5312.namprd12.prod.outlook.com (2603:10b6:5:39d::20) by DM4PR12MB5152.namprd12.prod.outlook.com (2603:10b6:5:393::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4690.18; Wed, 17 Nov 2021 14:44:29 +0000 Received: from DM4PR12MB5312.namprd12.prod.outlook.com ([fe80::7cf5:9d34:fc6b:b4a4]) by DM4PR12MB5312.namprd12.prod.outlook.com ([fe80::7cf5:9d34:fc6b:b4a4%9]) with mapi id 15.20.4713.019; Wed, 17 Nov 2021 14:44:29 +0000 From: Raslan Darawsheh To: Michael Baum , "dev@dpdk.org" CC: Matan Azrad , Slava Ovsiienko , "stable@dpdk.org" Subject: RE: [PATCH] common/mlx5: fix memory leak in Windows dereg MR function Thread-Topic: [PATCH] common/mlx5: fix memory leak in Windows dereg MR function Thread-Index: AQHX26LCMfGDVeHniEi3zeRsVkCLNKwHy84w Date: Wed, 17 Nov 2021 14:44:29 +0000 Message-ID: References: <20211117110255.2060417-1-michaelba@nvidia.com> In-Reply-To: <20211117110255.2060417-1-michaelba@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-office365-filtering-correlation-id: 98d53c6c-b309-458c-f42f-08d9a9d8c2d3 x-ms-traffictypediagnostic: DM4PR12MB5152: x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:519; x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: L2c8s4kUn2jkeMOOd9rXnsgGxLYfTtGzvIVcExQFDQgP+naEMKYpSqH1xkHQdCGf3U3IzH/WCTUwGWP8ScH7Rx+1zDG2yZz80ZwCMS8chUKGH60AW8QpFZSrJbB2gRjNvm4tdwrmiD7r+VM2BoTn3Ze4fpcan6ioqKIpOVpfH5RcPDf/ve+FKYaRNpNNz1vUyrQ7eC8kNtg4wRH3tdC/fnJLiJNpI+V10F1hKcIK8uv9au3SJTZL3G35mrlopKw3n19QH8r+/pvxlss/NRtgERqY8hMvjLCxJZxXF2DEClJkmLjxVSjF9DasDfiEqbHXE5P+JZgQGEC0D+/wBYYJ6zThqcyVegdi1JvcuEddirw75yDhlVzN/qoCeL4L3A+tdPJ8CnSXOyCB51ax1QvkxO6JsMWpOA6IuscWe9QtJ/78G/cgxdCXH3IVISECrSZBlLClj3Y/BWyJBvWs+QhtO1ONjnzyZzGoqronXXDchk9HpJxVhTZxQKTzoEMY9yljcKriyyI7t+VRSA2w5bUFh6FyV3E8T/d2hwZmdlKN7bEUE+jN7qE0blsRmkF51ElqZeHISmm4f/4F8GujYfwogoPHPz1YpWzFaVvhT1vyciskDcdURrcocVT/Ig0eCAJKBcT5XNwDd9ZAhR0DAPTl4eWajvi9uv84m5LWtxN1IX/XT2OYYSFgrh8gagiPsObHC+G+Cs4BUizRG7x+2k8mpw== x-forefront-antispam-report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:DM4PR12MB5312.namprd12.prod.outlook.com; PTR:; CAT:NONE; SFS:(4636009)(366004)(316002)(4326008)(33656002)(450100002)(83380400001)(110136005)(54906003)(76116006)(55016002)(8936002)(86362001)(66476007)(38100700002)(186003)(122000001)(2906002)(64756008)(53546011)(66556008)(66446008)(9686003)(26005)(38070700005)(6506007)(5660300002)(71200400001)(52536014)(7696005)(508600001)(8676002)(66946007); DIR:OUT; SFP:1101; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?us-ascii?Q?40x6X81AES3mejBHTFDVaPMOJMZg74LFWrOh9Xpk/CTe1bnbwdp4CUXfMVLy?= =?us-ascii?Q?Nn5dUntnOC9pMr6ZJSGs53Ounv19f/1S7/Z0NfGcw33pPJTdOrTp34kFUsQL?= =?us-ascii?Q?GJOamEGLxtc7sc3W1vB/FEOkhBlEWn4w9EbaBKsdkiFhQvIOcmna8S9VMTBq?= =?us-ascii?Q?moG34fZCAENzOlJdrZEm5lv4LgjIgaJ5cesLS2y88nX9+vTdRK5aYLfRYo7H?= =?us-ascii?Q?qXDlUXh3TWwtke1XoR3b0/CztAN/2VBvO0PX7wV3XPAPmH7jxwYMT9RaAwAr?= =?us-ascii?Q?Js0w3FLn+xna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XgkHy?= =?us-ascii?Q?Oo9GXRXT6jMJwmUGYjOTR/IUVzWiZpmR2Wr801+VZYym4cMTVhWMarHCCSro?= =?us-ascii?Q?MPQq84hbnMWMYIxL/aYV/45DPiAGy/FaELf1VFikrVCd7x5iRB4LtOEAmt8U?= =?us-ascii?Q?ovJZX0y5ChBTo8uXBsIBpEHTqupdJf4Fhw7wRdtSlCL2CbyX6n80SiZwvuUP?= =?us-ascii?Q?uSbxq3I+8d63dep/EytCRy+lU7T61W4zVUBepJjhm71GgrA0Aa9WKEEqHFY7?= =?us-ascii?Q?Ag1A0EwiDXjg0jvXKBun8yUSVpUpxzIWdlPJv89PBoRZkhTWZTnfZQ3a596d?= =?us-ascii?Q?bmE/1FCWExMGFPI6NlIxwd5qVxjMR9g4klsgLTVHUnYNaF0j9DuF7o6z76us?= =?us-ascii?Q?fUAt4FgC1EZPMpipzHaMTFzTnTXfrKajGzSf3ivQLpf+7KZBlNKl7e229DiM?= =?us-ascii?Q?DieDou5RCyvxpV4t8JqpH7I=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: DM4PR12MB5312.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 98d53c6c-b309-458c-f42f-08d9a9d8c2d3 X-MS-Exchange-CrossTenant-originalarrivaltime: 17 Nov 2021 14:44:29.5291 (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: 7l+BC9NN/lL+QAEXmt31sYtIl3V8JYF63+QZ2h2i/uy+zsclsqeb2XLNYKOCwddVFYjFiakdg36bXOvbUoVK9A== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM4PR12MB5152 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: Michael Baum > Sent: Wednesday, November 17, 2021 1:03 PM > To: dev@dpdk.org > Cc: Matan Azrad ; Raslan Darawsheh > ; Slava Ovsiienko ; Michael > Baum ; stable@dpdk.org > Subject: [PATCH] common/mlx5: fix memory leak in Windows dereg MR > function >=20 > From: Michael Baum >=20 > The "mlx5_devx_cmd_mkey_create" DevX cmd allocates DevX object using > mlx5_malloc and then creates MKey using glue function. > Compatibly, "mlx5_devx_cmd_destroy" cmd releases first the MKey using > glue function, and then free the DevX object using mlx5_free. >=20 > On Windows OS, the reg_mr function creates Mkey using > "mlx5_devx_cmd_mkey_create" cmd, but dereg_mr function using directly > glue function without freeing the object. > This behavior causes memory leak at each MR release. >=20 > In addition, the dereg_mr function makes sure that the MR pointer is > valid before destroying its fields, but always calls the memset function > that makes a difference to it. >=20 > This patch moves the dereg_mr function to use "mlx5_devx_cmd_destroy" > instead of glue function, and extends the validity test to the whole > function. >=20 > Fixes: ba420719823c ("common/mlx5: add reg/dereg MR on Windows") > Cc: stable@dpdk.org >=20 > Signed-off-by: Michael Baum > Acked-by: Matan Azrad Patch applied to next-net-mlx, Kindest regards, Raslan Darawsheh