[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20200714030348.6214-5-mathieu.desnoyers@efficios.com>
Date: Mon, 13 Jul 2020 23:03:48 -0400
From: Mathieu Desnoyers <mathieu.desnoyers@...icios.com>
To: Peter Zijlstra <peterz@...radead.org>
Cc: linux-kernel@...r.kernel.org, Thomas Gleixner <tglx@...utronix.de>,
"Paul E . McKenney" <paulmck@...ux.ibm.com>,
Boqun Feng <boqun.feng@...il.com>,
"H . Peter Anvin" <hpa@...or.com>, Paul Turner <pjt@...gle.com>,
linux-api@...r.kernel.org,
Christian Brauner <christian.brauner@...ntu.com>,
Florian Weimer <fw@...eb.enyo.de>, carlos@...hat.com,
Mathieu Desnoyers <mathieu.desnoyers@...icios.com>
Subject: [RFC PATCH 4/4] selftests: rseq: print rseq extensible size in basic test
Print whether extensible size feature is supported by the kernel
and __rseq_abi definition, along with the contents of the kernel_size
field if it is available.
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@...icios.com>
---
tools/testing/selftests/rseq/basic_test.c | 15 +++++++++++++++
1 file changed, 15 insertions(+)
diff --git a/tools/testing/selftests/rseq/basic_test.c b/tools/testing/selftests/rseq/basic_test.c
index d8efbfb89193..976e040574a1 100644
--- a/tools/testing/selftests/rseq/basic_test.c
+++ b/tools/testing/selftests/rseq/basic_test.c
@@ -10,6 +10,7 @@
#include <stdio.h>
#include <string.h>
#include <sys/time.h>
+#include <inttypes.h>
#include "rseq.h"
@@ -35,6 +36,17 @@ void test_cpu_pointer(void)
sched_setaffinity(0, sizeof(affinity), &affinity);
}
+static void print_rseq_size(void)
+{
+ bool supported = (__rseq_abi.flags & RSEQ_TLS_FLAG_SIZE) && __rseq_abi.kernel_size != 0;
+
+ printf("extensible struct rseq supported: %s",
+ supported ? "yes" : "no");
+ if (supported)
+ printf(" (kernel_size=%" PRIu16 ")", __rseq_abi.kernel_size);
+ printf("\n");
+}
+
int main(int argc, char **argv)
{
if (rseq_register_current_thread()) {
@@ -42,6 +54,9 @@ int main(int argc, char **argv)
errno, strerror(errno));
goto init_thread_error;
}
+
+ print_rseq_size();
+
printf("testing current cpu\n");
test_cpu_pointer();
if (rseq_unregister_current_thread()) {
--
2.17.1
Powered by blists - more mailing lists