linux-perf-users.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/1] perf test: Fix attr tests for PERF_FORMAT_LOST
@ 2022-09-26 14:49 James Clark
  2022-09-26 14:49 ` [PATCH 1/1] " James Clark
  0 siblings, 1 reply; 4+ messages in thread
From: James Clark @ 2022-09-26 14:49 UTC (permalink / raw)
  To: acme, namhyung
  Cc: linux-kernel, linux-perf-users, James Clark, Peter Zijlstra,
	Ingo Molnar, Mark Rutland, Alexander Shishkin, Jiri Olsa,
	Adrian Hunter

I'm not sure what the rule is for backwards compatibility of tests, but
in this case my change will not work on older kernels because I replaced
the previous expected value, rather than adding it as another valid one
with an OR. Like "read_format=4|20"

To me it seems that running the tests is a different workflow than say
someone running Perf itself on older kernels. And if we keep adding to
the valid values in tests, then the tests become less useful over time.

PERF_FORMAT_LOST is not an optional feature so it _should_ always be
present. For that reason I chose to not add it as an extra valid value,
but I'm happy to change it if we think that new tests should also pass
on older kernels.

Thanks
James

James Clark (1):
  perf test: Fix attr tests for PERF_FORMAT_LOST

 tools/perf/tests/attr/base-record                | 2 +-
 tools/perf/tests/attr/system-wide-dummy          | 2 +-
 tools/perf/tests/attr/test-record-group          | 4 ++--
 tools/perf/tests/attr/test-record-group-sampling | 6 +++---
 tools/perf/tests/attr/test-record-group1         | 4 ++--
 tools/perf/tests/attr/test-record-group2         | 4 ++--
 6 files changed, 11 insertions(+), 11 deletions(-)

-- 
2.28.0


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

* [PATCH 1/1] perf test: Fix attr tests for PERF_FORMAT_LOST
  2022-09-26 14:49 [PATCH 0/1] perf test: Fix attr tests for PERF_FORMAT_LOST James Clark
@ 2022-09-26 14:49 ` James Clark
  2022-10-11 13:00   ` James Clark
  0 siblings, 1 reply; 4+ messages in thread
From: James Clark @ 2022-09-26 14:49 UTC (permalink / raw)
  To: acme, namhyung
  Cc: linux-kernel, linux-perf-users, James Clark, Peter Zijlstra,
	Ingo Molnar, Mark Rutland, Alexander Shishkin, Jiri Olsa,
	Adrian Hunter

Since PERF_FORMAT_LOST was added, the default read format has that bit
set, so add it to the tests. When running on an older kernel the tests
will still fail because Perf will not set that bit.

This fixes the following failure:

  expected read_format=0|4, got 20
  FAILED './tests/attr/test-record-C0' - match failure

Fixes: 85b425f31c88 ("perf record: Set PERF_FORMAT_LOST by default")
Signed-off-by: James Clark <james.clark@arm.com>
---
 tools/perf/tests/attr/base-record                | 2 +-
 tools/perf/tests/attr/system-wide-dummy          | 2 +-
 tools/perf/tests/attr/test-record-group          | 4 ++--
 tools/perf/tests/attr/test-record-group-sampling | 6 +++---
 tools/perf/tests/attr/test-record-group1         | 4 ++--
 tools/perf/tests/attr/test-record-group2         | 4 ++--
 6 files changed, 11 insertions(+), 11 deletions(-)

diff --git a/tools/perf/tests/attr/base-record b/tools/perf/tests/attr/base-record
index 8c10955eff93..9758e22daf9c 100644
--- a/tools/perf/tests/attr/base-record
+++ b/tools/perf/tests/attr/base-record
@@ -9,7 +9,7 @@ size=128
 config=0
 sample_period=*
 sample_type=263
-read_format=0|4
+read_format=0|20
 disabled=1
 inherit=1
 pinned=0
diff --git a/tools/perf/tests/attr/system-wide-dummy b/tools/perf/tests/attr/system-wide-dummy
index 86a15dd359d9..0df8a997fe51 100644
--- a/tools/perf/tests/attr/system-wide-dummy
+++ b/tools/perf/tests/attr/system-wide-dummy
@@ -11,7 +11,7 @@ size=128
 config=9
 sample_period=4000
 sample_type=455
-read_format=4
+read_format=20
 # Event will be enabled right away.
 disabled=0
 inherit=1
diff --git a/tools/perf/tests/attr/test-record-group b/tools/perf/tests/attr/test-record-group
index 14ee60fd3f41..09aa40af841c 100644
--- a/tools/perf/tests/attr/test-record-group
+++ b/tools/perf/tests/attr/test-record-group
@@ -7,14 +7,14 @@ ret     = 1
 fd=1
 group_fd=-1
 sample_type=327
-read_format=4
+read_format=20
 
 [event-2:base-record]
 fd=2
 group_fd=1
 config=1
 sample_type=327
-read_format=4
+read_format=20
 mmap=0
 comm=0
 task=0
diff --git a/tools/perf/tests/attr/test-record-group-sampling b/tools/perf/tests/attr/test-record-group-sampling
index 300b9f7e6d69..3ad68c3405c8 100644
--- a/tools/perf/tests/attr/test-record-group-sampling
+++ b/tools/perf/tests/attr/test-record-group-sampling
@@ -7,7 +7,7 @@ ret     = 1
 fd=1
 group_fd=-1
 sample_type=343
-read_format=12
+read_format=28
 inherit=0
 
 [event-2:base-record]
@@ -21,8 +21,8 @@ config=3
 # default | PERF_SAMPLE_READ
 sample_type=343
 
-# PERF_FORMAT_ID | PERF_FORMAT_GROUP
-read_format=12
+# PERF_FORMAT_ID | PERF_FORMAT_GROUP  | PERF_FORMAT_LOST
+read_format=28
 task=0
 mmap=0
 comm=0
diff --git a/tools/perf/tests/attr/test-record-group1 b/tools/perf/tests/attr/test-record-group1
index 3ffe246e0228..53e1ba38febc 100644
--- a/tools/perf/tests/attr/test-record-group1
+++ b/tools/perf/tests/attr/test-record-group1
@@ -7,7 +7,7 @@ ret     = 1
 fd=1
 group_fd=-1
 sample_type=327
-read_format=4
+read_format=20
 
 [event-2:base-record]
 fd=2
@@ -15,7 +15,7 @@ group_fd=1
 type=0
 config=1
 sample_type=327
-read_format=4
+read_format=20
 mmap=0
 comm=0
 task=0
diff --git a/tools/perf/tests/attr/test-record-group2 b/tools/perf/tests/attr/test-record-group2
index 6b9f8d182ce1..ca21b5ce71aa 100644
--- a/tools/perf/tests/attr/test-record-group2
+++ b/tools/perf/tests/attr/test-record-group2
@@ -9,7 +9,7 @@ group_fd=-1
 config=0|1
 sample_period=1234000
 sample_type=87
-read_format=12
+read_format=28
 inherit=0
 freq=0
 
@@ -19,7 +19,7 @@ group_fd=1
 config=0|1
 sample_period=6789000
 sample_type=87
-read_format=12
+read_format=28
 disabled=0
 inherit=0
 mmap=0
-- 
2.28.0


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

* Re: [PATCH 1/1] perf test: Fix attr tests for PERF_FORMAT_LOST
  2022-09-26 14:49 ` [PATCH 1/1] " James Clark
@ 2022-10-11 13:00   ` James Clark
  2022-10-11 17:48     ` Namhyung Kim
  0 siblings, 1 reply; 4+ messages in thread
From: James Clark @ 2022-10-11 13:00 UTC (permalink / raw)
  To: acme, namhyung
  Cc: linux-kernel, linux-perf-users, Peter Zijlstra, Ingo Molnar,
	Mark Rutland, Alexander Shishkin, Jiri Olsa, Adrian Hunter



On 26/09/2022 15:49, James Clark wrote:
> Since PERF_FORMAT_LOST was added, the default read format has that bit
> set, so add it to the tests. When running on an older kernel the tests
> will still fail because Perf will not set that bit.
> 
> This fixes the following failure:
> 
>   expected read_format=0|4, got 20
>   FAILED './tests/attr/test-record-C0' - match failure
> 
> Fixes: 85b425f31c88 ("perf record: Set PERF_FORMAT_LOST by default")
> Signed-off-by: James Clark <james.clark@arm.com>
> ---
>  tools/perf/tests/attr/base-record                | 2 +-
>  tools/perf/tests/attr/system-wide-dummy          | 2 +-
>  tools/perf/tests/attr/test-record-group          | 4 ++--
>  tools/perf/tests/attr/test-record-group-sampling | 6 +++---
>  tools/perf/tests/attr/test-record-group1         | 4 ++--
>  tools/perf/tests/attr/test-record-group2         | 4 ++--
>  6 files changed, 11 insertions(+), 11 deletions(-)
> 
> diff --git a/tools/perf/tests/attr/base-record b/tools/perf/tests/attr/base-record
> index 8c10955eff93..9758e22daf9c 100644
> --- a/tools/perf/tests/attr/base-record
> +++ b/tools/perf/tests/attr/base-record
> @@ -9,7 +9,7 @@ size=128
>  config=0
>  sample_period=*
>  sample_type=263
> -read_format=0|4
> +read_format=0|20

Hi Namhyung,

Did you manage to take a look at this review? Are you ok with it being
0|20 or should I change it to 0|4|20?

Thanks
James

>  disabled=1
>  inherit=1
>  pinned=0
> diff --git a/tools/perf/tests/attr/system-wide-dummy b/tools/perf/tests/attr/system-wide-dummy
> index 86a15dd359d9..0df8a997fe51 100644
> --- a/tools/perf/tests/attr/system-wide-dummy
> +++ b/tools/perf/tests/attr/system-wide-dummy
> @@ -11,7 +11,7 @@ size=128
>  config=9
>  sample_period=4000
>  sample_type=455
> -read_format=4
> +read_format=20
>  # Event will be enabled right away.
>  disabled=0
>  inherit=1
> diff --git a/tools/perf/tests/attr/test-record-group b/tools/perf/tests/attr/test-record-group
> index 14ee60fd3f41..09aa40af841c 100644
> --- a/tools/perf/tests/attr/test-record-group
> +++ b/tools/perf/tests/attr/test-record-group
> @@ -7,14 +7,14 @@ ret     = 1
>  fd=1
>  group_fd=-1
>  sample_type=327
> -read_format=4
> +read_format=20
>  
>  [event-2:base-record]
>  fd=2
>  group_fd=1
>  config=1
>  sample_type=327
> -read_format=4
> +read_format=20
>  mmap=0
>  comm=0
>  task=0
> diff --git a/tools/perf/tests/attr/test-record-group-sampling b/tools/perf/tests/attr/test-record-group-sampling
> index 300b9f7e6d69..3ad68c3405c8 100644
> --- a/tools/perf/tests/attr/test-record-group-sampling
> +++ b/tools/perf/tests/attr/test-record-group-sampling
> @@ -7,7 +7,7 @@ ret     = 1
>  fd=1
>  group_fd=-1
>  sample_type=343
> -read_format=12
> +read_format=28
>  inherit=0
>  
>  [event-2:base-record]
> @@ -21,8 +21,8 @@ config=3
>  # default | PERF_SAMPLE_READ
>  sample_type=343
>  
> -# PERF_FORMAT_ID | PERF_FORMAT_GROUP
> -read_format=12
> +# PERF_FORMAT_ID | PERF_FORMAT_GROUP  | PERF_FORMAT_LOST
> +read_format=28
>  task=0
>  mmap=0
>  comm=0
> diff --git a/tools/perf/tests/attr/test-record-group1 b/tools/perf/tests/attr/test-record-group1
> index 3ffe246e0228..53e1ba38febc 100644
> --- a/tools/perf/tests/attr/test-record-group1
> +++ b/tools/perf/tests/attr/test-record-group1
> @@ -7,7 +7,7 @@ ret     = 1
>  fd=1
>  group_fd=-1
>  sample_type=327
> -read_format=4
> +read_format=20
>  
>  [event-2:base-record]
>  fd=2
> @@ -15,7 +15,7 @@ group_fd=1
>  type=0
>  config=1
>  sample_type=327
> -read_format=4
> +read_format=20
>  mmap=0
>  comm=0
>  task=0
> diff --git a/tools/perf/tests/attr/test-record-group2 b/tools/perf/tests/attr/test-record-group2
> index 6b9f8d182ce1..ca21b5ce71aa 100644
> --- a/tools/perf/tests/attr/test-record-group2
> +++ b/tools/perf/tests/attr/test-record-group2
> @@ -9,7 +9,7 @@ group_fd=-1
>  config=0|1
>  sample_period=1234000
>  sample_type=87
> -read_format=12
> +read_format=28
>  inherit=0
>  freq=0
>  
> @@ -19,7 +19,7 @@ group_fd=1
>  config=0|1
>  sample_period=6789000
>  sample_type=87
> -read_format=12
> +read_format=28
>  disabled=0
>  inherit=0
>  mmap=0

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

* Re: [PATCH 1/1] perf test: Fix attr tests for PERF_FORMAT_LOST
  2022-10-11 13:00   ` James Clark
@ 2022-10-11 17:48     ` Namhyung Kim
  0 siblings, 0 replies; 4+ messages in thread
From: Namhyung Kim @ 2022-10-11 17:48 UTC (permalink / raw)
  To: James Clark
  Cc: Arnaldo Carvalho de Melo, linux-kernel, linux-perf-users,
	Peter Zijlstra, Ingo Molnar, Mark Rutland, Alexander Shishkin,
	Jiri Olsa, Adrian Hunter

Hi James,

On Tue, Oct 11, 2022 at 6:00 AM James Clark <james.clark@arm.com> wrote:
>
>
>
> On 26/09/2022 15:49, James Clark wrote:
> > Since PERF_FORMAT_LOST was added, the default read format has that bit
> > set, so add it to the tests. When running on an older kernel the tests
> > will still fail because Perf will not set that bit.
> >
> > This fixes the following failure:
> >
> >   expected read_format=0|4, got 20
> >   FAILED './tests/attr/test-record-C0' - match failure
> >
> > Fixes: 85b425f31c88 ("perf record: Set PERF_FORMAT_LOST by default")
> > Signed-off-by: James Clark <james.clark@arm.com>
> > ---
> >  tools/perf/tests/attr/base-record                | 2 +-
> >  tools/perf/tests/attr/system-wide-dummy          | 2 +-
> >  tools/perf/tests/attr/test-record-group          | 4 ++--
> >  tools/perf/tests/attr/test-record-group-sampling | 6 +++---
> >  tools/perf/tests/attr/test-record-group1         | 4 ++--
> >  tools/perf/tests/attr/test-record-group2         | 4 ++--
> >  6 files changed, 11 insertions(+), 11 deletions(-)
> >
> > diff --git a/tools/perf/tests/attr/base-record b/tools/perf/tests/attr/base-record
> > index 8c10955eff93..9758e22daf9c 100644
> > --- a/tools/perf/tests/attr/base-record
> > +++ b/tools/perf/tests/attr/base-record
> > @@ -9,7 +9,7 @@ size=128
> >  config=0
> >  sample_period=*
> >  sample_type=263
> > -read_format=0|4
> > +read_format=0|20
>
> Hi Namhyung,
>
> Did you manage to take a look at this review? Are you ok with it being
> 0|20 or should I change it to 0|4|20?

I'm sorry I missed this.  It'd be nice if it can succeed on old kernels too.
Please go with 0|4|20 and the like.

Thanks,
Namhyung


>
> >  disabled=1
> >  inherit=1
> >  pinned=0
> > diff --git a/tools/perf/tests/attr/system-wide-dummy b/tools/perf/tests/attr/system-wide-dummy
> > index 86a15dd359d9..0df8a997fe51 100644
> > --- a/tools/perf/tests/attr/system-wide-dummy
> > +++ b/tools/perf/tests/attr/system-wide-dummy
> > @@ -11,7 +11,7 @@ size=128
> >  config=9
> >  sample_period=4000
> >  sample_type=455
> > -read_format=4
> > +read_format=20
> >  # Event will be enabled right away.
> >  disabled=0
> >  inherit=1
> > diff --git a/tools/perf/tests/attr/test-record-group b/tools/perf/tests/attr/test-record-group
> > index 14ee60fd3f41..09aa40af841c 100644
> > --- a/tools/perf/tests/attr/test-record-group
> > +++ b/tools/perf/tests/attr/test-record-group
> > @@ -7,14 +7,14 @@ ret     = 1
> >  fd=1
> >  group_fd=-1
> >  sample_type=327
> > -read_format=4
> > +read_format=20
> >
> >  [event-2:base-record]
> >  fd=2
> >  group_fd=1
> >  config=1
> >  sample_type=327
> > -read_format=4
> > +read_format=20
> >  mmap=0
> >  comm=0
> >  task=0
> > diff --git a/tools/perf/tests/attr/test-record-group-sampling b/tools/perf/tests/attr/test-record-group-sampling
> > index 300b9f7e6d69..3ad68c3405c8 100644
> > --- a/tools/perf/tests/attr/test-record-group-sampling
> > +++ b/tools/perf/tests/attr/test-record-group-sampling
> > @@ -7,7 +7,7 @@ ret     = 1
> >  fd=1
> >  group_fd=-1
> >  sample_type=343
> > -read_format=12
> > +read_format=28
> >  inherit=0
> >
> >  [event-2:base-record]
> > @@ -21,8 +21,8 @@ config=3
> >  # default | PERF_SAMPLE_READ
> >  sample_type=343
> >
> > -# PERF_FORMAT_ID | PERF_FORMAT_GROUP
> > -read_format=12
> > +# PERF_FORMAT_ID | PERF_FORMAT_GROUP  | PERF_FORMAT_LOST
> > +read_format=28
> >  task=0
> >  mmap=0
> >  comm=0
> > diff --git a/tools/perf/tests/attr/test-record-group1 b/tools/perf/tests/attr/test-record-group1
> > index 3ffe246e0228..53e1ba38febc 100644
> > --- a/tools/perf/tests/attr/test-record-group1
> > +++ b/tools/perf/tests/attr/test-record-group1
> > @@ -7,7 +7,7 @@ ret     = 1
> >  fd=1
> >  group_fd=-1
> >  sample_type=327
> > -read_format=4
> > +read_format=20
> >
> >  [event-2:base-record]
> >  fd=2
> > @@ -15,7 +15,7 @@ group_fd=1
> >  type=0
> >  config=1
> >  sample_type=327
> > -read_format=4
> > +read_format=20
> >  mmap=0
> >  comm=0
> >  task=0
> > diff --git a/tools/perf/tests/attr/test-record-group2 b/tools/perf/tests/attr/test-record-group2
> > index 6b9f8d182ce1..ca21b5ce71aa 100644
> > --- a/tools/perf/tests/attr/test-record-group2
> > +++ b/tools/perf/tests/attr/test-record-group2
> > @@ -9,7 +9,7 @@ group_fd=-1
> >  config=0|1
> >  sample_period=1234000
> >  sample_type=87
> > -read_format=12
> > +read_format=28
> >  inherit=0
> >  freq=0
> >
> > @@ -19,7 +19,7 @@ group_fd=1
> >  config=0|1
> >  sample_period=6789000
> >  sample_type=87
> > -read_format=12
> > +read_format=28
> >  disabled=0
> >  inherit=0
> >  mmap=0

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

end of thread, other threads:[~2022-10-11 17:48 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-09-26 14:49 [PATCH 0/1] perf test: Fix attr tests for PERF_FORMAT_LOST James Clark
2022-09-26 14:49 ` [PATCH 1/1] " James Clark
2022-10-11 13:00   ` James Clark
2022-10-11 17:48     ` Namhyung Kim

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