linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v1 1/2] perf test: Report failure for mmap events
@ 2019-10-11  9:19 Leo Yan
  2019-10-11  9:19 ` [PATCH v1 2/2] perf test: Avoid infinite loop for task exit case Leo Yan
                   ` (2 more replies)
  0 siblings, 3 replies; 8+ messages in thread
From: Leo Yan @ 2019-10-11  9:19 UTC (permalink / raw)
  To: Arnaldo Carvalho de Melo, Mark Rutland, Alexander Shishkin,
	Jiri Olsa, Namhyung Kim, linux-kernel
  Cc: Leo Yan

When fail to mmap events in task exit case, it misses to set 'err' to
-1; thus the testing will not report failure for it.

This patch sets 'err' to -1 when fails to mmap events, thus Perf tool
can report correct result.

Signed-off-by: Leo Yan <leo.yan@linaro.org>
---
 tools/perf/tests/task-exit.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/tools/perf/tests/task-exit.c b/tools/perf/tests/task-exit.c
index bce3a4cb4c89..ca0a6ca43b13 100644
--- a/tools/perf/tests/task-exit.c
+++ b/tools/perf/tests/task-exit.c
@@ -110,6 +110,7 @@ int test__task_exit(struct test *test __maybe_unused, int subtest __maybe_unused
 	if (evlist__mmap(evlist, 128) < 0) {
 		pr_debug("failed to mmap events: %d (%s)\n", errno,
 			 str_error_r(errno, sbuf, sizeof(sbuf)));
+		err = -1;
 		goto out_delete_evlist;
 	}
 
-- 
2.17.1


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

* [PATCH v1 2/2] perf test: Avoid infinite loop for task exit case
  2019-10-11  9:19 [PATCH v1 1/2] perf test: Report failure for mmap events Leo Yan
@ 2019-10-11  9:19 ` Leo Yan
  2019-10-11 14:38   ` Arnaldo Carvalho de Melo
                     ` (2 more replies)
  2019-10-14 14:09 ` [PATCH v1 1/2] perf test: Report failure for mmap events Arnaldo Carvalho de Melo
  2019-10-21 23:19 ` [tip: perf/core] " tip-bot2 for Leo Yan
  2 siblings, 3 replies; 8+ messages in thread
From: Leo Yan @ 2019-10-11  9:19 UTC (permalink / raw)
  To: Arnaldo Carvalho de Melo, Mark Rutland, Alexander Shishkin,
	Jiri Olsa, Namhyung Kim, linux-kernel
  Cc: Leo Yan

When execute task exit testing case, Perf tool stucks in this case and
doesn't return back on Arm64 Juno board.

After dig into this issue, since Juno board has Arm's big.LITTLE CPUs,
thus the PMUs are not compatible between the big CPUs and little CPUs.
This leads to PMU event cannot be enabled properly when the traced task
is migrated from one variant's CPU to another variant.  Finally, the
test case runs into infinite loop for cannot read out any event data
after return from polling.

Eventually, we need to work out formal solution to allow PMU events can
be freely migrated from one CPU variant to another, but this is a
difficult task and a different topic.  This patch tries to fix the Perf
test case to avoid infinite loop, when the testing detects 1000 times
retrying for reading empty events, it will directly bail out and return
failure.  This allows the Perf tool can continue its other test cases.

Signed-off-by: Leo Yan <leo.yan@linaro.org>
---
 tools/perf/tests/task-exit.c | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/tools/perf/tests/task-exit.c b/tools/perf/tests/task-exit.c
index ca0a6ca43b13..d85c9f608564 100644
--- a/tools/perf/tests/task-exit.c
+++ b/tools/perf/tests/task-exit.c
@@ -53,6 +53,7 @@ int test__task_exit(struct test *test __maybe_unused, int subtest __maybe_unused
 	struct perf_cpu_map *cpus;
 	struct perf_thread_map *threads;
 	struct mmap *md;
+	int retry_count = 0;
 
 	signal(SIGCHLD, sig_handler);
 
@@ -132,6 +133,13 @@ int test__task_exit(struct test *test __maybe_unused, int subtest __maybe_unused
 out_init:
 	if (!exited || !nr_exit) {
 		evlist__poll(evlist, -1);
+
+		if (retry_count++ > 1000) {
+			pr_debug("Failed after retrying 1000 times\n");
+			err = -1;
+			goto out_free_maps;
+		}
+
 		goto retry;
 	}
 
-- 
2.17.1


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

* Re: [PATCH v1 2/2] perf test: Avoid infinite loop for task exit case
  2019-10-11  9:19 ` [PATCH v1 2/2] perf test: Avoid infinite loop for task exit case Leo Yan
@ 2019-10-11 14:38   ` Arnaldo Carvalho de Melo
  2019-10-14 14:11   ` Arnaldo Carvalho de Melo
  2019-10-21 23:19   ` [tip: perf/core] " tip-bot2 for Leo Yan
  2 siblings, 0 replies; 8+ messages in thread
From: Arnaldo Carvalho de Melo @ 2019-10-11 14:38 UTC (permalink / raw)
  To: Leo Yan
  Cc: Mark Rutland, Alexander Shishkin, Jiri Olsa, Namhyung Kim, linux-kernel

Em Fri, Oct 11, 2019 at 05:19:42PM +0800, Leo Yan escreveu:
> When execute task exit testing case, Perf tool stucks in this case and
> doesn't return back on Arm64 Juno board.
> 
> After dig into this issue, since Juno board has Arm's big.LITTLE CPUs,
> thus the PMUs are not compatible between the big CPUs and little CPUs.
> This leads to PMU event cannot be enabled properly when the traced task
> is migrated from one variant's CPU to another variant.  Finally, the
> test case runs into infinite loop for cannot read out any event data
> after return from polling.

Thanks, I'll go over this after I finish the current pull request,

- Arnaldo
 
> Eventually, we need to work out formal solution to allow PMU events can
> be freely migrated from one CPU variant to another, but this is a
> difficult task and a different topic.  This patch tries to fix the Perf
> test case to avoid infinite loop, when the testing detects 1000 times
> retrying for reading empty events, it will directly bail out and return
> failure.  This allows the Perf tool can continue its other test cases.
> 
> Signed-off-by: Leo Yan <leo.yan@linaro.org>
> ---
>  tools/perf/tests/task-exit.c | 8 ++++++++
>  1 file changed, 8 insertions(+)
> 
> diff --git a/tools/perf/tests/task-exit.c b/tools/perf/tests/task-exit.c
> index ca0a6ca43b13..d85c9f608564 100644
> --- a/tools/perf/tests/task-exit.c
> +++ b/tools/perf/tests/task-exit.c
> @@ -53,6 +53,7 @@ int test__task_exit(struct test *test __maybe_unused, int subtest __maybe_unused
>  	struct perf_cpu_map *cpus;
>  	struct perf_thread_map *threads;
>  	struct mmap *md;
> +	int retry_count = 0;
>  
>  	signal(SIGCHLD, sig_handler);
>  
> @@ -132,6 +133,13 @@ int test__task_exit(struct test *test __maybe_unused, int subtest __maybe_unused
>  out_init:
>  	if (!exited || !nr_exit) {
>  		evlist__poll(evlist, -1);
> +
> +		if (retry_count++ > 1000) {
> +			pr_debug("Failed after retrying 1000 times\n");
> +			err = -1;
> +			goto out_free_maps;
> +		}
> +
>  		goto retry;
>  	}
>  
> -- 
> 2.17.1

-- 

- Arnaldo

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

* Re: [PATCH v1 1/2] perf test: Report failure for mmap events
  2019-10-11  9:19 [PATCH v1 1/2] perf test: Report failure for mmap events Leo Yan
  2019-10-11  9:19 ` [PATCH v1 2/2] perf test: Avoid infinite loop for task exit case Leo Yan
@ 2019-10-14 14:09 ` Arnaldo Carvalho de Melo
  2019-10-21 23:19 ` [tip: perf/core] " tip-bot2 for Leo Yan
  2 siblings, 0 replies; 8+ messages in thread
From: Arnaldo Carvalho de Melo @ 2019-10-14 14:09 UTC (permalink / raw)
  To: Leo Yan
  Cc: Mark Rutland, Alexander Shishkin, Jiri Olsa, Namhyung Kim, linux-kernel

Em Fri, Oct 11, 2019 at 05:19:41PM +0800, Leo Yan escreveu:
> When fail to mmap events in task exit case, it misses to set 'err' to
> -1; thus the testing will not report failure for it.
> 
> This patch sets 'err' to -1 when fails to mmap events, thus Perf tool
> can report correct result.

Thanks, applied and added:

Fixes: d723a55096b8 ("perf test: Add test case for checking number of EXIT events")


 
> Signed-off-by: Leo Yan <leo.yan@linaro.org>
> ---
>  tools/perf/tests/task-exit.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/tools/perf/tests/task-exit.c b/tools/perf/tests/task-exit.c
> index bce3a4cb4c89..ca0a6ca43b13 100644
> --- a/tools/perf/tests/task-exit.c
> +++ b/tools/perf/tests/task-exit.c
> @@ -110,6 +110,7 @@ int test__task_exit(struct test *test __maybe_unused, int subtest __maybe_unused
>  	if (evlist__mmap(evlist, 128) < 0) {
>  		pr_debug("failed to mmap events: %d (%s)\n", errno,
>  			 str_error_r(errno, sbuf, sizeof(sbuf)));
> +		err = -1;
>  		goto out_delete_evlist;
>  	}
>  
> -- 
> 2.17.1

-- 

- Arnaldo

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

* Re: [PATCH v1 2/2] perf test: Avoid infinite loop for task exit case
  2019-10-11  9:19 ` [PATCH v1 2/2] perf test: Avoid infinite loop for task exit case Leo Yan
  2019-10-11 14:38   ` Arnaldo Carvalho de Melo
@ 2019-10-14 14:11   ` Arnaldo Carvalho de Melo
  2019-10-15  3:20     ` Leo Yan
  2019-10-21 23:19   ` [tip: perf/core] " tip-bot2 for Leo Yan
  2 siblings, 1 reply; 8+ messages in thread
From: Arnaldo Carvalho de Melo @ 2019-10-14 14:11 UTC (permalink / raw)
  To: Leo Yan
  Cc: Mark Rutland, Alexander Shishkin, Jiri Olsa, Namhyung Kim, linux-kernel

Em Fri, Oct 11, 2019 at 05:19:42PM +0800, Leo Yan escreveu:
> When execute task exit testing case, Perf tool stucks in this case and
> doesn't return back on Arm64 Juno board.
> 
> After dig into this issue, since Juno board has Arm's big.LITTLE CPUs,
> thus the PMUs are not compatible between the big CPUs and little CPUs.
> This leads to PMU event cannot be enabled properly when the traced task
> is migrated from one variant's CPU to another variant.  Finally, the
> test case runs into infinite loop for cannot read out any event data
> after return from polling.
> 
> Eventually, we need to work out formal solution to allow PMU events can
> be freely migrated from one CPU variant to another, but this is a
> difficult task and a different topic.  This patch tries to fix the Perf
> test case to avoid infinite loop, when the testing detects 1000 times
> retrying for reading empty events, it will directly bail out and return
> failure.  This allows the Perf tool can continue its other test cases.

Thanks, applied.

- Arnaldo
 
> Signed-off-by: Leo Yan <leo.yan@linaro.org>
> ---
>  tools/perf/tests/task-exit.c | 8 ++++++++
>  1 file changed, 8 insertions(+)
> 
> diff --git a/tools/perf/tests/task-exit.c b/tools/perf/tests/task-exit.c
> index ca0a6ca43b13..d85c9f608564 100644
> --- a/tools/perf/tests/task-exit.c
> +++ b/tools/perf/tests/task-exit.c
> @@ -53,6 +53,7 @@ int test__task_exit(struct test *test __maybe_unused, int subtest __maybe_unused
>  	struct perf_cpu_map *cpus;
>  	struct perf_thread_map *threads;
>  	struct mmap *md;
> +	int retry_count = 0;
>  
>  	signal(SIGCHLD, sig_handler);
>  
> @@ -132,6 +133,13 @@ int test__task_exit(struct test *test __maybe_unused, int subtest __maybe_unused
>  out_init:
>  	if (!exited || !nr_exit) {
>  		evlist__poll(evlist, -1);
> +
> +		if (retry_count++ > 1000) {
> +			pr_debug("Failed after retrying 1000 times\n");
> +			err = -1;
> +			goto out_free_maps;
> +		}
> +
>  		goto retry;
>  	}
>  
> -- 
> 2.17.1

-- 

- Arnaldo

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

* Re: [PATCH v1 2/2] perf test: Avoid infinite loop for task exit case
  2019-10-14 14:11   ` Arnaldo Carvalho de Melo
@ 2019-10-15  3:20     ` Leo Yan
  0 siblings, 0 replies; 8+ messages in thread
From: Leo Yan @ 2019-10-15  3:20 UTC (permalink / raw)
  To: Arnaldo Carvalho de Melo
  Cc: Mark Rutland, Alexander Shishkin, Jiri Olsa, Namhyung Kim, linux-kernel

On Mon, Oct 14, 2019 at 11:11:36AM -0300, Arnaldo Carvalho de Melo wrote:
> Em Fri, Oct 11, 2019 at 05:19:42PM +0800, Leo Yan escreveu:
> > When execute task exit testing case, Perf tool stucks in this case and
> > doesn't return back on Arm64 Juno board.
> > 
> > After dig into this issue, since Juno board has Arm's big.LITTLE CPUs,
> > thus the PMUs are not compatible between the big CPUs and little CPUs.
> > This leads to PMU event cannot be enabled properly when the traced task
> > is migrated from one variant's CPU to another variant.  Finally, the
> > test case runs into infinite loop for cannot read out any event data
> > after return from polling.
> > 
> > Eventually, we need to work out formal solution to allow PMU events can
> > be freely migrated from one CPU variant to another, but this is a
> > difficult task and a different topic.  This patch tries to fix the Perf
> > test case to avoid infinite loop, when the testing detects 1000 times
> > retrying for reading empty events, it will directly bail out and return
> > failure.  This allows the Perf tool can continue its other test cases.
> 
> Thanks, applied.

Thanks a lot, Arnaldo.

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

* [tip: perf/core] perf test: Avoid infinite loop for task exit case
  2019-10-11  9:19 ` [PATCH v1 2/2] perf test: Avoid infinite loop for task exit case Leo Yan
  2019-10-11 14:38   ` Arnaldo Carvalho de Melo
  2019-10-14 14:11   ` Arnaldo Carvalho de Melo
@ 2019-10-21 23:19   ` tip-bot2 for Leo Yan
  2 siblings, 0 replies; 8+ messages in thread
From: tip-bot2 for Leo Yan @ 2019-10-21 23:19 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: Leo Yan, Alexander Shishkin, Jiri Olsa, Mark Rutland,
	Namhyung Kim, Arnaldo Carvalho de Melo, Ingo Molnar,
	Borislav Petkov, linux-kernel

The following commit has been merged into the perf/core branch of tip:

Commit-ID:     791ce9c48c79210d2ffcdbe69421e7783b32921f
Gitweb:        https://git.kernel.org/tip/791ce9c48c79210d2ffcdbe69421e7783b32921f
Author:        Leo Yan <leo.yan@linaro.org>
AuthorDate:    Fri, 11 Oct 2019 17:19:42 +08:00
Committer:     Arnaldo Carvalho de Melo <acme@redhat.com>
CommitterDate: Tue, 15 Oct 2019 08:36:22 -03:00

perf test: Avoid infinite loop for task exit case

When executing the task exit testing case, perf gets stuck in an endless
loop this case and doesn't return back on Arm64 Juno board.

After digging into this issue, since Juno board has Arm's big.LITTLE
CPUs, thus the PMUs are not compatible between the big CPUs and little
CPUs.  This leads to a PMU event that cannot be enabled properly when
the traced task is migrated from one variant's CPU to another variant.
Finally, the test case runs into infinite loop for cannot read out any
event data after return from polling.

Eventually, we need to work out formal solution to allow PMU events can
be freely migrated from one CPU variant to another, but this is a
difficult task and a different topic.  This patch tries to fix the Perf
test case to avoid infinite loop, when the testing detects 1000 times
retrying for reading empty events, it will directly bail out and return
failure.  This allows the Perf tool can continue its other test cases.

Signed-off-by: Leo Yan <leo.yan@linaro.org>
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Cc: Jiri Olsa <jolsa@redhat.com>
Cc: Mark Rutland <mark.rutland@arm.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Link: http://lore.kernel.org/lkml/20191011091942.29841-2-leo.yan@linaro.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/perf/tests/task-exit.c | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/tools/perf/tests/task-exit.c b/tools/perf/tests/task-exit.c
index 19fa7cb..adaff90 100644
--- a/tools/perf/tests/task-exit.c
+++ b/tools/perf/tests/task-exit.c
@@ -54,6 +54,7 @@ int test__task_exit(struct test *test __maybe_unused, int subtest __maybe_unused
 	struct perf_cpu_map *cpus;
 	struct perf_thread_map *threads;
 	struct mmap *md;
+	int retry_count = 0;
 
 	signal(SIGCHLD, sig_handler);
 
@@ -133,6 +134,13 @@ retry:
 out_init:
 	if (!exited || !nr_exit) {
 		evlist__poll(evlist, -1);
+
+		if (retry_count++ > 1000) {
+			pr_debug("Failed after retrying 1000 times\n");
+			err = -1;
+			goto out_free_maps;
+		}
+
 		goto retry;
 	}
 

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

* [tip: perf/core] perf test: Report failure for mmap events
  2019-10-11  9:19 [PATCH v1 1/2] perf test: Report failure for mmap events Leo Yan
  2019-10-11  9:19 ` [PATCH v1 2/2] perf test: Avoid infinite loop for task exit case Leo Yan
  2019-10-14 14:09 ` [PATCH v1 1/2] perf test: Report failure for mmap events Arnaldo Carvalho de Melo
@ 2019-10-21 23:19 ` tip-bot2 for Leo Yan
  2 siblings, 0 replies; 8+ messages in thread
From: tip-bot2 for Leo Yan @ 2019-10-21 23:19 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: Leo Yan, Alexander Shishkin, Jiri Olsa, Mark Rutland,
	Namhyung Kim, Arnaldo Carvalho de Melo, Ingo Molnar,
	Borislav Petkov, linux-kernel

The following commit has been merged into the perf/core branch of tip:

Commit-ID:     6add129c5d9210ada25217abc130df0b7096ee02
Gitweb:        https://git.kernel.org/tip/6add129c5d9210ada25217abc130df0b7096ee02
Author:        Leo Yan <leo.yan@linaro.org>
AuthorDate:    Fri, 11 Oct 2019 17:19:41 +08:00
Committer:     Arnaldo Carvalho de Melo <acme@redhat.com>
CommitterDate: Tue, 15 Oct 2019 08:36:22 -03:00

perf test: Report failure for mmap events

When fail to mmap events in task exit case, it misses to set 'err' to
-1; thus the testing will not report failure for it.

This patch sets 'err' to -1 when fails to mmap events, thus Perf tool
can report correct result.

Fixes: d723a55096b8 ("perf test: Add test case for checking number of EXIT events")
Signed-off-by: Leo Yan <leo.yan@linaro.org>
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Cc: Jiri Olsa <jolsa@redhat.com>
Cc: Mark Rutland <mark.rutland@arm.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Link: http://lore.kernel.org/lkml/20191011091942.29841-1-leo.yan@linaro.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/perf/tests/task-exit.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/tools/perf/tests/task-exit.c b/tools/perf/tests/task-exit.c
index 4965f8b..19fa7cb 100644
--- a/tools/perf/tests/task-exit.c
+++ b/tools/perf/tests/task-exit.c
@@ -111,6 +111,7 @@ int test__task_exit(struct test *test __maybe_unused, int subtest __maybe_unused
 	if (evlist__mmap(evlist, 128) < 0) {
 		pr_debug("failed to mmap events: %d (%s)\n", errno,
 			 str_error_r(errno, sbuf, sizeof(sbuf)));
+		err = -1;
 		goto out_delete_evlist;
 	}
 

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

end of thread, other threads:[~2019-10-22  0:03 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-10-11  9:19 [PATCH v1 1/2] perf test: Report failure for mmap events Leo Yan
2019-10-11  9:19 ` [PATCH v1 2/2] perf test: Avoid infinite loop for task exit case Leo Yan
2019-10-11 14:38   ` Arnaldo Carvalho de Melo
2019-10-14 14:11   ` Arnaldo Carvalho de Melo
2019-10-15  3:20     ` Leo Yan
2019-10-21 23:19   ` [tip: perf/core] " tip-bot2 for Leo Yan
2019-10-14 14:09 ` [PATCH v1 1/2] perf test: Report failure for mmap events Arnaldo Carvalho de Melo
2019-10-21 23:19 ` [tip: perf/core] " tip-bot2 for Leo Yan

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