[PATCH v1 0/2] Use BTF to trim return values

From: Donglin Peng

Date: Sun Dec 07 2025 - 09:27:49 EST


From: pengdonglin <pengdonglin@xxxxxxxxxx>

The current funcgraph-retval implementation has two limitations:

1. It prints a return value even when the traced function returns void.
2. When the return type is narrower than a register, the printed value may
be incorrect because high bits can contain undefined data.

Both issues are addressed by using BTF to obtain the precise return type
of each traced function:

- Return values are now printed only for functions whose return type is
not void.
- The value is truncated to the actual width of the return type, ensuring
correct representation.

These changes make the funcgraph-retval output more accurate and remove
noise from void functions.

pengdonglin (2):
fgraph: use BTF to trim and filter return values
tracing: Update funcgraph-retval documentation

Documentation/trace/ftrace.rst | 74 +++++++++++++++-------------
kernel/trace/trace_functions_graph.c | 64 ++++++++++++++++++++----
2 files changed, 94 insertions(+), 44 deletions(-)

--
2.34.1