From: "Liang, Kan" <kan.liang@linux.intel.com>
To: Namhyung Kim <namhyung@kernel.org>,
Peter Zijlstra <peterz@infradead.org>,
Alexei Starovoitov <ast@kernel.org>,
Daniel Borkmann <daniel@iogearbox.net>,
Andrii Nakryiko <andrii@kernel.org>,
Song Liu <songliubraving@fb.com>
Cc: Ingo Molnar <mingo@kernel.org>,
Mark Rutland <mark.rutland@arm.com>,
Alexander Shishkin <alexander.shishkin@linux.intel.com>,
Arnaldo Carvalho de Melo <acme@kernel.org>,
Jiri Olsa <jolsa@kernel.org>, LKML <linux-kernel@vger.kernel.org>,
Martin KaFai Lau <kafai@fb.com>, Yonghong Song <yhs@fb.com>,
John Fastabend <john.fastabend@gmail.com>,
KP Singh <kpsingh@kernel.org>, Hao Luo <haoluo@google.com>,
Stanislav Fomichev <sdf@google.com>,
bpf@vger.kernel.org, Ravi Bangoria <ravi.bangoria@amd.com>
Subject: Re: [PATCH 1/3] perf: Use sample_flags for callchain
Date: Fri, 9 Sep 2022 08:37:53 -0400 [thread overview]
Message-ID: <842164ce-b754-b727-c976-39d05c34ddf3@linux.intel.com> (raw)
In-Reply-To: <20220908214104.3851807-1-namhyung@kernel.org>
On 2022-09-08 5:41 p.m., Namhyung Kim wrote:
> So that it can call perf_callchain() only if needed. Historically it used
> __PERF_SAMPLE_CALLCHAIN_EARLY but we can do that with sample_flags in the
> struct perf_sample_data.
>
> Signed-off-by: Namhyung Kim <namhyung@kernel.org>
The series look good to me.
Reviewed-by: Kan Liang <kan.liang@linux.intel.com>
Thanks,
Kan
> ---
> arch/x86/events/amd/ibs.c | 4 +++-
> arch/x86/events/intel/ds.c | 8 ++++++--
> kernel/events/core.c | 2 +-
> 3 files changed, 10 insertions(+), 4 deletions(-)
>
> diff --git a/arch/x86/events/amd/ibs.c b/arch/x86/events/amd/ibs.c
> index c251bc44c088..dab094166693 100644
> --- a/arch/x86/events/amd/ibs.c
> +++ b/arch/x86/events/amd/ibs.c
> @@ -798,8 +798,10 @@ static int perf_ibs_handle_irq(struct perf_ibs *perf_ibs, struct pt_regs *iregs)
> * recorded as part of interrupt regs. Thus we need to use rip from
> * interrupt regs while unwinding call stack.
> */
> - if (event->attr.sample_type & PERF_SAMPLE_CALLCHAIN)
> + if (event->attr.sample_type & PERF_SAMPLE_CALLCHAIN) {
> data.callchain = perf_callchain(event, iregs);
> + data.sample_flags |= PERF_SAMPLE_CALLCHAIN;
> + }
>
> throttle = perf_event_overflow(event, &data, ®s);
> out:
> diff --git a/arch/x86/events/intel/ds.c b/arch/x86/events/intel/ds.c
> index a5275c235c2a..4ba6ab6d0d92 100644
> --- a/arch/x86/events/intel/ds.c
> +++ b/arch/x86/events/intel/ds.c
> @@ -1546,8 +1546,10 @@ static void setup_pebs_fixed_sample_data(struct perf_event *event,
> * previous PMI context or an (I)RET happened between the record and
> * PMI.
> */
> - if (sample_type & PERF_SAMPLE_CALLCHAIN)
> + if (sample_type & PERF_SAMPLE_CALLCHAIN) {
> data->callchain = perf_callchain(event, iregs);
> + data->sample_flags |= PERF_SAMPLE_CALLCHAIN;
> + }
>
> /*
> * We use the interrupt regs as a base because the PEBS record does not
> @@ -1719,8 +1721,10 @@ static void setup_pebs_adaptive_sample_data(struct perf_event *event,
> * previous PMI context or an (I)RET happened between the record and
> * PMI.
> */
> - if (sample_type & PERF_SAMPLE_CALLCHAIN)
> + if (sample_type & PERF_SAMPLE_CALLCHAIN) {
> data->callchain = perf_callchain(event, iregs);
> + data->sample_flags |= PERF_SAMPLE_CALLCHAIN;
> + }
>
> *regs = *iregs;
> /* The ip in basic is EventingIP */
> diff --git a/kernel/events/core.c b/kernel/events/core.c
> index 15d27b14c827..b8af9fdbf26f 100644
> --- a/kernel/events/core.c
> +++ b/kernel/events/core.c
> @@ -7323,7 +7323,7 @@ void perf_prepare_sample(struct perf_event_header *header,
> if (sample_type & PERF_SAMPLE_CALLCHAIN) {
> int size = 1;
>
> - if (!(sample_type & __PERF_SAMPLE_CALLCHAIN_EARLY))
> + if (filtered_sample_type & PERF_SAMPLE_CALLCHAIN)
> data->callchain = perf_callchain(event, regs);
>
> size += data->callchain->nr;
next prev parent reply other threads:[~2022-09-09 12:38 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-09-08 21:41 [PATCH 1/3] perf: Use sample_flags for callchain Namhyung Kim
2022-09-08 21:41 ` [PATCH 2/3] perf/bpf: Always use perf callchains if exist Namhyung Kim
2022-09-09 21:55 ` sdf
2022-09-15 14:16 ` [tip: perf/core] " tip-bot2 for Namhyung Kim
2022-09-08 21:41 ` [PATCH 3/3] perf: Kill __PERF_SAMPLE_CALLCHAIN_EARLY Namhyung Kim
2022-09-15 14:16 ` [tip: perf/core] " tip-bot2 for Namhyung Kim
2022-09-09 12:37 ` Liang, Kan [this message]
2022-09-15 14:16 ` [tip: perf/core] perf: Use sample_flags for callchain tip-bot2 for Namhyung Kim
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=842164ce-b754-b727-c976-39d05c34ddf3@linux.intel.com \
--to=kan.liang@linux.intel.com \
--cc=acme@kernel.org \
--cc=alexander.shishkin@linux.intel.com \
--cc=andrii@kernel.org \
--cc=ast@kernel.org \
--cc=bpf@vger.kernel.org \
--cc=daniel@iogearbox.net \
--cc=haoluo@google.com \
--cc=john.fastabend@gmail.com \
--cc=jolsa@kernel.org \
--cc=kafai@fb.com \
--cc=kpsingh@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mark.rutland@arm.com \
--cc=mingo@kernel.org \
--cc=namhyung@kernel.org \
--cc=peterz@infradead.org \
--cc=ravi.bangoria@amd.com \
--cc=sdf@google.com \
--cc=songliubraving@fb.com \
--cc=yhs@fb.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