Re: [PATCH v5 2/2] tracing: Add documentation for funcgraph-retval and graph_retval_hex

Ding Hui
2023-03-21T02:31:49Z

On 2023/3/20 21:16, Donglin Peng wrote:

> +There are some limitations when using the funcgraph-retval currently:
> +
> +- Even if the function return type is void, a return value will still
> + be printed, and you can just ignore it.
> +
> +- Even if the return value is not an error code actually, it may be
> + displayed as an error code. You should read the code to check.
> + For example, both 0xfe and 0xfffe are be interpreted as -2.

For char and short types, displaying as signed decimal may be not
appropriate, because they are rarely used to store error code.

So in "smart" mode (graph_retval_hex=0), I suggest just smart convert
error value stored in int or pointer to signed decimal.

> +- Only the value of the first return register will be recorded and
> + printed even if the return values may be stored in two registers
> + actually. For example, both the eax and edx are used to store a
> + 64 bit return value in the x86 architecture, and the eax stores
> + the low 32 bit, the edx stores the high 32 bit, however only the
> + value stored in eax will be recorded and printed.
> +
> You can put some comments on specific functions by using
> trace_printk() For example, if you want to put a comment inside
> the __might_sleep() function, you just have to include

--
Thanks,
- Ding Hui