From: Jiri Olsa <jolsa@redhat.com>
To: "Jin, Yao" <yao.jin@linux.intel.com>
Cc: acme@kernel.org, jolsa@kernel.org, peterz@infradead.org,
mingo@redhat.com, alexander.shishkin@linux.intel.com,
Linux-kernel@vger.kernel.org, ak@linux.intel.com,
kan.liang@intel.com, yao.jin@intel.com, irogers@google.com,
Adrian Hunter <adrian.hunter@intel.com>
Subject: Re: [PATCH v2] perf evsel: Don't set sample_regs_intr/sample_regs_user for dummy event
Date: Wed, 22 Jul 2020 13:08:10 +0200 [thread overview]
Message-ID: <20200722110810.GD981884@krava> (raw)
In-Reply-To: <af1da971-5c60-4c17-e5d9-01430c928592@linux.intel.com>
On Wed, Jul 22, 2020 at 01:00:03PM +0800, Jin, Yao wrote:
SNIP
> > >
> > > If we use -IXMM0, the attr>sample_regs_intr will be set with
> > > PERF_REG_EXTENDED_MASK bit.
> > >
> > > It doesn't make sense to set attr->sample_regs_intr for a
> > > software dummy event.
> > >
> > > This patch adds dummy event checking before setting
> > > attr->sample_regs_intr and attr->sample_regs_user.
> > >
> > > After:
> > > # ./perf record -e cycles:p -IXMM0 -a -- sleep 1
> > > [ perf record: Woken up 1 times to write data ]
> > > [ perf record: Captured and wrote 0.413 MB perf.data (45 samples) ]
> > >
> > > v2:
> > > ---
> > > Rebase to perf/core
> > >
> > > Fixes: 0a892c1c9472 ("perf record: Add dummy event during system wide synthesis")
> > > Signed-off-by: Jin Yao <yao.jin@linux.intel.com>
> > > ---
> > > tools/perf/util/evsel.c | 6 ++++--
> > > 1 file changed, 4 insertions(+), 2 deletions(-)
> > >
> > > diff --git a/tools/perf/util/evsel.c b/tools/perf/util/evsel.c
> > > index 9aa51a65593d..11794d3b7879 100644
> > > --- a/tools/perf/util/evsel.c
> > > +++ b/tools/perf/util/evsel.c
> > > @@ -1014,12 +1014,14 @@ void evsel__config(struct evsel *evsel, struct record_opts *opts,
> > > if (callchain && callchain->enabled && !evsel->no_aux_samples)
> > > evsel__config_callchain(evsel, opts, callchain);
> > > - if (opts->sample_intr_regs && !evsel->no_aux_samples) {
> > > + if (opts->sample_intr_regs && !evsel->no_aux_samples &&
> > > + !evsel__is_dummy_event(evsel)) {
> >
> > hum, I thought it'd look something like this:
> >
> > if (opts->sample_intr_regs && (!evsel->no_aux_samples || !evsel__is_dummy_event(evsel))
> >
> > but I'm not sure how no_aux_samples flag works exactly.. so it might be
> > correct.. just making sure ;-)
> >
> > cc-ing Adrian
> >
> > jirka
> >
> >
>
> no_aux_samples is set to false by default and it's only set to true by pt, right?
>
> So most of the time, !evsel->no_aux_samples is always true.
>
> if (opts->sample_intr_regs && (!evsel->no_aux_samples || !evsel__is_dummy_event(evsel)) {
> attr->sample_regs_intr = opts->sample_intr_regs;
> evsel__set_sample_bit(evsel, REGS_INTR);
> }
>
> So even if the evsel is dummy event, the condition check is true. :(
>
> Or maybe I misunderstand anything?
I was just curious, because I did not follow the no_aux_samples
usage in detail.. so how about a case where:
evsel->no_aux_samples == true and evsel__is_dummy_event(evsel) = false
then the original condition will be false for non dummy event
(opts->sample_intr_regs && !evsel->no_aux_samples && !evsel__is_dummy_event(evsel))
is that ok?
jirka
next prev parent reply other threads:[~2020-07-22 11:08 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-07-20 1:00 [PATCH v2] perf evsel: Don't set sample_regs_intr/sample_regs_user for dummy event Jin Yao
2020-07-20 9:17 ` Jiri Olsa
2020-07-22 5:00 ` Jin, Yao
2020-07-22 11:08 ` Jiri Olsa [this message]
2020-07-23 1:01 ` Jin, Yao
2020-07-29 7:23 ` Jin, Yao
2020-08-04 7:06 ` Adrian Hunter
2020-08-04 12:06 ` Arnaldo Carvalho de Melo
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=20200722110810.GD981884@krava \
--to=jolsa@redhat.com \
--cc=Linux-kernel@vger.kernel.org \
--cc=acme@kernel.org \
--cc=adrian.hunter@intel.com \
--cc=ak@linux.intel.com \
--cc=alexander.shishkin@linux.intel.com \
--cc=irogers@google.com \
--cc=jolsa@kernel.org \
--cc=kan.liang@intel.com \
--cc=mingo@redhat.com \
--cc=peterz@infradead.org \
--cc=yao.jin@intel.com \
--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).