Page MenuHomeFreeBSD

HWPMC: Fix clang stack frame parsing
ClosedPublic

Authored by fabient on Aug 2 2016, 4:14 PM.
Tags
None
Referenced Files
Unknown Object (File)
Sat, Apr 20, 11:36 AM
Unknown Object (File)
Sat, Apr 20, 4:58 AM
Unknown Object (File)
Wed, Apr 17, 2:15 PM
Unknown Object (File)
Thu, Apr 11, 5:14 AM
Unknown Object (File)
Mon, Apr 8, 9:12 PM
Unknown Object (File)
Sat, Apr 6, 4:32 AM
Unknown Object (File)
Tue, Apr 2, 4:56 AM
Unknown Object (File)
Feb 18 2024, 8:32 AM
Subscribers

Details

Summary

clang generate stack frame differently than gcc.
The patch handle both compiler and enable stack frame when HWPMC is enabled.
If some userland program is using gcc the stack frame will not be captured correctly. A future possible evolution is to add a heuristic on failure to change from one mode to the other.

Test Plan

Without patch "pmcstat -n1 -S clock.hard -T" will not show any level above captured location.
With the patch chain is captured correctly.

Diff Detail

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

Event Timeline

fabient retitled this revision from to HWPMC: Fix clang stack frame parsing.
fabient updated this object.
fabient edited the test plan for this revision. (Show Details)
fabient set the repository for this revision to rS FreeBSD src repository - subversion.

We should be using the EABI unwinding function. The location of any given register on the EABI stack is compiler specific so we shouldn't hard code it.

sys/conf/Makefile.arm
54 ↗(On Diff #18961)

Your source tree seems to be out of date. WITHOUT_ARM_EABI was removed from this file over 2 years ago.

We should be using the EABI unwinding function. The location of any given register on the EABI stack is compiler specific so we shouldn't hard code it.

Yes but the EABI unwinding cost is not the same.
At the moment every platform use basic stack walk.
This patch only repair something broken since clang as default compiler.
https://llvm.org/bugs/show_bug.cgi?id=18505

As a second step it will be interesting to benchmark.

sys/conf/Makefile.arm
54 ↗(On Diff #18961)

Yes I've imported the patch for 10.3...

fabient edited edge metadata.

Correctly generated from head.
Added a fix support callchains for software events.

Any news on the review ?

Please can you review ? :)
If no one is strictly opposed I will commit next week.
Thanks in advance.

This revision was automatically updated to reflect the committed changes.