On 26/11/25 00:23, Steven Rostedt wrote:
> On Tue, 25 Nov 2025 16:22:07 +0800
> Leon Hwang <[email protected]> wrote:
> 
>> +TRACE_EVENT(page_pool_release_stalled,
>> +
>> +    TP_PROTO(const struct page_pool *pool, int inflight, int sec),
>> +
>> +    TP_ARGS(pool, inflight, sec),
>> +
>> +    TP_STRUCT__entry(
>> +            __field(const struct page_pool *, pool)
>> +            __field(int,                      inflight)
>> +            __field(int,                      sec)
>> +    ),
>> +
>> +    TP_fast_assign(
>> +            __entry->pool           = pool;
>> +            __entry->inflight       = inflight;
>> +            __entry->sec            = sec;
>> +    ),
>> +
>> +    TP_printk("page_pool=%p id=%d inflight=%d sec=%d",
>> +              __entry->pool, __entry->pool->user.id, __entry->inflight, 
>> __entry->sec)
> 
> You can't do: __entry->pool->user.id
> 
> The TP_fast_assign() is executed when the tracepoint is triggered. The
> TP_printk() is executed when the trace is read. That can happen seconds,
> minutes, hours, days, even months after the pool was assigned.
> 
> That __entry->pool can very well be freed a long time ago.
> 
> If you need the id, you need to record it in the TP_fast_assign():
> 
>       __entry->id             = pool->user.id
> 
> and print that.
> 
> -- Steve
> 

Hi Steve,

Thanks for the review.

Yes, the id is needed here (similar to what we emit in pr_warn()), so
I'll follow your suggestion and record it explicitly in TP_fast_assign():

        __entry->id             = pool->user.id;

And then update the print format to:

        TP_printk("page_pool=%p id=%d inflight=%d sec=%d",
                  __entry->pool, __entry->id,
                  __entry->inflight, __entry->sec)

Thanks,
Leon

Reply via email to