lkml.org 
[lkml]   [2021]   [Oct]   [20]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
Date
SubjectRe: [sched.h] 317419b91e: perf-sanity-tests.Parse_sched_tracepoints_fields.fail
On Wed, Oct 20, 2021 at 12:51 AM Arnaldo Carvalho de Melo
<arnaldo.melo@gmail.com> wrote:
>
> Em Thu, Oct 14, 2021 at 08:42:05AM -0400, Mathieu Desnoyers escreveu:
> > ----- On Oct 14, 2021, at 5:24 AM, Yafang Shao laoar.shao@gmail.com wrote:
> > > On Thu, Oct 14, 2021 at 3:08 PM kernel test robot <oliver.sang@intel.com> wrote:
> > > That issue is caused by another hardcode 16 ...
>
> > > Seems we should make some change as below,
>
> > > diff --git a/tools/perf/tests/evsel-tp-sched.c
> > > b/tools/perf/tests/evsel-tp-sched.c
> > > index f9e34bd26cf3..401a737b1d85 100644
> > > --- a/tools/perf/tests/evsel-tp-sched.c
> > > +++ b/tools/perf/tests/evsel-tp-sched.c
> > > @@ -42,7 +42,7 @@ int test__perf_evsel__tp_sched_test(struct test
> > > *test __maybe_unused, int subtes
> > > return -1;
> > > }
>
> > > - if (evsel__test_field(evsel, "prev_comm", 16, false))
> > > + if (evsel__test_field(evsel, "prev_comm", TASK_COMM_LEN, false))
> >
> > tools/perf/tests/* contains userspace test programs. This means it gets the
> > TASK_COMM_LEN from the uapi. The fix you propose won't do any good here.
>
> That specific test is just checking if the parsing is being done as
> expected, i.e. we know beforehand that COMMs have 16 bytes, so the test
> expects that.
>

Right.

> Now that it can have a different size, then the test should accept the
> two sizes as possible and pass if it is 16 or 24.
>
> Like in this patch:
>

Thanks for the suggestion. I will do it as you suggested.

> diff --git a/tools/perf/tests/evsel-tp-sched.c b/tools/perf/tests/evsel-tp-sched.c
> index f9e34bd26cf33536..182328f3f7f70e0e 100644
> --- a/tools/perf/tests/evsel-tp-sched.c
> +++ b/tools/perf/tests/evsel-tp-sched.c
> @@ -5,7 +5,7 @@
> #include "tests.h"
> #include "debug.h"
>
> -static int evsel__test_field(struct evsel *evsel, const char *name, int size, bool should_be_signed)
> +static int evsel__test_field_alt(struct evsel *evsel, const char *name, int size, int alternate_size, bool should_be_signed)
> {
> struct tep_format_field *field = evsel__field(evsel, name);
> int is_signed;
> @@ -23,15 +23,23 @@ static int evsel__test_field(struct evsel *evsel, const char *name, int size, bo
> ret = -1;
> }
>
> - if (field->size != size) {
> - pr_debug("%s: \"%s\" size (%d) should be %d!\n",
> + if (field->size != size && field->size != alternate_size) {
> + pr_debug("%s: \"%s\" size (%d) should be %d",
> evsel->name, name, field->size, size);
> + if (alternate_size > 0)
> + pr_debug(" or %d", alternate_size);
> + pr_debug("!\n");
> ret = -1;
> }
>
> return ret;
> }
>
> +static int evsel__test_field(struct evsel *evsel, const char *name, int size, bool should_be_signed)
> +{
> + return evsel__test_field_alt(evsel, name, size, -1, should_be_signed);
> +}
> +
> int test__perf_evsel__tp_sched_test(struct test *test __maybe_unused, int subtest __maybe_unused)
> {
> struct evsel *evsel = evsel__newtp("sched", "sched_switch");
> @@ -42,7 +50,7 @@ int test__perf_evsel__tp_sched_test(struct test *test __maybe_unused, int subtes
> return -1;
> }
>
> - if (evsel__test_field(evsel, "prev_comm", 16, false))
> + if (evsel__test_field_alt(evsel, "prev_comm", 16, 24, false))
> ret = -1;
>
> if (evsel__test_field(evsel, "prev_pid", 4, true))
> @@ -54,7 +62,7 @@ int test__perf_evsel__tp_sched_test(struct test *test __maybe_unused, int subtes
> if (evsel__test_field(evsel, "prev_state", sizeof(long), true))
> ret = -1;
>
> - if (evsel__test_field(evsel, "next_comm", 16, false))
> + if (evsel__test_field_alt(evsel, "next_comm", 16, 24, false))
> ret = -1;
>
> if (evsel__test_field(evsel, "next_pid", 4, true))
> @@ -72,7 +80,7 @@ int test__perf_evsel__tp_sched_test(struct test *test __maybe_unused, int subtes
> return -1;
> }
>
> - if (evsel__test_field(evsel, "comm", 16, false))
> + if (evsel__test_field_alt(evsel, "comm", 16, 24, false))
> ret = -1;
>
> if (evsel__test_field(evsel, "pid", 4, true))



--
Thanks
Yafang

\
 
 \ /
  Last update: 2021-10-20 06:02    [W:0.088 / U:0.136 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site