From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from EUR01-VE1-obe.outbound.protection.outlook.com (mail-eopbgr140051.outbound.protection.outlook.com [40.107.14.51]) by dpdk.org (Postfix) with ESMTP id 028B61B445 for ; Mon, 22 Apr 2019 19:51:44 +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=qMznU8SMjFUC+yaxStpvJr1Cm0R0eQKaA5JDTlQNo8I=; b=TiSR9UpKg+mtekMQYw6eG/MLrtZ4jHkHwIZ/Xj4hmri7WlByQqudkUDtrZBrFZx/cv5mtqCdJkSSqOtrh0LFUm/VE8vXQAPgkIWdB9QsCCD5i5Tz7N8/+QqINDXq/XL/k8pOKchtTxGwjNAWEMIw4wrgQ9m2NfdDRwqTJ7I9hfw= Received: from DB3PR0502MB3980.eurprd05.prod.outlook.com (52.134.72.27) by DB3PR0502MB4025.eurprd05.prod.outlook.com (52.134.68.25) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1813.18; Mon, 22 Apr 2019 17:51:42 +0000 Received: from DB3PR0502MB3980.eurprd05.prod.outlook.com ([fe80::6072:43be:7c2d:103a]) by DB3PR0502MB3980.eurprd05.prod.outlook.com ([fe80::6072:43be:7c2d:103a%3]) with mapi id 15.20.1813.017; Mon, 22 Apr 2019 17:51:42 +0000 From: Yongseok Koh To: Herakliusz Lipiec CC: "shafafs@mellanox.com" , "dev@dpdk.org" Thread-Topic: [PATCH 8/8] ipc: fix net/mlx5 memleak Thread-Index: AQHU9Sv3c7FJmMCo+UGMLgfsf7sqx6ZIfb2A Date: Mon, 22 Apr 2019 17:51:42 +0000 Message-ID: References: <20190417144436.24216-1-herakliusz.lipiec@intel.com> In-Reply-To: <20190417144436.24216-1-herakliusz.lipiec@intel.com> 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: [209.116.155.178] x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: 6ce910c5-21fe-4bfb-e3bf-08d6c74b2de2 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:DB3PR0502MB4025; x-ms-traffictypediagnostic: DB3PR0502MB4025: x-microsoft-antispam-prvs: x-forefront-prvs: 00159D1518 x-forefront-antispam-report: SFV:NSPM; SFS:(10009020)(376002)(346002)(39860400002)(396003)(136003)(366004)(43544003)(199004)(189003)(486006)(66446008)(186003)(66476007)(64756008)(66066001)(478600001)(97736004)(54906003)(66556008)(26005)(86362001)(476003)(2616005)(11346002)(446003)(91956017)(76116006)(71200400001)(73956011)(71190400001)(99286004)(82746002)(83716004)(66946007)(102836004)(6506007)(53546011)(14454004)(5660300002)(76176011)(81166006)(6512007)(8676002)(3846002)(6116002)(6246003)(256004)(2906002)(14444005)(53936002)(8936002)(4326008)(33656002)(68736007)(25786009)(316002)(7736002)(305945005)(6916009)(229853002)(36756003)(6486002)(6436002)(81156014); DIR:OUT; SFP:1101; SCL:1; SRVR:DB3PR0502MB4025; H:DB3PR0502MB3980.eurprd05.prod.outlook.com; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; A:1; MX: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: lFaAsLmZQD3kvtbK+juma26pi97hcbykQRhZujWVBG/3/UWSMs+uRIM2DLAdDnauwpiOKCm/0d17zo2oTJXZs+pnIiJrvS4zREDqhP/8w1ABQdcgfmGTOBRKlp+/7j5DA87oHTeYws44bjsX0eHUiMPcoI7Wcsk1/JvrCPJDVweBgGkJnZdahRQapNjo4JHte2GNT662r3LeNmy5WOYkGkY4DOz12tq2gdZne6yaa59peL2MN1zvcmOFdAllH0fgZiMYFBlB9RrBPjyfe78A51ypQtnRANdql6ZpCbK/rKme1Vmovku/O/T9LuHsufQoj93VoPKFMfaxdQQHnbOqB1mVnIv3YCyeir8rHu+KP4UbUL9D5GySl+jneuQzTHvXwfBUBLn63cI0XrgSDCMynUG9yIAzMEX2PY9G66LW15U= Content-Type: text/plain; charset="us-ascii" Content-ID: <62120A8E687B2040A68454345A7C419B@eurprd05.prod.outlook.com> Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-OriginatorOrg: Mellanox.com X-MS-Exchange-CrossTenant-Network-Message-Id: 6ce910c5-21fe-4bfb-e3bf-08d6c74b2de2 X-MS-Exchange-CrossTenant-originalarrivaltime: 22 Apr 2019 17:51:42.5442 (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: DB3PR0502MB4025 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: , X-List-Received-Date: Mon, 22 Apr 2019 17:51:44 -0000 > 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 DMA = 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, uintpt= r_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 pri= mary. Then, there's only one request in this case and we don't need to take care = of that. Right? Same comment for mlx4. Thanks, Yongseok > } > assert(mp_rep.nb_received =3D=3D 1); > mp_res =3D &mp_rep.msgs[0]; > --=20 > 2.17.2 >=20 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 827B1A05D3 for ; Mon, 22 Apr 2019 19:51:46 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 445D11B446; Mon, 22 Apr 2019 19:51:45 +0200 (CEST) Received: from EUR01-VE1-obe.outbound.protection.outlook.com (mail-eopbgr140051.outbound.protection.outlook.com [40.107.14.51]) by dpdk.org (Postfix) with ESMTP id 028B61B445 for ; Mon, 22 Apr 2019 19:51:44 +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=qMznU8SMjFUC+yaxStpvJr1Cm0R0eQKaA5JDTlQNo8I=; b=TiSR9UpKg+mtekMQYw6eG/MLrtZ4jHkHwIZ/Xj4hmri7WlByQqudkUDtrZBrFZx/cv5mtqCdJkSSqOtrh0LFUm/VE8vXQAPgkIWdB9QsCCD5i5Tz7N8/+QqINDXq/XL/k8pOKchtTxGwjNAWEMIw4wrgQ9m2NfdDRwqTJ7I9hfw= Received: from DB3PR0502MB3980.eurprd05.prod.outlook.com (52.134.72.27) by DB3PR0502MB4025.eurprd05.prod.outlook.com (52.134.68.25) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1813.18; Mon, 22 Apr 2019 17:51:42 +0000 Received: from DB3PR0502MB3980.eurprd05.prod.outlook.com ([fe80::6072:43be:7c2d:103a]) by DB3PR0502MB3980.eurprd05.prod.outlook.com ([fe80::6072:43be:7c2d:103a%3]) with mapi id 15.20.1813.017; Mon, 22 Apr 2019 17:51:42 +0000 From: Yongseok Koh To: Herakliusz Lipiec CC: "shafafs@mellanox.com" , "dev@dpdk.org" Thread-Topic: [PATCH 8/8] ipc: fix net/mlx5 memleak Thread-Index: AQHU9Sv3c7FJmMCo+UGMLgfsf7sqx6ZIfb2A Date: Mon, 22 Apr 2019 17:51:42 +0000 Message-ID: References: <20190417144436.24216-1-herakliusz.lipiec@intel.com> In-Reply-To: <20190417144436.24216-1-herakliusz.lipiec@intel.com> 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: [209.116.155.178] x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: 6ce910c5-21fe-4bfb-e3bf-08d6c74b2de2 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:DB3PR0502MB4025; x-ms-traffictypediagnostic: DB3PR0502MB4025: x-microsoft-antispam-prvs: x-forefront-prvs: 00159D1518 x-forefront-antispam-report: SFV:NSPM; SFS:(10009020)(376002)(346002)(39860400002)(396003)(136003)(366004)(43544003)(199004)(189003)(486006)(66446008)(186003)(66476007)(64756008)(66066001)(478600001)(97736004)(54906003)(66556008)(26005)(86362001)(476003)(2616005)(11346002)(446003)(91956017)(76116006)(71200400001)(73956011)(71190400001)(99286004)(82746002)(83716004)(66946007)(102836004)(6506007)(53546011)(14454004)(5660300002)(76176011)(81166006)(6512007)(8676002)(3846002)(6116002)(6246003)(256004)(2906002)(14444005)(53936002)(8936002)(4326008)(33656002)(68736007)(25786009)(316002)(7736002)(305945005)(6916009)(229853002)(36756003)(6486002)(6436002)(81156014); DIR:OUT; SFP:1101; SCL:1; SRVR:DB3PR0502MB4025; H:DB3PR0502MB3980.eurprd05.prod.outlook.com; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; A:1; MX: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: lFaAsLmZQD3kvtbK+juma26pi97hcbykQRhZujWVBG/3/UWSMs+uRIM2DLAdDnauwpiOKCm/0d17zo2oTJXZs+pnIiJrvS4zREDqhP/8w1ABQdcgfmGTOBRKlp+/7j5DA87oHTeYws44bjsX0eHUiMPcoI7Wcsk1/JvrCPJDVweBgGkJnZdahRQapNjo4JHte2GNT662r3LeNmy5WOYkGkY4DOz12tq2gdZne6yaa59peL2MN1zvcmOFdAllH0fgZiMYFBlB9RrBPjyfe78A51ypQtnRANdql6ZpCbK/rKme1Vmovku/O/T9LuHsufQoj93VoPKFMfaxdQQHnbOqB1mVnIv3YCyeir8rHu+KP4UbUL9D5GySl+jneuQzTHvXwfBUBLn63cI0XrgSDCMynUG9yIAzMEX2PY9G66LW15U= Content-Type: text/plain; charset="UTF-8" Content-ID: <62120A8E687B2040A68454345A7C419B@eurprd05.prod.outlook.com> Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-OriginatorOrg: Mellanox.com X-MS-Exchange-CrossTenant-Network-Message-Id: 6ce910c5-21fe-4bfb-e3bf-08d6c74b2de2 X-MS-Exchange-CrossTenant-originalarrivaltime: 22 Apr 2019 17:51:42.5442 (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: DB3PR0502MB4025 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: <20190422175142.ZGrrFhClTYHxHlrZreOxb0Jl6o3-uZihEC_6lubLX3Q@z> > 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 DMA = 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, uintpt= r_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 pri= mary. Then, there's only one request in this case and we don't need to take care = of that. Right? Same comment for mlx4. Thanks, Yongseok > } > assert(mp_rep.nb_received =3D=3D 1); > mp_res =3D &mp_rep.msgs[0]; > --=20 > 2.17.2 >=20