All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v6 0/2] perf: Make tsc testing as a common testing case
@ 2020-10-19 10:02 Leo Yan
  2020-10-19 10:02 ` [PATCH v6 1/2] perf tests tsc: Make tsc testing as a common testing Leo Yan
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Leo Yan @ 2020-10-19 10:02 UTC (permalink / raw)
  To: Arnaldo Carvalho de Melo, Will Deacon, Peter Zijlstra,
	Ingo Molnar, Mark Rutland, Alexander Shishkin, Jiri Olsa,
	Namhyung Kim, Ian Rogers, Remi Bernon, Nick Gasson,
	Stephane Eranian, Andi Kleen, John Garry, Mathieu Poirier,
	linux-kernel
  Cc: Leo Yan

This patch set is to move tsc testing from x86 specific to common
testing case.  Since Arnaldo found the building failure for patch set
v4 [1], the first four patches have been merged but the last two patches
were left out; this patch set is to resend the last two patches with
fixed the building failure (by removing the header "arch-tests.h" from the
testing code).

These two patches have been tested on x86_64 and Arm64.  Though I don't
test them on archs MIPS, PowerPC, etc, I tried to search every header so
ensure included headers are supported for all archs.

These two patches have been rebased on the perf/core branch with its
latest commit 744aec4df2c5 ("perf c2c: Update documentation for metrics
reorganization").

Changes from v5:
* Found the merging confliction on latest perf/core, so rebased it.

[1] https://lore.kernel.org/patchwork/cover/1305382/#1505752


Leo Yan (2):
  perf tests tsc: Make tsc testing as a common testing
  perf tests tsc: Add checking helper is_supported()

 tools/perf/arch/x86/include/arch-tests.h      |  1 -
 tools/perf/arch/x86/tests/Build               |  1 -
 tools/perf/arch/x86/tests/arch-tests.c        |  4 ----
 tools/perf/tests/Build                        |  1 +
 tools/perf/tests/builtin-test.c               |  5 +++++
 .../{arch/x86 => }/tests/perf-time-to-tsc.c   | 19 +++++++++++++++----
 tools/perf/tests/tests.h                      |  2 ++
 7 files changed, 23 insertions(+), 10 deletions(-)
 rename tools/perf/{arch/x86 => }/tests/perf-time-to-tsc.c (92%)

-- 
2.17.1


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

* [PATCH v6 1/2] perf tests tsc: Make tsc testing as a common testing
  2020-10-19 10:02 [PATCH v6 0/2] perf: Make tsc testing as a common testing case Leo Yan
@ 2020-10-19 10:02 ` Leo Yan
  2020-10-19 10:02 ` [PATCH v6 2/2] perf tests tsc: Add checking helper is_supported() Leo Yan
  2020-10-20  6:11 ` [PATCH v6 0/2] perf: Make tsc testing as a common testing case Jiri Olsa
  2 siblings, 0 replies; 5+ messages in thread
From: Leo Yan @ 2020-10-19 10:02 UTC (permalink / raw)
  To: Arnaldo Carvalho de Melo, Will Deacon, Peter Zijlstra,
	Ingo Molnar, Mark Rutland, Alexander Shishkin, Jiri Olsa,
	Namhyung Kim, Ian Rogers, Remi Bernon, Nick Gasson,
	Stephane Eranian, Andi Kleen, John Garry, Mathieu Poirier,
	linux-kernel
  Cc: Leo Yan

x86 arch provides the testing for conversion between tsc and perf time,
the testing is located in x86 arch folder.  Move this testing out from
x86 arch folder and place it into the common testing folder, so allows
to execute tsc testing on other architectures (e.g. Arm64).

This patch removes the inclusion of "arch-tests.h" from the testing
code, this can avoid building failure if any arch has no this header
file.

Signed-off-by: Leo Yan <leo.yan@linaro.org>
---
 tools/perf/arch/x86/include/arch-tests.h           | 1 -
 tools/perf/arch/x86/tests/Build                    | 1 -
 tools/perf/arch/x86/tests/arch-tests.c             | 4 ----
 tools/perf/tests/Build                             | 1 +
 tools/perf/tests/builtin-test.c                    | 4 ++++
 tools/perf/{arch/x86 => }/tests/perf-time-to-tsc.c | 6 ++----
 tools/perf/tests/tests.h                           | 1 +
 7 files changed, 8 insertions(+), 10 deletions(-)
 rename tools/perf/{arch/x86 => }/tests/perf-time-to-tsc.c (98%)

diff --git a/tools/perf/arch/x86/include/arch-tests.h b/tools/perf/arch/x86/include/arch-tests.h
index c41c5affe4be..6a54b94f1c25 100644
--- a/tools/perf/arch/x86/include/arch-tests.h
+++ b/tools/perf/arch/x86/include/arch-tests.h
@@ -7,7 +7,6 @@ struct test;
 
 /* Tests */
 int test__rdpmc(struct test *test __maybe_unused, int subtest);
-int test__perf_time_to_tsc(struct test *test __maybe_unused, int subtest);
 int test__insn_x86(struct test *test __maybe_unused, int subtest);
 int test__intel_pt_pkt_decoder(struct test *test, int subtest);
 int test__bp_modify(struct test *test, int subtest);
diff --git a/tools/perf/arch/x86/tests/Build b/tools/perf/arch/x86/tests/Build
index 2997c506550c..36d4f248b51d 100644
--- a/tools/perf/arch/x86/tests/Build
+++ b/tools/perf/arch/x86/tests/Build
@@ -3,6 +3,5 @@ perf-$(CONFIG_DWARF_UNWIND) += dwarf-unwind.o
 
 perf-y += arch-tests.o
 perf-y += rdpmc.o
-perf-y += perf-time-to-tsc.o
 perf-$(CONFIG_AUXTRACE) += insn-x86.o intel-pt-pkt-decoder-test.o
 perf-$(CONFIG_X86_64) += bp-modify.o
diff --git a/tools/perf/arch/x86/tests/arch-tests.c b/tools/perf/arch/x86/tests/arch-tests.c
index 6763135aec17..bc25d727b4e9 100644
--- a/tools/perf/arch/x86/tests/arch-tests.c
+++ b/tools/perf/arch/x86/tests/arch-tests.c
@@ -8,10 +8,6 @@ struct test arch_tests[] = {
 		.desc = "x86 rdpmc",
 		.func = test__rdpmc,
 	},
-	{
-		.desc = "Convert perf time to TSC",
-		.func = test__perf_time_to_tsc,
-	},
 #ifdef HAVE_DWARF_UNWIND_SUPPORT
 	{
 		.desc = "DWARF unwind",
diff --git a/tools/perf/tests/Build b/tools/perf/tests/Build
index 4d15bf6041fb..aa4dc4f5abde 100644
--- a/tools/perf/tests/Build
+++ b/tools/perf/tests/Build
@@ -62,6 +62,7 @@ perf-y += pfm.o
 perf-y += parse-metric.o
 perf-y += pe-file-parsing.o
 perf-y += expand-cgroup.o
+perf-y += perf-time-to-tsc.o
 
 $(OUTPUT)tests/llvm-src-base.c: tests/bpf-script-example.c tests/Build
 	$(call rule_mkdir)
diff --git a/tools/perf/tests/builtin-test.c b/tools/perf/tests/builtin-test.c
index 132bdb3e6c31..02e7bbf70419 100644
--- a/tools/perf/tests/builtin-test.c
+++ b/tools/perf/tests/builtin-test.c
@@ -349,6 +349,10 @@ static struct test generic_tests[] = {
 		.desc = "Event expansion for cgroups",
 		.func = test__expand_cgroup_events,
 	},
+	{
+		.desc = "Convert perf time to TSC",
+		.func = test__perf_time_to_tsc,
+	},
 	{
 		.func = NULL,
 	},
diff --git a/tools/perf/arch/x86/tests/perf-time-to-tsc.c b/tools/perf/tests/perf-time-to-tsc.c
similarity index 98%
rename from tools/perf/arch/x86/tests/perf-time-to-tsc.c
rename to tools/perf/tests/perf-time-to-tsc.c
index 026d32ed078e..aee97c16c0d9 100644
--- a/tools/perf/arch/x86/tests/perf-time-to-tsc.c
+++ b/tools/perf/tests/perf-time-to-tsc.c
@@ -18,10 +18,8 @@
 #include "thread_map.h"
 #include "record.h"
 #include "tsc.h"
-#include "util/mmap.h"
-#include "tests/tests.h"
-
-#include "arch-tests.h"
+#include "mmap.h"
+#include "tests.h"
 
 #define CHECK__(x) {				\
 	while ((x) < 0) {			\
diff --git a/tools/perf/tests/tests.h b/tools/perf/tests/tests.h
index c85a2c08e407..c9b180e640e5 100644
--- a/tools/perf/tests/tests.h
+++ b/tools/perf/tests/tests.h
@@ -124,6 +124,7 @@ int test__pfm_subtest_get_nr(void);
 int test__parse_metric(struct test *test, int subtest);
 int test__pe_file_parsing(struct test *test, int subtest);
 int test__expand_cgroup_events(struct test *test, int subtest);
+int test__perf_time_to_tsc(struct test *test, int subtest);
 
 bool test__bp_signal_is_supported(void);
 bool test__bp_account_is_supported(void);
-- 
2.17.1


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

* [PATCH v6 2/2] perf tests tsc: Add checking helper is_supported()
  2020-10-19 10:02 [PATCH v6 0/2] perf: Make tsc testing as a common testing case Leo Yan
  2020-10-19 10:02 ` [PATCH v6 1/2] perf tests tsc: Make tsc testing as a common testing Leo Yan
@ 2020-10-19 10:02 ` Leo Yan
  2020-10-20  6:11 ` [PATCH v6 0/2] perf: Make tsc testing as a common testing case Jiri Olsa
  2 siblings, 0 replies; 5+ messages in thread
From: Leo Yan @ 2020-10-19 10:02 UTC (permalink / raw)
  To: Arnaldo Carvalho de Melo, Will Deacon, Peter Zijlstra,
	Ingo Molnar, Mark Rutland, Alexander Shishkin, Jiri Olsa,
	Namhyung Kim, Ian Rogers, Remi Bernon, Nick Gasson,
	Stephane Eranian, Andi Kleen, John Garry, Mathieu Poirier,
	linux-kernel
  Cc: Leo Yan

So far tsc is enabled on x86_64, i386 and Arm64 architectures, add
checking helper to skip this testing for other architectures.

Signed-off-by: Leo Yan <leo.yan@linaro.org>
---
 tools/perf/tests/builtin-test.c     |  1 +
 tools/perf/tests/perf-time-to-tsc.c | 13 +++++++++++++
 tools/perf/tests/tests.h            |  1 +
 3 files changed, 15 insertions(+)

diff --git a/tools/perf/tests/builtin-test.c b/tools/perf/tests/builtin-test.c
index 02e7bbf70419..a185904c47f3 100644
--- a/tools/perf/tests/builtin-test.c
+++ b/tools/perf/tests/builtin-test.c
@@ -352,6 +352,7 @@ static struct test generic_tests[] = {
 	{
 		.desc = "Convert perf time to TSC",
 		.func = test__perf_time_to_tsc,
+		.is_supported = test__tsc_is_supported,
 	},
 	{
 		.func = NULL,
diff --git a/tools/perf/tests/perf-time-to-tsc.c b/tools/perf/tests/perf-time-to-tsc.c
index aee97c16c0d9..a9560e0f6360 100644
--- a/tools/perf/tests/perf-time-to-tsc.c
+++ b/tools/perf/tests/perf-time-to-tsc.c
@@ -169,3 +169,16 @@ int test__perf_time_to_tsc(struct test *test __maybe_unused, int subtest __maybe
 	evlist__delete(evlist);
 	return err;
 }
+
+bool test__tsc_is_supported(void)
+{
+	/*
+	 * Except x86_64/i386 and Arm64, other archs don't support TSC in perf.
+	 * Just enable the test for x86_64/i386 and Arm64 archs.
+	 */
+#if defined(__x86_64__) || defined(__i386__) || defined(__aarch64__)
+	return true;
+#else
+	return false;
+#endif
+}
diff --git a/tools/perf/tests/tests.h b/tools/perf/tests/tests.h
index c9b180e640e5..b1f2aac93b33 100644
--- a/tools/perf/tests/tests.h
+++ b/tools/perf/tests/tests.h
@@ -129,6 +129,7 @@ int test__perf_time_to_tsc(struct test *test, int subtest);
 bool test__bp_signal_is_supported(void);
 bool test__bp_account_is_supported(void);
 bool test__wp_is_supported(void);
+bool test__tsc_is_supported(void);
 
 #if defined(__arm__) || defined(__aarch64__)
 #ifdef HAVE_DWARF_UNWIND_SUPPORT
-- 
2.17.1


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

* Re: [PATCH v6 0/2] perf: Make tsc testing as a common testing case
  2020-10-19 10:02 [PATCH v6 0/2] perf: Make tsc testing as a common testing case Leo Yan
  2020-10-19 10:02 ` [PATCH v6 1/2] perf tests tsc: Make tsc testing as a common testing Leo Yan
  2020-10-19 10:02 ` [PATCH v6 2/2] perf tests tsc: Add checking helper is_supported() Leo Yan
@ 2020-10-20  6:11 ` Jiri Olsa
  2020-10-20 12:09   ` Arnaldo Carvalho de Melo
  2 siblings, 1 reply; 5+ messages in thread
From: Jiri Olsa @ 2020-10-20  6:11 UTC (permalink / raw)
  To: Leo Yan
  Cc: Arnaldo Carvalho de Melo, Will Deacon, Peter Zijlstra,
	Ingo Molnar, Mark Rutland, Alexander Shishkin, Namhyung Kim,
	Ian Rogers, Remi Bernon, Nick Gasson, Stephane Eranian,
	Andi Kleen, John Garry, Mathieu Poirier, linux-kernel

On Mon, Oct 19, 2020 at 06:02:34PM +0800, Leo Yan wrote:
> This patch set is to move tsc testing from x86 specific to common
> testing case.  Since Arnaldo found the building failure for patch set
> v4 [1], the first four patches have been merged but the last two patches
> were left out; this patch set is to resend the last two patches with
> fixed the building failure (by removing the header "arch-tests.h" from the
> testing code).
> 
> These two patches have been tested on x86_64 and Arm64.  Though I don't
> test them on archs MIPS, PowerPC, etc, I tried to search every header so
> ensure included headers are supported for all archs.
> 
> These two patches have been rebased on the perf/core branch with its
> latest commit 744aec4df2c5 ("perf c2c: Update documentation for metrics
> reorganization").
> 
> Changes from v5:
> * Found the merging confliction on latest perf/core, so rebased it.
> 
> [1] https://lore.kernel.org/patchwork/cover/1305382/#1505752
> 
> 
> Leo Yan (2):
>   perf tests tsc: Make tsc testing as a common testing
>   perf tests tsc: Add checking helper is_supported()

Acked-by: Jiri Olsa <jolsa@redhat.com>

thanks,
jirka

> 
>  tools/perf/arch/x86/include/arch-tests.h      |  1 -
>  tools/perf/arch/x86/tests/Build               |  1 -
>  tools/perf/arch/x86/tests/arch-tests.c        |  4 ----
>  tools/perf/tests/Build                        |  1 +
>  tools/perf/tests/builtin-test.c               |  5 +++++
>  .../{arch/x86 => }/tests/perf-time-to-tsc.c   | 19 +++++++++++++++----
>  tools/perf/tests/tests.h                      |  2 ++
>  7 files changed, 23 insertions(+), 10 deletions(-)
>  rename tools/perf/{arch/x86 => }/tests/perf-time-to-tsc.c (92%)
> 
> -- 
> 2.17.1
> 


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

* Re: [PATCH v6 0/2] perf: Make tsc testing as a common testing case
  2020-10-20  6:11 ` [PATCH v6 0/2] perf: Make tsc testing as a common testing case Jiri Olsa
@ 2020-10-20 12:09   ` Arnaldo Carvalho de Melo
  0 siblings, 0 replies; 5+ messages in thread
From: Arnaldo Carvalho de Melo @ 2020-10-20 12:09 UTC (permalink / raw)
  To: Jiri Olsa
  Cc: Leo Yan, Will Deacon, Peter Zijlstra, Ingo Molnar, Mark Rutland,
	Alexander Shishkin, Namhyung Kim, Ian Rogers, Remi Bernon,
	Nick Gasson, Stephane Eranian, Andi Kleen, John Garry,
	Mathieu Poirier, linux-kernel

Em Tue, Oct 20, 2020 at 08:11:59AM +0200, Jiri Olsa escreveu:
> On Mon, Oct 19, 2020 at 06:02:34PM +0800, Leo Yan wrote:
> > This patch set is to move tsc testing from x86 specific to common
> > testing case.  Since Arnaldo found the building failure for patch set
> > v4 [1], the first four patches have been merged but the last two patches
> > were left out; this patch set is to resend the last two patches with
> > fixed the building failure (by removing the header "arch-tests.h" from the
> > testing code).
> > 
> > These two patches have been tested on x86_64 and Arm64.  Though I don't
> > test them on archs MIPS, PowerPC, etc, I tried to search every header so
> > ensure included headers are supported for all archs.
> > 
> > These two patches have been rebased on the perf/core branch with its
> > latest commit 744aec4df2c5 ("perf c2c: Update documentation for metrics
> > reorganization").
> > 
> > Changes from v5:
> > * Found the merging confliction on latest perf/core, so rebased it.
> > 
> > [1] https://lore.kernel.org/patchwork/cover/1305382/#1505752
> > 
> > 
> > Leo Yan (2):
> >   perf tests tsc: Make tsc testing as a common testing
> >   perf tests tsc: Add checking helper is_supported()
> 
> Acked-by: Jiri Olsa <jolsa@redhat.com>



Thanks, applied.

- Arnaldo


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

end of thread, other threads:[~2020-10-20 12:09 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-10-19 10:02 [PATCH v6 0/2] perf: Make tsc testing as a common testing case Leo Yan
2020-10-19 10:02 ` [PATCH v6 1/2] perf tests tsc: Make tsc testing as a common testing Leo Yan
2020-10-19 10:02 ` [PATCH v6 2/2] perf tests tsc: Add checking helper is_supported() Leo Yan
2020-10-20  6:11 ` [PATCH v6 0/2] perf: Make tsc testing as a common testing case Jiri Olsa
2020-10-20 12:09   ` Arnaldo Carvalho de Melo

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.