Page MenuHomeFreeBSD

HWPMC: Fix clang stack frame parsing
ClosedPublic

Authored by fabient on Aug 2 2016, 4:14 PM.

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
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; 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.