Re: [RFC PATCH 4/9] cxl/mem: Trace General Media Event Record

From: Jonathan Cameron
Date: Tue Sep 20 2022 - 11:52:53 EST


On Mon, 12 Sep 2022 15:38:21 -0700
Ira Weiny <ira.weiny@xxxxxxxxx> wrote:

> On Wed, Aug 24, 2022 at 05:11:13PM +0100, Jonathan Cameron wrote:
> > On Fri, 12 Aug 2022 22:32:38 -0700
> > ira.weiny@xxxxxxxxx wrote:
> >
> > > From: Ira Weiny <ira.weiny@xxxxxxxxx>
> > >
> > > CXL v3.0 section 8.2.9.2.1.1 defines the General Media Event Record.
> > >
> > > Determine if the event read is a general media record and if so trace
> > > the record.
> > >
> > > Signed-off-by: Ira Weiny <ira.weiny@xxxxxxxxx>
> > A few trivial things inline...
> >
>
> [snip]
>
> > > +/*
> > > + * General Media Event Record - GMER
> > > + * CXL v2.0 Section 8.2.9.1.1.1; Table 154
> > > + */
> > > +#define CXL_GMER_PHYS_ADDR_VOLATILE BIT(0)
> > > +#define CXL_GMER_PHYS_ADDR_MASK 0x3f
> >
> > Inverse of mask is confusing. Just specify the full mask.
>
> Fixed
>
> [snip]
>
> > > + TP_printk("%s: %s time=%llu id=%pUl handle=%x related_handle=%x hdr_flags='%s': " \
> > > + "phys_addr=%llx volatile=%s desc='%s' type='%s' trans_type='%s' channel=%u " \
> > > + "rank=%u device=%x comp_id=%s valid_flags='%s'",
> > > + __get_str(dev_name), show_log_type(__entry->log),
> > > + __entry->timestamp, __entry->id, __entry->handle,
> > > + __entry->related_handle, show_hdr_flags(__entry->flags),
> > > + __entry->phys_addr & ~CXL_GMER_PHYS_ADDR_MASK,
> > > + (__entry->phys_addr & CXL_GMER_PHYS_ADDR_VOLATILE) ? "TRUE" : "FALSE",
> > > + show_event_desc_flags(__entry->descriptor),
> > > + show_mem_event_type(__entry->type),
> > > + show_trans_type(__entry->transaction_type),
> > > + __entry->channel, __entry->rank, __entry->device,
> > > + __print_hex(__entry->comp_id, CXL_EVT_GEN_MED_COMP_ID_SIZE),
> > > + show_valid_flags(__entry->validity_flags)
> >
> > Can we make the printing of fields with valid flags conditional?
> > Been a while since I wrote a Trace point, but I think I recall doing that..
>
> I'm not seeing a way right off. But I can't say it is impossible...

Needs some helper code... Here's one I made earlier (and had almost entirely
banished from my memory!)

https://lore.kernel.org/all/20191114133919.32290-2-Jonathan.Cameron@xxxxxxxxxx/

>
> I'll keep an eye out as I clean the series up,
> Ira
>
> >
> > > + )
> > > +);
> > > +
> > > #endif /* _CXL_TRACE_EVENTS_H */
> > >
> > > /* This part must be outside protection */
> >