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)
Oct 20 2024, 3:25 PM
Unknown Object (File)
Oct 3 2024, 11:50 AM
Unknown Object (File)
Oct 3 2024, 10:47 AM
Unknown Object (File)
Oct 1 2024, 1:36 PM
Unknown Object (File)
Sep 25 2024, 6:00 PM
Unknown Object (File)
Sep 25 2024, 1:28 PM
Unknown Object (File)
Sep 24 2024, 4:22 AM
Unknown Object (File)
Sep 19 2024, 8:17 PM
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 Skipped
Unit
Tests Skipped

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

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

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.