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 D3774A0C52; Mon, 1 Nov 2021 08:37:38 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id BCB9541121; Mon, 1 Nov 2021 08:37:27 +0100 (CET) Received: from AZHDRRW-EX01.nvidia.com (azhdrrw-ex01.nvidia.com [20.51.104.162]) by mails.dpdk.org (Postfix) with ESMTP id F3693410FF for ; Mon, 1 Nov 2021 08:37:24 +0100 (CET) Received: from NAM02-SN1-obe.outbound.protection.outlook.com (104.47.57.44) by mxs.oss.nvidia.com (10.13.234.36) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.858.15; Mon, 1 Nov 2021 00:37:24 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=B2dDqOYsrp6pUyZhj+dRn3MXYQNjcPW8Y+wHDqJcUEG47jf8ogX/7tjnXL5RvoTrMcgticEmzm54wFZDqq+ZMDnKNb22XwdX5dSIcr9yHGmI4P9+BXiRM25P/es63jvTH7gxO0LFXSnW1O3EaOlThmfmU+QOnNFLJxejPovJjn98I9MAKv0fTOmI9SLjItw0YH1Vo84Tkyb8CRmcWoKkoBEiG520A0QZv05guT2s5q7/5lTRWb9ilRF82dX3O9U9d/xYRdpMX6e+kf93bxSN1VbQKU8gZg7C9mnwkpK3fQ8EM2IV64nRuFcfu3aOA46MNinU7GtZP/UGZB5h/AtdvQ== 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=NHDBC/4plHFGO6Q7K6MgjpvaPtv8AeMShYvPtD1q/nA+WBw8Gutywd32gBRgwHUjbXMur+VUmHBttgPNJOVKeN9UZ8VHELEA2WswLoRnakbzhuZ6M2Fxefs8VT/lGazxXo89Exr4FfGEfinpscZ+IDxIbH/tPuV4WOViVA/jVgqoQb/EICtNNHy4v+Xm4aum4cpw5MvvCz5ft6hecsDjfI9BWK4OrjGTT8Nm144Ua6bJyiVTRBJ7dmhpqnwhaSs+tORrENS2UAtl8dwAWCb0Q2s5XayLmEGgSRAiTvtADvY56jg4odRl9gxS2zoS8dOP5F3d9d8vyJ2a8f39oxEVxg== 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=eORINdd4ONrGFrgE6ZUrvBMIJwVIF1vzkOuXTdjX2gDJRZJqUN3jhUgMsyYieT1Xl4NtAmBERhN74KRvN7ucaUL/f/CAFBpHSFx4nNRaRqONZ+sM7gxANcK+HTnA80Hs+WgA76k5ZfssRFPGX+zCG0cl1FLKmdC8BKbr2/VN73XIsM+Z7oXVK7jR7aqUOfsMvn79kDbQ+ThrSpf7xd//9iaULPYjvH2O1QF72CzNiB3y5jklQJ/+Ra7KsdIer3g7wACfGTGa7+SBCAmtn1nHMyQnLdW2Xi9L4u0afMlzp3u2nzCRpnpuzHM5R3ao7rxei2zzu343bKr11VjylFMg9A== Received: from MW4PR04CA0348.namprd04.prod.outlook.com (2603:10b6:303:8a::23) by MWHPR1201MB0237.namprd12.prod.outlook.com (2603:10b6:301:56::23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4649.19; Mon, 1 Nov 2021 07:37:22 +0000 Received: from CO1NAM11FT024.eop-nam11.prod.protection.outlook.com (2603:10b6:303:8a:cafe::46) by MW4PR04CA0348.outlook.office365.com (2603:10b6:303:8a::23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4649.13 via Frontend Transport; Mon, 1 Nov 2021 07:37:22 +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 CO1NAM11FT024.mail.protection.outlook.com (10.13.174.162) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.4649.14 via Frontend Transport; Mon, 1 Nov 2021 07:37:21 +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; Mon, 1 Nov 2021 07:37:20 +0000 From: Dmitry Kozlyuk To: CC: Olivier Matz , Andrew Rybchenko Date: Mon, 1 Nov 2021 09:37:01 +0200 Message-ID: <20211101073701.825389-4-dkozlyuk@nvidia.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20211101073701.825389-1-dkozlyuk@nvidia.com> References: <20211029084051.679233-1-dkozlyuk@nvidia.com> <20211101073701.825389-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: HQMAIL105.nvidia.com (172.20.187.12) To HQMAIL107.nvidia.com (172.20.187.13) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 54b3f72a-6347-4598-5a85-08d99d0a70f6 X-MS-TrafficTypeDiagnostic: MWHPR1201MB0237: 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: LYNUYw1OEOPYQN8q2e8iCHHt8vhakyniiFMHU28+ZUfnvrx5DLdra97y1R3M/d0AZo/rcoHUYrlml7ubjAN6hI9eG90R8GRetcYK1qI9oeIDfkXldukZuPAdoZLzWb+WAOXFz2RvjxnLC6ywQQjXimNF26dAJjOj4N+fUZibusrQqRDESipSTTXjyTpJfW5Gd8o8F8wg1Hr47PJu7iMlreYeqfB2sCPGzS8BZUvXLKdTAKRlULuhuQzHtAAirsnf5c+ZSDjZlo9NjhDz4ZakwWoOrSqEpktuPuvzL8xbM5eRAgLBKvpgxycLOcE4PMRicWCa4g0YUM4yX2G2d8ZxrT7wEia8QxZspmcmFmf6v8M+Sb0Ukpl3Z6dYr4Dy/dAPNBN48HpS7T3E/wGzo1v5ek/BQ1C8L46+fcGCNAVu4+RzaHpBHcfWP4ZgEaMQrLiZI2qwWVbVVBinoj+KslcMAZZZWv9xmK4XjmCoGsbADllqFC3XNP/wzz8jx0U9mjQCMetSemyG5Kll2TxbSjEQLkLhBBuMgBJK9mJt+y0vqrLbGOTCo63CwNWlePX9l9+u/hV86mSQx2Q00lTcztXZ+itGF/vUhd8GUYjpYO9EiovIttQb0FtWiXVD/ZfooFSz2YoYETO20fmAmhC0uTPGb1VwI1o9AIQ505txejNea3RukkJeK7JbyOXGXbNTv+FbjGOEhhoWr3qMh+Kd8AYmvrmW6ieUtf9OW2dpev1W0Nk= 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)(36840700001)(46966006)(70206006)(6666004)(186003)(426003)(6916009)(55016002)(316002)(16526019)(86362001)(36756003)(107886003)(36906005)(36860700001)(8676002)(7696005)(2906002)(8936002)(7636003)(4326008)(2616005)(54906003)(47076005)(83380400001)(336012)(356005)(5660300002)(26005)(82310400003)(1076003)(508600001)(6286002)(70586007)(14583001); DIR:OUT; SFP:1101; X-MS-Exchange-CrossTenant-OriginalArrivalTime: 01 Nov 2021 07:37:21.8983 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 54b3f72a-6347-4598-5a85-08d99d0a70f6 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: CO1NAM11FT024.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: MWHPR1201MB0237 Subject: [dpdk-dev] [PATCH v2 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