From: Namhyung Kim <namhyung@kernel.org>
To: Howard Chu <howardchu95@gmail.com>
Cc: acme@kernel.org, peterz@infradead.org, irogers@google.com,
mingo@redhat.com, jolsa@kernel.org, adrian.hunter@intel.com,
kan.liang@linux.intel.com, linux-perf-users@vger.kernel.org,
linux-kernel@vger.kernel.org,
Alexander Shishkin <alexander.shishkin@linux.intel.com>,
James Clark <james.clark@linaro.org>,
Mark Rutland <mark.rutland@arm.com>,
Arnaldo Carvalho de Melo <acme@redhat.com>
Subject: Re: [PATCH v8 06/10] perf evsel: Assemble offcpu samples
Date: Mon, 18 Nov 2024 13:46:24 -0800 [thread overview]
Message-ID: <Zzu1sI8E_vX26MgX@google.com> (raw)
In-Reply-To: <20241113002818.3578645-7-howardchu95@gmail.com>
On Tue, Nov 12, 2024 at 04:28:14PM -0800, Howard Chu wrote:
> Use the data in bpf-output samples, to assemble offcpu samples.
Now it requires PERF_SAMPLE_RAW for the off-cpu events. But it's not
compatible with the earlier format. Can you please make sure if it can
read old off-cpu data recorded before your change? Maybe you need to
check or add new info (like in a header.misc field) to distinguish them.
Thanks,
Namhyung
>
> Suggested-by: Namhyung Kim <namhyung@kernel.org>
> Reviewed-by: Ian Rogers <irogers@google.com>
> Signed-off-by: Howard Chu <howardchu95@gmail.com>
> Cc: Adrian Hunter <adrian.hunter@intel.com>
> Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
> Cc: Ingo Molnar <mingo@redhat.com>
> Cc: James Clark <james.clark@linaro.org>
> Cc: Jiri Olsa <jolsa@kernel.org>
> Cc: Kan Liang <kan.liang@linux.intel.com>
> Cc: Mark Rutland <mark.rutland@arm.com>
> Cc: Peter Zijlstra <peterz@infradead.org>
> Link: https://lore.kernel.org/r/20241108204137.2444151-7-howardchu95@gmail.com
> Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
> ---
> tools/perf/util/evsel.c | 32 ++++++++++++++++++++++++++++++++
> 1 file changed, 32 insertions(+)
>
> diff --git a/tools/perf/util/evsel.c b/tools/perf/util/evsel.c
> index 8d0308f62484..654fb5196ecf 100644
> --- a/tools/perf/util/evsel.c
> +++ b/tools/perf/util/evsel.c
> @@ -2792,6 +2792,35 @@ static inline bool evsel__has_branch_counters(const struct evsel *evsel)
> return false;
> }
>
> +static int __set_offcpu_sample(struct perf_sample *data)
> +{
> + u64 *array = data->raw_data;
> + u32 max_size = data->raw_size, *p32;
> + const void *endp = (void *)array + max_size;
> +
> + if (array == NULL)
> + return -EFAULT;
> +
> + OVERFLOW_CHECK_u64(array);
> + p32 = (void *)array++;
> + data->pid = p32[0];
> + data->tid = p32[1];
> +
> + OVERFLOW_CHECK_u64(array);
> + data->period = *array++;
> +
> + OVERFLOW_CHECK_u64(array);
> + data->callchain = (struct ip_callchain *)array++;
> + OVERFLOW_CHECK(array, data->callchain->nr * sizeof(u64), max_size);
> + data->ip = data->callchain->ips[1];
> + array += data->callchain->nr;
> +
> + OVERFLOW_CHECK_u64(array);
> + data->cgroup = *array;
> +
> + return 0;
> +}
> +
> int evsel__parse_sample(struct evsel *evsel, union perf_event *event,
> struct perf_sample *data)
> {
> @@ -3143,6 +3172,9 @@ int evsel__parse_sample(struct evsel *evsel, union perf_event *event,
> array = (void *)array + sz;
> }
>
> + if (evsel__is_offcpu_event(evsel))
> + return __set_offcpu_sample(data);
> +
> return 0;
> }
>
> --
> 2.43.0
>
next prev parent reply other threads:[~2024-11-18 21:46 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-11-13 0:28 [PATCH v8 00/10] perf record --off-cpu: Dump off-cpu samples directly Howard Chu
2024-11-13 0:28 ` [PATCH v8 01/10] perf record --off-cpu: Add --off-cpu-thresh option Howard Chu
2024-11-18 21:09 ` Namhyung Kim
2024-11-18 23:03 ` Howard Chu
2024-11-13 0:28 ` [PATCH v8 02/10] perf evsel: Expose evsel__is_offcpu_event() for future use Howard Chu
2024-11-13 0:28 ` [PATCH v8 03/10] perf record --off-cpu: Parse off-cpu event Howard Chu
2024-11-18 21:17 ` Namhyung Kim
2024-11-18 23:05 ` Howard Chu
2024-11-13 0:28 ` [PATCH v8 04/10] perf record --off-cpu: Preparation of off-cpu BPF program Howard Chu
2024-11-13 17:03 ` Ian Rogers
2024-11-13 0:28 ` [PATCH v8 05/10] perf record --off-cpu: Dump off-cpu samples in BPF Howard Chu
2024-11-13 0:28 ` [PATCH v8 06/10] perf evsel: Assemble offcpu samples Howard Chu
2024-11-18 21:46 ` Namhyung Kim [this message]
2024-11-13 0:28 ` [PATCH v8 07/10] perf record --off-cpu: Disable perf_event's callchain collection Howard Chu
2024-11-13 0:28 ` [PATCH v8 08/10] perf script: Display off-cpu samples correctly Howard Chu
2024-11-13 0:28 ` [PATCH v8 09/10] perf record --off-cpu: Dump the remaining samples in BPF's stack trace map Howard Chu
2024-11-13 0:28 ` [PATCH v8 10/10] perf test: Add direct off-cpu test Howard Chu
2024-11-13 17:08 ` [PATCH v8 00/10] perf record --off-cpu: Dump off-cpu samples directly Ian Rogers
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=Zzu1sI8E_vX26MgX@google.com \
--to=namhyung@kernel.org \
--cc=acme@kernel.org \
--cc=acme@redhat.com \
--cc=adrian.hunter@intel.com \
--cc=alexander.shishkin@linux.intel.com \
--cc=howardchu95@gmail.com \
--cc=irogers@google.com \
--cc=james.clark@linaro.org \
--cc=jolsa@kernel.org \
--cc=kan.liang@linux.intel.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-perf-users@vger.kernel.org \
--cc=mark.rutland@arm.com \
--cc=mingo@redhat.com \
--cc=peterz@infradead.org \
/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