Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

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>

authored by

Zi Yan and committed by
Andrew Morton
11515590 6d211303

+9 -17
+9 -17
tools/testing/selftests/mm/va_high_addr_switch.sh
··· 7 7 # real test to check that the kernel is configured to support at least 5 8 8 # pagetable levels. 9 9 10 - # 1 means the test failed 11 - exitcode=1 12 - 13 10 # Kselftest framework requirement - SKIP code is 4. 14 11 ksft_skip=4 15 12 16 - fail() 13 + skip() 17 14 { 18 15 echo "$1" 19 - exit $exitcode 16 + exit $ksft_skip 20 17 } 21 18 22 19 check_supported_x86_64() 23 20 { 24 21 local config="/proc/config.gz" 25 22 [[ -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" 27 24 28 25 # gzip -dcfq automatically handles both compressed and plaintext input. 29 26 # See man 1 gzip under '-f'. ··· 30 33 else {print 1}; exit}' /proc/cpuinfo 2>/dev/null) 31 34 32 35 if [[ "${pg_table_levels}" -lt 5 ]]; then 33 - echo "$0: PGTABLE_LEVELS=${pg_table_levels}, must be >= 5 to run this test" 34 - exit $ksft_skip 36 + skip "$0: PGTABLE_LEVELS=${pg_table_levels}, must be >= 5 to run this test" 35 37 elif [[ "${cpu_supports_pl5}" -ne 0 ]]; then 36 - echo "$0: CPU does not have the necessary la57 flag to support page table level 5" 37 - exit $ksft_skip 38 + skip "$0: CPU does not have the necessary la57 flag to support page table level 5" 38 39 fi 39 40 } 40 41 ··· 40 45 { 41 46 local config="/proc/config.gz" 42 47 [[ -f "${config}" ]] || config="/boot/config-$(uname -r)" 43 - [[ -f "${config}" ]] || fail "Cannot find kernel config in /proc or /boot" 48 + [[ -f "${config}" ]] || skip "Cannot find kernel config in /proc or /boot" 44 49 45 50 local pg_table_levels=$(gzip -dcfq "${config}" | grep PGTABLE_LEVELS | cut -d'=' -f 2) 46 51 if [[ "${pg_table_levels}" -lt 5 ]]; then 47 - echo "$0: PGTABLE_LEVELS=${pg_table_levels}, must be >= 5 to run this test" 48 - exit $ksft_skip 52 + skip "$0: PGTABLE_LEVELS=${pg_table_levels}, must be >= 5 to run this test" 49 53 fi 50 54 51 55 local mmu_support=$(grep -m1 "mmu" /proc/cpuinfo | awk '{print $3}') 52 56 if [[ "$mmu_support" != "radix" ]]; then 53 - echo "$0: System does not use Radix MMU, required for 5-level paging" 54 - exit $ksft_skip 57 + skip "$0: System does not use Radix MMU, required for 5-level paging" 55 58 fi 56 59 57 60 local hugepages_total=$(awk '/HugePages_Total/ {print $2}' /proc/meminfo) 58 61 if [[ "${hugepages_total}" -eq 0 ]]; then 59 - echo "$0: HugePages are not enabled, required for some tests" 60 - exit $ksft_skip 62 + skip "$0: HugePages are not enabled, required for some tests" 61 63 fi 62 64 } 63 65