GH-98894: Fix function__return and function__entry dTrace probe missing after GH-103083#125019
GH-98894: Fix function__return and function__entry dTrace probe missing after GH-103083#125019Zheaoli wants to merge 6 commits into
function__return and function__entry dTrace probe missing after GH-103083#125019Conversation
|
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. |
Sorry, something went wrong.
|
The build errors:
Something is probably missing somewhere. |
Sorry, something went wrong.
I have noticed this, I'm working on the CI. Thanks for the tips. Draft this PR first |
Sorry, something went wrong.
…e-98894.uG2s-h.rst Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
87ac00a to
128e856
Compare
October 7, 2024 15:26
|
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? |
Sorry, something went wrong.
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 |
Sorry, something went wrong.
How? |
Sorry, something went wrong.
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 |
Sorry, something went wrong.
|
Also, merging it as it is facilitates backporting. |
Sorry, something went wrong.
The JIT will be included in 3.14, but probably off by default. It will almost certainly on by default for 3.15. |
Sorry, something went wrong.
|
I'm not opposed to having dtrace hooks, but I don't see much value in them unless they
|
Sorry, something went wrong.
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? |
Sorry, something went wrong.
|
+1 |
Sorry, something went wrong.
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? |
Sorry, something went wrong.
|
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!) |
Sorry, something went wrong.
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. |
Sorry, something went wrong.
|
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). |
Sorry, something went wrong.
…ka/fix-dtrace Signed-off-by: Manjusaka <me@manjusaka.me>
|
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 |
Sorry, something went wrong.
|
close this PR |
Sorry, something went wrong.
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.
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.
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.
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 #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