From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from EUR01-DB5-obe.outbound.protection.outlook.com (mail-db5eur01on0079.outbound.protection.outlook.com [104.47.2.79]) by dpdk.org (Postfix) with ESMTP id 2B6A514E8 for ; Fri, 25 May 2018 12:19:48 +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=emaV1KT1mH0Q1MnbckK/L9UbuZnlpeWqLzQdbgy06U0=; b=Jqp7Pplnlexht5P8XW0VtvstuF4NsRIsN9L41l+Iuq7a+Yfi59I9XYGMFfIW/c58NEkiWpc/NtVt3yol4GewCItdDJ5kIoTeSvOnijTInImPvBlINjxj1daWwgaoWpIOkQEbr1M0A8Oa3LBJFC16641g71Kf9/Y1qWhcpQtRl7w= Received: from VI1PR0501MB2045.eurprd05.prod.outlook.com (10.167.195.147) by VI1PR0501MB2543.eurprd05.prod.outlook.com (10.168.136.146) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.776.16; Fri, 25 May 2018 10:19:44 +0000 Received: from VI1PR0501MB2045.eurprd05.prod.outlook.com ([fe80::11b2:1e2d:709c:695d]) by VI1PR0501MB2045.eurprd05.prod.outlook.com ([fe80::11b2:1e2d:709c:695d%13]) with mapi id 15.20.0797.011; Fri, 25 May 2018 10:19:43 +0000 From: Yongseok Koh To: "Xueming(Steven) Li" CC: Shahaf Shuler , "dev@dpdk.org" Thread-Topic: [PATCH] net/mlx5: fix memory region cache init Thread-Index: AQHT8/KgP6CxX3XCbU++YuUV7DM3oKRAPAWA Date: Fri, 25 May 2018 10:19:43 +0000 Message-ID: <249F1114-CFB6-41A1-9816-CD545514B553@mellanox.com> References: <20180525063538.24363-1-xuemingl@mellanox.com> In-Reply-To: <20180525063538.24363-1-xuemingl@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=yskoh@mellanox.com; x-originating-ip: [73.222.116.174] x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1; VI1PR0501MB2543; 7:S6uIfYJowu3/53Nf1fKpB3vJ4xf91P9Q91E4QEOlPRnfyC1bnZAdhjVACCPwUjvIdvnG9mEoAkpuN/Ift0HlJlqMe35XG4PDJ4QeHRw6qcpNczYrpnwo0fKA0P22yUyI32o83RecOrdZd0RcJrisatQ8Nd7biQn2+gbg2DiSyIxsgVD+e0alvCqjHcYLtUih0PffldkNx+uWn/ZXuiPzkGoyk2u7qYqoWAdxyqgXT4sNsRd/IiSFdojMmlp1Ar4B x-ms-exchange-antispam-srfa-diagnostics: SOS; x-ms-office365-filtering-ht: Tenant x-microsoft-antispam: UriScan:; BCL:0; PCL:0; RULEID:(7020095)(4652020)(5600026)(48565401081)(2017052603328)(7153060)(7193020); SRVR:VI1PR0501MB2543; x-ms-traffictypediagnostic: VI1PR0501MB2543: x-microsoft-antispam-prvs: x-exchange-antispam-report-test: UriScan:; x-ms-exchange-senderadcheck: 1 x-exchange-antispam-report-cfa-test: BCL:0; PCL:0; RULEID:(8211001083)(6040522)(2401047)(5005006)(8121501046)(3231254)(944501410)(52105095)(3002001)(10201501046)(93006095)(93001095)(6055026)(149027)(150027)(6041310)(20161123560045)(20161123562045)(20161123558120)(20161123564045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(6072148)(201708071742011)(7699016); SRVR:VI1PR0501MB2543; BCL:0; PCL:0; RULEID:; SRVR:VI1PR0501MB2543; x-forefront-prvs: 06833C6A67 x-forefront-antispam-report: SFV:NSPM; SFS:(10009020)(346002)(376002)(366004)(396003)(39380400002)(39860400002)(189003)(199004)(53936002)(14454004)(6506007)(478600001)(66066001)(97736004)(6512007)(82746002)(86362001)(25786009)(2900100001)(53546011)(59450400001)(6486002)(6436002)(54906003)(76176011)(83716003)(229853002)(316002)(37006003)(6636002)(36756003)(486006)(81156014)(102836004)(2616005)(476003)(6246003)(5250100002)(6116002)(26005)(11346002)(8936002)(99286004)(4326008)(446003)(105586002)(81166006)(3846002)(6862004)(8676002)(68736007)(5660300001)(7736002)(33656002)(106356001)(3280700002)(2906002)(305945005)(3660700001); DIR:OUT; SFP:1101; SCL:1; SRVR:VI1PR0501MB2543; H:VI1PR0501MB2045.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-microsoft-antispam-message-info: RlI3jHFqh6DP9UjY4SVnHGgaB6tEKb7YbnGO54BV33l/S4H/ek5/CLX+xS3WCYW0+WNESiDivJFWPaPgOo8Wo/PjaWmVF0O4JcgjNdw/2K1leWLU55zT8qTZcvqAmalT7i4k4nJYHNrSZU7ORL1UwVEIqs0/naVtPMl/kHr/y+oYv27Gob+kh48dCQA0tRPl spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM Content-Type: text/plain; charset="us-ascii" Content-ID: Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-MS-Office365-Filtering-Correlation-Id: d8845d07-498e-4ca3-931c-08d5c22908a1 X-OriginatorOrg: Mellanox.com X-MS-Exchange-CrossTenant-Network-Message-Id: d8845d07-498e-4ca3-931c-08d5c22908a1 X-MS-Exchange-CrossTenant-originalarrivaltime: 25 May 2018 10:19:43.5172 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: a652971c-7d2e-4d9b-a6a4-d149256f461b X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR0501MB2543 Subject: Re: [dpdk-dev] [PATCH] net/mlx5: fix memory region cache init 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: Fri, 25 May 2018 10:19:48 -0000 > On May 24, 2018, at 11:35 PM, Xueming Li wrote: >=20 > This patch moved MR cache init from device configuration function to > probe function to make sure init only once. >=20 > Fixes: 974f1e7ef146 ("net/mlx5: add new memory region support") > Cc: yskoh@mellanox.com >=20 > Signed-off-by: Xueming Li > --- > drivers/net/mlx5/mlx5.c | 11 +++++++++++ > drivers/net/mlx5/mlx5_ethdev.c | 11 ----------- > drivers/net/mlx5/mlx5_mr.c | 1 + > 3 files changed, 12 insertions(+), 11 deletions(-) >=20 > diff --git a/drivers/net/mlx5/mlx5.c b/drivers/net/mlx5/mlx5.c > index dae847493..77ed8e01f 100644 > --- a/drivers/net/mlx5/mlx5.c > +++ b/drivers/net/mlx5/mlx5.c > @@ -1193,6 +1193,17 @@ mlx5_pci_probe(struct rte_pci_driver *pci_drv __rt= e_unused, > goto port_error; > } > priv->config.max_verbs_prio =3D verb_priorities; > + /* > + * Once the device is added to the list of memory event > + * callback, its global MR cache table cannot be expanded > + * on the fly because of deadlock. If it overflows, lookup > + * should be done by searching MR list linearly, which is slow. > + */ > + err =3D -mlx5_mr_btree_init(&priv->mr.cache, > + MLX5_MR_BTREE_CACHE_N * 2, > + eth_dev->device->numa_node); > + if (err) > + goto port_error; A nit. Like mlx5_flow_create_drop_queue(), please store rte_errno to err (err =3D = rte_errno;) instead of putting a minus sign to the function. With that being fixed, you can put my acked-by tag when you submit v2. =20 Thanks, Yongseok > /* Add device to memory callback list. */ > rte_rwlock_write_lock(&mlx5_shared_data->mem_event_rwlock); > LIST_INSERT_HEAD(&mlx5_shared_data->mem_event_cb_list, > diff --git a/drivers/net/mlx5/mlx5_ethdev.c b/drivers/net/mlx5/mlx5_ethde= v.c > index f6cebae41..90488af33 100644 > --- a/drivers/net/mlx5/mlx5_ethdev.c > +++ b/drivers/net/mlx5/mlx5_ethdev.c > @@ -392,17 +392,6 @@ mlx5_dev_configure(struct rte_eth_dev *dev) > if (++j =3D=3D rxqs_n) > j =3D 0; > } > - /* > - * Once the device is added to the list of memory event callback, its > - * global MR cache table cannot be expanded on the fly because of > - * deadlock. If it overflows, lookup should be done by searching MR lis= t > - * linearly, which is slow. > - */ > - if (mlx5_mr_btree_init(&priv->mr.cache, MLX5_MR_BTREE_CACHE_N * 2, > - dev->device->numa_node)) { > - /* rte_errno is already set. */ > - return -rte_errno; > - } > return 0; > } >=20 > diff --git a/drivers/net/mlx5/mlx5_mr.c b/drivers/net/mlx5/mlx5_mr.c > index abb1f5179..08105a443 100644 > --- a/drivers/net/mlx5/mlx5_mr.c > +++ b/drivers/net/mlx5/mlx5_mr.c > @@ -191,6 +191,7 @@ mlx5_mr_btree_init(struct mlx5_mr_btree *bt, int n, i= nt socket) > rte_errno =3D EINVAL; > return -rte_errno; > } > + assert(!bt->table && !bt->size); > memset(bt, 0, sizeof(*bt)); > bt->table =3D rte_calloc_socket("B-tree table", > n, sizeof(struct mlx5_mr_cache), > --=20 > 2.13.3 >=20