OpenVZ / Virtuozzo kernel development (devel@openvz.org)
 help / color / mirror / Atom feed
From: Eva Kurchatova <eva.kurchatova@virtuozzo.com>
To: khorenko@virtuozzo.com
Cc: devel@openvz.org
Subject: [Devel] [PATCH vz10] selftests: dma-buf: skip the huge page test without huge pages
Date: Tue,  1 Sep 2026 03:41:24 +0300	[thread overview]
Message-ID: <20260901004125.1654709-1-eva.kurchatova@virtuozzo.com> (raw)

The last udmabuf test backs a memfd with MFD_HUGETLB. Where no huge
pages are reserved the mapping fails and the whole test is reported as
a failure.

https://virtuozzo.atlassian.net/browse/VSTOR-142448
Feature: fix selftests
Signed-off-by: Eva Kurchatova <eva.kurchatova@virtuozzo.com>
---
 .../selftests/drivers/dma-buf/udmabuf.c       | 20 +++++++++++++++++++
 1 file changed, 20 insertions(+)

diff --git a/tools/testing/selftests/drivers/dma-buf/udmabuf.c b/tools/testing/selftests/drivers/dma-buf/udmabuf.c
index 6062723a172e..a3bb26c1991a 100644
--- a/tools/testing/selftests/drivers/dma-buf/udmabuf.c
+++ b/tools/testing/selftests/drivers/dma-buf/udmabuf.c
@@ -25,6 +25,21 @@
 
 static unsigned int page_size;
 
+static bool hugepages_available(void)
+{
+	unsigned long nr = 0;
+	FILE *f;
+
+	f = fopen("/proc/sys/vm/nr_hugepages", "r");
+	if (!f)
+		return false;
+	if (fscanf(f, "%lu", &nr) != 1)
+		nr = 0;
+	fclose(f);
+
+	return nr > 0;
+}
+
 static int create_memfd_with_seals(off64_t size, bool hpage)
 {
 	int memfd, ret;
@@ -234,6 +249,11 @@ int main(int argc, char *argv[])
 	close(memfd);
 
 	/* should work (migration of 2MB size huge pages)*/
+	if (!hugepages_available()) {
+		ksft_test_result_skip("%s: [SKIP,test-6] no huge pages\n", TEST_PREFIX);
+		close(devfd);
+		ksft_finished();
+	}
 	page_size = getpagesize() * 512; /* 2 MB */
 	size = MEMFD_SIZE * page_size;
 	memfd = create_memfd_with_seals(size, true);
-- 
2.55.0

_______________________________________________
Devel mailing list
Devel@openvz.org
https://lists.openvz.org/mailman/listinfo/devel

             reply	other threads:[~2026-09-01  0:42 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-01  0:41 Eva Kurchatova [this message]
2026-09-01 21:31 ` Konstantin Khorenko
2026-09-01 21:33 ` Konstantin Khorenko

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260901004125.1654709-1-eva.kurchatova@virtuozzo.com \
    --to=eva.kurchatova@virtuozzo.com \
    --cc=devel@openvz.org \
    --cc=khorenko@virtuozzo.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox