[PATCH] contrib/plugins/uftrace.c: fix depth for exit events

Pierrick Bouvier posted 1 patch 3 weeks, 4 days ago
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/qemu tags/patchew/20260313063441.2048882-1-pierrick.bouvier@linaro.org
Maintainers: "Alex Bennée" <alex.bennee@linaro.org>, Pierrick Bouvier <pierrick.bouvier@linaro.org>, Alexandre Iooss <erdnaxe@crans.org>, Mahmoud Mandour <ma.mandourr@gmail.com>
contrib/plugins/uftrace.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
[PATCH] contrib/plugins/uftrace.c: fix depth for exit events
Posted by Pierrick Bouvier 3 weeks, 4 days ago
Uftrace plugin was recording wrong depth for exit events, resulting in
incoherent traces, especially for partial ones.

Thanks to Honggyu Kim, one of the original author of uftrace, who
spotted the issue.
https://github.com/namhyung/uftrace/pull/2031#issuecomment-4051762627

Signed-off-by: Pierrick Bouvier <pierrick.bouvier@linaro.org>
---
 contrib/plugins/uftrace.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/contrib/plugins/uftrace.c b/contrib/plugins/uftrace.c
index e3c65a1c930..f974090e23e 100644
--- a/contrib/plugins/uftrace.c
+++ b/contrib/plugins/uftrace.c
@@ -817,7 +817,8 @@ static void track_callstack(unsigned int cpu_index, void *udata)
     if (fp == caller.frame_pointer) {
         /* return */
         CallstackEntry e = callstack_pop(cs);
-        trace_exit_function(t, timestamp, e.pc, callstack_depth(cs));
+        /* uftrace convention is to use same depth as entry */
+        trace_exit_function(t, timestamp, e.pc, callstack_depth(cs) + 1);
         return;
     }
 
-- 
2.47.3
Re: [PATCH] contrib/plugins/uftrace.c: fix depth for exit events
Posted by Pierrick Bouvier 2 weeks, 6 days ago
On 3/12/26 11:34 PM, Pierrick Bouvier wrote:
> Uftrace plugin was recording wrong depth for exit events, resulting in
> incoherent traces, especially for partial ones.
> 
> Thanks to Honggyu Kim, one of the original author of uftrace, who
> spotted the issue.
> https://github.com/namhyung/uftrace/pull/2031#issuecomment-4051762627
> 
> Signed-off-by: Pierrick Bouvier <pierrick.bouvier@linaro.org>
> ---
>   contrib/plugins/uftrace.c | 3 ++-
>   1 file changed, 2 insertions(+), 1 deletion(-)
> 

This was merged into master (6667668e0cf369e47aa9dd0bae40989896e9ed9f).

Regards,
Pierrick
Re: [PATCH] contrib/plugins/uftrace.c: fix depth for exit events
Posted by Pierrick Bouvier 3 weeks ago
On 3/12/26 11:34 PM, Pierrick Bouvier wrote:
> Uftrace plugin was recording wrong depth for exit events, resulting in
> incoherent traces, especially for partial ones.
> 
> Thanks to Honggyu Kim, one of the original author of uftrace, who
> spotted the issue.
> https://github.com/namhyung/uftrace/pull/2031#issuecomment-4051762627
> 
> Signed-off-by: Pierrick Bouvier <pierrick.bouvier@linaro.org>
> ---
>   contrib/plugins/uftrace.c | 3 ++-
>   1 file changed, 2 insertions(+), 1 deletion(-)
> 

Auto review to send this for hard freeze.
Reviewed-by: Pierrick Bouvier <pierrick.bouvier@linaro.org>
Re: [PATCH] contrib/plugins/uftrace.c: fix depth for exit events
Posted by Pierrick Bouvier 3 weeks, 4 days ago
On 3/12/26 11:34 PM, Pierrick Bouvier wrote:
> Uftrace plugin was recording wrong depth for exit events, resulting in
> incoherent traces, especially for partial ones.
> 
> Thanks to Honggyu Kim, one of the original author of uftrace, who
> spotted the issue.
> https://github.com/namhyung/uftrace/pull/2031#issuecomment-4051762627
> 
> Signed-off-by: Pierrick Bouvier <pierrick.bouvier@linaro.org>
> ---
>   contrib/plugins/uftrace.c | 3 ++-
>   1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/contrib/plugins/uftrace.c b/contrib/plugins/uftrace.c
> index e3c65a1c930..f974090e23e 100644
> --- a/contrib/plugins/uftrace.c
> +++ b/contrib/plugins/uftrace.c
> @@ -817,7 +817,8 @@ static void track_callstack(unsigned int cpu_index, void *udata)
>       if (fp == caller.frame_pointer) {
>           /* return */
>           CallstackEntry e = callstack_pop(cs);
> -        trace_exit_function(t, timestamp, e.pc, callstack_depth(cs));
> +        /* uftrace convention is to use same depth as entry */
> +        trace_exit_function(t, timestamp, e.pc, callstack_depth(cs) + 1);
>           return;
>       }
>   

This is good candidate for stable releases also.

Thanks,
Pierrick