KVM: selftests: Print a more helpful message for EACCESS in access tracking test

Use open_path_or_exit() helper to probe /sys/kernel/mm/page_idle/bitmap in
the access tracking perf test so that a helpful/pertinent SKIP message is
printed if the file exists but is inaccessible, e.g. because the file has
the kernel's default 0600 permissions.

Cc: James Houghton <jthoughton@google.com>
Link: https://lore.kernel.org/r/20250516215909.2551628-5-seanjc@google.com
Signed-off-by: Sean Christopherson <seanjc@google.com>
This commit is contained in:
Sean Christopherson
2025-05-16 14:59:09 -07:00
parent ba300a728f
commit 71443210e2

View File

@@ -596,11 +596,8 @@ int main(int argc, char *argv[])
if (ret)
return ret;
} else {
page_idle_fd = open("/sys/kernel/mm/page_idle/bitmap", O_RDWR);
__TEST_REQUIRE(page_idle_fd >= 0,
"Couldn't open /sys/kernel/mm/page_idle/bitmap. "
"Is CONFIG_IDLE_PAGE_TRACKING enabled?");
page_idle_fd = __open_path_or_exit("/sys/kernel/mm/page_idle/bitmap", O_RDWR,
"Is CONFIG_IDLE_PAGE_TRACKING enabled?");
close(page_idle_fd);
puts("Using page_idle for aging");