perf test: Report failure for mmap events
PATCH 1/2 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.
--- tools/perf/tests/task-exit.c | 1 + 1 file changed, 1 insertion(+)
tools/perf/tests/task-exit.c +1 -0
@@ -110,6 +110,7 @@ int test__task_exit(struct test *test __maybe_unused, int subtest __maybe_unusedif (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; }
Signature · 1 line
2.17.1
PATCH 2/2 perf test: Avoid infinite loop for task exit case
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.
--- tools/perf/tests/task-exit.c | 8 ++++++++ 1 file changed, 8 insertions(+)
tools/perf/tests/task-exit.c +8 -0
@@ -53,6 +53,7 @@ int test__task_exit(struct test *test __maybe_unused, int subtest __maybe_unusedstruct 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; }
Signature · 1 line
2.17.1
Re: [PATCH v1 2/2] perf test: Avoid infinite loop for task exit case
Em Fri, Oct 11, 2019 at 05:19:42PM +0800, Leo Yan escreveu:
Quoted 9 lines
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
Quoted 40 lines
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 <[email protected]>--- tools/perf/tests/task-exit.c | 8 ++++++++ 1 file changed, 8 insertions(+)tools/perf/tests/task-exit.c +8
-0@@ -53,6 +53,7 @@ int test__task_exit(struct test *test __maybe_unused, int subtest __maybe_unusedstruct 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; }Signature · 1 line
2.17.1
Signature · 1 line
- Arnaldo
Arnaldo Carvalho de Melo
AppliedRe: [PATCH v1 2/2] perf test: Avoid infinite loop for task exit case
In reply to Leo YanEm Fri, Oct 11, 2019 at 05:19:42PM +0800, Leo Yan escreveu:
Quoted 10 lines
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.
Quoted 6 lines
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
Quoted 33 lines
Signed-off-by Leo Yan <[email protected]>--- tools/perf/tests/task-exit.c | 8 ++++++++ 1 file changed, 8 insertions(+)tools/perf/tests/task-exit.c +8
-0@@ -53,6 +53,7 @@ int test__task_exit(struct test *test __maybe_unused, int subtest __maybe_unusedstruct 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; }Signature · 1 line
2.17.1
Signature · 1 line
- Arnaldo
Re: [PATCH v1 2/2] perf test: Avoid infinite loop for task exit case
Quoted 11 lines · Arnaldo Carvalho de Melo
Em Fri, Oct 11, 2019 at 05:19:42PM +0800, Leo Yan escreveu:
Quoted 10 lines
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.
Quoted 8 lines
Quoted 6 lines
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.
[tip: perf/core] perf test: Avoid infinite loop for task exit case
In reply to Leo YanThe following commit has been merged into the perf/core branch of tip:
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 <[email protected]> AuthorDate: Fri, 11 Oct 2019 17:19:42 +08:00 Committer: Arnaldo Carvalho de Melo <[email protected]> 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.
--- tools/perf/tests/task-exit.c | 8 ++++++++ 1 file changed, 8 insertions(+)
tools/perf/tests/task-exit.c +8 -0
@@ -54,6 +54,7 @@ int test__task_exit(struct test *test __maybe_unused, int subtest __maybe_unusedstruct 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; }
Arnaldo Carvalho de Melo
AppliedEm Fri, Oct 11, 2019 at 05:19:41PM +0800, Leo Yan escreveu:
Quoted 5 lines
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:
Quoted 19 lines
Signed-off-by Leo Yan <[email protected]>--- tools/perf/tests/task-exit.c | 1 + 1 file changed, 1 insertion(+)tools/perf/tests/task-exit.c +1
-0@@ -110,6 +110,7 @@ int test__task_exit(struct test *test __maybe_unused, int subtest __maybe_unusedif (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; }Signature · 1 line
2.17.1
Signature · 1 line
- Arnaldo
The following commit has been merged into the perf/core branch of tip:
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 <[email protected]> AuthorDate: Fri, 11 Oct 2019 17:19:41 +08:00 Committer: Arnaldo Carvalho de Melo <[email protected]> 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.
--- tools/perf/tests/task-exit.c | 1 + 1 file changed, 1 insertion(+)
tools/perf/tests/task-exit.c +1 -0
@@ -111,6 +111,7 @@ int test__task_exit(struct test *test __maybe_unused, int subtest __maybe_unusedif (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; }