Page MenuHomeFreeBSD

Implement dtrace_getupcstack in ARM64
ClosedPublic

Authored by wma on Mar 30 2016, 11:47 AM.
Tags
None
Referenced Files
Unknown Object (File)
Feb 28 2024, 10:49 AM
Unknown Object (File)
Feb 28 2024, 9:03 AM
Unknown Object (File)
Feb 5 2024, 7:20 PM
Unknown Object (File)
Nov 4 2023, 7:12 AM
Unknown Object (File)
Nov 2 2023, 7:11 AM
Unknown Object (File)
Sep 30 2023, 7:10 AM
Unknown Object (File)
Sep 10 2023, 5:28 PM
Unknown Object (File)
Aug 6 2023, 11:45 AM

Details

Summary
This allows using DTRACE for performance analysis of userspace
applications - the function call stack can be captured.
This is almost an exact copy of AMD64 solution.

Example of FlameGraph for iperf3
https://drive.google.com/file/d/0B-7yTLrPxaWtYUJDc2FaVWRJeDA/view?usp=sharing

Diff Detail

Repository
rS FreeBSD src repository - subversion
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

wma retitled this revision from to Implement dtrace_getupcstack in ARM64.
wma updated this object.
wma edited the test plan for this revision. (Show Details)
wma added reviewers: br, zbb.
wma set the repository for this revision to rS FreeBSD src repository - subversion.
gnn requested changes to this revision.Mar 30 2016, 1:17 PM
gnn edited edge metadata.

Only one requested change from me. I have not tested this directly, only read the code.

sys/cddl/dev/dtrace/aarch64/dtrace_isa.c
66 ↗(On Diff #14733)

I think this ought to be a tunable.

163 ↗(On Diff #14733)

If this is related to x86 do we need this at all?

This revision now requires changes to proceed.Mar 30 2016, 1:17 PM
emaste added inline comments.
sys/cddl/dev/dtrace/aarch64/dtrace_isa.c
66 ↗(On Diff #14733)

I'm not sure; in hwpmc we have a similar setting kern.hwpmc.callchaindepth that is a tunable, but it defaults to 32. In this case it's just safety belt and should be higher than any user stack depth we support.

163 ↗(On Diff #14733)

This came in rS179237 for x86, and it looks like mips and powerpc have the same behaviour (and powerpc has the same comment). Perhaps @jhibbits has some insight on the latter case.

It might be sensible to keep the code (I'm not sure), but the comment definitely needs to be updated.

sys/cddl/dev/dtrace/aarch64/dtrace_isa.c
163 ↗(On Diff #14733)

I think part of this is that mips, arm*, and powerpc are all copied from x86. I chose not to remove the comment, thinking I would revisit it later with someone who actually knows dtrace. So, my answer for is it related only to x86 is... no idea. It might be x86 specific, in which case it can be removed from every other arch.

emaste added inline comments.
sys/cddl/dev/dtrace/aarch64/dtrace_isa.c
163 ↗(On Diff #14733)

This has been refactored somewhat in MIPS, but on a quick look there seems to be an equivalent:

                        if (*flags & CPU_DTRACE_FAULT)
                                goto fault;
...
fault:
        /*
         * We just got lost in backtrace, no big deal
         */
        *flags &= ~CPU_DTRACE_FAULT;
        return (-1);

@markj do you have any insight?

sys/cddl/dev/dtrace/aarch64/dtrace_isa.c
163 ↗(On Diff #14733)

In that case I'll leave the code as-is but update the comment with ARM64TODO to remember that this thing needs to be checked. Either way, removing this stuff from other architectures should be made in a separate commit with thorough testing, which I don't feel competent enough to perform...

sys/cddl/dev/dtrace/aarch64/dtrace_isa.c
163 ↗(On Diff #14733)

Agreed. We can revisit it separately for all architectures.

sys/cddl/dev/dtrace/aarch64/dtrace_isa.c
163 ↗(On Diff #14733)

I'm not sure what the exact problem scenario is here - this code was in the initial OpenSolaris release. I wonder if this code was hitting a fault while trying to unwind past a thread trampoline or something like that.

wma edited edge metadata.
wma marked 3 inline comments as done.

Changed ustack_max to be a define, I'm not convinced if anyone should be allowed to change it so didn't export that one to sysctl.

Added some more meaningful info to the x86 JVM comment.

Is there anything else that should be changed here or can I commit the latest version?

This revision was automatically updated to reflect the committed changes.