From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id E6150A00C5; Thu, 30 Apr 2020 12:30:04 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id AFBD81DB22; Thu, 30 Apr 2020 12:30:03 +0200 (CEST) Received: from EUR05-VI1-obe.outbound.protection.outlook.com (mail-vi1eur05on2066.outbound.protection.outlook.com [40.107.21.66]) by dpdk.org (Postfix) with ESMTP id 19E6D1DB20 for ; Thu, 30 Apr 2020 12:30:02 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=QNJD+kLxqg0BHpGUaT/Vu1pw79/jJgZ3wJVOfoighXaf4mE6o2lWppmk6sHNpFsfrEiP9/kPoCfBNvwTLrWFPEgp1s5whgUDHDEtog6/iutCN6n0qjfyyMTSikY1VhBhFuAujbmaWByTyEUGqknXDnzUdNbnwWvsVoNB/EhQ4XYa3L+iJfjnbaoOqMxt5Nfhioo8F1UOR7+XaMYqEqK4CUlBbBwS80G9n4Wj9ZE4O9U0TnhIeg9xNbx5WWwkfk8E7m0JDCUm4JBldN6jj00CJPxg4qtaybZ+hvRtSAwzeLwTm8Yrxnzbx9yICCqHs+LqIwD+/XeAi0oGnBEdpO51Ag== 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-SenderADCheck; bh=Lsffiq9ghGldsFomkrSJ6redjY5ur18/wS+GMEBE9NY=; b=fCvpmYh+auUovIpro6mHPzWRC5sl0C7Tq11jIonFkXrEPevnF/SKbpuObv/JCFogKBPd65f4K23GZ6EyxM5m77Hfu6CDGYGVPs68XHYPBCW6Uf8GMW3dxs1p21FKJ6tANEL9c0nqtD7xZo+FmBuhXHWHRWpzHunx5fmA8NyKy+MmbW1FJ3jxJObNDgVNMxW1NHRDmk5MZ/16z710zrYn+NCK+lP/7ElsNCOe9zFgwEwIIvj/9EIiYamb2ZwRnK+KSUbuqQL0KcTrU8XGv9YQxLTqCeg0gQXrBYrVFfVGv2UkQLnAQutyqZhwa8gOSCR/3ZzrF16zXVPLSbjYuAi0yw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=mellanox.com; dmarc=pass action=none header.from=mellanox.com; dkim=pass header.d=mellanox.com; arc=none 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=Lsffiq9ghGldsFomkrSJ6redjY5ur18/wS+GMEBE9NY=; b=SZkdCiIV7Gz6J9g4M9SYl9cAXtL22cev556A3QYhSsbRIwABYG6eHuZ162L8hQy075gEgcBlcD/zMfTWytiFTWygqe1yMWede60TjS0gCFfdtH/4WhWmXoCRhtslF00E2Ygi/AWT/+CkrT1s2IrX0C5hCz3bCu2376zxARqF04A= Received: from AM0PR05MB6707.eurprd05.prod.outlook.com (2603:10a6:20b:15b::17) by AM0PR05MB5940.eurprd05.prod.outlook.com (2603:10a6:208:12f::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2958.20; Thu, 30 Apr 2020 10:29:55 +0000 Received: from AM0PR05MB6707.eurprd05.prod.outlook.com ([fe80::508:747b:cc12:5f6e]) by AM0PR05MB6707.eurprd05.prod.outlook.com ([fe80::508:747b:cc12:5f6e%5]) with mapi id 15.20.2958.020; Thu, 30 Apr 2020 10:29:55 +0000 From: Raslan Darawsheh To: Suanming Mou , Matan Azrad , Shahaf Shuler , Slava Ovsiienko CC: "dev@dpdk.org" , "Lijian.Zhang@arm.com" Thread-Topic: [PATCH] net/mlx5: fix indexed pool bitmap initialization Thread-Index: AQHWHT1T8ZbP3SW/2ECXvKt2vppLfqiRegfw Date: Thu, 30 Apr 2020 10:29:55 +0000 Message-ID: References: <1588065217-199098-1-git-send-email-suanmingm@mellanox.com> In-Reply-To: <1588065217-199098-1-git-send-email-suanmingm@mellanox.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: authentication-results: mellanox.com; dkim=none (message not signed) header.d=none;mellanox.com; dmarc=none action=none header.from=mellanox.com; x-originating-ip: [188.161.230.216] x-ms-publictraffictype: Email x-ms-office365-filtering-ht: Tenant x-ms-office365-filtering-correlation-id: 249716c6-c496-434f-1531-08d7ecf16cf1 x-ms-traffictypediagnostic: AM0PR05MB5940:|AM0PR05MB5940: x-ms-exchange-transport-forked: True x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:6790; x-forefront-prvs: 0389EDA07F x-ms-exchange-senderadcheck: 1 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: K5QQ7cNKxE5vDLEpMgx/ffbY4MRO1BB6iUsQT8/jT3yeYphyGIPXfgTc4JM9NebeJ6ttWag+lAFJ8O16RtabcP91FlrKHUyO55dTCgQhhQpZf3tZmClZ+QXKp75O57haMOw69RDkbEpSkzn2u5/XP586K0LVc6Qm98ADXl3luOPLf20DXwXW9hqfGvvgho8T4UXenyz/fGY2OAPoqvIJVKKDr3zKyXQqhIAH1GR2sGgfgb+Il44s1cjcLCixWKWGNkXPEzL07f8GnbHn+Ld5WiCvq3icRD/cN14564UtMYphsap8pnE7f7p3k4XvMbKk8kOA/At/ipIm2RITXxq40JgHsIap6CxAKgNkwPseBQenzTObYicA8N+qlK3jXhVeEoIyQnqeV3P9TQrZiQrGdqcikDb9zTkfdDE8SzWsCtOeQS+HbrYz7HVU8qJ9px8p x-forefront-antispam-report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:AM0PR05MB6707.eurprd05.prod.outlook.com; PTR:; CAT:NONE; SFTY:; SFS:(4636009)(396003)(366004)(39860400002)(346002)(136003)(376002)(4326008)(316002)(2906002)(66946007)(76116006)(5660300002)(55016002)(9686003)(186003)(26005)(478600001)(64756008)(66446008)(66556008)(110136005)(66476007)(53546011)(6506007)(6636002)(33656002)(54906003)(8676002)(52536014)(86362001)(8936002)(71200400001)(7696005); DIR:OUT; SFP:1101; x-ms-exchange-antispam-messagedata: HjDndlYOOs04ypN36hRT61QsgvqSe8j306pqOwnnLJE0x54sl3HOcJH2PvFB6KEQCpqNE/BXKTnies5M5nNU7w3IQ576QkQKCJIoeDnR2cPySXY6tN1Anp3RlhkjTg5gm2n1zJ4cTQEx/Z4dXDzA66ghfEIpMw6pMn7DUo3gY6Ut04isQOc4G2S2vhX88UkCsnjuhJxhbLbD1p/Ss+/q7iSlSuDzhsP2gEf3/eOXhy813CZz5tM3Ll/g/lzVPX/9J/bhs5OofixGy2DOyDpEVlmLa50jCqsHXOBQS9yyCG8jESyF9i8OeYHXbRQt/uurwE4OhellqwGGH9nwDEivQeBRODqCUTy0LGXjjudLkIQNIwBaf9Qy66N6bkkkWUzlzrxiqkwBi+Rr2Ai3bpAh6eTHcznwDjaykUsEinF8iRjpRJmH6t3UV7okWuvEVfwx1JgOVNpYIceq6E4ejnnL+4TyLuL3aqwoIeWtQA172SwsZeki5EcjkN/vDpCHr6K+z9ntlA0dGZt42ZtACuq05AGEabjW/1OPpojmqi0ObVIzFjxj4Dqd6IyQQw1IEtzCdezTIG0DtSku2F/4KOKUPBJUCWGq+e2fKy8l3VC+2GDf+NIfmAGFJCUyU2/pY29bT/SIzlQvdi8Z2N1Oy1Neg2+KcuYctUxNNh479y7Epz1UcDG+rzjLCTj87Ud4JYex0NyKpHcNlFYfIvL8aC/6HAmSILraTJBBZiaBnR4dGLOmbLP8Qqy72cFpWKlk4uJOQR0Q3/c3927k86kohXEXClYJOMzzZPSB6CElq8b6Vg+OFm6GDV0HsY+5NxxALUFG Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-OriginatorOrg: Mellanox.com X-MS-Exchange-CrossTenant-Network-Message-Id: 249716c6-c496-434f-1531-08d7ecf16cf1 X-MS-Exchange-CrossTenant-originalarrivaltime: 30 Apr 2020 10:29:55.3723 (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-CrossTenant-userprincipalname: EoG1/qUG11CBRg+IrhBPfh4LcMDdcCYQJifpV9/NSfTcPMbZk/mUrkF52mScaFEmG/ugoduqq8mN4OLb4qi+Iw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM0PR05MB5940 Subject: Re: [dpdk-dev] [PATCH] net/mlx5: fix indexed pool bitmap initialization 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" Hi, > -----Original Message----- > From: Suanming Mou > Sent: Tuesday, April 28, 2020 12:14 PM > To: Matan Azrad ; Shahaf Shuler > ; Slava Ovsiienko > Cc: dev@dpdk.org; Raslan Darawsheh ; > Lijian.Zhang@arm.com > Subject: [PATCH] net/mlx5: fix indexed pool bitmap initialization >=20 > Currently, the indexed memory pool bitmap start address is not aligned > to cacheline size explicitly. The bitmap initialization requires the > address should be cacheline aligned. In that case, the initialization > maybe failed if the address is not cacheline aligned. >=20 > Add RTE_CACHE_LINE_ROUNDUP() to the trunk size calculation to make sure > the bitmap offset address will start with cacheline aligned. >=20 > Fixes: a3cf59f56c47 ("net/mlx5: add indexed memory pool") >=20 > Signed-off-by: Suanming Mou > Tested-by: Lijian Zhang > Acked-by: Viacheslav Ovsiienko > --- > drivers/net/mlx5/mlx5_utils.c | 10 +++++++--- > drivers/net/mlx5/mlx5_utils.h | 2 +- > 2 files changed, 8 insertions(+), 4 deletions(-) >=20 > diff --git a/drivers/net/mlx5/mlx5_utils.c b/drivers/net/mlx5/mlx5_utils.= c > index 2146ffd..d29fbcb 100644 > --- a/drivers/net/mlx5/mlx5_utils.c > +++ b/drivers/net/mlx5/mlx5_utils.c > @@ -265,7 +265,9 @@ struct mlx5_indexed_pool * > trunk_size +=3D sizeof(*trunk); > data_size =3D mlx5_trunk_size_get(pool, idx); > bmp_size =3D rte_bitmap_get_memory_footprint(data_size); > - trunk_size +=3D data_size * pool->cfg.size + bmp_size; > + /* rte_bitmap requires memory cacheline aligned. */ > + trunk_size +=3D RTE_CACHE_LINE_ROUNDUP(data_size * pool- > >cfg.size); > + trunk_size +=3D bmp_size; > trunk =3D pool->cfg.malloc(pool->cfg.type, trunk_size, > RTE_CACHE_LINE_SIZE, rte_socket_id()); > if (!trunk) > @@ -278,8 +280,10 @@ struct mlx5_indexed_pool * > MLX5_ASSERT(pool->free_list =3D=3D TRUNK_INVALID); > pool->free_list =3D idx; > /* Mark all entries as available. */ > - trunk->bmp =3D rte_bitmap_init_with_all_set(data_size, > - &trunk->data[data_size * pool->cfg.size], bmp_size); > + trunk->bmp =3D rte_bitmap_init_with_all_set(data_size, &trunk->data > + [RTE_CACHE_LINE_ROUNDUP(data_size * pool- > >cfg.size)], > + bmp_size); > + MLX5_ASSERT(trunk->bmp); > pool->n_trunk_valid++; > #ifdef POOL_DEBUG > pool->trunk_new++; > diff --git a/drivers/net/mlx5/mlx5_utils.h b/drivers/net/mlx5/mlx5_utils.= h > index d81ace3..1248caa 100644 > --- a/drivers/net/mlx5/mlx5_utils.h > +++ b/drivers/net/mlx5/mlx5_utils.h > @@ -115,7 +115,7 @@ struct mlx5_indexed_trunk { > uint32_t next; /* Next free trunk in free list. */ > uint32_t free; /* Free entries available */ > struct rte_bitmap *bmp; > - uint8_t data[] __rte_cache_min_aligned; /* Entry data start. */ > + uint8_t data[] __rte_cache_aligned; /* Entry data start. */ > }; >=20 > struct mlx5_indexed_pool { > -- > 1.8.3.1 Patch applied to next-net-mlx, Kindest regards, Raslan Darawsheh