Skip to content

Commit dd7f091

Browse files
tirthendu-intelborkmann
authored andcommitted
selftests/bpf: Fix xdpxceiver failures for no hugepages
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: a4ba98d (selftests: xsk: Add test for unaligned mode) Signed-off-by: Tirthendu Sarkar <tirthendu.sarkar@intel.com> Signed-off-by: Daniel Borkmann <daniel@iogearbox.net> Link: https://lore.kernel.org/bpf/20211117123613.22288-1-tirthendu.sarkar@intel.com
1 parent 5931d9a commit dd7f091

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

tools/testing/selftests/bpf/xdpxceiver.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1217,7 +1217,7 @@ static bool hugepages_present(struct ifobject *ifobject)
12171217
void *bufs;
12181218

12191219
bufs = mmap(NULL, mmap_sz, PROT_READ | PROT_WRITE,
1220-
MAP_PRIVATE | MAP_ANONYMOUS | MAP_NORESERVE | MAP_HUGETLB, -1, 0);
1220+
MAP_PRIVATE | MAP_ANONYMOUS | MAP_HUGETLB, -1, 0);
12211221
if (bufs == MAP_FAILED)
12221222
return false;
12231223

@@ -1364,6 +1364,10 @@ static void run_pkt_test(struct test_spec *test, enum test_mode mode, enum test_
13641364
testapp_invalid_desc(test);
13651365
break;
13661366
case TEST_TYPE_UNALIGNED_INV_DESC:
1367+
if (!hugepages_present(test->ifobj_tx)) {
1368+
ksft_test_result_skip("No 2M huge pages present.\n");
1369+
return;
1370+
}
13671371
test_spec_set_name(test, "UNALIGNED_INV_DESC");
13681372
test->ifobj_tx->umem->unaligned_mode = true;
13691373
test->ifobj_rx->umem->unaligned_mode = true;

0 commit comments

Comments
 (0)