Re: [PATCH v1 2/2] NFS: use unsigned long for req field in nfs_page_class

From: Sean Chang

Date: Tue Apr 14 2026 - 05:15:31 EST


On Fri, Apr 10, 2026 at 11:23 PM Benjamin Coddington
<ben.coddington@xxxxxxxxxxxxxxx> wrote:
>
> Hi Sean,
>
> On 8 Apr 2026, at 12:14, Sean Chang wrote:
>
> > The nfs_page_class tracepoint used a pointer for the req field. This
> > caused Sparse to complain about dereferencing a pointer marked as
> > __private within the trace ring buffer context.
> >
> > Change the field type to unsigned long to store the address of the
> > request without dereferencing it. Update TP_printk to use 0x%lx for
> > consistent hexadecimal output, allowing for unique identification of
> > requests across the trace log.
>
> Probably we don't want to bypass the %p formatting because some
> configurations use it to obfuscate kernel pointers.
>
> I think in this context the __private annotation is incorrect. We deref the
> nfs_page pointer only in TP_fast_assign() which runs at the call site, and
> the TP_printk only outputs the pointer value.
>

Hi Ben,

Thanks for pointing this out.

I realize that using unsigned long results in printing the raw pointer
address, which bypasses the intended %p formatting.

You are right that the __private annotation is not appropriate here,
since the req pointer is only dereferenced in TP_fast_assign() at the
call site and only printed from the trace buffer context.

I will rework the patch to remove __private and keep the pointer type
with %p formatting.

Best Regards,
Sean