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 B5DC4A00E6 for ; Thu, 18 Apr 2019 20:55:00 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 146971BC9C; Thu, 18 Apr 2019 20:54:59 +0200 (CEST) Received: from EUR01-DB5-obe.outbound.protection.outlook.com (mail-eopbgr150045.outbound.protection.outlook.com [40.107.15.45]) by dpdk.org (Postfix) with ESMTP id 02BB61BC96; Thu, 18 Apr 2019 20:54:55 +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=EHLOTtmEC5ilZ6LopVZVS7sb1pwyPThygdyc13Rt7i4=; b=qxuZuOIcYQrRUHHjYh47ZyVX+rzeEkZFbZiUaFPqD4CYk+H7nOtprNsKrId5n599EgN5+hnSmZ1VXC9J05AyPgkFRuwyuwtaCOIBef+2uLZVMZjPsroOLmM4tguqXIblS0uaK/HnIGY0yTXyr1WhUXsSwkKyE4ZbFzGwJJSRQec= Received: from AM6PR0502MB3797.eurprd05.prod.outlook.com (52.133.22.13) by AM6PR0502MB4055.eurprd05.prod.outlook.com (52.133.10.142) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1813.12; Thu, 18 Apr 2019 18:54:53 +0000 Received: from AM6PR0502MB3797.eurprd05.prod.outlook.com ([fe80::5db8:12bc:aff3:5048]) by AM6PR0502MB3797.eurprd05.prod.outlook.com ([fe80::5db8:12bc:aff3:5048%6]) with mapi id 15.20.1792.022; Thu, 18 Apr 2019 18:54:53 +0000 From: Shahaf Shuler To: Slava Ovsiienko , "dev@dpdk.org" CC: "stable@dpdk.org" Thread-Topic: [dpdk-dev] [PATCH] net/mlx4: fix memory region cleanup routine Thread-Index: AQHU82b6j3bznmISKk2NA6WcD/yziKZCQVzQ Date: Thu, 18 Apr 2019 18:54:52 +0000 Message-ID: References: <1555317658-28091-1-git-send-email-viacheslavo@mellanox.com> In-Reply-To: <1555317658-28091-1-git-send-email-viacheslavo@mellanox.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=shahafs@mellanox.com; x-originating-ip: [31.154.10.105] x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: 39256bb3-712b-45a8-de8d-08d6c42f5785 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:AM6PR0502MB4055; x-ms-traffictypediagnostic: AM6PR0502MB4055: x-microsoft-antispam-prvs: x-forefront-prvs: 0011612A55 x-forefront-antispam-report: SFV:NSPM; SFS:(10009020)(376002)(346002)(136003)(396003)(39860400002)(366004)(199004)(189003)(68736007)(14454004)(2501003)(11346002)(6436002)(14444005)(76176011)(66066001)(53936002)(256004)(6246003)(446003)(8936002)(102836004)(74316002)(476003)(66446008)(64756008)(229853002)(6506007)(478600001)(7736002)(305945005)(45080400002)(26005)(486006)(81156014)(81166006)(8676002)(186003)(71200400001)(71190400001)(52536014)(110136005)(316002)(5660300002)(25786009)(86362001)(2906002)(3846002)(450100002)(6116002)(4326008)(33656002)(7696005)(55016002)(9686003)(97736004)(99286004); DIR:OUT; SFP:1101; SCL:1; SRVR:AM6PR0502MB4055; H:AM6PR0502MB3797.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: PGTboFSO5tb9fVlIolrIbB4K5jzLpFeypjCdYWMqjzSM+gu6Re/opcZXaI4CgmlsXxFXZZcZFcxTwmILFO4/56r2AKuFJag4BC1KKC3zOH0lXe8xppmFVsyEJbAJvfGYqMTs9GZSwnbbZn6+IcCwijuvvxiZtUgJcwYolIvWNsywAt8bStjRRfFrhafC7WVRlcFPEMYJsmdAXQDVR1TE+/fEdAw+4mSqCh1BNorOXZN46Ffw+qdceNKkCGcW8Nx1GCu0F4bKXFVgIsMlyPWR1uLmdyPCNUGAL3ymnz6dF2bl0W02CyAGVS5u7TOK1X2iIXPLBMbZQ2Xypf9idvGHZbW8aRkK0JovLldY2TK11Il+dm0lWnIBcGZZtvxTg/inu5A3x22QUopW160ekiLJfd2Li+rttK4oziLxllBTmiM= Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-OriginatorOrg: Mellanox.com X-MS-Exchange-CrossTenant-Network-Message-Id: 39256bb3-712b-45a8-de8d-08d6c42f5785 X-MS-Exchange-CrossTenant-originalarrivaltime: 18 Apr 2019 18:54:52.8860 (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: AM6PR0502MB4055 Subject: Re: [dpdk-dev] [PATCH] net/mlx4: fix memory region cleanup routine 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: <20190418185452.0UaupICRFOqugVICdcZohkzAsXcr2AxYvnFAQwqaLeU@z> Monday, April 15, 2019 11:41 AM, Viacheslav Ovsiienko: > Subject: [dpdk-dev] [PATCH] net/mlx4: fix memory region cleanup routine >=20 > mlx4 driver has a global list of Memory Regions created by device, and th= ere > is a ml4_mr_release() routine which makes a memory cleanup at device > closing. The head of device MR list was fetched outside the rwlock protec= ted > section. Also some noticed typos are fixed. >=20 > Fixes: 9797bfcce1c9 ("net/mlx4: add new memory region support") > Cc: stable@dpdk.org >=20 > Signed-off-by: Viacheslav Ovsiienko > Acked-by: Yongseok Koh Applied to next-net-mlx, thanks.=20 > --- > drivers/net/mlx4/mlx4_mr.c | 13 +++++++------ > 1 file changed, 7 insertions(+), 6 deletions(-) >=20 > diff --git a/drivers/net/mlx4/mlx4_mr.c b/drivers/net/mlx4/mlx4_mr.c inde= x > ad7d483..48d458a 100644 > --- a/drivers/net/mlx4/mlx4_mr.c > +++ b/drivers/net/mlx4/mlx4_mr.c > @@ -477,7 +477,7 @@ struct mr_update_mp_data { } >=20 > /** > - * Releass resources of detached MR having no online entry. > + * Release resources of detached MR having no online entry. > * > * @param dev > * Pointer to Ethernet device. > @@ -527,7 +527,7 @@ struct mr_update_mp_data { } >=20 > /** > - * Create a new global Memroy Region (MR) for a missing virtual address. > + * Create a new global Memory Region (MR) for a missing virtual address. > * This API should be called on a secondary process, then a request is s= ent to > * the primary process in order to create a MR for the address. As the g= lobal > MR > * list is on the shared memory, following LKey lookup should succeed un= less > the @@ -573,7 +573,7 @@ struct mr_update_mp_data { } >=20 > /** > - * Create a new global Memroy Region (MR) for a missing virtual address. > + * Create a new global Memory Region (MR) for a missing virtual address. > * Register entire virtually contiguous memory chunk around the address. > * This must be called from the primary process. > * > @@ -682,7 +682,7 @@ struct mr_update_mp_data { > bmp_mem =3D RTE_PTR_ALIGN_CEIL(mr + 1, RTE_CACHE_LINE_SIZE); > mr->ms_bmp =3D rte_bitmap_init(ms_n, bmp_mem, bmp_size); > if (mr->ms_bmp =3D=3D NULL) { > - WARN("port %u unable to initialize bitamp for a new MR of" > + WARN("port %u unable to initialize bitmap for a new MR of" > " address (%p).", > dev->data->port_id, (void *)addr); > rte_errno =3D EINVAL; > @@ -820,7 +820,7 @@ struct mr_update_mp_data { } >=20 > /** > - * Create a new global Memroy Region (MR) for a missing virtual address. > + * Create a new global Memory Region (MR) for a missing virtual address. > * This can be called from primary and secondary process. > * > * @param dev > @@ -1434,7 +1434,7 @@ struct mr_update_mp_data { > mlx4_mr_release(struct rte_eth_dev *dev) { > struct mlx4_priv *priv =3D dev->data->dev_private; > - struct mlx4_mr *mr_next =3D LIST_FIRST(&priv->mr.mr_list); > + struct mlx4_mr *mr_next; >=20 > /* Remove from memory callback device list. */ > rte_rwlock_write_lock(&mlx4_shared_data->mem_event_rwlock); > @@ -1445,6 +1445,7 @@ struct mr_update_mp_data { #endif > rte_rwlock_write_lock(&priv->mr.rwlock); > /* Detach from MR list and move to free list. */ > + mr_next =3D LIST_FIRST(&priv->mr.mr_list); > while (mr_next !=3D NULL) { > struct mlx4_mr *mr =3D mr_next; >=20 > -- > 1.8.3.1