mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "tip-bot2 for Thomas Weißschuh" <tip-bot2@linutronix.de>
To: linux-tip-commits@vger.kernel.org
Cc: thomas.weissschuh@linutronix.de,
	Thomas Gleixner <tglx@kernel.org>,
	x86@kernel.org, linux-kernel@vger.kernel.org
Subject: [tip: timers/vdso] selftests: vDSO: vdso_test_abi: Add test for clock_getres_time64()
Date: Tue, 13 Jan 2026 13:47:38 -0000	[thread overview]
Message-ID: <176831205878.510.3437388750079795458.tip-bot2@tip-bot2> (raw)
In-Reply-To: <20251223-vdso-compat-time32-v1-4-97ea7a06a543@linutronix.de>

The following commit has been merged into the timers/vdso branch of tip:

Commit-ID:     4e6a2312986d437cc22805b9e08f86b15fee0318
Gitweb:        https://git.kernel.org/tip/4e6a2312986d437cc22805b9e08f86b15fee0318
Author:        Thomas Weißschuh <thomas.weissschuh@linutronix.de>
AuthorDate:    Tue, 23 Dec 2025 07:59:15 +01:00
Committer:     Thomas Gleixner <tglx@kernel.org>
CommitterDate: Tue, 13 Jan 2026 14:42:23 +01:00

selftests: vDSO: vdso_test_abi: Add test for clock_getres_time64()

Some architectures will start to implement this function.
Make sure it works correctly.

Signed-off-by: Thomas Weißschuh <thomas.weissschuh@linutronix.de>
Signed-off-by: Thomas Gleixner <tglx@kernel.org>
Link: https://patch.msgid.link/20251223-vdso-compat-time32-v1-4-97ea7a06a543@linutronix.de
---
 tools/testing/selftests/vDSO/vdso_test_abi.c | 53 ++++++++++++++++++-
 1 file changed, 52 insertions(+), 1 deletion(-)

diff --git a/tools/testing/selftests/vDSO/vdso_test_abi.c b/tools/testing/selftests/vDSO/vdso_test_abi.c
index a75c12d..b162a4b 100644
--- a/tools/testing/selftests/vDSO/vdso_test_abi.c
+++ b/tools/testing/selftests/vDSO/vdso_test_abi.c
@@ -36,6 +36,7 @@ typedef long (*vdso_gettimeofday_t)(struct timeval *tv, struct timezone *tz);
 typedef long (*vdso_clock_gettime_t)(clockid_t clk_id, struct timespec *ts);
 typedef long (*vdso_clock_gettime64_t)(clockid_t clk_id, struct vdso_timespec64 *ts);
 typedef long (*vdso_clock_getres_t)(clockid_t clk_id, struct timespec *ts);
+typedef long (*vdso_clock_getres_time64_t)(clockid_t clk_id, struct vdso_timespec64 *ts);
 typedef time_t (*vdso_time_t)(time_t *t);
 
 static const char * const vdso_clock_name[] = {
@@ -196,6 +197,55 @@ static void vdso_test_clock_getres(clockid_t clk_id)
 	}
 }
 
+#ifdef __NR_clock_getres_time64
+static void vdso_test_clock_getres_time64(clockid_t clk_id)
+{
+	int clock_getres_fail = 0;
+
+	/* Find clock_getres. */
+	vdso_clock_getres_time64_t vdso_clock_getres_time64 =
+		(vdso_clock_getres_time64_t)vdso_sym(version, name[7]);
+
+	if (!vdso_clock_getres_time64) {
+		ksft_print_msg("Couldn't find %s\n", name[7]);
+		ksft_test_result_skip("%s %s\n", name[7],
+				      vdso_clock_name[clk_id]);
+		return;
+	}
+
+	struct vdso_timespec64 ts, sys_ts;
+	long ret = VDSO_CALL(vdso_clock_getres_time64, 2, clk_id, &ts);
+
+	if (ret == 0) {
+		ksft_print_msg("The vdso resolution is %lld %lld\n",
+			       (long long)ts.tv_sec, (long long)ts.tv_nsec);
+	} else {
+		clock_getres_fail++;
+	}
+
+	ret = syscall(__NR_clock_getres_time64, clk_id, &sys_ts);
+
+	ksft_print_msg("The syscall resolution is %lld %lld\n",
+			(long long)sys_ts.tv_sec, (long long)sys_ts.tv_nsec);
+
+	if ((sys_ts.tv_sec != ts.tv_sec) || (sys_ts.tv_nsec != ts.tv_nsec))
+		clock_getres_fail++;
+
+	if (clock_getres_fail > 0) {
+		ksft_test_result_fail("%s %s\n", name[7],
+				      vdso_clock_name[clk_id]);
+	} else {
+		ksft_test_result_pass("%s %s\n", name[7],
+				      vdso_clock_name[clk_id]);
+	}
+}
+#else /* !__NR_clock_getres_time64 */
+static void vdso_test_clock_getres_time64(clockid_t clk_id)
+{
+	ksft_test_result_skip("%s %s\n", name[7], vdso_clock_name[clk_id]);
+}
+#endif /* __NR_clock_getres_time64 */
+
 /*
  * This function calls vdso_test_clock_gettime and vdso_test_clock_getres
  * with different values for clock_id.
@@ -208,9 +258,10 @@ static inline void vdso_test_clock(clockid_t clock_id)
 	vdso_test_clock_gettime64(clock_id);
 
 	vdso_test_clock_getres(clock_id);
+	vdso_test_clock_getres_time64(clock_id);
 }
 
-#define VDSO_TEST_PLAN	29
+#define VDSO_TEST_PLAN	38
 
 int main(int argc, char **argv)
 {

  reply	other threads:[~2026-01-13 13:47 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-12-23  6:59 [PATCH 0/9] vDSO: Provide clock_getres_time64() where applicable Thomas Weißschuh
2025-12-23  6:59 ` [PATCH 1/9] vdso: Add prototype for __vdso_clock_getres_time64() Thomas Weißschuh
2026-01-13 13:47   ` [tip: timers/vdso] " tip-bot2 for Thomas Weißschuh
2025-12-23  6:59 ` [PATCH 2/9] selftests: vDSO: vdso_config: Add configurations for clock_getres_time64() Thomas Weißschuh
2026-01-13 13:47   ` [tip: timers/vdso] " tip-bot2 for Thomas Weißschuh
2025-12-23  6:59 ` [PATCH 3/9] selftests: vDSO: vdso_test_abi: Use UAPI system call numbers Thomas Weißschuh
2026-01-13 13:47   ` [tip: timers/vdso] " tip-bot2 for Thomas Weißschuh
2025-12-23  6:59 ` [PATCH 4/9] selftests: vDSO: vdso_test_abi: Add test for clock_getres_time64() Thomas Weißschuh
2026-01-13 13:47   ` tip-bot2 for Thomas Weißschuh [this message]
2025-12-23  6:59 ` [PATCH 5/9] x86/vdso: Provide clock_getres_time64() for x86-32 Thomas Weißschuh
2026-01-13 13:47   ` [tip: timers/vdso] " tip-bot2 for Thomas Weißschuh
2025-12-23  6:59 ` [PATCH 6/9] ARM: VDSO: also patch out __vdso_clock_getres() if unavailable Thomas Weißschuh
2026-01-13 13:47   ` [tip: timers/vdso] ARM: VDSO: Patch " tip-bot2 for Thomas Weißschuh
2025-12-23  6:59 ` [PATCH 7/9] ARM: VDSO: provide clock_getres_time64() Thomas Weißschuh
2026-01-13 13:47   ` [tip: timers/vdso] ARM: VDSO: Provide clock_getres_time64() tip-bot2 for Thomas Weißschuh
2025-12-23  6:59 ` [PATCH 8/9] arm64: vdso32: " Thomas Weißschuh
2026-01-05 20:55   ` Will Deacon
2026-01-13 13:47   ` [tip: timers/vdso] " tip-bot2 for Thomas Weißschuh
2025-12-23  6:59 ` [PATCH 9/9] MIPS: vdso: Provide getres_time64() for 32-bit ABIs Thomas Weißschuh
2026-01-13 13:47   ` [tip: timers/vdso] " tip-bot2 for Thomas Weißschuh

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=176831205878.510.3437388750079795458.tip-bot2@tip-bot2 \
    --to=tip-bot2@linutronix.de \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-tip-commits@vger.kernel.org \
    --cc=tglx@kernel.org \
    --cc=thomas.weissschuh@linutronix.de \
    --cc=x86@kernel.org \
    /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

all inboxes | Powered by JetHome®