From: Ian Rogers <irogers@google.com> Date: 2020-09-12 02:57:14
Some fixes that address issues for regular and pfm4 events with 2
additional perf_event_attr tests. Various authors, David Sharp isn't
currently at Google.
v3. moved a loop into a helper following Adrian Hunter's suggestion.
v2. corrects the commit message following Athira Rajeev's suggestion.
David Sharp (1):
perf record: Set PERF_RECORD_PERIOD if attr->freq is set.
Ian Rogers (2):
perf record: Don't clear event's period if set by a term
perf test: Leader sampling shouldn't clear sample period
Stephane Eranian (1):
perf record: Prevent override of attr->sample_period for libpfm4
events
tools/perf/tests/attr/README | 1 +
tools/perf/tests/attr/test-record-group2 | 29 ++++++++++++++++++++
tools/perf/util/evsel.c | 10 ++++---
tools/perf/util/record.c | 34 ++++++++++++++++++------
4 files changed, 63 insertions(+), 11 deletions(-)
create mode 100644 tools/perf/tests/attr/test-record-group2
--
2.28.0.618.gf4bc123cb7-goog
From: Ian Rogers <irogers@google.com> Date: 2020-09-12 02:57:26
From: David Sharp <redacted>
evsel__config() would only set PERF_RECORD_PERIOD if it set attr->freq
from perf record options. When it is set by libpfm events, it would not
get set. This changes evsel__config to see if attr->freq is set outside of
whether or not it changes attr->freq itself.
Signed-off-by: David Sharp <redacted>
Signed-off-by: Ian Rogers <irogers@google.com>
---
tools/perf/util/evsel.c | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
From: Ian Rogers <irogers@google.com> Date: 2020-09-12 02:57:32
If events in a group explicitly set a frequency or period with leader
sampling, don't disable the samples on those events.
Prior to 5.8:
perf record -e '{cycles/period=12345000/,instructions/period=6789000/}:S'
would clear the attributes then apply the config terms. In commit
5f34278867b7 leader sampling configuration was moved to after applying the
config terms, in the example, making the instructions' event have its period
cleared.
This change makes it so that sampling is only disabled if configuration
terms aren't present.
Fixes: 5f34278867b7 ("perf evlist: Move leader-sampling configuration")
Signed-off-by: Ian Rogers <irogers@google.com>
---
tools/perf/util/record.c | 34 ++++++++++++++++++++++++++--------
1 file changed, 26 insertions(+), 8 deletions(-)
From: Adrian Hunter <adrian.hunter@intel.com> Date: 2020-09-14 06:03:07
On 12/09/20 5:56 am, Ian Rogers wrote:
If events in a group explicitly set a frequency or period with leader
sampling, don't disable the samples on those events.
Prior to 5.8:
perf record -e '{cycles/period=12345000/,instructions/period=6789000/}:S'
would clear the attributes then apply the config terms. In commit
5f34278867b7 leader sampling configuration was moved to after applying the
config terms, in the example, making the instructions' event have its period
cleared.
This change makes it so that sampling is only disabled if configuration
terms aren't present.
Fixes: 5f34278867b7 ("perf evlist: Move leader-sampling configuration")
Signed-off-by: Ian Rogers <irogers@google.com>
From: Arnaldo Carvalho de Melo <acme@kernel.org> Date: 2020-09-14 21:47:09
Em Fri, Sep 11, 2020 at 07:56:54PM -0700, Ian Rogers escreveu:
If events in a group explicitly set a frequency or period with leader
sampling, don't disable the samples on those events.
Prior to 5.8:
perf record -e '{cycles/period=12345000/,instructions/period=6789000/}:S'
would clear the attributes then apply the config terms. In commit
5f34278867b7 leader sampling configuration was moved to after applying the
config terms, in the example, making the instructions' event have its period
cleared.
This change makes it so that sampling is only disabled if configuration
terms aren't present.
Adrian, Jiri, can you please take a look a this and provide Reviewed-by
or Acked-by tags?
- Arnaldo
From: Arnaldo Carvalho de Melo <acme@kernel.org> Date: 2020-09-14 21:51:22
Em Mon, Sep 14, 2020 at 06:46:55PM -0300, Arnaldo Carvalho de Melo escreveu:
Em Fri, Sep 11, 2020 at 07:56:54PM -0700, Ian Rogers escreveu:
quoted
If events in a group explicitly set a frequency or period with leader
sampling, don't disable the samples on those events.
Prior to 5.8:
perf record -e '{cycles/period=12345000/,instructions/period=6789000/}:S'
would clear the attributes then apply the config terms. In commit
5f34278867b7 leader sampling configuration was moved to after applying the
config terms, in the example, making the instructions' event have its period
cleared.
This change makes it so that sampling is only disabled if configuration
terms aren't present.
Adrian, Jiri, can you please take a look a this and provide Reviewed-by
or Acked-by tags?
Without this patch we have:
# perf record -e '{cycles/period=1/,instructions/period=2/}:S' sleep 1
[ perf record: Woken up 1 times to write data ]
[ perf record: Captured and wrote 0.051 MB perf.data (6 samples) ]
#
# perf evlist -v
cycles/period=1/: size: 120, { sample_period, sample_freq }: 1, sample_type: IP|TID|TIME|READ|ID, read_format: ID|GROUP, disabled: 1, mmap: 1, comm: 1, enable_on_exec: 1, task: 1, sample_id_all: 1, exclude_guest: 1, mmap2: 1, comm_exec: 1, ksymbol: 1, bpf_event: 1
instructions/period=2/: size: 120, config: 0x1, sample_type: IP|TID|TIME|READ|ID, read_format: ID|GROUP, sample_id_all: 1, exclude_guest: 1
#
So indeed the period=2 is being cleared for the second event in that
group.
- Arnaldo
From: Ian Rogers <irogers@google.com> Date: 2020-09-14 21:53:37
On Mon, Sep 14, 2020 at 2:51 PM Arnaldo Carvalho de Melo
[off-list ref] wrote:
Em Mon, Sep 14, 2020 at 06:46:55PM -0300, Arnaldo Carvalho de Melo escreveu:
quoted
Em Fri, Sep 11, 2020 at 07:56:54PM -0700, Ian Rogers escreveu:
quoted
If events in a group explicitly set a frequency or period with leader
sampling, don't disable the samples on those events.
Prior to 5.8:
perf record -e '{cycles/period=12345000/,instructions/period=6789000/}:S'
would clear the attributes then apply the config terms. In commit
5f34278867b7 leader sampling configuration was moved to after applying the
config terms, in the example, making the instructions' event have its period
cleared.
This change makes it so that sampling is only disabled if configuration
terms aren't present.
Adrian, Jiri, can you please take a look a this and provide Reviewed-by
or Acked-by tags?
Without this patch we have:
# perf record -e '{cycles/period=1/,instructions/period=2/}:S' sleep 1
[ perf record: Woken up 1 times to write data ]
[ perf record: Captured and wrote 0.051 MB perf.data (6 samples) ]
#
# perf evlist -v
cycles/period=1/: size: 120, { sample_period, sample_freq }: 1, sample_type: IP|TID|TIME|READ|ID, read_format: ID|GROUP, disabled: 1, mmap: 1, comm: 1, enable_on_exec: 1, task: 1, sample_id_all: 1, exclude_guest: 1, mmap2: 1, comm_exec: 1, ksymbol: 1, bpf_event: 1
instructions/period=2/: size: 120, config: 0x1, sample_type: IP|TID|TIME|READ|ID, read_format: ID|GROUP, sample_id_all: 1, exclude_guest: 1
#
So indeed the period=2 is being cleared for the second event in that
group.
- Arnaldo
From: Arnaldo Carvalho de Melo <acme@kernel.org> Date: 2020-09-14 22:34:30
Em Mon, Sep 14, 2020 at 02:52:57PM -0700, Ian Rogers escreveu:
On Mon, Sep 14, 2020 at 2:51 PM Arnaldo Carvalho de Melo
[off-list ref] wrote:
quoted
Em Mon, Sep 14, 2020 at 06:46:55PM -0300, Arnaldo Carvalho de Melo escreveu:
quoted
Em Fri, Sep 11, 2020 at 07:56:54PM -0700, Ian Rogers escreveu:
quoted
If events in a group explicitly set a frequency or period with leader
sampling, don't disable the samples on those events.
Prior to 5.8:
perf record -e '{cycles/period=12345000/,instructions/period=6789000/}:S'
would clear the attributes then apply the config terms. In commit
5f34278867b7 leader sampling configuration was moved to after applying the
config terms, in the example, making the instructions' event have its period
cleared.
This change makes it so that sampling is only disabled if configuration
terms aren't present.
Adrian, Jiri, can you please take a look a this and provide Reviewed-by
or Acked-by tags?
Without this patch we have:
# perf record -e '{cycles/period=1/,instructions/period=2/}:S' sleep 1
[ perf record: Woken up 1 times to write data ]
[ perf record: Captured and wrote 0.051 MB perf.data (6 samples) ]
#
# perf evlist -v
cycles/period=1/: size: 120, { sample_period, sample_freq }: 1, sample_type: IP|TID|TIME|READ|ID, read_format: ID|GROUP, disabled: 1, mmap: 1, comm: 1, enable_on_exec: 1, task: 1, sample_id_all: 1, exclude_guest: 1, mmap2: 1, comm_exec: 1, ksymbol: 1, bpf_event: 1
instructions/period=2/: size: 120, config: 0x1, sample_type: IP|TID|TIME|READ|ID, read_format: ID|GROUP, sample_id_all: 1, exclude_guest: 1
#
So indeed the period=2 is being cleared for the second event in that
group.
- Arnaldo
From: Ian Rogers <irogers@google.com> Date: 2020-09-12 02:57:45
Add test that a sibling with leader sampling doesn't have its period
cleared.
Signed-off-by: Ian Rogers <irogers@google.com>
---
tools/perf/tests/attr/README | 1 +
tools/perf/tests/attr/test-record-group2 | 29 ++++++++++++++++++++++++
2 files changed, 30 insertions(+)
create mode 100644 tools/perf/tests/attr/test-record-group2
From: Ian Rogers <irogers@google.com> Date: 2020-09-12 02:57:51
From: Stephane Eranian <redacted>
Before:
$ perf record -c 10000 --pfm-events=cycles:period=77777
Would yield a cycles event with period=10000, instead of 77777.
This was due to an ordering issue between libpfm4 parsing
the event string and perf record initializing the event.
This patch fixes the problem by preventing override for
events with attr->sample_period != 0 by the time
perf_evsel__config() is invoked. This seems to have been the
intent of the author.
Signed-off-by: Stephane Eranian <redacted>
Reviewed-by: Ian Rogers <irogers@google.com>
Signed-off-by: Ian Rogers <irogers@google.com>
---
tools/perf/util/evsel.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
From: Jiri Olsa <hidden> Date: 2020-09-12 20:49:46
On Fri, Sep 11, 2020 at 07:56:51PM -0700, Ian Rogers wrote:
Some fixes that address issues for regular and pfm4 events with 2
additional perf_event_attr tests. Various authors, David Sharp isn't
currently at Google.
v3. moved a loop into a helper following Adrian Hunter's suggestion.
v2. corrects the commit message following Athira Rajeev's suggestion.
David Sharp (1):
perf record: Set PERF_RECORD_PERIOD if attr->freq is set.
Ian Rogers (2):
perf record: Don't clear event's period if set by a term
perf test: Leader sampling shouldn't clear sample period
Stephane Eranian (1):
perf record: Prevent override of attr->sample_period for libpfm4
events