* [PATCH] perf evlist: Fix error out while applying initial delay and LBR
@ 2018-07-09 14:15 kan.liang
2018-07-09 15:20 ` Jiri Olsa
2018-08-02 8:07 ` [tip:perf/core] " tip-bot for Kan Liang
0 siblings, 2 replies; 4+ messages in thread
From: kan.liang @ 2018-07-09 14:15 UTC (permalink / raw)
To: acme, peterz, mingo, linux-kernel
Cc: jolsa, namhyung, ak, sunil.k.pandey, Kan Liang
From: Kan Liang <kan.liang@linux.intel.com>
Perf record will error out if both --delay and LBR are applied.
For example:
perf record -D 1000 -a -e cycles -j any -- sleep 2
Error:
dummy:HG: PMU Hardware doesn't support sampling/overflow-interrupts.
Try 'perf stat'
A dummy event is added implicitly for initial delay, which has the same
configurations as real sampling events. The dummy event is a software
event. If LBR is configured, perf must error out.
The dummy event only be used to track PERF_RECORD_MMAP while perf waits
for the initial delay to enable the real events. The BRANCH_STACK bit
can be safely cleared for the dummy event.
After applying the patch:
perf record -D 1000 -a -e cycles -j any -- sleep 2
[ perf record: Woken up 1 times to write data ]
[ perf record: Captured and wrote 1.054 MB perf.data (828 samples) ]
Reported-by: Pandey, Sunil K <sunil.k.pandey@intel.com>
Signed-off-by: Kan Liang <kan.liang@linux.intel.com>
---
tools/perf/util/evsel.c | 14 ++++++++++++++
1 file changed, 14 insertions(+)
diff --git a/tools/perf/util/evsel.c b/tools/perf/util/evsel.c
index 94fce4f..0d55047 100644
--- a/tools/perf/util/evsel.c
+++ b/tools/perf/util/evsel.c
@@ -848,6 +848,12 @@ static void apply_config_terms(struct perf_evsel *evsel,
}
}
+static bool is_dummy_event(struct perf_evsel *evsel)
+{
+ return (evsel->attr.type == PERF_TYPE_SOFTWARE) &&
+ (evsel->attr.config == PERF_COUNT_SW_DUMMY);
+}
+
/*
* The enable_on_exec/disabled value strategy:
*
@@ -1086,6 +1092,14 @@ void perf_evsel__config(struct perf_evsel *evsel, struct record_opts *opts,
else
perf_evsel__reset_sample_bit(evsel, PERIOD);
}
+
+ /*
+ * For initial_delay, a dummy event is added implicitly.
+ * The software event will trigger -EOPNOTSUPP error out,
+ * if BRANCH_STACK bit is set.
+ */
+ if (opts->initial_delay && is_dummy_event(evsel))
+ perf_evsel__reset_sample_bit(evsel, BRANCH_STACK);
}
static int perf_evsel__alloc_fd(struct perf_evsel *evsel, int ncpus, int nthreads)
--
2.7.4
^ permalink raw reply related [flat|nested] 4+ messages in thread* Re: [PATCH] perf evlist: Fix error out while applying initial delay and LBR
2018-07-09 14:15 [PATCH] perf evlist: Fix error out while applying initial delay and LBR kan.liang
@ 2018-07-09 15:20 ` Jiri Olsa
2018-07-26 12:51 ` Arnaldo Carvalho de Melo
2018-08-02 8:07 ` [tip:perf/core] " tip-bot for Kan Liang
1 sibling, 1 reply; 4+ messages in thread
From: Jiri Olsa @ 2018-07-09 15:20 UTC (permalink / raw)
To: kan.liang; +Cc: acme, peterz, mingo, linux-kernel, namhyung, ak, sunil.k.pandey
On Mon, Jul 09, 2018 at 07:15:22AM -0700, kan.liang@linux.intel.com wrote:
> From: Kan Liang <kan.liang@linux.intel.com>
>
> Perf record will error out if both --delay and LBR are applied.
> For example:
> perf record -D 1000 -a -e cycles -j any -- sleep 2
> Error:
> dummy:HG: PMU Hardware doesn't support sampling/overflow-interrupts.
> Try 'perf stat'
>
> A dummy event is added implicitly for initial delay, which has the same
> configurations as real sampling events. The dummy event is a software
> event. If LBR is configured, perf must error out.
>
> The dummy event only be used to track PERF_RECORD_MMAP while perf waits
> for the initial delay to enable the real events. The BRANCH_STACK bit
> can be safely cleared for the dummy event.
>
> After applying the patch:
> perf record -D 1000 -a -e cycles -j any -- sleep 2
> [ perf record: Woken up 1 times to write data ]
> [ perf record: Captured and wrote 1.054 MB perf.data (828 samples) ]
>
> Reported-by: Pandey, Sunil K <sunil.k.pandey@intel.com>
> Signed-off-by: Kan Liang <kan.liang@linux.intel.com>
Acked-by: Jiri Olsa <jolsa@kernel.org>
thanks,
jirka
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] perf evlist: Fix error out while applying initial delay and LBR
2018-07-09 15:20 ` Jiri Olsa
@ 2018-07-26 12:51 ` Arnaldo Carvalho de Melo
0 siblings, 0 replies; 4+ messages in thread
From: Arnaldo Carvalho de Melo @ 2018-07-26 12:51 UTC (permalink / raw)
To: Jiri Olsa
Cc: kan.liang, peterz, mingo, linux-kernel, namhyung, ak,
sunil.k.pandey
Em Mon, Jul 09, 2018 at 05:20:54PM +0200, Jiri Olsa escreveu:
> On Mon, Jul 09, 2018 at 07:15:22AM -0700, kan.liang@linux.intel.com wrote:
> > After applying the patch:
> > perf record -D 1000 -a -e cycles -j any -- sleep 2
> > [ perf record: Woken up 1 times to write data ]
> > [ perf record: Captured and wrote 1.054 MB perf.data (828 samples) ]
> >
> > Reported-by: Pandey, Sunil K <sunil.k.pandey@intel.com>
> > Signed-off-by: Kan Liang <kan.liang@linux.intel.com>
>
> Acked-by: Jiri Olsa <jolsa@kernel.org>
Thanks, applied, tested.
- Arnaldo
^ permalink raw reply [flat|nested] 4+ messages in thread
* [tip:perf/core] perf evlist: Fix error out while applying initial delay and LBR
2018-07-09 14:15 [PATCH] perf evlist: Fix error out while applying initial delay and LBR kan.liang
2018-07-09 15:20 ` Jiri Olsa
@ 2018-08-02 8:07 ` tip-bot for Kan Liang
1 sibling, 0 replies; 4+ messages in thread
From: tip-bot for Kan Liang @ 2018-08-02 8:07 UTC (permalink / raw)
To: linux-tip-commits
Cc: jolsa, acme, kan.liang, peterz, namhyung, mingo, sunil.k.pandey,
ak, linux-kernel, hpa, tglx
Commit-ID: 95035c5e167ae6e740b1ddd30210ae0eaf39a5db
Gitweb: https://git.kernel.org/tip/95035c5e167ae6e740b1ddd30210ae0eaf39a5db
Author: Kan Liang <kan.liang@linux.intel.com>
AuthorDate: Mon, 9 Jul 2018 07:15:22 -0700
Committer: Arnaldo Carvalho de Melo <acme@redhat.com>
CommitDate: Tue, 31 Jul 2018 09:56:46 -0300
perf evlist: Fix error out while applying initial delay and LBR
'perf record' will error out if both --delay and LBR are applied.
For example:
# perf record -D 1000 -a -e cycles -j any -- sleep 2
Error:
dummy:HG: PMU Hardware doesn't support sampling/overflow-interrupts.
Try 'perf stat'
#
A dummy event is added implicitly for initial delay, which has the same
configurations as real sampling events. The dummy event is a software
event. If LBR is configured, perf must error out.
The dummy event will only be used to track PERF_RECORD_MMAP while perf
waits for the initial delay to enable the real events. The BRANCH_STACK
bit can be safely cleared for the dummy event.
After applying the patch:
# perf record -D 1000 -a -e cycles -j any -- sleep 2
[ perf record: Woken up 1 times to write data ]
[ perf record: Captured and wrote 1.054 MB perf.data (828 samples) ]
#
Reported-by: Sunil K Pandey <sunil.k.pandey@intel.com>
Signed-off-by: Kan Liang <kan.liang@linux.intel.com>
Acked-by: Jiri Olsa <jolsa@kernel.org>
Tested-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: Andi Kleen <ak@linux.intel.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Link: http://lkml.kernel.org/r/1531145722-16404-1-git-send-email-kan.liang@linux.intel.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
tools/perf/util/evsel.c | 14 ++++++++++++++
1 file changed, 14 insertions(+)
diff --git a/tools/perf/util/evsel.c b/tools/perf/util/evsel.c
index 5285da0417c5..ddf84b941abf 100644
--- a/tools/perf/util/evsel.c
+++ b/tools/perf/util/evsel.c
@@ -859,6 +859,12 @@ static void apply_config_terms(struct perf_evsel *evsel,
}
}
+static bool is_dummy_event(struct perf_evsel *evsel)
+{
+ return (evsel->attr.type == PERF_TYPE_SOFTWARE) &&
+ (evsel->attr.config == PERF_COUNT_SW_DUMMY);
+}
+
/*
* The enable_on_exec/disabled value strategy:
*
@@ -1097,6 +1103,14 @@ void perf_evsel__config(struct perf_evsel *evsel, struct record_opts *opts,
else
perf_evsel__reset_sample_bit(evsel, PERIOD);
}
+
+ /*
+ * For initial_delay, a dummy event is added implicitly.
+ * The software event will trigger -EOPNOTSUPP error out,
+ * if BRANCH_STACK bit is set.
+ */
+ if (opts->initial_delay && is_dummy_event(evsel))
+ perf_evsel__reset_sample_bit(evsel, BRANCH_STACK);
}
static int perf_evsel__alloc_fd(struct perf_evsel *evsel, int ncpus, int nthreads)
^ permalink raw reply related [flat|nested] 4+ messages in thread
end of thread, other threads:[~2018-08-02 8:08 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-07-09 14:15 [PATCH] perf evlist: Fix error out while applying initial delay and LBR kan.liang
2018-07-09 15:20 ` Jiri Olsa
2018-07-26 12:51 ` Arnaldo Carvalho de Melo
2018-08-02 8:07 ` [tip:perf/core] " tip-bot for Kan Liang
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox