From: Adrian Hunter <adrian.hunter@intel.com>
To: Athira Rajeev <atrajeev@linux.ibm.com>, <acme@kernel.org>,
<jolsa@kernel.org>, <maddy@linux.ibm.com>, <irogers@google.com>,
<namhyung@kernel.org>
Cc: <linux-perf-users@vger.kernel.org>,
<linuxppc-dev@lists.ozlabs.org>, <aboorvad@linux.ibm.com>,
<sshegde@linux.ibm.com>, <kjain@linux.ibm.com>,
<hbathini@linux.vnet.ibm.com>, <Aditya.Bodkhe1@ibm.com>,
<venkat88@linux.ibm.com>
Subject: Re: [PATCH 13/14] tools/perf: Enable perf script to present the DTL entries
Date: Wed, 27 Aug 2025 20:30:38 +0300 [thread overview]
Message-ID: <4adc8413-e2c8-4c5b-9bb4-f425a6bed875@intel.com> (raw)
In-Reply-To: <20250815083407.27953-14-atrajeev@linux.ibm.com>
On 15/08/2025 11:34, Athira Rajeev wrote:
> Enable perf script to present the DTL entries. Process the
> dispatch trace log details in arch_perf_sample__fprintf_synth_evt()
> defined in buiultin-script.c file for config value:
> PERF_SYNTH_POWERPC_VPA_DTL.
>
> Sample output:
>
> ./perf record -a -e sched:*,vpa_dtl/dtl_all/ -c 1000000000 sleep 1
> [ perf record: Woken up 1 times to write data ]
> [ perf record: Captured and wrote 0.300 MB perf.data ]
>
> ./perf script
> perf 13322 [002] 233.835807: sched:sched_switch: perf:13322 [120] R ==> migration/2:27 [0]
> migration/2 27 [002] 233.835811: sched:sched_migrate_task: comm=perf pid=13322 prio=120 orig_cpu=2 dest_cpu=3
> migration/2 27 [002] 233.835818: sched:sched_stat_runtime: comm=migration/2 pid=27 runtime=9214 [ns]
> migration/2 27 [002] 233.835819: sched:sched_switch: migration/2:27 [0] S ==> swapper/2:0 [120]
> swapper 0 [002] 233.835822: vpa-dtl: timebase: 338954486062657 dispatch_reason:decrementer_interrupt, preempt_reason:H_CEDE, enqueue_to_dispatch_time:435, ready_to_enqueue_time:0, waiting_to_ready_time:34775058, processor_id: 202 c0000000000f8094 plpar_hcall_norets_notrace+0x18 ([kernel.kallsyms])
> swapper 0 [001] 233.835886: vpa-dtl: timebase: 338954486095398 dispatch_reason:priv_doorbell, preempt_reason:H_CEDE, enqueue_to_dispatch_time:542, ready_to_enqueue_time:0, waiting_to_ready_time:1245360, processor_id: 201 c0000000000f8094 plpar_hcall_norets_notrace+0x18 ([kernel.kallsyms])
>
> Signed-off-by: Athira Rajeev <atrajeev@linux.ibm.com>
> ---
> tools/perf/builtin-script.c | 23 +++++++++++++++++++++--
> tools/perf/util/powerpc-vpadtl.c | 16 ----------------
> tools/perf/util/powerpc-vpadtl.h | 19 +++++++++++++++++++
> 3 files changed, 40 insertions(+), 18 deletions(-)
>
> diff --git a/tools/perf/builtin-script.c b/tools/perf/builtin-script.c
> index eff584735980..a0faadaadc4d 100644
> --- a/tools/perf/builtin-script.c
> +++ b/tools/perf/builtin-script.c
> @@ -66,6 +66,7 @@
> #include "util/cgroup.h"
> #include "util/annotate.h"
> #include "perf.h"
> +#include "util/powerpc-vpadtl.h"
>
> #include <linux/ctype.h>
> #ifdef HAVE_LIBTRACEEVENT
> @@ -2004,8 +2005,26 @@ static int perf_sample__fprintf_synth_iflag_chg(struct perf_sample *sample, FILE
> }
>
> static void arch_perf_sample__fprintf_synth_evt(struct perf_sample *data __maybe_unused,
> - FILE *fp __maybe_unused, u64 config __maybe_unused)
> + FILE *fp __maybe_unused, u64 config __maybe_unused, struct perf_env *env)
> {
> + const char *arch = perf_env__arch(env);
> +
> + if (!strcmp("powerpc", arch)) {
Not needed. PERF_SYNTH_POWERPC_VPA_DTL is unique.
> + struct dtl_entry *dtl = (struct dtl_entry *)data->raw_data;
> +
> + if (config != PERF_SYNTH_POWERPC_VPA_DTL)
> + return;
> + fprintf(fp, "timebase: %" PRIu64 "dispatch_reason:%s, preempt_reason:%s, enqueue_to_dispatch_time:%d,\
> + ready_to_enqueue_time:%d, waiting_to_ready_time:%d, processor_id: %d",\
> + be64_to_cpu(dtl->timebase),
If the output were ever to be injected into another
perf.data file (by adding support in perf inject) then it
would be aligned to 4 bytes not 8, so for 64-bit access it
would be safer to use get_unaligned_be64()
> + dispatch_reasons[dtl->dispatch_reason],
> + preempt_reasons[dtl->preempt_reason],
> + be32_to_cpu(dtl->enqueue_to_dispatch_time),
> + be32_to_cpu(dtl->ready_to_enqueue_time),
> + be32_to_cpu(dtl->waiting_to_ready_time),
> + be16_to_cpu(dtl->processor_id));
> + }
> +
> return;
> }
>
> @@ -2032,7 +2051,7 @@ static int perf_sample__fprintf_synth(struct perf_sample *sample,
> case PERF_SYNTH_INTEL_IFLAG_CHG:
> return perf_sample__fprintf_synth_iflag_chg(sample, fp);
> default:
> - arch_perf_sample__fprintf_synth_evt(sample, fp, evsel->core.attr.config);
> + arch_perf_sample__fprintf_synth_evt(sample, fp, evsel->core.attr.config, evsel__env(evsel));
> break;
> }
>
> diff --git a/tools/perf/util/powerpc-vpadtl.c b/tools/perf/util/powerpc-vpadtl.c
> index 370c566f9ac2..482ddf1a2d51 100644
> --- a/tools/perf/util/powerpc-vpadtl.c
> +++ b/tools/perf/util/powerpc-vpadtl.c
> @@ -30,22 +30,6 @@
> #include "symbol.h"
> #include "tool.h"
>
> -/*
> - * The DTL entries are of below format
> - */
> -struct dtl_entry {
> - u8 dispatch_reason;
> - u8 preempt_reason;
> - u16 processor_id;
> - u32 enqueue_to_dispatch_time;
> - u32 ready_to_enqueue_time;
> - u32 waiting_to_ready_time;
> - u64 timebase;
> - u64 fault_addr;
> - u64 srr0;
> - u64 srr1;
> -};
> -
> /*
> * Structure to save the auxtrace queue
> */
> diff --git a/tools/perf/util/powerpc-vpadtl.h b/tools/perf/util/powerpc-vpadtl.h
> index 625172adaba5..497f704787a5 100644
> --- a/tools/perf/util/powerpc-vpadtl.h
> +++ b/tools/perf/util/powerpc-vpadtl.h
> @@ -20,6 +20,25 @@ union perf_event;
> struct perf_session;
> struct perf_pmu;
>
> +/*
> + * The DTL entries are of below format
> + */
> +struct dtl_entry {
> + u8 dispatch_reason;
> + u8 preempt_reason;
> + u16 processor_id;
> + u32 enqueue_to_dispatch_time;
> + u32 ready_to_enqueue_time;
> + u32 waiting_to_ready_time;
> + u64 timebase;
> + u64 fault_addr;
> + u64 srr0;
> + u64 srr1;
> +};
As mentioned for patch 8, maybe call it vpadtl_entry or powerpc_vpadtl_entry and
put it in perf/util/event.h
> +
> +extern const char *dispatch_reasons[11];
> +extern const char *preempt_reasons[10];
These are in perf/util/powerpc-vpadtl.c which is conditionally compiled
depending on CONFIG_AUXTRACE. So this happens when building with
NO_AUXTRACE=1 :
usr/bin/ld: perf-in.o: in function `process_sample_event':
builtin-script.c:(.text+0x379a6): undefined reference to `preempt_reasons'
/usr/bin/ld: builtin-script.c:(.text+0x379d5): undefined reference to `dispatch_reasons
> +
> int powerpc_vpadtl_process_auxtrace_info(union perf_event *event,
> struct perf_session *session);
>
next prev parent reply other threads:[~2025-08-27 17:31 UTC|newest]
Thread overview: 31+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-08-15 8:33 [PATCH 00/14] Add interface to expose vpa dtl counters via perf Athira Rajeev
2025-08-15 8:33 ` [PATCH 01/14] powerpc/time: Expose boot_tb via accessor Athira Rajeev
2025-08-15 8:33 ` [PATCH 02/14] powerpc/vpa_dtl: Add interface to expose vpa dtl counters via perf Athira Rajeev
2025-08-20 11:53 ` Shrikanth Hegde
2025-09-04 7:25 ` Athira Rajeev
2025-08-15 8:33 ` [PATCH 03/14] docs: ABI: sysfs-bus-event_source-devices-vpa-dtl: Document sysfs event format entries for vpa_dtl pmu Athira Rajeev
2025-08-15 8:33 ` [PATCH 04/14] powerpc/perf/vpa-dtl: Add support to setup and free aux buffer for capturing DTL data Athira Rajeev
2025-08-15 8:33 ` [PATCH 05/14] powerpc/perf/vpa-dtl: Add support to capture DTL data in aux buffer Athira Rajeev
2025-08-15 8:33 ` [PATCH 06/14] powerpc/perf/vpa-dtl: Handle the writing of perf record when aux wake up is needed Athira Rajeev
2025-08-15 8:34 ` [PATCH 07/14] tools/perf: Add basic CONFIG_AUXTRACE support for VPA pmu on powerpc Athira Rajeev
2025-08-27 17:27 ` Adrian Hunter
2025-08-29 8:29 ` Athira Rajeev
2025-09-15 7:31 ` Athira Rajeev
2025-08-15 8:34 ` [PATCH 08/14] tools/perf: process auxtrace events and display in perf report -D Athira Rajeev
2025-08-27 17:28 ` Adrian Hunter
2025-08-29 8:31 ` Athira Rajeev
2025-08-15 8:34 ` [PATCH 09/14] tools/perf: Add event name as vpa-dtl of PERF_TYPE_SYNTH type to present DTL samples Athira Rajeev
2025-08-15 8:34 ` [PATCH 10/14] tools/perf: Allocate and setup aux buffer queue to help co-relate with other events across CPU's Athira Rajeev
2025-08-27 17:29 ` Adrian Hunter
2025-08-15 8:34 ` [PATCH 11/14] tools/perf: Process the DTL entries in queue and deliver samples Athira Rajeev
2025-08-27 17:29 ` Adrian Hunter
2025-08-29 8:33 ` Athira Rajeev
2025-08-15 8:34 ` [PATCH 12/14] tools/perf: Add support for printing synth event details via default callback Athira Rajeev
2025-08-27 17:29 ` Adrian Hunter
2025-08-29 8:35 ` Athira Rajeev
2025-08-15 8:34 ` [PATCH 13/14] tools/perf: Enable perf script to present the DTL entries Athira Rajeev
2025-08-27 17:30 ` Adrian Hunter [this message]
2025-08-15 8:34 ` [PATCH 14/14] powerpc/perf/vpa-dtl: Add documentation for VPA dispatch trace log PMU Athira Rajeev
2025-08-15 12:17 ` [PATCH 00/14] Add interface to expose vpa dtl counters via perf Venkat Rao Bagalkote
2025-08-15 12:51 ` Athira Rajeev
2025-08-18 14:41 ` tejas05
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=4adc8413-e2c8-4c5b-9bb4-f425a6bed875@intel.com \
--to=adrian.hunter@intel.com \
--cc=Aditya.Bodkhe1@ibm.com \
--cc=aboorvad@linux.ibm.com \
--cc=acme@kernel.org \
--cc=atrajeev@linux.ibm.com \
--cc=hbathini@linux.vnet.ibm.com \
--cc=irogers@google.com \
--cc=jolsa@kernel.org \
--cc=kjain@linux.ibm.com \
--cc=linux-perf-users@vger.kernel.org \
--cc=linuxppc-dev@lists.ozlabs.org \
--cc=maddy@linux.ibm.com \
--cc=namhyung@kernel.org \
--cc=sshegde@linux.ibm.com \
--cc=venkat88@linux.ibm.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).