Re: [PATCH 3/3] drm/panthor: Add tracepoints for cache flushing

From: Steven Rostedt

Date: Wed Jul 29 2026 - 14:07:03 EST


On Wed, 29 Jul 2026 08:19:51 +0200
Nicolas Frattaroli <nicolas.frattaroli@xxxxxxxxxxxxx> wrote:

> diff --git a/drivers/gpu/drm/panthor/panthor_trace.h b/drivers/gpu/drm/panthor/panthor_trace.h
> index 6ffeb4fe6599..5e2a9b8d0481 100644
> --- a/drivers/gpu/drm/panthor/panthor_trace.h
> +++ b/drivers/gpu/drm/panthor/panthor_trace.h
> @@ -76,6 +76,64 @@ TRACE_EVENT(gpu_job_irq,
> __entry->events, __entry->duration_ns)
> );
>
> +/**
> + * gpu_cache_flush_start - called after cache flush locks taken, before flush
> + * @dev: pointer to the &struct device, for printing the device name
> + * @l2: "l2" flush flags
> + * @lsc: "lsc" flush flags
> + * @other: "other" flush flags
> + *
> + * Fires after any initial lock contention around the locks needed for flushing
> + * caches, but before the actual cache flush is requested.
> + */
> +TRACE_EVENT(gpu_cache_flush_start,
> + TP_PROTO(const struct device *dev, u32 l2, u32 lsc, u32 other),
> + TP_ARGS(dev, l2, lsc, other),
> + TP_STRUCT__entry(
> + __string(dev_name, dev_name(dev))
> + __field(u32, l2)
> + __field(u32, lsc)
> + __field(u32, other)
> + ),
> + TP_fast_assign(
> + __assign_str(dev_name);
> + __entry->l2 = l2;
> + __entry->lsc = lsc;
> + __entry->other = other;
> + ),
> + TP_printk("%s: l2=0x%x lsc=0x%x other=0x%x", __get_str(dev_name),
> + __entry->l2, __entry->lsc, __entry->other)
> +);
> +
> +/**
> + * gpu_cache_flush_end - called after cache flush
> + * @dev: pointer to the &struct device, for printing the device name
> + * @l2: "l2" flush flags
> + * @lsc: "lsc" flush flags
> + * @other: "other" flush flags
> + *
> + * Fires after either the cache flush is complete, or has failed. Can be used
> + * together with gpu_cache_flush_start to get how long the flush has taken.
> + */
> +TRACE_EVENT(gpu_cache_flush_end,
> + TP_PROTO(const struct device *dev, u32 l2, u32 lsc, u32 other),
> + TP_ARGS(dev, l2, lsc, other),
> + TP_STRUCT__entry(
> + __string(dev_name, dev_name(dev))
> + __field(u32, l2)
> + __field(u32, lsc)
> + __field(u32, other)
> + ),
> + TP_fast_assign(
> + __assign_str(dev_name);
> + __entry->l2 = l2;
> + __entry->lsc = lsc;
> + __entry->other = other;
> + ),
> + TP_printk("%s: l2=0x%x lsc=0x%x other=0x%x", __get_str(dev_name),
> + __entry->l2, __entry->lsc, __entry->other)
> +);
> +
> #endif /* __PANTHOR_TRACE_H__ */

The above two are identical. You'll save memory by using a template instead:

DECLARE_EVENT_CLASS(gpu_cache_flush_template,
TP_PROTO(const struct device *dev, u32 l2, u32 lsc, u32 other),
TP_ARGS(dev, l2, lsc, other),
TP_STRUCT__entry(
__string(dev_name, dev_name(dev))
__field(u32, l2)
__field(u32, lsc)
__field(u32, other)
),
TP_fast_assign(
__assign_str(dev_name);
__entry->l2 = l2;
__entry->lsc = lsc;
__entry->other = other;
),
TP_printk("%s: l2=0x%x lsc=0x%x other=0x%x", __get_str(dev_name),
__entry->l2, __entry->lsc, __entry->other)
);

DEFINE_EVENT(gpu_cache_flush_template, gpu_cache_flush_start,
TP_PROTO(const struct device *dev, u32 l2, u32 lsc, u32 other),
TP_ARGS(dev, l2, lsc, other)
);

DEFINE_EVENT(gpu_cache_flush_template, gpu_cache_flush_end,
TP_PROTO(const struct device *dev, u32 l2, u32 lsc, u32 other),
TP_ARGS(dev, l2, lsc, other)
);

-- Steve