linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/4] selftests/powerpc: Move pick_online_cpu() up into utils.c
@ 2015-12-02  9:44 Michael Ellerman
  2015-12-02  9:44 ` [PATCH 2/4] selftests/powerpc: Import Anton's context_switch2 benchmark Michael Ellerman
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: Michael Ellerman @ 2015-12-02  9:44 UTC (permalink / raw)
  To: linuxppc-dev; +Cc: Anton Blanchard

We want to use this in another test, so make it available at the top of
the powerpc selftests tree.

Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
---
 tools/testing/selftests/powerpc/pmu/Makefile     |  2 +-
 tools/testing/selftests/powerpc/pmu/ebb/Makefile |  3 ++-
 tools/testing/selftests/powerpc/pmu/lib.c        | 26 ------------------------
 tools/testing/selftests/powerpc/pmu/lib.h        |  1 -
 tools/testing/selftests/powerpc/utils.h          |  1 +
 5 files changed, 4 insertions(+), 29 deletions(-)

diff --git a/tools/testing/selftests/powerpc/pmu/Makefile b/tools/testing/selftests/powerpc/pmu/Makefile
index a9099d9f8f39..15cbd6d5a463 100644
--- a/tools/testing/selftests/powerpc/pmu/Makefile
+++ b/tools/testing/selftests/powerpc/pmu/Makefile
@@ -2,7 +2,7 @@ noarg:
 	$(MAKE) -C ../
 
 TEST_PROGS := count_instructions l3_bank_test per_event_excludes
-EXTRA_SOURCES := ../harness.c event.c lib.c
+EXTRA_SOURCES := ../harness.c event.c lib.c ../utils.c
 
 all: $(TEST_PROGS) ebb
 
diff --git a/tools/testing/selftests/powerpc/pmu/ebb/Makefile b/tools/testing/selftests/powerpc/pmu/ebb/Makefile
index 5cdc9dbf2b27..c18285e9a7b6 100644
--- a/tools/testing/selftests/powerpc/pmu/ebb/Makefile
+++ b/tools/testing/selftests/powerpc/pmu/ebb/Makefile
@@ -18,7 +18,8 @@ TEST_PROGS := reg_access_test event_attributes_test cycles_test	\
 
 all: $(TEST_PROGS)
 
-$(TEST_PROGS): ../../harness.c ../event.c ../lib.c ebb.c ebb_handler.S trace.c busy_loop.S
+$(TEST_PROGS): ../../harness.c ../event.c ../lib.c ../../utils.c \
+               ebb.c ebb_handler.S trace.c busy_loop.S
 
 instruction_count_test: ../loop.S
 
diff --git a/tools/testing/selftests/powerpc/pmu/lib.c b/tools/testing/selftests/powerpc/pmu/lib.c
index a07104c2afe6..a361ad3334ce 100644
--- a/tools/testing/selftests/powerpc/pmu/lib.c
+++ b/tools/testing/selftests/powerpc/pmu/lib.c
@@ -15,32 +15,6 @@
 #include "lib.h"
 
 
-int pick_online_cpu(void)
-{
-	cpu_set_t mask;
-	int cpu;
-
-	CPU_ZERO(&mask);
-
-	if (sched_getaffinity(0, sizeof(mask), &mask)) {
-		perror("sched_getaffinity");
-		return -1;
-	}
-
-	/* We prefer a primary thread, but skip 0 */
-	for (cpu = 8; cpu < CPU_SETSIZE; cpu += 8)
-		if (CPU_ISSET(cpu, &mask))
-			return cpu;
-
-	/* Search for anything, but in reverse */
-	for (cpu = CPU_SETSIZE - 1; cpu >= 0; cpu--)
-		if (CPU_ISSET(cpu, &mask))
-			return cpu;
-
-	printf("No cpus in affinity mask?!\n");
-	return -1;
-}
-
 int bind_to_cpu(int cpu)
 {
 	cpu_set_t mask;
diff --git a/tools/testing/selftests/powerpc/pmu/lib.h b/tools/testing/selftests/powerpc/pmu/lib.h
index ca5d72ae3be6..0213af4ff332 100644
--- a/tools/testing/selftests/powerpc/pmu/lib.h
+++ b/tools/testing/selftests/powerpc/pmu/lib.h
@@ -19,7 +19,6 @@ union pipe {
 	int fds[2];
 };
 
-extern int pick_online_cpu(void);
 extern int bind_to_cpu(int cpu);
 extern int kill_child_and_wait(pid_t child_pid);
 extern int wait_for_child(pid_t child_pid);
diff --git a/tools/testing/selftests/powerpc/utils.h b/tools/testing/selftests/powerpc/utils.h
index b7d41086bb0a..7dd75c39d610 100644
--- a/tools/testing/selftests/powerpc/utils.h
+++ b/tools/testing/selftests/powerpc/utils.h
@@ -21,6 +21,7 @@ typedef uint8_t u8;
 
 int test_harness(int (test_function)(void), char *name);
 extern void *get_auxv_entry(int type);
+int pick_online_cpu(void);
 
 /* Yes, this is evil */
 #define FAIL_IF(x)						\
-- 
2.5.0

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

* [PATCH 2/4] selftests/powerpc: Import Anton's context_switch2 benchmark
  2015-12-02  9:44 [PATCH 1/4] selftests/powerpc: Move pick_online_cpu() up into utils.c Michael Ellerman
@ 2015-12-02  9:44 ` Michael Ellerman
  2015-12-02  9:44 ` [PATCH 3/4] selftests/powerpc: Make context_switch do something with no args Michael Ellerman
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: Michael Ellerman @ 2015-12-02  9:44 UTC (permalink / raw)
  To: linuxppc-dev; +Cc: Anton Blanchard

This gets referred to a lot in commit messages, so let's pull it into
the selftests.

Almost vanilla from: http://ozlabs.org/~anton/junkcode/context_switch2.c

Signed-off-by: Anton Blanchard <anton@samba.org>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Acked-by: Anton Blanchard <anton@samba.org>
---
 .../selftests/powerpc/benchmarks/.gitignore        |   1 +
 .../testing/selftests/powerpc/benchmarks/Makefile  |   4 +-
 .../selftests/powerpc/benchmarks/context_switch.c  | 452 +++++++++++++++++++++
 3 files changed, 456 insertions(+), 1 deletion(-)
 create mode 100644 tools/testing/selftests/powerpc/benchmarks/context_switch.c

diff --git a/tools/testing/selftests/powerpc/benchmarks/.gitignore b/tools/testing/selftests/powerpc/benchmarks/.gitignore
index b4709ea588c1..6fa673316ac2 100644
--- a/tools/testing/selftests/powerpc/benchmarks/.gitignore
+++ b/tools/testing/selftests/powerpc/benchmarks/.gitignore
@@ -1 +1,2 @@
 gettimeofday
+context_switch
diff --git a/tools/testing/selftests/powerpc/benchmarks/Makefile b/tools/testing/selftests/powerpc/benchmarks/Makefile
index 5fa48702070d..8cb7415c55aa 100644
--- a/tools/testing/selftests/powerpc/benchmarks/Makefile
+++ b/tools/testing/selftests/powerpc/benchmarks/Makefile
@@ -1,4 +1,4 @@
-TEST_PROGS := gettimeofday
+TEST_PROGS := gettimeofday context_switch
 
 CFLAGS += -O2
 
@@ -6,6 +6,8 @@ all: $(TEST_PROGS)
 
 $(TEST_PROGS): ../harness.c
 
+context_switch: LDLIBS += -lpthread
+
 include ../../lib.mk
 
 clean:
diff --git a/tools/testing/selftests/powerpc/benchmarks/context_switch.c b/tools/testing/selftests/powerpc/benchmarks/context_switch.c
new file mode 100644
index 000000000000..ed21a83a0f99
--- /dev/null
+++ b/tools/testing/selftests/powerpc/benchmarks/context_switch.c
@@ -0,0 +1,452 @@
+/*
+ * Context switch microbenchmark.
+ *
+ * Copyright (C) 2015 Anton Blanchard <anton@au.ibm.com>, IBM
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version
+ * 2 of the License, or (at your option) any later version.
+ */
+
+#define _GNU_SOURCE
+#include <sched.h>
+#include <string.h>
+#include <stdio.h>
+#include <unistd.h>
+#include <stdlib.h>
+#include <getopt.h>
+#include <signal.h>
+#include <assert.h>
+#include <pthread.h>
+#include <limits.h>
+#include <sys/time.h>
+#include <sys/syscall.h>
+#include <sys/types.h>
+#include <sys/shm.h>
+#include <linux/futex.h>
+
+static unsigned int timeout = INT_MAX;
+
+static int touch_vdso;
+struct timeval tv;
+
+static int touch_fp;
+double fp;
+
+static int touch_vector;
+typedef int v4si __attribute__ ((vector_size (16)));
+v4si a, b, c;
+
+#ifdef __powerpc__
+static int touch_altivec;
+
+static void __attribute__((__target__("no-vsx"))) altivec_touch_fn(void)
+{
+	c = a + b;
+}
+#endif
+
+static void touch(void)
+{
+	if (touch_vdso)
+		gettimeofday(&tv, NULL);
+
+	if (touch_fp)
+		fp += 0.1;
+
+#ifdef __powerpc__
+	if (touch_altivec)
+		altivec_touch_fn();
+#endif
+
+	if (touch_vector)
+		c = a + b;
+
+	asm volatile("# %0 %1 %2": : "r"(&tv), "r"(&fp), "r"(&c));
+}
+
+static void start_thread_on(void *(*fn)(void *), void *arg, unsigned long cpu)
+{
+	pthread_t tid;
+	cpu_set_t cpuset;
+	pthread_attr_t attr;
+
+	CPU_ZERO(&cpuset);
+	CPU_SET(cpu, &cpuset);
+
+	pthread_attr_init(&attr);
+
+	if (pthread_attr_setaffinity_np(&attr, sizeof(cpu_set_t), &cpuset)) {
+		perror("pthread_attr_setaffinity_np");
+		exit(1);
+	}
+
+	if (pthread_create(&tid, &attr, fn, arg)) {
+		perror("pthread_create");
+		exit(1);
+	}
+}
+
+static void start_process_on(void *(*fn)(void *), void *arg, unsigned long cpu)
+{
+	int pid;
+	cpu_set_t cpuset;
+
+	pid = fork();
+	if (pid == -1) {
+		perror("fork");
+		exit(1);
+	}
+
+	if (pid)
+		return;
+
+	CPU_ZERO(&cpuset);
+	CPU_SET(cpu, &cpuset);
+
+	if (sched_setaffinity(0, sizeof(cpuset), &cpuset)) {
+		perror("sched_setaffinity");
+		exit(1);
+	}
+
+	fn(arg);
+
+	exit(0);
+}
+
+static unsigned long iterations;
+static unsigned long iterations_prev;
+
+static void sigalrm_handler(int junk)
+{
+	unsigned long i = iterations;
+
+	printf("%ld\n", i - iterations_prev);
+	iterations_prev = i;
+
+	if (--timeout == 0)
+		kill(0, SIGUSR1);
+
+	alarm(1);
+}
+
+static void sigusr1_handler(int junk)
+{
+	exit(0);
+}
+
+struct actions {
+	void (*setup)(int, int);
+	void *(*thread1)(void *);
+	void *(*thread2)(void *);
+};
+
+#define READ 0
+#define WRITE 1
+
+static int pipe_fd1[2];
+static int pipe_fd2[2];
+
+static void pipe_setup(int cpu1, int cpu2)
+{
+	if (pipe(pipe_fd1) || pipe(pipe_fd2))
+		exit(1);
+}
+
+static void *pipe_thread1(void *arg)
+{
+	signal(SIGALRM, sigalrm_handler);
+	alarm(1);
+
+	while (1) {
+		assert(read(pipe_fd1[READ], &c, 1) == 1);
+		touch();
+
+		assert(write(pipe_fd2[WRITE], &c, 1) == 1);
+		touch();
+
+		iterations += 2;
+	}
+
+	return NULL;
+}
+
+static void *pipe_thread2(void *arg)
+{
+	while (1) {
+		assert(write(pipe_fd1[WRITE], &c, 1) == 1);
+		touch();
+
+		assert(read(pipe_fd2[READ], &c, 1) == 1);
+		touch();
+	}
+
+	return NULL;
+}
+
+static struct actions pipe_actions = {
+	.setup = pipe_setup,
+	.thread1 = pipe_thread1,
+	.thread2 = pipe_thread2,
+};
+
+static void yield_setup(int cpu1, int cpu2)
+{
+	if (cpu1 != cpu2) {
+		fprintf(stderr, "Both threads must be on the same CPU for yield test\n");
+		exit(1);
+	}
+}
+
+static void *yield_thread1(void *arg)
+{
+	signal(SIGALRM, sigalrm_handler);
+	alarm(1);
+
+	while (1) {
+		sched_yield();
+		touch();
+
+		iterations += 2;
+	}
+
+	return NULL;
+}
+
+static void *yield_thread2(void *arg)
+{
+	while (1) {
+		sched_yield();
+		touch();
+	}
+
+	return NULL;
+}
+
+static struct actions yield_actions = {
+	.setup = yield_setup,
+	.thread1 = yield_thread1,
+	.thread2 = yield_thread2,
+};
+
+static long sys_futex(void *addr1, int op, int val1, struct timespec *timeout,
+		      void *addr2, int val3)
+{
+	return syscall(SYS_futex, addr1, op, val1, timeout, addr2, val3);
+}
+
+static unsigned long cmpxchg(unsigned long *p, unsigned long expected,
+			     unsigned long desired)
+{
+	unsigned long exp = expected;
+
+	__atomic_compare_exchange_n(p, &exp, desired, 0,
+				    __ATOMIC_SEQ_CST, __ATOMIC_SEQ_CST);
+	return exp;
+}
+
+static unsigned long xchg(unsigned long *p, unsigned long val)
+{
+	return __atomic_exchange_n(p, val, __ATOMIC_SEQ_CST);
+}
+
+static int mutex_lock(unsigned long *m)
+{
+	int c;
+
+	c = cmpxchg(m, 0, 1);
+	if (!c)
+		return 0;
+
+	if (c == 1)
+		c = xchg(m, 2);
+
+	while (c) {
+		sys_futex(m, FUTEX_WAIT, 2, NULL, NULL, 0);
+		c = xchg(m, 2);
+	}
+
+	return 0;
+}
+
+static int mutex_unlock(unsigned long *m)
+{
+	if (*m == 2)
+		*m = 0;
+	else if (xchg(m, 0) == 1)
+		return 0;
+
+	sys_futex(m, FUTEX_WAKE, 1, NULL, NULL, 0);
+
+	return 0;
+}
+
+static unsigned long *m1, *m2;
+
+static void futex_setup(int cpu1, int cpu2)
+{
+	int shmid;
+	void *shmaddr;
+
+	shmid = shmget(IPC_PRIVATE, getpagesize(), SHM_R | SHM_W);
+	if (shmid < 0) {
+		perror("shmget");
+		exit(1);
+	}
+
+	shmaddr = shmat(shmid, NULL, 0);
+	if (shmaddr == (char *)-1) {
+		perror("shmat");
+		shmctl(shmid, IPC_RMID, NULL);
+		exit(1);
+	}
+
+	shmctl(shmid, IPC_RMID, NULL);
+
+	m1 = shmaddr;
+	m2 = shmaddr + sizeof(*m1);
+
+	*m1 = 0;
+	*m2 = 0;
+
+	mutex_lock(m1);
+	mutex_lock(m2);
+}
+
+static void *futex_thread1(void *arg)
+{
+	signal(SIGALRM, sigalrm_handler);
+	alarm(1);
+
+	while (1) {
+		mutex_lock(m2);
+		mutex_unlock(m1);
+
+		iterations += 2;
+	}
+
+	return NULL;
+}
+
+static void *futex_thread2(void *arg)
+{
+	while (1) {
+		mutex_unlock(m2);
+		mutex_lock(m1);
+	}
+
+	return NULL;
+}
+
+static struct actions futex_actions = {
+	.setup = futex_setup,
+	.thread1 = futex_thread1,
+	.thread2 = futex_thread2,
+};
+
+static int processes;
+
+static struct option options[] = {
+	{ "test", required_argument, 0, 't' },
+	{ "process", no_argument, &processes, 1 },
+	{ "timeout", required_argument, 0, 's' },
+	{ "vdso", no_argument, &touch_vdso, 1 },
+	{ "fp", no_argument, &touch_fp, 1 },
+#ifdef __powerpc__
+	{ "altivec", no_argument, &touch_altivec, 1 },
+#endif
+	{ "vector", no_argument, &touch_vector, 1 },
+	{ 0, },
+};
+
+static void usage(void)
+{
+	fprintf(stderr, "Usage: context_switch2 <options> CPU1 CPU2\n\n");
+	fprintf(stderr, "\t\t--test=X\tpipe, futex or yield\n");
+	fprintf(stderr, "\t\t--process\tUse processes (default threads)\n");
+	fprintf(stderr, "\t\t--timeout=X\tDuration in seconds to run\n");
+	fprintf(stderr, "\t\t--vdso\t\ttouch VDSO\n");
+	fprintf(stderr, "\t\t--fp\t\ttouch FP\n");
+#ifdef __powerpc__
+	fprintf(stderr, "\t\t--altivec\ttouch altivec\n");
+#endif
+	fprintf(stderr, "\t\t--vector\ttouch vector\n");
+}
+
+int main(int argc, char *argv[])
+{
+	signed char c;
+	struct actions *actions = &pipe_actions;
+	int cpu1;
+	int cpu2;
+	static void (*start_fn)(void *(*fn)(void *), void *arg, unsigned long cpu);
+
+	while (1) {
+		int option_index = 0;
+
+		c = getopt_long(argc, argv, "", options, &option_index);
+
+		if (c == -1)
+			break;
+
+		switch (c) {
+		case 0:
+			if (options[option_index].flag != 0)
+				break;
+
+			usage();
+			exit(1);
+			break;
+
+		case 't':
+			if (!strcmp(optarg, "pipe")) {
+				actions = &pipe_actions;
+			} else if (!strcmp(optarg, "yield")) {
+				actions = &yield_actions;
+			} else if (!strcmp(optarg, "futex")) {
+				actions = &futex_actions;
+			} else {
+				usage();
+				exit(1);
+			}
+			break;
+
+		case 's':
+			timeout = atoi(optarg);
+			break;
+
+		default:
+			usage();
+			exit(1);
+		}
+	}
+
+	if (processes)
+		start_fn = start_process_on;
+	else
+		start_fn = start_thread_on;
+
+	if (((argc - optind) != 2)) {
+		usage();
+		exit(1);
+	}
+
+	/* Create a new process group so we can signal everyone for exit */
+	setpgid(getpid(), getpid());
+
+	signal(SIGUSR1, sigusr1_handler);
+
+	cpu1 = atoi(argv[optind++]);
+	cpu2 = atoi(argv[optind++]);
+
+	actions->setup(cpu1, cpu2);
+
+	start_fn(actions->thread1, NULL, cpu1);
+	start_fn(actions->thread2, NULL, cpu2);
+
+	while (1)
+		sleep(3600);
+
+	return 0;
+}
-- 
2.5.0

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

* [PATCH 3/4] selftests/powerpc: Make context_switch do something with no args
  2015-12-02  9:44 [PATCH 1/4] selftests/powerpc: Move pick_online_cpu() up into utils.c Michael Ellerman
  2015-12-02  9:44 ` [PATCH 2/4] selftests/powerpc: Import Anton's context_switch2 benchmark Michael Ellerman
@ 2015-12-02  9:44 ` Michael Ellerman
  2015-12-02  9:44 ` [PATCH 4/4] selftests/powerpc: Make context_switch touch FP/altivec/vector by default Michael Ellerman
  2015-12-17 11:57 ` [1/4] selftests/powerpc: Move pick_online_cpu() up into utils.c Michael Ellerman
  3 siblings, 0 replies; 5+ messages in thread
From: Michael Ellerman @ 2015-12-02  9:44 UTC (permalink / raw)
  To: linuxppc-dev; +Cc: Anton Blanchard

For ease of use make the context_switch test do something useful when
called with no arguments.

Default to a 30 second run, using threads, doing yield, and use any
online cpu. Make it print out what it's doing to avoid confusion.

Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Acked-by: Anton Blanchard <anton@samba.org>
---
 .../testing/selftests/powerpc/benchmarks/Makefile  |  1 +
 .../selftests/powerpc/benchmarks/context_switch.c  | 32 ++++++++++++++++------
 2 files changed, 24 insertions(+), 9 deletions(-)

diff --git a/tools/testing/selftests/powerpc/benchmarks/Makefile b/tools/testing/selftests/powerpc/benchmarks/Makefile
index 8cb7415c55aa..912445ff7ce7 100644
--- a/tools/testing/selftests/powerpc/benchmarks/Makefile
+++ b/tools/testing/selftests/powerpc/benchmarks/Makefile
@@ -6,6 +6,7 @@ all: $(TEST_PROGS)
 
 $(TEST_PROGS): ../harness.c
 
+context_switch: ../utils.c
 context_switch: LDLIBS += -lpthread
 
 include ../../lib.mk
diff --git a/tools/testing/selftests/powerpc/benchmarks/context_switch.c b/tools/testing/selftests/powerpc/benchmarks/context_switch.c
index ed21a83a0f99..d8b6d10f36a6 100644
--- a/tools/testing/selftests/powerpc/benchmarks/context_switch.c
+++ b/tools/testing/selftests/powerpc/benchmarks/context_switch.c
@@ -26,7 +26,9 @@
 #include <sys/shm.h>
 #include <linux/futex.h>
 
-static unsigned int timeout = INT_MAX;
+#include "../utils.h"
+
+static unsigned int timeout = 30;
 
 static int touch_vdso;
 struct timeval tv;
@@ -363,9 +365,9 @@ static struct option options[] = {
 static void usage(void)
 {
 	fprintf(stderr, "Usage: context_switch2 <options> CPU1 CPU2\n\n");
-	fprintf(stderr, "\t\t--test=X\tpipe, futex or yield\n");
+	fprintf(stderr, "\t\t--test=X\tpipe, futex or yield (default)\n");
 	fprintf(stderr, "\t\t--process\tUse processes (default threads)\n");
-	fprintf(stderr, "\t\t--timeout=X\tDuration in seconds to run\n");
+	fprintf(stderr, "\t\t--timeout=X\tDuration in seconds to run (default 30)\n");
 	fprintf(stderr, "\t\t--vdso\t\ttouch VDSO\n");
 	fprintf(stderr, "\t\t--fp\t\ttouch FP\n");
 #ifdef __powerpc__
@@ -377,7 +379,7 @@ static void usage(void)
 int main(int argc, char *argv[])
 {
 	signed char c;
-	struct actions *actions = &pipe_actions;
+	struct actions *actions = &yield_actions;
 	int cpu1;
 	int cpu2;
 	static void (*start_fn)(void *(*fn)(void *), void *arg, unsigned long cpu);
@@ -428,18 +430,30 @@ int main(int argc, char *argv[])
 		start_fn = start_thread_on;
 
 	if (((argc - optind) != 2)) {
-		usage();
-		exit(1);
+		cpu1 = cpu2 = pick_online_cpu();
+	} else {
+		cpu1 = atoi(argv[optind++]);
+		cpu2 = atoi(argv[optind++]);
 	}
 
+	printf("Using %s with ", processes ? "processes" : "threads");
+
+	if (actions == &pipe_actions)
+		printf("pipe");
+	else if (actions == &yield_actions)
+		printf("yield");
+	else
+		printf("futex");
+
+	printf(" on cpus %d/%d touching FP:%s altivec:%s vector:%s vdso:%s\n",
+	       cpu1, cpu2, touch_fp ?  "yes" : "no", touch_altivec ? "yes" : "no",
+	       touch_vector ? "yes" : "no", touch_vdso ? "yes" : "no");
+
 	/* Create a new process group so we can signal everyone for exit */
 	setpgid(getpid(), getpid());
 
 	signal(SIGUSR1, sigusr1_handler);
 
-	cpu1 = atoi(argv[optind++]);
-	cpu2 = atoi(argv[optind++]);
-
 	actions->setup(cpu1, cpu2);
 
 	start_fn(actions->thread1, NULL, cpu1);
-- 
2.5.0

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

* [PATCH 4/4] selftests/powerpc: Make context_switch touch FP/altivec/vector by default
  2015-12-02  9:44 [PATCH 1/4] selftests/powerpc: Move pick_online_cpu() up into utils.c Michael Ellerman
  2015-12-02  9:44 ` [PATCH 2/4] selftests/powerpc: Import Anton's context_switch2 benchmark Michael Ellerman
  2015-12-02  9:44 ` [PATCH 3/4] selftests/powerpc: Make context_switch do something with no args Michael Ellerman
@ 2015-12-02  9:44 ` Michael Ellerman
  2015-12-17 11:57 ` [1/4] selftests/powerpc: Move pick_online_cpu() up into utils.c Michael Ellerman
  3 siblings, 0 replies; 5+ messages in thread
From: Michael Ellerman @ 2015-12-02  9:44 UTC (permalink / raw)
  To: linuxppc-dev; +Cc: Anton Blanchard

Simply because it touches more code paths that way, and therefore tests
more things.

Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Acked-by: Anton Blanchard <anton@samba.org>
---
 tools/testing/selftests/powerpc/benchmarks/context_switch.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/tools/testing/selftests/powerpc/benchmarks/context_switch.c b/tools/testing/selftests/powerpc/benchmarks/context_switch.c
index d8b6d10f36a6..7b785941adec 100644
--- a/tools/testing/selftests/powerpc/benchmarks/context_switch.c
+++ b/tools/testing/selftests/powerpc/benchmarks/context_switch.c
@@ -33,15 +33,15 @@ static unsigned int timeout = 30;
 static int touch_vdso;
 struct timeval tv;
 
-static int touch_fp;
+static int touch_fp = 1;
 double fp;
 
-static int touch_vector;
+static int touch_vector = 1;
 typedef int v4si __attribute__ ((vector_size (16)));
 v4si a, b, c;
 
 #ifdef __powerpc__
-static int touch_altivec;
+static int touch_altivec = 1;
 
 static void __attribute__((__target__("no-vsx"))) altivec_touch_fn(void)
 {
@@ -354,11 +354,11 @@ static struct option options[] = {
 	{ "process", no_argument, &processes, 1 },
 	{ "timeout", required_argument, 0, 's' },
 	{ "vdso", no_argument, &touch_vdso, 1 },
-	{ "fp", no_argument, &touch_fp, 1 },
+	{ "no-fp", no_argument, &touch_fp, 0 },
 #ifdef __powerpc__
-	{ "altivec", no_argument, &touch_altivec, 1 },
+	{ "no-altivec", no_argument, &touch_altivec, 0 },
 #endif
-	{ "vector", no_argument, &touch_vector, 1 },
+	{ "no-vector", no_argument, &touch_vector, 0 },
 	{ 0, },
 };
 
-- 
2.5.0

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

* Re: [1/4] selftests/powerpc: Move pick_online_cpu() up into utils.c
  2015-12-02  9:44 [PATCH 1/4] selftests/powerpc: Move pick_online_cpu() up into utils.c Michael Ellerman
                   ` (2 preceding siblings ...)
  2015-12-02  9:44 ` [PATCH 4/4] selftests/powerpc: Make context_switch touch FP/altivec/vector by default Michael Ellerman
@ 2015-12-17 11:57 ` Michael Ellerman
  3 siblings, 0 replies; 5+ messages in thread
From: Michael Ellerman @ 2015-12-17 11:57 UTC (permalink / raw)
  To: Michael Ellerman, linuxppc-dev; +Cc: Anton Blanchard

On Wed, 2015-02-12 at 09:44:08 UTC, Michael Ellerman wrote:
> We want to use this in another test, so make it available at the top of
> the powerpc selftests tree.
> 
> Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>

Series applied to powerpc next.

https://git.kernel.org/powerpc/c/d1301afd71bd38b1610b391e50

cheers

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

end of thread, other threads:[~2015-12-17 11:57 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-12-02  9:44 [PATCH 1/4] selftests/powerpc: Move pick_online_cpu() up into utils.c Michael Ellerman
2015-12-02  9:44 ` [PATCH 2/4] selftests/powerpc: Import Anton's context_switch2 benchmark Michael Ellerman
2015-12-02  9:44 ` [PATCH 3/4] selftests/powerpc: Make context_switch do something with no args Michael Ellerman
2015-12-02  9:44 ` [PATCH 4/4] selftests/powerpc: Make context_switch touch FP/altivec/vector by default Michael Ellerman
2015-12-17 11:57 ` [1/4] selftests/powerpc: Move pick_online_cpu() up into utils.c Michael Ellerman

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).