Uh oh!
There was an error while loading. Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork 34k
GH-98894: Fix function__return and function__entry dTrace probe missing after GH-103083#125019
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Uh oh!
There was an error while loading. Please reload this page.
Conversation
Zheaoli commented Oct 6, 2024 • edited by bedevere-app bot
Loading Uh oh!
There was an error while loading. Please reload this page.
edited by bedevere-app bot
Uh oh!
There was an error while loading. Please reload this page.
Zheaoli commented Oct 6, 2024 • edited
Loading Uh oh!
There was an error while loading. Please reload this page.
edited
Uh oh!
There was an error while loading. Please reload this page.
After #103083, the sudo bpftrace -e 'usdt:/home/manjusaka/Documents/projects/cpython/python:python:function__return{printf("filename: %s, funcname:%s, lineno:%d\n",str(arg0),str(arg1),arg2);}' -p 291832And the So I think we should keep the codebase same with the document or we need to update the document if we confirm that we don't need the dtrace feature any more. |
Misc/NEWS.d/next/Core_and_Builtins/2024-10-06-17-46-24.gh-issue-98894.uG2s-h.rst Outdated Show resolvedHide resolved
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
picnixz commented Oct 6, 2024
The build errors:
Something is probably missing somewhere. |
Zheaoli commented Oct 6, 2024
I have noticed this, I'm working on the CI. Thanks for the tips. Draft this PR first |
…e-98894.uG2s-h.rst Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
87ac00a to 128e856Comparemarkshannon commented Oct 9, 2024
IIUC, this means that they will not work with the JIT. Even if the instrumentation points are compiled into the templates, dtrace will not be able to find them. How does dtrace handle jit-in-time compiled code? |
Zheaoli commented Oct 9, 2024 • edited
Loading Uh oh!
There was an error while loading. Please reload this page.
edited
Uh oh!
There was an error while loading. Please reload this page.
Yes, it's static
The For now, the JIT is still an experimental feature. I think For the future, I think we may need extra dtrace point for JIT module |
markshannon commented Oct 10, 2024
How? |
Zheaoli commented Oct 10, 2024
That would be some different dtrace points, I'm not sure we need to discuss it here.
I'm not sure about the JIT roadmap. if here's more than five years before we make the JIT default release, I think it still is worthed adding the dtrace point back. Otherwise, we need to clean up the docs FYI https://docs.python.org/3/howto/instrumentation.html |
Zheaoli commented Oct 14, 2024
@markshannon ping~ |
thesamesam commented Oct 14, 2024
Also, merging it as it is facilitates backporting. |
Zheaoli commented Oct 22, 2024
@markshannon ping~ |
markshannon commented Oct 23, 2024
The JIT will be included in 3.14, but probably off by default. It will almost certainly on by default for 3.15. |
markshannon commented Oct 23, 2024
I'm not opposed to having dtrace hooks, but I don't see much value in them unless they
|
Zheaoli commented Oct 23, 2024 • edited
Loading Uh oh!
There was an error while loading. Please reload this page.
edited
Uh oh!
There was an error while loading. Please reload this page.
OK, I got it. 1 and 3 would not be a big issue, but I need more time about 2. So how about we update https://docs.python.org/3/howto/instrumentation.html and remove the function__return and function__entry part first? |
x-zvf commented Mar 29, 2025
+1 |
furkanonder commented Apr 3, 2025
@Zheaoli Can you resolve the conflicts? |
Zheaoli commented Apr 4, 2025
Yes, But I think we need a final call here. @markshannon Should we recover the USDT probe or we just need to remove it from documentation? |
ajor commented Apr 23, 2025
If the Python JIT can be enabled/disabled without a recompilation of Python, then to me it seems worth it to include this instrumentation for non-JIT codepaths at least. That way, people who want instrumentation can disable the JIT to get it as needed. It can be documented that the probe points won't work when the JIT is enabled (rather than the alternative of them not working at all!) |
x-zvf commented Apr 23, 2025 • edited
Loading Uh oh!
There was an error while loading. Please reload this page.
edited
Uh oh!
There was an error while loading. Please reload this page.
This seems like the easiest path to move forward with, but it defeats the greatest power of Dtrace - intrumenting running processes (with low overhead). If you need to restart a process to instrument it (disabling the jit), the probes become much less useful. |
thesamesam commented Apr 23, 2025 • edited
Loading Uh oh!
There was an error while loading. Please reload this page.
edited
Uh oh!
There was an error while loading. Please reload this page.
I'm also confident that I can get eyes on the general DTrace vs JIT issue in the future, just at the moment, the team working on that is busy with some more fundamental bits on the DTrace side. That is, I don't think this is delaying the inevitable or anything (and therefore PR should ideally go in for now). |
…ka/fix-dtrace Signed-off-by: Manjusaka <me@manjusaka.me>
Zheaoli commented May 22, 2025
I think there are many people still need USDT for non-JIT build. I think this PR is still worth to push forward. I resolve the code conflict |
Zheaoli commented Sep 25, 2025
close this PR |
The function__entry and function__return probes stopped working in Python 3.11 when the interpreter was restructured around the new bytecode system. This change restores these probes by adding DTRACE_FUNCTION_ENTRY() at the start_frame label in bytecodes.c and DTRACE_FUNCTION_RETURN() in the RETURN_VALUE and YIELD_VALUE instructions. The helper functions are defined in ceval.c and extract the filename, function name, and line number from the frame before firing the probe. This builds on the approach from python#125019 but avoids modifying the JIT template since the JIT does not currently support DTrace. The macros are conditionally compiled with WITH_DTRACE and are no-ops otherwise. The tests have been updated to use modern opcode names (CALL, CALL_KW, CALL_FUNCTION_EX) and a new bpftrace backend was added for Linux CI alongside the existing SystemTap tests. Line probe tests were removed since that probe was never restored after 3.11.
Fix#98894