From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by dpdk.space (Postfix) with ESMTP id 6BA1EA05D3 for ; Tue, 23 Apr 2019 22:13:48 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 4752F1B101; Tue, 23 Apr 2019 22:13:48 +0200 (CEST) Received: from EUR04-DB3-obe.outbound.protection.outlook.com (mail-eopbgr60058.outbound.protection.outlook.com [40.107.6.58]) by dpdk.org (Postfix) with ESMTP id 4E21F7D4A for ; Tue, 23 Apr 2019 22:13:47 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Mellanox.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=Ss61fBLnM06JANlLAucPnlehcjJAutKeNB1VU1hMWiE=; b=L9ZVA/l8kjQgeXIXPlvCALjvliSWcv+AgnSe8vn3xwUk9v57yGrw+HXxTW5i7t3EO9R805rmgMxwXMD+mmTFsjmFW/1uIRRZ/oe0UvQ3Lap6c2fAGYEh23DZ4Y4Rx0ucnNq6Lp0aaqt13xNm5oc7Vxh1bzw3sOYekA6ugV1jW4M= Received: from DB3PR0502MB3980.eurprd05.prod.outlook.com (52.134.72.27) by DB3PR0502MB3993.eurprd05.prod.outlook.com (52.134.70.154) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1813.16; Tue, 23 Apr 2019 20:13:46 +0000 Received: from DB3PR0502MB3980.eurprd05.prod.outlook.com ([fe80::e8d5:4aff:902d:6e98]) by DB3PR0502MB3980.eurprd05.prod.outlook.com ([fe80::e8d5:4aff:902d:6e98%5]) with mapi id 15.20.1835.010; Tue, 23 Apr 2019 20:13:46 +0000 From: Yongseok Koh To: "Burakov, Anatoly" CC: Herakliusz Lipiec , "shafafs@mellanox.com" , "dev@dpdk.org" Thread-Topic: [dpdk-dev] [PATCH 8/8] ipc: fix net/mlx5 memleak Thread-Index: AQHU9Sv3c7FJmMCo+UGMLgfsf7sqx6ZIfb2AgADvlACAAMpxAA== Date: Tue, 23 Apr 2019 20:13:45 +0000 Message-ID: References: <20190417144436.24216-1-herakliusz.lipiec@intel.com> In-Reply-To: Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: authentication-results: spf=none (sender IP is ) smtp.mailfrom=yskoh@mellanox.com; x-originating-ip: [69.181.245.183] x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: ca947fbd-c957-4219-aa91-08d6c82830a8 x-ms-office365-filtering-ht: Tenant x-microsoft-antispam: BCL:0; PCL:0; RULEID:(2390118)(7020095)(4652040)(8989299)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(5600141)(711020)(4605104)(4618075)(2017052603328)(7193020); SRVR:DB3PR0502MB3993; x-ms-traffictypediagnostic: DB3PR0502MB3993: x-ms-exchange-purlcount: 2 x-microsoft-antispam-prvs: x-forefront-prvs: 0016DEFF96 x-forefront-antispam-report: SFV:NSPM; SFS:(10009020)(366004)(39860400002)(136003)(396003)(346002)(376002)(189003)(199004)(43544003)(8936002)(256004)(25786009)(45080400002)(76176011)(97736004)(83716004)(66066001)(102836004)(26005)(53546011)(14454004)(14444005)(966005)(33656002)(7736002)(6506007)(229853002)(71190400001)(71200400001)(478600001)(6486002)(6436002)(68736007)(5660300002)(446003)(82746002)(11346002)(6512007)(305945005)(53936002)(91956017)(6306002)(86362001)(64756008)(316002)(2906002)(36756003)(2616005)(8676002)(486006)(476003)(6916009)(4326008)(73956011)(99286004)(66946007)(66556008)(66446008)(66476007)(186003)(6246003)(6116002)(81156014)(76116006)(81166006)(54906003)(3846002); DIR:OUT; SFP:1101; SCL:1; SRVR:DB3PR0502MB3993; H:DB3PR0502MB3980.eurprd05.prod.outlook.com; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; MX:1; A:1; received-spf: None (protection.outlook.com: mellanox.com does not designate permitted sender hosts) x-ms-exchange-senderadcheck: 1 x-microsoft-antispam-message-info: a7g9Rh8PZSzslkGSeBpN0wpj+YBgLWpiV3Z8EfEYCkPpetevyoPutewL33mfo9F6c4SnEQawBlRuoQONI1OiaWjwu8ci08228atBtS4IJ+hp0zh2R9vJK9c5gBdXIOnphHt6n7CjJoUk5G3UUZgOPDfxVPAVX8W1RwXK5Di1ycnMF+gzJQv824hGTRY6TiKHOlMy6SOSv90p/oqFhrr5rHRu0VIMoL60IDaAgypA23MJJVQ1YckNlnrQHTdP2fHK5UgWgymjkopp2gOWKoRKfT07rNXEFaTxcaE5CqWkZ1//KbPLLS7xZzqZYM8u0Hm51Z+QnkFKjaa3zyiloZNHEYZAZxlF5ckp9tIaqaJhb+YaN6Y1UUhZ+9sdSqUYkO/dEGeTOdpvcZlyHX6Wt3kUhJGdpEjIzwZNc9S3ix25K3U= Content-Type: text/plain; charset="UTF-8" Content-ID: Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-OriginatorOrg: Mellanox.com X-MS-Exchange-CrossTenant-Network-Message-Id: ca947fbd-c957-4219-aa91-08d6c82830a8 X-MS-Exchange-CrossTenant-originalarrivaltime: 23 Apr 2019 20:13:45.9020 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: a652971c-7d2e-4d9b-a6a4-d149256f461b X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB3PR0502MB3993 Subject: Re: [dpdk-dev] [PATCH 8/8] ipc: fix net/mlx5 memleak X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 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" Message-ID: <20190423201345._uVdEGOWG8esw7kITuTrPenTGmrkbI0rGoaleKCQO30@z> > On Apr 23, 2019, at 1:09 AM, Burakov, Anatoly = wrote: >=20 > On 22-Apr-19 6:51 PM, Yongseok Koh wrote: >>> On Apr 17, 2019, at 7:44 AM, Herakliusz Lipiec wrote: >>>=20 >>> When sending multiple requests, rte_mp_request_sync >>> can succeed sending a few of those requests, but then >>> fail on a later one and in the end return with rc=3D-1. >>> The upper layers - e.g. device hotplug - currently >>> handles this case as if no messages were sent and no >>> memory for response buffers was allocated, which is >>> not true. Fixed by always freeing reply message buffers. >>>=20 >>> Fixes: 9a8ab29b84d3 ("net/mlx5: replace IPC socket with EAL API") >>> Fixes: c18cf501a7af ("net/mlx5: enable secondary process to register DM= A memory") >>> Cc: yskoh@mellanox.com >>> Signed-off-by: Herakliusz Lipiec >>> --- >>> drivers/net/mlx5/mlx5_mp.c | 4 +++- >>> 1 file changed, 3 insertions(+), 1 deletion(-) >>>=20 >>> diff --git a/drivers/net/mlx5/mlx5_mp.c b/drivers/net/mlx5/mlx5_mp.c >>> index cea74adb6..c9915b1d5 100644 >>> --- a/drivers/net/mlx5/mlx5_mp.c >>> +++ b/drivers/net/mlx5/mlx5_mp.c >>> @@ -258,6 +258,7 @@ mlx5_mp_req_mr_create(struct rte_eth_dev *dev, uint= ptr_t addr) >>> if (ret) { >>> DRV_LOG(ERR, "port %u request to primary process failed", >>> dev->data->port_id); >>> + free(mp_rep.msgs); >>> return -rte_errno; >>> } >>> assert(mp_rep.nb_received =3D=3D 1); >>> @@ -295,7 +296,8 @@ mlx5_mp_req_verbs_cmd_fd(struct rte_eth_dev *dev) >>> if (ret) { >>> DRV_LOG(ERR, "port %u request to primary process failed", >>> dev->data->port_id); >>> - return -rte_errno; >>> + ret =3D -rte_errno; >>> + goto exit; >> These two requests will be made by a secondary process targeting to the = primary. >> Then, there's only one request in this case and we don't need to take ca= re of that. >> Right? >> Same comment for mlx4. >=20 > Hi Yongseok, >=20 > mp_rep.msgs is potentially allocated regardless of whether you're in prim= ary or secondary, and whether the call to mp_request_sync succeeded or fail= ed. Hence, need to free in all cases. Then, it looks fine to me. >=20 > See this patch: https://eur03.safelinks.protection.outlook.com/?url=3Dhtt= p%3A%2F%2Fpatches.dpdk.org%2Fpatch%2F52868%2F&data=3D02%7C01%7Cyskoh%40= mellanox.com%7C007b61ef9d964dc79e7108d6c7c2f9d8%7Ca652971c7d2e4d9ba6a4d1492= 56f461b%7C0%7C0%7C636916037564345993&sdata=3DO%2BoG%2F8P8cXwKS%2FDfZyMi= G3CiIDpeXe3dPMJgVilzFWY%3D&reserved=3D0 > and this bug: https://eur03.safelinks.protection.outlook.com/?url=3Dhttps= %3A%2F%2Fbugs.dpdk.org%2Fshow_bug.cgi%3Fid%3D228&data=3D02%7C01%7Cyskoh= %40mellanox.com%7C007b61ef9d964dc79e7108d6c7c2f9d8%7Ca652971c7d2e4d9ba6a4d1= 49256f461b%7C0%7C0%7C636916037564345993&sdata=3DjLA5wLqT%2BfW3p79rg2SVE= Z16GS37dgqdF4NwmiRU%2B7A%3D&reserved=3D0 >=20 >> Thanks, >> Yongseok >>> } >>> assert(mp_rep.nb_received =3D=3D 1); >>> mp_res =3D &mp_rep.msgs[0]; >>> --=20 >>> 2.17.2 >>>=20 >=20 >=20 > --=20 > Thanks, > Anatoly