From: Dmitry Kozlyuk <dkozlyuk@oss.nvidia.com>
To: <dev@dpdk.org>
Cc: Yu Jiang <yux.jiang@intel.com>,
Olivier Matz <olivier.matz@6wind.com>,
Andrew Rybchenko <andrew.rybchenko@oktetlabs.ru>
Subject: [dpdk-dev] [PATCH v2 2/3] app/test: fix mempool test on FreeBSD
Date: Mon, 1 Nov 2021 09:37:00 +0200 [thread overview]
Message-ID: <20211101073701.825389-3-dkozlyuk@nvidia.com> (raw)
In-Reply-To: <20211101073701.825389-1-dkozlyuk@nvidia.com>
FreeBSD EAL does not implement rte_mem_virt2iova() causing an error:
EAL: Test assert test_mempool_flag_non_io_unset_when_populated_with_valid_iova
line 781 failed: Cannot get IOVA
test failed at test_mempool():1030
Test Failed
Change unit test to use rte_memzone_reserve() to allocate memory,
which allows to obtain IOVA directly.
Bugzilla ID: 863
Fixes: 11541c5c81dd ("mempool: add non-IO flag")
Reported-by: Yu Jiang <yux.jiang@intel.com>
Signed-off-by: Dmitry Kozlyuk <dkozlyuk@nvidia.com>
---
app/test/test_mempool.c | 28 +++++++++++++++-------------
1 file changed, 15 insertions(+), 13 deletions(-)
diff --git a/app/test/test_mempool.c b/app/test/test_mempool.c
index 4b0f6b0e7f..ced20dcdc3 100644
--- a/app/test/test_mempool.c
+++ b/app/test/test_mempool.c
@@ -740,16 +740,17 @@ test_mempool_events_safety(void)
static int
test_mempool_flag_non_io_set_when_no_iova_contig_set(void)
{
- void *virt = NULL;
+ const struct rte_memzone *mz = NULL;
+ void *virt;
rte_iova_t iova;
size_t size = MEMPOOL_ELT_SIZE * 16;
struct rte_mempool *mp = NULL;
int ret;
- virt = rte_malloc("test_mempool", size, rte_mem_page_size());
- RTE_TEST_ASSERT_NOT_NULL(virt, "Cannot allocate memory");
- iova = rte_mem_virt2iova(virt);
- RTE_TEST_ASSERT_NOT_EQUAL(iova, RTE_BAD_IOVA, "Cannot get IOVA");
+ mz = rte_memzone_reserve("test_mempool", size, SOCKET_ID_ANY, 0);
+ RTE_TEST_ASSERT_NOT_NULL(mz, "Cannot allocate memory");
+ virt = mz->addr;
+ iova = mz->iova;
mp = rte_mempool_create_empty("empty", MEMPOOL_SIZE,
MEMPOOL_ELT_SIZE, 0, 0,
SOCKET_ID_ANY, RTE_MEMPOOL_F_NO_IOVA_CONTIG);
@@ -772,14 +773,15 @@ test_mempool_flag_non_io_set_when_no_iova_contig_set(void)
ret = TEST_SUCCESS;
exit:
rte_mempool_free(mp);
- rte_free(virt);
+ rte_memzone_free(mz);
return ret;
}
static int
test_mempool_flag_non_io_unset_when_populated_with_valid_iova(void)
{
- void *virt = NULL;
+ const struct rte_memzone *mz = NULL;
+ void *virt;
rte_iova_t iova;
size_t total_size = MEMPOOL_ELT_SIZE * MEMPOOL_SIZE;
size_t block_size = total_size / 3;
@@ -789,12 +791,12 @@ test_mempool_flag_non_io_unset_when_populated_with_valid_iova(void)
/*
* Since objects from the pool are never used in the test,
* we don't care for contiguous IOVA, on the other hand,
- * reiuring it could cause spurious test failures.
+ * requiring it could cause spurious test failures.
*/
- virt = rte_malloc("test_mempool", total_size, rte_mem_page_size());
- RTE_TEST_ASSERT_NOT_NULL(virt, "Cannot allocate memory");
- iova = rte_mem_virt2iova(virt);
- RTE_TEST_ASSERT_NOT_EQUAL(iova, RTE_BAD_IOVA, "Cannot get IOVA");
+ mz = rte_memzone_reserve("test_mempool", total_size, SOCKET_ID_ANY, 0);
+ RTE_TEST_ASSERT_NOT_NULL(mz, "Cannot allocate memory");
+ virt = mz->addr;
+ iova = mz->iova;
mp = rte_mempool_create_empty("empty", MEMPOOL_SIZE,
MEMPOOL_ELT_SIZE, 0, 0,
SOCKET_ID_ANY, 0);
@@ -827,7 +829,7 @@ test_mempool_flag_non_io_unset_when_populated_with_valid_iova(void)
exit:
rte_mempool_free(mp);
- rte_free(virt);
+ rte_memzone_free(mz);
return ret;
}
--
2.25.1
next prev parent reply other threads:[~2021-11-01 7:37 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-10-29 8:40 [dpdk-dev] [PATCH] app/test: fix mempool test failure " Dmitry Kozlyuk
2021-10-29 9:34 ` Olivier Matz
2021-10-29 9:37 ` Dmitry Kozlyuk
2021-11-01 7:36 ` [dpdk-dev] [PATCH v2 0/3] Mempool fixes for FreeBSD Dmitry Kozlyuk
2021-11-01 7:36 ` [dpdk-dev] [PATCH v2 1/3] eal/freebsd: fix IOVA mode selection Dmitry Kozlyuk
2021-11-01 16:21 ` Bruce Richardson
2021-11-01 7:37 ` Dmitry Kozlyuk [this message]
2021-11-01 7:37 ` [dpdk-dev] [PATCH v2 3/3] app/test: fix mempool test in no-huge mode Dmitry Kozlyuk
2021-11-02 10:08 ` [dpdk-dev] [PATCH v3 0/3] Mempool fixes for FreeBSD Dmitry Kozlyuk
2021-11-02 10:08 ` [dpdk-dev] [PATCH v3 1/3] eal/freebsd: fix IOVA mode selection Dmitry Kozlyuk
2021-11-02 10:08 ` [dpdk-dev] [PATCH v3 2/3] app/test: fix mempool test on FreeBSD Dmitry Kozlyuk
2021-11-02 10:08 ` [dpdk-dev] [PATCH v3 3/3] app/test: fix mempool test in no-huge mode Dmitry Kozlyuk
2021-11-03 17:39 ` [dpdk-dev] [PATCH v3 0/3] Mempool fixes for FreeBSD Thomas Monjalon
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20211101073701.825389-3-dkozlyuk@nvidia.com \
--to=dkozlyuk@oss.nvidia.com \
--cc=andrew.rybchenko@oktetlabs.ru \
--cc=dev@dpdk.org \
--cc=olivier.matz@6wind.com \
--cc=yux.jiang@intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).