Skip to content

Commit 62c42f2

Browse files
committed
selftests/mm: skip hugevm test if kernel config file is not present
JIRA: https://issues.redhat.com/browse/RHEL-130531 commit 1151559 Author: Zi Yan <ziy@nvidia.com> Date: Fri May 16 09:29:38 2025 -0400 selftests/mm: skip hugevm test if kernel config file is not present When running hugevm tests in a machine without kernel config present, e.g., a VM running a kernel without CONFIG_IKCONFIG_PROC nor /boot/config-*, skip hugevm tests, which reads kernel config to get page table level information. Link: https://lkml.kernel.org/r/20250516132938.356627-3-ziy@nvidia.com Signed-off-by: Zi Yan <ziy@nvidia.com> Acked-by: Lorenzo Stoakes <lorenzo.stoakes@oracle.com> Cc: Adam Sindelar <adam@wowsignal.io> Cc: Lorenzo Stoakes <lorenzo.stoakes@oracle.com> Cc: Pedro Falcato <pfalcato@suse.de> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Chunyu Hu <chuhu@redhat.com>
1 parent 9eaa425 commit 62c42f2

File tree

1 file changed

+9
-17
lines changed

1 file changed

+9
-17
lines changed

tools/testing/selftests/mm/va_high_addr_switch.sh

Lines changed: 9 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -7,23 +7,20 @@
77
# real test to check that the kernel is configured to support at least 5
88
# pagetable levels.
99

10-
# 1 means the test failed
11-
exitcode=1
12-
1310
# Kselftest framework requirement - SKIP code is 4.
1411
ksft_skip=4
1512

16-
fail()
13+
skip()
1714
{
1815
echo "$1"
19-
exit $exitcode
16+
exit $ksft_skip
2017
}
2118

2219
check_supported_x86_64()
2320
{
2421
local config="/proc/config.gz"
2522
[[ -f "${config}" ]] || config="/boot/config-$(uname -r)"
26-
[[ -f "${config}" ]] || fail "Cannot find kernel config in /proc or /boot"
23+
[[ -f "${config}" ]] || skip "Cannot find kernel config in /proc or /boot"
2724

2825
# gzip -dcfq automatically handles both compressed and plaintext input.
2926
# See man 1 gzip under '-f'.
@@ -33,36 +30,31 @@ check_supported_x86_64()
3330
else {print 1}; exit}' /proc/cpuinfo 2>/dev/null)
3431

3532
if [[ "${pg_table_levels}" -lt 5 ]]; then
36-
echo "$0: PGTABLE_LEVELS=${pg_table_levels}, must be >= 5 to run this test"
37-
exit $ksft_skip
33+
skip "$0: PGTABLE_LEVELS=${pg_table_levels}, must be >= 5 to run this test"
3834
elif [[ "${cpu_supports_pl5}" -ne 0 ]]; then
39-
echo "$0: CPU does not have the necessary la57 flag to support page table level 5"
40-
exit $ksft_skip
35+
skip "$0: CPU does not have the necessary la57 flag to support page table level 5"
4136
fi
4237
}
4338

4439
check_supported_ppc64()
4540
{
4641
local config="/proc/config.gz"
4742
[[ -f "${config}" ]] || config="/boot/config-$(uname -r)"
48-
[[ -f "${config}" ]] || fail "Cannot find kernel config in /proc or /boot"
43+
[[ -f "${config}" ]] || skip "Cannot find kernel config in /proc or /boot"
4944

5045
local pg_table_levels=$(gzip -dcfq "${config}" | grep PGTABLE_LEVELS | cut -d'=' -f 2)
5146
if [[ "${pg_table_levels}" -lt 5 ]]; then
52-
echo "$0: PGTABLE_LEVELS=${pg_table_levels}, must be >= 5 to run this test"
53-
exit $ksft_skip
47+
skip "$0: PGTABLE_LEVELS=${pg_table_levels}, must be >= 5 to run this test"
5448
fi
5549

5650
local mmu_support=$(grep -m1 "mmu" /proc/cpuinfo | awk '{print $3}')
5751
if [[ "$mmu_support" != "radix" ]]; then
58-
echo "$0: System does not use Radix MMU, required for 5-level paging"
59-
exit $ksft_skip
52+
skip "$0: System does not use Radix MMU, required for 5-level paging"
6053
fi
6154

6255
local hugepages_total=$(awk '/HugePages_Total/ {print $2}' /proc/meminfo)
6356
if [[ "${hugepages_total}" -eq 0 ]]; then
64-
echo "$0: HugePages are not enabled, required for some tests"
65-
exit $ksft_skip
57+
skip "$0: HugePages are not enabled, required for some tests"
6658
fi
6759
}
6860

0 commit comments

Comments
 (0)