diff mbox series

[bpf-next] selftests/bpf: fix xdpxceiver failures for no hugepages

Message ID 20211117123613.22288-1-tirthendu.sarkar@intel.com (mailing list archive)
State Accepted
Commit dd7f091fd22b1dce6c20e8f7769aa068ed88ac6d
Delegated to: BPF
Headers show
Series [bpf-next] selftests/bpf: fix xdpxceiver failures for no hugepages | expand

Checks

Context Check Description
bpf/vmtest-bpf-next fail VM_Test
bpf/vmtest-bpf-next-PR fail PR summary
netdev/tree_selection success Clearly marked for bpf-next
netdev/fixes_present success Fixes tag not required for -next series
netdev/subject_prefix success Link
netdev/cover_letter success Single patches do not need cover letters
netdev/patch_count success Link
netdev/header_inline success No static functions without inline keyword in header files
netdev/build_32bit success Errors and warnings before: 0 this patch: 0
netdev/cc_maintainers warning 12 maintainers not CCed: kafai@fb.com kpsingh@kernel.org davem@davemloft.net hawk@kernel.org bpf@vger.kernel.org linux-kselftest@vger.kernel.org kuba@kernel.org yhs@fb.com john.fastabend@gmail.com andrii@kernel.org songliubraving@fb.com shuah@kernel.org
netdev/build_clang success Errors and warnings before: 0 this patch: 0
netdev/module_param success Was 0 now: 0
netdev/verify_signedoff fail author Signed-off-by missing
netdev/verify_fixes success Fixes tag looks correct
netdev/build_allmodconfig_warn success Errors and warnings before: 0 this patch: 0
netdev/checkpatch fail ERROR: Unrecognized email address: 'Tirthendu Sarkar tirthendu.sarkar@intel.com'
netdev/kdoc success Errors and warnings before: 0 this patch: 0
netdev/source_inline success Was 0 now: 0

Commit Message

Tirthendu Sarkar Nov. 17, 2021, 12:36 p.m. UTC
xsk_configure_umem() needs hugepages to work in unaligned mode. So when
hugepages are not configured, 'unaligned' tests should be skipped which
is determined by the helper function hugepages_present(). This function
erroneously returns true with MAP_NORESERVE flag even when no hugepages
are configured. The removal of this flag fixes the issue.

The test TEST_TYPE_UNALIGNED_INV_DESC also needs to be skipped when
there are no hugepages. However, this was not skipped as there was no
check for presence of hugepages and hence was failing. The check to skip
the test has now been added.

Fixes: a4ba98dd0c693 (selftests: xsk: Add test for unaligned mode)
Signed-off-by: Tirthendu Sarkar tirthendu.sarkar@intel.com
---
 tools/testing/selftests/bpf/xdpxceiver.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

Comments

patchwork-bot+netdevbpf@kernel.org Nov. 17, 2021, 11 p.m. UTC | #1
Hello:

This patch was applied to bpf/bpf-next.git (master)
by Daniel Borkmann <daniel@iogearbox.net>:

On Wed, 17 Nov 2021 18:06:13 +0530 you wrote:
> xsk_configure_umem() needs hugepages to work in unaligned mode. So when
> hugepages are not configured, 'unaligned' tests should be skipped which
> is determined by the helper function hugepages_present(). This function
> erroneously returns true with MAP_NORESERVE flag even when no hugepages
> are configured. The removal of this flag fixes the issue.
> 
> The test TEST_TYPE_UNALIGNED_INV_DESC also needs to be skipped when
> there are no hugepages. However, this was not skipped as there was no
> check for presence of hugepages and hence was failing. The check to skip
> the test has now been added.
> 
> [...]

Here is the summary with links:
  - [bpf-next] selftests/bpf: fix xdpxceiver failures for no hugepages
    https://git.kernel.org/bpf/bpf-next/c/dd7f091fd22b

You are awesome, thank you!
diff mbox series

Patch

diff --git a/tools/testing/selftests/bpf/xdpxceiver.c b/tools/testing/selftests/bpf/xdpxceiver.c
index fe7f423b8c3f..040164c7efc1 100644
--- a/tools/testing/selftests/bpf/xdpxceiver.c
+++ b/tools/testing/selftests/bpf/xdpxceiver.c
@@ -1217,7 +1217,7 @@  static bool hugepages_present(struct ifobject *ifobject)
 	void *bufs;
 
 	bufs = mmap(NULL, mmap_sz, PROT_READ | PROT_WRITE,
-		    MAP_PRIVATE | MAP_ANONYMOUS | MAP_NORESERVE | MAP_HUGETLB, -1, 0);
+		    MAP_PRIVATE | MAP_ANONYMOUS | MAP_HUGETLB, -1, 0);
 	if (bufs == MAP_FAILED)
 		return false;
 
@@ -1364,6 +1364,10 @@  static void run_pkt_test(struct test_spec *test, enum test_mode mode, enum test_
 		testapp_invalid_desc(test);
 		break;
 	case TEST_TYPE_UNALIGNED_INV_DESC:
+		if (!hugepages_present(test->ifobj_tx)) {
+			ksft_test_result_skip("No 2M huge pages present.\n");
+			return;
+		}
 		test_spec_set_name(test, "UNALIGNED_INV_DESC");
 		test->ifobj_tx->umem->unaligned_mode = true;
 		test->ifobj_rx->umem->unaligned_mode = true;