From: German Gomez <german.gomez@arm.com>
To: Jiri Olsa <jolsa@redhat.com>
Cc: linux-kernel@vger.kernel.org, linux-perf-users@vger.kernel.org,
acme@kernel.org, Alexandre Truong <alexandre.truong@arm.com>,
John Garry <john.garry@huawei.com>, Will Deacon <will@kernel.org>,
Mathieu Poirier <mathieu.poirier@linaro.org>,
Leo Yan <leo.yan@linaro.org>, Mark Rutland <mark.rutland@arm.com>,
Alexander Shishkin <alexander.shishkin@linux.intel.com>,
Namhyung Kim <namhyung@kernel.org>,
linux-arm-kernel@lists.infradead.org
Subject: Re: [PATCH v5 6/6] perf arm64: inject missing frames if perf-record used "--call-graph=fp"
Date: Mon, 10 Jan 2022 10:48:57 +0000 [thread overview]
Message-ID: <866deed3-9f01-7b68-9b01-9c9f02fbdfac@arm.com> (raw)
In-Reply-To: <YcGfQr43ChIgtacC@krava>
Hi Jiri,
On 21/12/2021 09:32, Jiri Olsa wrote:
> On Fri, Dec 17, 2021 at 03:45:20PM +0000, German Gomez wrote:
>
> SNIP
>
>> +}
>> +
>> +u64 get_leaf_frame_caller_aarch64(struct perf_sample *sample, struct thread *thread, int usr_idx)
>> +{
>> + int ret;
>> + struct entries entries = {};
>> + struct regs_dump old_regs = sample->user_regs;
>> +
>> + if (!get_leaf_frame_caller_enabled(sample))
>> + return 0;
>> +
>> + /*
>> + * If PC and SP are not recorded, get the value of PC from the stack
>> + * and set its mask. SP is not used when doing the unwinding but it
>> + * still needs to be set to prevent failures.
>> + */
>> +
>> + if (!(sample->user_regs.mask & SMPL_REG_MASK(PERF_REG_ARM64_PC))) {
>> + sample->user_regs.cache_mask |= SMPL_REG_MASK(PERF_REG_ARM64_PC);
>> + sample->user_regs.cache_regs[PERF_REG_ARM64_PC] = sample->callchain->ips[usr_idx+1];
>> + }
>> +
>> + if (!(sample->user_regs.mask & SMPL_REG_MASK(PERF_REG_ARM64_SP))) {
>> + sample->user_regs.cache_mask |= SMPL_REG_MASK(PERF_REG_ARM64_SP);
>> + sample->user_regs.cache_regs[PERF_REG_ARM64_SP] = 0;
>> + }
>> +
>> + ret = unwind__get_entries(add_entry, &entries, thread, sample, 2);
> just curious, did you try this with both unwinders libunwind/libdw?
Yes I did,
This is the program I was using:
int a = 0;
void leaf() {
for (int i = 0; i < 10000000; i++)
a *= a;
}
void parent() {
leaf();
}
int main() {
parent();
}
... compiled with "gcc -O0 -fno-omit-frame-pointer -fno-inline program.c"
>
> any chance you could add arm specific test for this?
I don't see a reason not to. I'll make a note for a separate patch.
>
> otherwise it looks good to me
>
> Acked-by: Jiri Olsa <jolsa@kernel.org>
Thanks for the review,
German
prev parent reply other threads:[~2022-01-10 10:49 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-12-17 15:45 [PATCH v5 0/6] perf tools/arm64: Fix missing leaf-function callers in ARM64 when using "--call-graph=fp" German Gomez
2021-12-17 15:45 ` [PATCH v5 1/6] perf tools: record ARM64 LR register automatically German Gomez
2021-12-17 15:45 ` [PATCH v5 2/6] perf tools: add a mechanism to inject stack frames German Gomez
2021-12-17 15:45 ` [PATCH v5 3/6] perf tools: Refactor script__setup_sample_type() German Gomez
2021-12-17 15:45 ` [PATCH v5 4/6] perf tools: enable dwarf_callchain_users on arm64 German Gomez
2021-12-17 15:45 ` [PATCH v5 5/6] perf tools: Refactor SMPL_REG macro in perf_regs.h German Gomez
2021-12-17 15:45 ` [PATCH v5 6/6] perf arm64: inject missing frames if perf-record used "--call-graph=fp" German Gomez
2021-12-17 16:01 ` James Clark
2021-12-18 11:35 ` Arnaldo Carvalho de Melo
2021-12-21 9:32 ` Jiri Olsa
2021-12-21 14:17 ` Arnaldo Carvalho de Melo
2021-12-21 15:06 ` Jiri Olsa
2022-01-10 10:48 ` German Gomez [this message]
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=866deed3-9f01-7b68-9b01-9c9f02fbdfac@arm.com \
--to=german.gomez@arm.com \
--cc=acme@kernel.org \
--cc=alexander.shishkin@linux.intel.com \
--cc=alexandre.truong@arm.com \
--cc=john.garry@huawei.com \
--cc=jolsa@redhat.com \
--cc=leo.yan@linaro.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-perf-users@vger.kernel.org \
--cc=mark.rutland@arm.com \
--cc=mathieu.poirier@linaro.org \
--cc=namhyung@kernel.org \
--cc=will@kernel.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
all inboxes | Powered by JetHome®