[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <4f9b3183-1aa1-4506-b4dc-3297a8f19928@linux.dev>
Date: Wed, 26 Nov 2025 10:16:41 +0800
From: Leon Hwang <leon.hwang@...ux.dev>
To: Steven Rostedt <rostedt@...dmis.org>
Cc: netdev@...r.kernel.org, hawk@...nel.org, ilias.apalodimas@...aro.org,
mhiramat@...nel.org, mathieu.desnoyers@...icios.com, davem@...emloft.net,
edumazet@...gle.com, kuba@...nel.org, pabeni@...hat.com, horms@...nel.org,
kerneljasonxing@...il.com, lance.yang@...ux.dev, jiayuan.chen@...ux.dev,
linux-kernel@...r.kernel.org, linux-trace-kernel@...r.kernel.org,
Leon Huang Fu <leon.huangfu@...pee.com>
Subject: Re: [RFC PATCH net-next] page_pool: Add page_pool_release_stalled
tracepoint
On 26/11/25 00:23, Steven Rostedt wrote:
> On Tue, 25 Nov 2025 16:22:07 +0800
> Leon Hwang <leon.hwang@...ux.dev> 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
Powered by blists - more mailing lists