linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2] selftests: vdso_test: support ARM64 targets
@ 2017-11-01 21:34 Greg Hackmann
  2017-11-01 23:11 ` Shuah Khan
  0 siblings, 1 reply; 2+ messages in thread
From: Greg Hackmann @ 2017-11-01 21:34 UTC (permalink / raw)
  To: Shuah Khan; +Cc: Steve Muckle, linux-kselftest, linux-kernel, Greg Hackmann

ARM64's vDSO exports its gettimeofday() implementation with a different
name (__kernel_gettimeofday) and version (LINUX_2.6.39) from other
architectures.  Add a corresponding special-case to vdso_test.

Signed-off-by: Greg Hackmann <ghackmann@google.com>
---

Changes since v1:
 * Moved definitions outside main()
 * Added a comment explaining the special case

 tools/testing/selftests/vDSO/vdso_test.c | 19 ++++++++++++++++---
 1 file changed, 16 insertions(+), 3 deletions(-)

diff --git a/tools/testing/selftests/vDSO/vdso_test.c b/tools/testing/selftests/vDSO/vdso_test.c
index 8daeb7d7032c..2df26bd0099c 100644
--- a/tools/testing/selftests/vDSO/vdso_test.c
+++ b/tools/testing/selftests/vDSO/vdso_test.c
@@ -19,6 +19,19 @@ extern void *vdso_sym(const char *version, const char *name);
 extern void vdso_init_from_sysinfo_ehdr(uintptr_t base);
 extern void vdso_init_from_auxv(void *auxv);
 
+/*
+ * ARM64's vDSO exports its gettimeofday() implementation with a different
+ * name and version from other architectures, so we need to handle it as
+ * a special case.
+ */
+#if defined(__aarch64__)
+const char *version = "LINUX_2.6.39";
+const char *name = "__kernel_gettimeofday";
+#else
+const char *version = "LINUX_2.6";
+const char *name = "__vdso_gettimeofday";
+#endif
+
 int main(int argc, char **argv)
 {
 	unsigned long sysinfo_ehdr = getauxval(AT_SYSINFO_EHDR);
@@ -31,10 +44,10 @@ int main(int argc, char **argv)
 
 	/* Find gettimeofday. */
 	typedef long (*gtod_t)(struct timeval *tv, struct timezone *tz);
-	gtod_t gtod = (gtod_t)vdso_sym("LINUX_2.6", "__vdso_gettimeofday");
+	gtod_t gtod = (gtod_t)vdso_sym(version, name);
 
 	if (!gtod) {
-		printf("Could not find __vdso_gettimeofday\n");
+		printf("Could not find %s\n", name);
 		return 1;
 	}
 
@@ -45,7 +58,7 @@ int main(int argc, char **argv)
 		printf("The time is %lld.%06lld\n",
 		       (long long)tv.tv_sec, (long long)tv.tv_usec);
 	} else {
-		printf("__vdso_gettimeofday failed\n");
+		printf("%s failed\n", name);
 	}
 
 	return 0;
-- 
2.15.0.403.gc27cc4dac6-goog

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH v2] selftests: vdso_test: support ARM64 targets
  2017-11-01 21:34 [PATCH v2] selftests: vdso_test: support ARM64 targets Greg Hackmann
@ 2017-11-01 23:11 ` Shuah Khan
  0 siblings, 0 replies; 2+ messages in thread
From: Shuah Khan @ 2017-11-01 23:11 UTC (permalink / raw)
  To: Greg Hackmann
  Cc: Steve Muckle, linux-kselftest, linux-kernel, Shuah Khan, Shuah Khan

On 11/01/2017 03:34 PM, Greg Hackmann wrote:
> ARM64's vDSO exports its gettimeofday() implementation with a different
> name (__kernel_gettimeofday) and version (LINUX_2.6.39) from other
> architectures.  Add a corresponding special-case to vdso_test.
> 
> Signed-off-by: Greg Hackmann <ghackmann@google.com>
> ---
> 
> Changes since v1:
>  * Moved definitions outside main()
>  * Added a comment explaining the special case
> 

That was fast. Applied to linux-kselftest next for 4.15-rc1

thanks,
-- Shuah

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2017-11-01 23:11 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-11-01 21:34 [PATCH v2] selftests: vdso_test: support ARM64 targets Greg Hackmann
2017-11-01 23:11 ` Shuah Khan

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).