From: Leon Hwang <leon.hwang@linux.dev>
To: Steven Rostedt <rostedt@goodmis.org>
Cc: netdev@vger.kernel.org, hawk@kernel.org,
ilias.apalodimas@linaro.org, mhiramat@kernel.org,
mathieu.desnoyers@efficios.com, davem@davemloft.net,
edumazet@google.com, kuba@kernel.org, pabeni@redhat.com,
horms@kernel.org, kerneljasonxing@gmail.com,
lance.yang@linux.dev, jiayuan.chen@linux.dev,
linux-kernel@vger.kernel.org, linux-trace-kernel@vger.kernel.org,
Leon Huang Fu <leon.huangfu@shopee.com>
Subject: Re: [RFC PATCH net-next] page_pool: Add page_pool_release_stalled tracepoint
Date: Wed, 26 Nov 2025 10:16:41 +0800 [thread overview]
Message-ID: <4f9b3183-1aa1-4506-b4dc-3297a8f19928@linux.dev> (raw)
In-Reply-To: <20251125112304.493ea1ee@gandalf.local.home>
On 26/11/25 00:23, Steven Rostedt wrote:
> On Tue, 25 Nov 2025 16:22:07 +0800
> Leon Hwang <leon.hwang@linux.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
prev parent reply other threads:[~2025-11-26 2:16 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-11-25 8:22 [RFC PATCH net-next] page_pool: Add page_pool_release_stalled tracepoint Leon Hwang
2025-11-25 16:23 ` Steven Rostedt
2025-11-26 2:16 ` Leon Hwang [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4f9b3183-1aa1-4506-b4dc-3297a8f19928@linux.dev \
--to=leon.hwang@linux.dev \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=hawk@kernel.org \
--cc=horms@kernel.org \
--cc=ilias.apalodimas@linaro.org \
--cc=jiayuan.chen@linux.dev \
--cc=kerneljasonxing@gmail.com \
--cc=kuba@kernel.org \
--cc=lance.yang@linux.dev \
--cc=leon.huangfu@shopee.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-trace-kernel@vger.kernel.org \
--cc=mathieu.desnoyers@efficios.com \
--cc=mhiramat@kernel.org \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=rostedt@goodmis.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox