From: Arnaldo Carvalho de Melo <acme@kernel.org>
To: kan.liang@linux.intel.com
Cc: mingo@kernel.org, linux-kernel@vger.kernel.org,
peterz@infradead.org, eranian@google.com, namhyung@kernel.org,
jolsa@redhat.com, ak@linux.intel.com, yao.jin@linux.intel.com,
maddy@linux.vnet.ibm.com
Subject: Re: [PATCH 2/9] perf tools: Support the auxiliary event
Date: Wed, 3 Feb 2021 17:02:56 -0300 [thread overview]
Message-ID: <20210203200256.GH854763@kernel.org> (raw)
In-Reply-To: <1612296553-21962-3-git-send-email-kan.liang@linux.intel.com>
Em Tue, Feb 02, 2021 at 12:09:06PM -0800, kan.liang@linux.intel.com escreveu:
> From: Kan Liang <kan.liang@linux.intel.com>
> diff --git a/tools/perf/util/evsel.c b/tools/perf/util/evsel.c
> index c26ea822..c48f6de 100644
> --- a/tools/perf/util/evsel.c
> +++ b/tools/perf/util/evsel.c
> @@ -2689,6 +2689,9 @@ int evsel__open_strerror(struct evsel *evsel, struct target *target,
> if (perf_missing_features.aux_output)
> return scnprintf(msg, size, "The 'aux_output' feature is not supported, update the kernel.");
> break;
> + case ENODATA:
> + return scnprintf(msg, size, "Cannot collect data source with the load latency event alone. "
> + "Please add an auxiliary event in front of the load latency event.");
Are you sure this is the only case where ENODATA comes out from
perf_event_open()? Well, according to your comment in:
61b985e3e775a3a7 ("perf/x86/intel: Add perf core PMU support for Sapphire Rapids")
It should be at that point in time, so its safe to merge as-is, but then
I think this is fragile, what if someone else, in the future, not
knowing that ENODATA is supposed to be used only with that ancient CPU,
Sapphire Rapids, uses it? :-)
Please consider adding a check before assuming ENODATA is for this
specific case.
Back to processing the other patches.
- Arnaldo
> default:
> break;
> }
> diff --git a/tools/perf/util/mem-events.c b/tools/perf/util/mem-events.c
> index 19007e4..3edfb88 100644
> --- a/tools/perf/util/mem-events.c
> +++ b/tools/perf/util/mem-events.c
> @@ -56,6 +56,11 @@ char * __weak perf_mem_events__name(int i)
> return (char *)e->name;
> }
>
> +__weak bool is_mem_loads_aux_event(struct evsel *leader __maybe_unused)
> +{
> + return false;
> +}
> +
> int perf_mem_events__parse(const char *str)
> {
> char *tok, *saveptr = NULL;
> diff --git a/tools/perf/util/mem-events.h b/tools/perf/util/mem-events.h
> index 5ef1782..045a507 100644
> --- a/tools/perf/util/mem-events.h
> +++ b/tools/perf/util/mem-events.h
> @@ -9,6 +9,7 @@
> #include <linux/refcount.h>
> #include <linux/perf_event.h>
> #include "stat.h"
> +#include "evsel.h"
>
> struct perf_mem_event {
> bool record;
> @@ -39,6 +40,7 @@ int perf_mem_events__init(void);
>
> char *perf_mem_events__name(int i);
> struct perf_mem_event *perf_mem_events__ptr(int i);
> +bool is_mem_loads_aux_event(struct evsel *leader);
>
> void perf_mem_events__list(void);
>
> diff --git a/tools/perf/util/parse-events.l b/tools/perf/util/parse-events.l
> index 9db5097..0b36285 100644
> --- a/tools/perf/util/parse-events.l
> +++ b/tools/perf/util/parse-events.l
> @@ -356,6 +356,7 @@ bpf-output { return sym(yyscanner, PERF_TYPE_SOFTWARE, PERF_COUNT_SW_BPF_OUT
> cycles-ct |
> cycles-t |
> mem-loads |
> +mem-loads-aux |
> mem-stores |
> topdown-[a-z-]+ |
> tx-capacity-[a-z-]+ |
> diff --git a/tools/perf/util/record.c b/tools/perf/util/record.c
> index e70c9dd..d0735fb 100644
> --- a/tools/perf/util/record.c
> +++ b/tools/perf/util/record.c
> @@ -15,6 +15,8 @@
> #include "record.h"
> #include "../perf-sys.h"
> #include "topdown.h"
> +#include "map_symbol.h"
> +#include "mem-events.h"
>
> /*
> * evsel__config_leader_sampling() uses special rules for leader sampling.
> @@ -25,7 +27,8 @@ static struct evsel *evsel__read_sampler(struct evsel *evsel, struct evlist *evl
> {
> struct evsel *leader = evsel->leader;
>
> - if (evsel__is_aux_event(leader) || arch_topdown_sample_read(leader)) {
> + if (evsel__is_aux_event(leader) || arch_topdown_sample_read(leader) ||
> + is_mem_loads_aux_event(leader)) {
> evlist__for_each_entry(evlist, evsel) {
> if (evsel->leader == leader && evsel != evsel->leader)
> return evsel;
> --
> 2.7.4
>
--
- Arnaldo
next prev parent reply other threads:[~2021-02-03 20:03 UTC|newest]
Thread overview: 34+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-02-02 20:09 [PATCH 0/9] perf core PMU support for Sapphire Rapids (User tools) kan.liang
2021-02-02 20:09 ` [PATCH 1/9] tools headers uapi: Update tools's copy of linux/perf_event.h kan.liang
2021-02-02 20:09 ` [PATCH 2/9] perf tools: Support the auxiliary event kan.liang
2021-02-03 20:02 ` Arnaldo Carvalho de Melo [this message]
2021-02-03 21:20 ` Liang, Kan
2021-02-03 21:30 ` Arnaldo Carvalho de Melo
2021-02-05 10:52 ` Namhyung Kim
2021-02-05 14:13 ` Liang, Kan
2021-02-05 15:26 ` Arnaldo Carvalho de Melo
2021-02-05 15:45 ` Liang, Kan
2021-02-02 20:09 ` [PATCH 3/9] perf tools: Support data block and addr block kan.liang
2021-02-05 11:02 ` Namhyung Kim
2021-02-05 14:17 ` Liang, Kan
2021-02-02 20:09 ` [PATCH 4/9] perf c2c: " kan.liang
2021-02-03 20:21 ` Arnaldo Carvalho de Melo
2021-02-02 20:09 ` [PATCH 5/9] perf tools: Support PERF_SAMPLE_WEIGHT_STRUCT kan.liang
2021-02-03 20:31 ` Arnaldo Carvalho de Melo
2021-02-03 21:19 ` Liang, Kan
2021-02-03 21:29 ` Arnaldo Carvalho de Melo
2021-02-02 20:09 ` [PATCH 6/9] perf report: Support instruction latency kan.liang
2021-02-03 20:43 ` Arnaldo Carvalho de Melo
2021-02-04 13:11 ` Athira Rajeev
2021-02-04 15:19 ` Liang, Kan
2021-02-05 12:55 ` Athira Rajeev
2021-02-05 14:51 ` Liang, Kan
2021-02-07 16:45 ` Athira Rajeev
2021-02-05 11:08 ` Namhyung Kim
2021-02-05 14:38 ` Liang, Kan
2021-02-06 8:09 ` Namhyung Kim
2021-02-08 13:50 ` Liang, Kan
2021-02-02 20:09 ` [PATCH 7/9] perf test: Support PERF_SAMPLE_WEIGHT_STRUCT kan.liang
2021-02-03 20:44 ` Arnaldo Carvalho de Melo
2021-02-02 20:09 ` [PATCH 8/9] perf stat: Support L2 Topdown events kan.liang
2021-02-02 20:09 ` [PATCH 9/9] perf, tools: Update topdown documentation for Sapphire Rapids kan.liang
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20210203200256.GH854763@kernel.org \
--to=acme@kernel.org \
--cc=ak@linux.intel.com \
--cc=eranian@google.com \
--cc=jolsa@redhat.com \
--cc=kan.liang@linux.intel.com \
--cc=linux-kernel@vger.kernel.org \
--cc=maddy@linux.vnet.ibm.com \
--cc=mingo@kernel.org \
--cc=namhyung@kernel.org \
--cc=peterz@infradead.org \
--cc=yao.jin@linux.intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).