On Wed, 25 Jun 2025 18:56:06 -0400
Steven Rostedt <[email protected]> wrote:

>  static __always_inline void unwind_reset_info(void)
>  {
> -     if (unlikely(current->unwind_info.cache))
> +     /* Exit out early if this was never used */
> +     if (likely(!current->unwind_info.timestamp))
> +             return;

I found that this breaks the use of perf using the unwind_user_faultable()
directly and not relying on the deferred infrastructure (which it does when
it traces a single task and also needs to remove the separate in_nmi()
code). Because this still requires the nr_entries to be set to zero.

The clearing of the nr_entries has to be separate from the timestamp. To
prevent unneeded writes after the cache is allocated, should we check the
nr_entries is set before writing zero?

        if (current->unwind_info.cache && 
current->unwind_info.cache->nr_entries)
                current->unwind_info.cache->nr_entries = 0;

?

-- Steve

> +
> +     if (current->unwind_info.cache)
>               current->unwind_info.cache->nr_entries = 0;
> +     current->unwind_info.timestamp = 0;
>  }

Reply via email to