gh-152769: Enable perf trampoline on Alpine#152774
Conversation
|
@vstinner Hi, this is the PR fixing perf trampolines on musl. Could you please take a look? |
|
Thanks for pointing out, @thesamesam — you're right. I'll close #152769 as a duplicate of #121608 so the discussion stays in one place. Hi, @corona10, since you authored the original #122370, I'd like to defer to you on how best to handle this.
Whatever works best for you — if you'd prefer to update and land #122370 yourself, I'm happy to close mine; or feel free to use this PR if that's easier. Thanks! |
|
I have issues to try First, it complained because of I ran That's maybe because I'm running Alpine Linux in a podman container which is running as root? Second, The command hangs. If I run samply in strace, it no longer hangs, so I cannot debug the issue :-( By the way, |
|
I also had permission issues with running Linux perf in my Alpine Linux container: Note: I tried setting |
|
@corona10: Are you able to run the 3 tests on Alpine Linux successfully? |
|
@vstinner Hi, looks like it's related to permission issues. When you start your podman, did you add the flag |
|
Ah, I forgot to mention that I tried running |
|
Could you let me know which version of the alpine image you're using? I'll see if I can reproduce it. |
|
And |
Proposal of change
As mentioned in #152769,
perfcan‘t collect Python function-level hotspot info on Alpine Linux because perf trampoline support is not enabled there.The trampoline is a CPU-architecture-specific feature and has little to do with OS or libc. Therefore, we can simply modify
configureto reuse the same trampoline implementation as glibc.Test results
I ran the tests on the following three platforms:
The three profiling-related tests now pass on all of these platforms:
Before this PR, these tests were skipped.
I also manually collected profiling data with
perfand confirmed that Python-level functions appear in the profiling output.How to reproduce
When running Alpine in a container, note that the container needs to be started with the additional
--privilegedoption.Apart from build dependencies, install
perfandsamply.samplyneeds to be built with Rust:./python -m test test_perf_profiler test_perfmaps test_samply_profiler