Skip to content

gh-121608: Add supporting perf trampoline on -linux-musl#122370

Closed
corona10 wants to merge 1 commit into
python:mainfrom
corona10:gh-121608
Closed

gh-121608: Add supporting perf trampoline on -linux-musl#122370
corona10 wants to merge 1 commit into
python:mainfrom
corona10:gh-121608

Conversation

@corona10

@corona10 corona10 commented Jul 28, 2024

Copy link
Copy Markdown
Member

@corona10

Copy link
Copy Markdown
Member Author

@pablogsal I think that there is no harm in adding support for musl.

@pablogsal

Copy link
Copy Markdown
Member

@pablogsal I think that there is no harm in adding support for musl.

I am a bit hessitant because we don't have CI for this. Have we tried it at least in a musl container or system and check that works?

@pablogsal pablogsal left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM but see my comment

@corona10

Copy link
Copy Markdown
Member Author

I am a bit hessitant because we don't have CI for this. Have we tried it at least in a musl container or system and check that works?

I will share the result of cross-check from my side before merging this.

@corona10

Copy link
Copy Markdown
Member Author

@pablogsal See my verification script. :)

main

Dockerfile

FROM alpine:latest

# install build dependencies and needed tools
RUN apk add \
    wget \
    git \
    gcc \
    make \
    perf \
    zlib-dev \
    libffi-dev \
    openssl-dev \
    musl-dev


RUN cd /opt && git clone https://github.com/python/cpython.git
RUN cd /opt/cpython && ./configure && make -j8 && ./python -m test test_perf_profiler -v

Output

0:00:00 load avg: 6.37 Run 1 test sequentially in a single process
0:00:00 load avg: 6.37 [1/1] test_perf_profiler
test_perf_profiler skipped -- perf trampoline profiling not supported
test_perf_profiler skipped

== Tests result: SUCCESS ==

1 test skipped:
    test_perf_profiler

Total duration: 65 ms
Total tests: run=0
Total test files: run=1/1 skipped=1
Result: SUCCESS

PR

Dockerfile

FROM alpine:latest

# install build dependencies and needed tools
RUN apk add \
    wget \
    git \
    gcc \
    make \
    perf \
    zlib-dev \
    libffi-dev \
    openssl-dev \
    musl-dev


RUN cd /opt && git clone https://github.com/corona10/cpython.git
RUN cd /opt/cpython && git checkout gh-121608 && ./configure && make -j8 && ./python -m test test_perf_profiler -v

Output

0:00:00 load avg: 6.55 Run 1 test sequentially in a single process
0:00:00 load avg: 6.55 [1/1] test_perf_profiler
test_pre_fork_compile (test.test_perf_profiler.TestPerfProfiler.test_pre_fork_compile) ... skipped "perf command doesn't work"
test_python_calls_appear_in_the_stack_if_perf_activated (test.test_perf_profiler.TestPerfProfiler.test_python_calls_appear_in_the_stack_if_perf_activated) ... skipped "perf command doesn't work"
test_python_calls_do_not_appear_in_the_stack_if_perf_deactivated (test.test_perf_profiler.TestPerfProfiler.test_python_calls_do_not_appear_in_the_stack_if_perf_deactivated) ... skipped "perf command doesn't work"
test_python_calls_appear_in_the_stack_if_perf_activated (test.test_perf_profiler.TestPerfProfilerWithDwarf.test_python_calls_appear_in_the_stack_if_perf_activated) ... skipped "perf command doesn't work"
test_python_calls_do_not_appear_in_the_stack_if_perf_deactivated (test.test_perf_profiler.TestPerfProfilerWithDwarf.test_python_calls_do_not_appear_in_the_stack_if_perf_deactivated) ... skipped "perf command doesn't work"
test_sys_api (test.test_perf_profiler.TestPerfTrampoline.test_sys_api) ... ok
test_sys_api_get_status (test.test_perf_profiler.TestPerfTrampoline.test_sys_api_get_status) ... ok
test_sys_api_with_existing_trampoline (test.test_perf_profiler.TestPerfTrampoline.test_sys_api_with_existing_trampoline) ... ok
test_sys_api_with_invalid_trampoline (test.test_perf_profiler.TestPerfTrampoline.test_sys_api_with_invalid_trampoline) ... ok
test_trampoline_works (test.test_perf_profiler.TestPerfTrampoline.test_trampoline_works) ... ok
test_trampoline_works_with_forks (test.test_perf_profiler.TestPerfTrampoline.test_trampoline_works_with_forks) ... ok

----------------------------------------------------------------------
Ran 11 tests in 0.245s

OK (skipped=5)

== Tests result: SUCCESS ==

1 test OK.

Total duration: 453 ms
Total tests: run=11 skipped=5
Total test files: run=1/1
Result: SUCCESS
COMMIT
--> 9f33d8c1b2ec
9f33d8c1b2ecc190f5c9bd3af27b7a402877ba45983043ade8afea0367e58391

@pablogsal

Copy link
Copy Markdown
Member

We still have:

test_python_calls_appear_in_the_stack_if_perf_activated (test.test_perf_profiler.TestPerfProfiler.test_python_calls_appear_in_the_stack_if_perf_activated) ... skipped "perf command doesn't work"
test_python_calls_do_not_appear_in_the_stack_if_perf_deactivated (test.test_perf_profiler.TestPerfProfiler.test_python_calls_do_not_appear_in_the_stack_if_perf_deactivated) ... skipped "perf command doesn't work"
test_python_calls_appear_in_the_stack_if_perf_activated (test.test_perf_profiler.TestPerfProfilerWithDwarf.test_python_calls_appear_in_the_stack_if_perf_activated) ... skipped "perf command doesn't work"
test_python_calls_do_not_appear_in_the_stack_if_perf_deactivated (test.test_perf_profiler.TestPerfProfilerWithDwarf.test_python_calls_do_not_appear_in_the_stack_if_perf_deactivated) ... skipped "perf command doesn't work"

so this is still not testing the perf DWARF integration because the kernel/perf version it's too old or has a bug. Check https://docs.python.org/3.14/howto/perf_profiling.html#how-to-work-without-frame-pointers

@corona10

Copy link
Copy Markdown
Member Author

so this is still not testing the perf DWARF integration because the kernel/perf version it's too old or has a bug. Check

STEP 3/5: RUN perf version
perf version 6.6.4

Yeah.. Thanks for catching this. let me check.

@zware

zware commented Aug 9, 2024

Copy link
Copy Markdown
Member

!buildbot Alpine

@bedevere-bot

Copy link
Copy Markdown

🤖 New build scheduled with the buildbot fleet by @zware for commit b8573ea 🤖

The command will test the builders whose names match following regular expression: Alpine

The builders matched are:

  • AMD64 Alpine Linux PR

@zware

zware commented Aug 12, 2024

Copy link
Copy Markdown
Member

!buildbot Alpine

@bedevere-bot

Copy link
Copy Markdown

🤖 New build scheduled with the buildbot fleet by @zware for commit b8573ea 🤖

The command will test the builders whose names match following regular expression: Alpine

The builders matched are:

  • AMD64 Alpine Linux PR

@pablogsal pablogsal added the 🔨 test-with-buildbots Test PR w/ buildbots; report in status section label Jan 13, 2025
@bedevere-bot

Copy link
Copy Markdown

🤖 New build scheduled with the buildbot fleet by @pablogsal for commit b8573ea 🤖

If you want to schedule another build, you need to add the 🔨 test-with-buildbots label again.

@bedevere-bot bedevere-bot removed the 🔨 test-with-buildbots Test PR w/ buildbots; report in status section label Jan 13, 2025
@github-actions

Copy link
Copy Markdown

This PR is stale because it has been open for 30 days with no activity.

@github-actions github-actions Bot added the stale Stale PR or inactive for long period of time. label Apr 17, 2026
@vstinner

Copy link
Copy Markdown
Member

I closed this PR. I merged the more recent #152774 which sets also PERF_TRAMPOLINE_OBJ in configure.

@vstinner vstinner closed this Jul 10, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

awaiting merge stale Stale PR or inactive for long period of time.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants