From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 177E6A0C4E; Tue, 2 Nov 2021 11:08:54 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 9EBA841123; Tue, 2 Nov 2021 11:08:40 +0100 (CET) Received: from AZHDRRW-EX02.NVIDIA.COM (azhdrrw-ex02.nvidia.com [20.64.145.131]) by mails.dpdk.org (Postfix) with ESMTP id 20DB541120 for ; Tue, 2 Nov 2021 11:08:40 +0100 (CET) Received: from NAM11-BN8-obe.outbound.protection.outlook.com (104.47.58.173) by mxs.oss.nvidia.com (10.13.234.37) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.858.15; Tue, 2 Nov 2021 03:08:39 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=V/onVCIl7uJYgeDRxzIW+P6IsTj1XjwZK+KatlMQ7TcPQg4Xp2YayNh7iVCKlOi8na2fQw16CtpwdKPpffI7a70uIl2UJeH2JdjVT9cytsI955R0poj5ztDpmEQV/sat4Rw+hRwueZqAtyF4kpCDjheOboZs74T5OvaTYee/oeqo4ERvHyuuPaKtRPrMa+y3yJiBn+zKXMc3zBqePntgLvP03gp/RysWEOOG1aUv+Rji+Ha5fWnIIwY2i6eQvW/i6Cj8+EnIqIvwFeGBnsOfJtpiUpcSHsN+st9W8iU+1lKH6Rlu7D6J9cP29TmwPZBWiH6R55EYPQLnFvPgOouSmQ== 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-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=A3XgGjy+WZyeGlT4i45rwKJ7rjZy5/pqPQH+YXWwIEg=; b=FieR1LyiSTG8OYPePtqPD7SmrUvCXGWt4T4421eIer+hFa18X9kjXKvMZmmQCSbNzPM6dLry5kWvSHs8RYfR9UQz+bozh6lU7TWR9M0uapqo7v/un5y5zct098/cjt0vQ2MtW6aKIhOUXMiNCGBdElG11CPQLbp2n2wTr67X/3rEQoytiQYyjSvr/A0jToWb2azaC9of06mOmPhoalXzna4Y7ELMMmFZdHv+RkrI0NI0pRew8m48I5tIQnI/OckcqMjwhdD6SW/dkYUAZpBp4pLL0nF03eiqS4O94A52VGJGe3FMAuvd/qax+BFZ6gRXUExNdDW2Ao2TADj0MS18fQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.112.34) smtp.rcpttodomain=oktetlabs.ru smtp.mailfrom=nvidia.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=nvidia.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Nvidia.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=A3XgGjy+WZyeGlT4i45rwKJ7rjZy5/pqPQH+YXWwIEg=; b=KiYft4EwoY0n8uKA1Dz00Mb4xF3aFKa1eR+PMFUKmhVciI6I+QJtmDl2MKGZRRVBNviv3bijdb0lJCM4kP9fiVl0t9UPNyFjmSLRw9nQBldHAk9ehssmSQT3uzsL6HUX2/0qLgB4jTIWbX5zctR8LcAX2jS6VPJZ1oKy3KfqWcBWwP3sXWrcoJKFEMa1wGpZWUhf1F3TiMmCXk0mSOkXbyMyc1zgKYay28tUqSf+vN2mtncRLT/Rb5xMPaqoqFMUwdSFnzesIX/u8RVWsPjRvTFSwbKvn44biFdF+yVyVJbJUJvrry0lRsROhKEs2CCOgkFkWj9vTc4QLj0lVo3MOg== Received: from BN0PR04CA0097.namprd04.prod.outlook.com (2603:10b6:408:ec::12) by MN2PR12MB3165.namprd12.prod.outlook.com (2603:10b6:208:ac::27) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4649.15; Tue, 2 Nov 2021 10:08:37 +0000 Received: from BN8NAM11FT014.eop-nam11.prod.protection.outlook.com (2603:10b6:408:ec:cafe::b4) by BN0PR04CA0097.outlook.office365.com (2603:10b6:408:ec::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4649.18 via Frontend Transport; Tue, 2 Nov 2021 10:08:37 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 216.228.112.34) smtp.mailfrom=nvidia.com; oktetlabs.ru; dkim=none (message not signed) header.d=none;oktetlabs.ru; dmarc=pass action=none header.from=nvidia.com; Received-SPF: Pass (protection.outlook.com: domain of nvidia.com designates 216.228.112.34 as permitted sender) receiver=protection.outlook.com; client-ip=216.228.112.34; helo=mail.nvidia.com; Received: from mail.nvidia.com (216.228.112.34) by BN8NAM11FT014.mail.protection.outlook.com (10.13.177.142) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.4649.14 via Frontend Transport; Tue, 2 Nov 2021 10:08:36 +0000 Received: from nvidia.com (172.20.187.5) by HQMAIL107.nvidia.com (172.20.187.13) with Microsoft SMTP Server (TLS) id 15.0.1497.18; Tue, 2 Nov 2021 10:08:34 +0000 From: Dmitry Kozlyuk To: CC: Olivier Matz , Andrew Rybchenko Date: Tue, 2 Nov 2021 12:08:17 +0200 Message-ID: <20211102100817.916303-4-dkozlyuk@nvidia.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20211102100817.916303-1-dkozlyuk@nvidia.com> References: <20211101073701.825389-1-dkozlyuk@nvidia.com> <20211102100817.916303-1-dkozlyuk@nvidia.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-Originating-IP: [172.20.187.5] X-ClientProxiedBy: HQMAIL111.nvidia.com (172.20.187.18) To HQMAIL107.nvidia.com (172.20.187.13) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: e88e0bb7-f4b7-4fdb-533d-08d99de8bc20 X-MS-TrafficTypeDiagnostic: MN2PR12MB3165: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:1265; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: EfjiIGfM9Z6I4oFD7P5B3WMTy6Re2e0/tfcYPfevsB0AuMdA8dUvT0lCzYq3yEEd47JSxTBcn7cAjg7n+whYWJrAko50fr0AL1HDbETxzEkkUdt/hQDQsmiWBUXG1ssz9wQ47ubvdteeCG67a75etCaat4JosZ//tkX/FSWYLLmA0kzW/cNY/9nAz/e1c/QjuL5jEmRIKyvJAEuW6EltdTZ2A3Z/uBLsaSNw+hxJvNbaGFhgfOiQP80oHMOc3v0Tbk0NJosFp8haRDIN+eFZQgKe3u3VEu3hiybpBLRWcOgluSYezYVEzQ7Iv3LGQBugrgfPUZB3hW94g8LcTAO2pRKsWCS6hygFHaDI4SztsGdTDUxl9UgLpAiMqvA3TSPjSBm9sXydG7pPpR3ddlkUyQ2FkYeBE4pCFHGoyA6CXWlku8xf8DLXNmhQCG8A+PF4VlCByUX3gCepq3MR8kBT98pTiCknU35IKMoQbMEGU8bcjKcgc9CoFRMkiNNQPfV97ImiuQ/mzINgb69cOKzdeQfbB3aXskHOZP9DpPbT3itVBUEAvNn7AtugjeKNgGbEAxrxv7DNw+jrMSDcIpvCaXSILbhzvIkiVoAxQbkBoaBSr7LjxsTQSm0I8qqzxswkFFSVJf6hpYN6ht379kPx+QFaRKdrmkJf8hVPkTWy3sxCFnafqE62yEVxD/GibmJ4epf3nGjfNQHq12erKaHPILHOZS8w0miQyNm12Q5WV1Q= X-Forefront-Antispam-Report: CIP:216.228.112.34; CTRY:US; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:mail.nvidia.com; PTR:schybrid03.nvidia.com; CAT:NONE; SFS:(4636009)(46966006)(36840700001)(2906002)(26005)(6286002)(7696005)(47076005)(36860700001)(508600001)(55016002)(36756003)(186003)(6666004)(16526019)(8676002)(6916009)(2616005)(86362001)(8936002)(54906003)(83380400001)(336012)(107886003)(426003)(7636003)(70586007)(356005)(4326008)(5660300002)(1076003)(316002)(82310400003)(70206006)(14583001); DIR:OUT; SFP:1101; X-MS-Exchange-CrossTenant-OriginalArrivalTime: 02 Nov 2021 10:08:36.2255 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: e88e0bb7-f4b7-4fdb-533d-08d99de8bc20 X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=43083d15-7273-40c1-b7db-39efd9ccc17a; Ip=[216.228.112.34]; Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: BN8NAM11FT014.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: MN2PR12MB3165 Subject: [dpdk-dev] [PATCH v3 3/3] app/test: fix mempool test in no-huge mode X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 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" Amount of locked memory for regular users is limited, it is usually 64 KB by default. Hitting this limit in rte_mempool_populate_anon() resulted in not populating the mempool, and a test case failure: EAL: Test assert test_mempool_events line 585 failed: Failed to populate mempool empty1: Success test failed at test_mempool():1019 Test Failed Decrease the amount of mapped anonymous memory to fit the limit. While there, make all function-local constants lowercase. Fixes: 11541c5c81dd ("mempool: add non-IO flag") Reported-by: Olivier Matz Signed-off-by: Dmitry Kozlyuk --- app/test/test_mempool.c | 34 ++++++++++++++++++---------------- 1 file changed, 18 insertions(+), 16 deletions(-) diff --git a/app/test/test_mempool.c b/app/test/test_mempool.c index ced20dcdc3..a451608558 100644 --- a/app/test/test_mempool.c +++ b/app/test/test_mempool.c @@ -515,17 +515,19 @@ test_mempool_events(int (*populate)(struct rte_mempool *mp)) #undef RTE_TEST_TRACE_FAILURE #define RTE_TEST_TRACE_FAILURE(...) do { goto fail; } while (0) - static const size_t CB_NUM = 3; - static const size_t MP_NUM = 2; + static const size_t callback_num = 3; + static const size_t mempool_num = 2; + static const unsigned int mempool_elt_size = 64; + static const unsigned int mempool_size = 64; - struct test_mempool_events_data data[CB_NUM]; - struct rte_mempool *mp[MP_NUM], *freed; + struct test_mempool_events_data data[callback_num]; + struct rte_mempool *mp[mempool_num], *freed; char name[RTE_MEMPOOL_NAMESIZE]; size_t i, j; int ret; memset(mp, 0, sizeof(mp)); - for (i = 0; i < CB_NUM; i++) { + for (i = 0; i < callback_num; i++) { ret = rte_mempool_event_callback_register (test_mempool_events_cb, &data[i]); RTE_TEST_ASSERT_EQUAL(ret, 0, "Failed to register the callback %zu: %s", @@ -541,12 +543,12 @@ test_mempool_events(int (*populate)(struct rte_mempool *mp)) /* Create mempool 0 that will be observed by all callbacks. */ memset(&data, 0, sizeof(data)); strcpy(name, "empty0"); - mp[0] = rte_mempool_create_empty(name, MEMPOOL_SIZE, - MEMPOOL_ELT_SIZE, 0, 0, + mp[0] = rte_mempool_create_empty(name, mempool_size, + mempool_elt_size, 0, 0, SOCKET_ID_ANY, 0); RTE_TEST_ASSERT_NOT_NULL(mp[0], "Cannot create mempool %s: %s", name, rte_strerror(rte_errno)); - for (j = 0; j < CB_NUM; j++) + for (j = 0; j < callback_num; j++) RTE_TEST_ASSERT_EQUAL(data[j].invoked, false, "Callback %zu invoked on %s mempool creation", j, name); @@ -555,7 +557,7 @@ test_mempool_events(int (*populate)(struct rte_mempool *mp)) ret = populate(mp[0]); RTE_TEST_ASSERT_EQUAL(ret, (int)mp[0]->size, "Failed to populate mempool %s: %s", name, rte_strerror(-ret)); - for (j = 0; j < CB_NUM; j++) { + for (j = 0; j < callback_num; j++) { RTE_TEST_ASSERT_EQUAL(data[j].invoked, true, "Callback %zu not invoked on mempool %s population", j, name); @@ -574,8 +576,8 @@ test_mempool_events(int (*populate)(struct rte_mempool *mp)) rte_strerror(rte_errno)); memset(&data, 0, sizeof(data)); strcpy(name, "empty1"); - mp[1] = rte_mempool_create_empty(name, MEMPOOL_SIZE, - MEMPOOL_ELT_SIZE, 0, 0, + mp[1] = rte_mempool_create_empty(name, mempool_size, + mempool_elt_size, 0, 0, SOCKET_ID_ANY, 0); RTE_TEST_ASSERT_NOT_NULL(mp[1], "Cannot create mempool %s: %s", name, rte_strerror(rte_errno)); @@ -587,7 +589,7 @@ test_mempool_events(int (*populate)(struct rte_mempool *mp)) "Unregistered callback 0 invoked on %s mempool populaton", name); - for (i = 0; i < MP_NUM; i++) { + for (i = 0; i < mempool_num; i++) { memset(&data, 0, sizeof(data)); sprintf(name, "empty%zu", i); rte_mempool_free(mp[i]); @@ -597,7 +599,7 @@ test_mempool_events(int (*populate)(struct rte_mempool *mp)) */ freed = mp[i]; mp[i] = NULL; - for (j = 1; j < CB_NUM; j++) { + for (j = 1; j < callback_num; j++) { RTE_TEST_ASSERT_EQUAL(data[j].invoked, true, "Callback %zu not invoked on mempool %s destruction", j, name); @@ -613,7 +615,7 @@ test_mempool_events(int (*populate)(struct rte_mempool *mp)) name); } - for (j = 1; j < CB_NUM; j++) { + for (j = 1; j < callback_num; j++) { ret = rte_mempool_event_callback_unregister (test_mempool_events_cb, &data[j]); RTE_TEST_ASSERT_EQUAL(ret, 0, "Failed to unregister the callback %zu: %s", @@ -622,10 +624,10 @@ test_mempool_events(int (*populate)(struct rte_mempool *mp)) return TEST_SUCCESS; fail: - for (j = 0; j < CB_NUM; j++) + for (j = 0; j < callback_num; j++) rte_mempool_event_callback_unregister (test_mempool_events_cb, &data[j]); - for (i = 0; i < MP_NUM; i++) + for (i = 0; i < mempool_num; i++) rte_mempool_free(mp[i]); return TEST_FAILED; -- 2.25.1