Skip to contentSkip to conversation

+ selftests-add-test-of-pmu-instruction-counting-on-powerpc.patch added to -mm tree

PATCH [email protected] 1 participant 1 message Aug 6, 2013

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

Subject: + selftests-add-test-of-pmu-instruction-counting-on-powerpc.patch added to -mm tree
To: [email protected],[email protected],[email protected],[email protected],[email protected]
From: [email protected]
Date: Tue, 06 Aug 2013 14:47:36 -0700

The patch titled
Subject: selftests: add test of PMU instruction counting on powerpc
has been added to the -mm tree. Its filename is
selftests-add-test-of-pmu-instruction-counting-on-powerpc.patch

This patch should soon appear at
http://ozlabs.org/~akpm/mmots/broken-out/selftests-add-test-of-pmu-instruction-counting-on-powerpc.patch
and later at
http://ozlabs.org/~akpm/mmotm/broken-out/selftests-add-test-of-pmu-instruction-counting-on-powerpc.patch

Before you just go and hit "reply", please:
a) Consider who else should be cc'ed
b) Prefer to cc a suitable mailing list as well
c) Ideally: find the original patch on the mailing list and do a reply-to-all to that, adding suitable additional cc's

*** Remember to use Documentation/SubmitChecklist when testing your code ***

The -mm tree is included into linux-next and is updated there every 3-4 working days

------------------------------------------------------
From: Michael Ellerman <[email protected]>
Subject: selftests: add test of PMU instruction counting on powerpc

Add a test of instruction counting using the PMU on powerpc.

Although the bulk of the code is architecture agnostic, the code needs to run a precisely sized loop which is implemented in assembler.

Cc Anton Blanchard <[email protected]>
Cc Jeremy Kerr <[email protected]>
Cc Michael Neuling <[email protected]>
Cc Benjamin Herrenschmidt <[email protected]>

---

 tools/testing/selftests/powerpc/Makefile                 |    2 
 tools/testing/selftests/powerpc/pmu/Makefile             |   23 +
 tools/testing/selftests/powerpc/pmu/count_instructions.c |  135 ++++++++++
 tools/testing/selftests/powerpc/pmu/event.c              |  105 +++++++
 tools/testing/selftests/powerpc/pmu/event.h              |   39 ++
 tools/testing/selftests/powerpc/pmu/loop.S               |   46 +++
 6 files changed, 349 insertions(+), 1 deletion(-)
tools/testing/selftests/powerpc/Makefile renamed from tools/testing/selftests/powerpc/Makefile~selftests-add-test-of-pmu-instruction-counting-on-powerpc +1 -1
diff -puN tools/testing/selftests/powerpc/Makefile~selftests-add-test-of-pmu-instruction-counting-on-powerpc tools/testing/selftests/powerpc/Makefile
@@ -13,7 +13,7 @@ CFLAGS := -Wall -O2 -flto -Wall -Werror
 
 export CC CFLAGS
 
-TARGETS =
+TARGETS = pmu
 
 endif
 
tools/testing/selftests/powerpc/pmu/Makefile new file +23 -0
diff -puN /dev/null tools/testing/selftests/powerpc/pmu/Makefile
@@ -0,0 +1,23 @@
+noarg:
+	$(MAKE) -C ../
+
+PROGS := count_instructions
+EXTRA_SOURCES := ../harness.c event.c
+
+all: $(PROGS)
+
+$(PROGS): $(EXTRA_SOURCES)
+
+# loop.S can only be built 64-bit
+count_instructions: loop.S count_instructions.c $(EXTRA_SOURCES)
+	$(CC) $(CFLAGS) -m64 -o $@ $^
+
+run_tests: all
+	@-for PROG in $(PROGS); do \
+		./$$PROG; \
+	done;
+
+clean:
+	rm -f $(PROGS) loop.o
+
+.PHONY: all run_tests clean
tools/testing/selftests/powerpc/pmu/count_instructions.c new file +135 -0

135 lines not on this page · raw message

tools/testing/selftests/powerpc/pmu/event.c new file +105 -0

105 lines not on this page · raw message

tools/testing/selftests/powerpc/pmu/event.h new file +39 -0
diff -puN /dev/null tools/testing/selftests/powerpc/pmu/event.h
@@ -0,0 +1,39 @@
+/*
+ * Copyright 2013, Michael Ellerman, IBM Corp.
+ * Licensed under GPLv2.
+ */
+
+#ifndef _SELFTESTS_POWERPC_PMU_EVENT_H
+#define _SELFTESTS_POWERPC_PMU_EVENT_H
+
+#include <unistd.h>
+#include <linux/perf_event.h>
+
+#include "utils.h"
+
+
+struct event {
+	struct perf_event_attr attr;
+	char *name;
+	int fd;
+	/* This must match the read_format we use */
+	struct {
+		u64 value;
+		u64 running;
+		u64 enabled;
+	} result;
+};
+
+void event_init(struct event *e, u64 config);
+void event_init_named(struct event *e, u64 config, char *name);
+void event_init_opts(struct event *e, u64 config, int type, char *name);
+int event_open_with_options(struct event *e, pid_t pid, int cpu, int group_fd);
+int event_open_with_group(struct event *e, int group_fd);
+int event_open(struct event *e);
+void event_close(struct event *e);
+int event_reset(struct event *e);
+int event_read(struct event *e);
+void event_report_justified(struct event *e, int name_width, int result_width);
+void event_report(struct event *e);
+
+#endif /* _SELFTESTS_POWERPC_PMU_EVENT_H */
tools/testing/selftests/powerpc/pmu/loop.S new file +46 -0

46 lines not on this page · raw message

_

Patches currently in -mm which might be from [email protected] are

selftests-add-infrastructure-for-powerpc-selftests.patch selftests-add-support-files-for-powerpc-tests.patch selftests-add-test-of-pmu-instruction-counting-on-powerpc.patch linux-next.patch