This is an archive of the discontinued LLVM Phabricator instance.

[Pseudo Probe] Remove the assert of allowing only one call probe for a callsite.
ClosedPublic

Authored by hoy on Jun 22 2023, 2:03 PM.

Details

Summary

Compiler-generated static symbols, such as the global initializers, can shared the same name and can coexist in the binary. As a result, their pseudo probes are all kept in the binary too. This could cause multiple call probes decoded against one callsite, as probes are decoded against there owning functions by name. I'm temporarily disabling an assert to keep the debug build green until we have a better fix.

Diff Detail

Event Timeline

hoy created this revision.Jun 22 2023, 2:03 PM
Herald added a project: Restricted Project. · View Herald TranscriptJun 22 2023, 2:03 PM
hoy requested review of this revision.Jun 22 2023, 2:03 PM
Herald added a project: Restricted Project. · View Herald TranscriptJun 22 2023, 2:03 PM

Due to the the way .pseudo_probe section is decoded, probes of the same-named independent static functions are merged

Is this because dwarf based name (the container for probes) doesn't have the concept of static function and all functions are keyed on names (TopLevelProbeFrameMap), so we can't differentiate static functions of the same name?

I might misunderstand it initially, but this seems like a flaw we should try to fix? Two static functions can be completely different, and we need to have the capability to differentiate them..

hoy added a comment.Jun 23 2023, 3:03 PM

Due to the the way .pseudo_probe section is decoded, probes of the same-named independent static functions are merged

Is this because dwarf based name (the container for probes) doesn't have the concept of static function and all functions are keyed on names (TopLevelProbeFrameMap), so we can't differentiate static functions of the same name?

In this case the linkage names are also the same. Those functions are global ctors which bypass the unique linkage phase and end up same-named.

I might misunderstand it initially, but this seems like a flaw we should try to fix? Two static functions can be completely different, and we need to have the capability to differentiate them..

User static functions has no such problem since they have unique linkage names for both elf and dwarf. It only happens to compiler-generated functions such as global ctors. Those functions are usually not hot functions. I'm not sure they are worth being fixed.

wenlei accepted this revision.Jun 23 2023, 4:13 PM

Due to the the way .pseudo_probe section is decoded, probes of the same-named independent static functions are merged

Is this because dwarf based name (the container for probes) doesn't have the concept of static function and all functions are keyed on names (TopLevelProbeFrameMap), so we can't differentiate static functions of the same name?

In this case the linkage names are also the same. Those functions are global ctors which bypass the unique linkage phase and end up same-named.

I might misunderstand it initially, but this seems like a flaw we should try to fix? Two static functions can be completely different, and we need to have the capability to differentiate them..

User static functions has no such problem since they have unique linkage names for both elf and dwarf. It only happens to compiler-generated functions such as global ctors. Those functions are usually not hot functions. I'm not sure they are worth being fixed.

Ok, can you update the comment to explicit mention compiler generated static functions? also mention that user defined static functions are fine. Otherwise LGTM.

This revision is now accepted and ready to land.Jun 23 2023, 4:13 PM
hoy updated this revision to Diff 534121.Jun 23 2023, 4:39 PM

Updating comments

This revision was landed with ongoing or failed builds.Jun 23 2023, 4:41 PM
This revision was automatically updated to reflect the committed changes.