linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Sven Schnelle <svens@linux.ibm.com>
To: Shuah Khan <shuah@kernel.org>
Cc: svens@stackframe.org, Thomas Gleixner <tglx@linutronix.de>,
	Steve Winslow <swinslow@gmail.com>,
	Alexios Zavras <alexios.zavras@intel.com>,
	Allison Randal <allison@lohutok.net>,
	linux-kselftest@vger.kernel.org, linux-kernel@vger.kernel.org,
	Sven Schnelle <svens@linux.ibm.com>
Subject: [PATCH 2/2] selftests/vDSO: make vDSO test work on s390x
Date: Sat,  4 Apr 2020 22:37:04 +0200	[thread overview]
Message-ID: <20200404203704.69412-2-svens@linux.ibm.com> (raw)
In-Reply-To: <20200404203704.69412-1-svens@linux.ibm.com>

s390x used 8 byte (Elf64_Xword) sized hash table entries.
Add some code to the vdso test to handle that properly.

Signed-off-by: Sven Schnelle <svens@linux.ibm.com>
---
 tools/testing/selftests/vDSO/parse_vdso.c | 14 ++++++++++----
 tools/testing/selftests/vDSO/vdso_test.c  | 11 +++++++----
 2 files changed, 17 insertions(+), 8 deletions(-)

diff --git a/tools/testing/selftests/vDSO/parse_vdso.c b/tools/testing/selftests/vDSO/parse_vdso.c
index 8e5a70a24d9a..2e1e88ebee3d 100644
--- a/tools/testing/selftests/vDSO/parse_vdso.c
+++ b/tools/testing/selftests/vDSO/parse_vdso.c
@@ -58,6 +58,12 @@ extern void *vdso_sym(const char *version, const char *name);
 #define ELF_BITS_XFORM(bits, x) ELF_BITS_XFORM2(bits, x)
 #define ELF(x) ELF_BITS_XFORM(ELF_BITS, x)
 
+#if defined(__s390x__)
+#define	ELF_HASH_TYPE ELF(Xword)
+#else
+#define	ELF_HASH_TYPE ELF(Word)
+#endif
+
 static struct vdso_info
 {
 	bool valid;
@@ -69,8 +75,8 @@ static struct vdso_info
 	/* Symbol table */
 	ELF(Sym) *symtab;
 	const char *symstrings;
-	ELF(Word) *bucket, *chain;
-	ELF(Word) nbucket, nchain;
+	ELF_HASH_TYPE *bucket, *chain;
+	ELF_HASH_TYPE nbucket, nchain;
 
 	/* Version table */
 	ELF(Versym) *versym;
@@ -131,7 +137,7 @@ void vdso_init_from_sysinfo_ehdr(uintptr_t base)
 	/*
 	 * Fish out the useful bits of the dynamic table.
 	 */
-	ELF(Word) *hash = 0;
+	ELF_HASH_TYPE *hash = 0;
 	vdso_info.symstrings = 0;
 	vdso_info.symtab = 0;
 	vdso_info.versym = 0;
@@ -149,7 +155,7 @@ void vdso_init_from_sysinfo_ehdr(uintptr_t base)
 				 + vdso_info.load_offset);
 			break;
 		case DT_HASH:
-			hash = (ELF(Word) *)
+			hash = (ELF_HASH_TYPE *)
 				((uintptr_t)dyn[i].d_un.d_ptr
 				 + vdso_info.load_offset);
 			break;
diff --git a/tools/testing/selftests/vDSO/vdso_test.c b/tools/testing/selftests/vDSO/vdso_test.c
index 719d5a6bd664..2b21261a5eba 100644
--- a/tools/testing/selftests/vDSO/vdso_test.c
+++ b/tools/testing/selftests/vDSO/vdso_test.c
@@ -22,11 +22,14 @@ 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.
+ * Both ARM64's and s390x' vDSO exports its gettimeofday() implementation
+ * with a different name and version from other architectures, so we need
+ * to handle them as a special case.
  */
-#if defined(__aarch64__)
+#if defined(__s390x__)
+const char *version = "LINUX_2.6.29";
+const char *name = "__kernel_gettimeofday";
+#elif defined(__aarch64__)
 const char *version = "LINUX_2.6.39";
 const char *name = "__kernel_gettimeofday";
 #else
-- 
2.17.1


  reply	other threads:[~2020-04-04 20:37 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-04-04 20:37 [PATCH 1/2] selftests/vDSO: prevent SIGFPE if vdso_info.nbucket is zero Sven Schnelle
2020-04-04 20:37 ` Sven Schnelle [this message]
2020-04-28  6:21   ` [PATCH 2/2] selftests/vDSO: make vDSO test work on s390x Sven Schnelle
2020-04-28  6:20 ` [PATCH 1/2] selftests/vDSO: prevent SIGFPE if vdso_info.nbucket is zero Sven Schnelle

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=20200404203704.69412-2-svens@linux.ibm.com \
    --to=svens@linux.ibm.com \
    --cc=alexios.zavras@intel.com \
    --cc=allison@lohutok.net \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-kselftest@vger.kernel.org \
    --cc=shuah@kernel.org \
    --cc=svens@stackframe.org \
    --cc=swinslow@gmail.com \
    --cc=tglx@linutronix.de \
    /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;
as well as URLs for NNTP newsgroup(s).