From: Boris Brezillon <boris.brezillon@collabora.com>
To: Nicolas Frattaroli <nicolas.frattaroli@collabora.com>
Cc: Steven Price <steven.price@arm.com>,
Liviu Dudau <liviu.dudau@arm.com>,
Maarten Lankhorst <maarten.lankhorst@linux.intel.com>,
Maxime Ripard <mripard@kernel.org>,
Thomas Zimmermann <tzimmermann@suse.de>,
David Airlie <airlied@gmail.com>, Simona Vetter <simona@ffwll.ch>,
Chia-I Wu <olvaffe@gmail.com>,
Karunika Choo <karunika.choo@arm.com>,
kernel@collabora.com, linux-kernel@vger.kernel.org,
dri-devel@lists.freedesktop.org
Subject: Re: [PATCH v10 4/4] drm/panthor: Add gpu_job_irq tracepoint
Date: Fri, 16 Jan 2026 15:00:44 +0100 [thread overview]
Message-ID: <20260116150044.0e45c232@fedora> (raw)
In-Reply-To: <20260116-panthor-tracepoints-v10-4-d925986e3d1b@collabora.com>
On Fri, 16 Jan 2026 13:57:33 +0100
Nicolas Frattaroli <nicolas.frattaroli@collabora.com> wrote:
> Mali's CSF firmware triggers the job IRQ whenever there's new firmware
> events for processing. While this can be a global event (BIT(31) of the
> status register), it's usually an event relating to a command stream
> group (the other bit indices).
>
> Panthor throws these events onto a workqueue for processing outside the
> IRQ handler. It's therefore useful to have an instrumented tracepoint
> that goes beyond the generic IRQ tracepoint for this specific case, as
> it can be augmented with additional data, namely the events bit mask.
>
> This can then be used to debug problems relating to GPU jobs events not
> being processed quickly enough. The duration_ns field can be used to
> work backwards from when the tracepoint fires (at the end of the IRQ
> handler) to figure out when the interrupt itself landed, providing not
> just information on how long the work queueing took, but also when the
> actual interrupt itself arrived.
>
> With this information in hand, the IRQ handler itself being slow can be
> excluded as a possible source of problems, and attention can be directed
> to the workqueue processing instead.
>
> Signed-off-by: Nicolas Frattaroli <nicolas.frattaroli@collabora.com>
Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com>
> ---
> drivers/gpu/drm/panthor/panthor_fw.c | 13 +++++++++++++
> drivers/gpu/drm/panthor/panthor_trace.h | 28 ++++++++++++++++++++++++++++
> 2 files changed, 41 insertions(+)
>
> diff --git a/drivers/gpu/drm/panthor/panthor_fw.c b/drivers/gpu/drm/panthor/panthor_fw.c
> index 0e46625f7621..5a904ca64525 100644
> --- a/drivers/gpu/drm/panthor/panthor_fw.c
> +++ b/drivers/gpu/drm/panthor/panthor_fw.c
> @@ -26,6 +26,7 @@
> #include "panthor_mmu.h"
> #include "panthor_regs.h"
> #include "panthor_sched.h"
> +#include "panthor_trace.h"
>
> #define CSF_FW_NAME "mali_csffw.bin"
>
> @@ -1060,6 +1061,12 @@ static void panthor_fw_init_global_iface(struct panthor_device *ptdev)
>
> static void panthor_job_irq_handler(struct panthor_device *ptdev, u32 status)
> {
> + u32 duration;
> + u64 start = 0;
> +
> + if (tracepoint_enabled(gpu_job_irq))
> + start = ktime_get_ns();
> +
> gpu_write(ptdev, JOB_INT_CLEAR, status);
>
> if (!ptdev->fw->booted && (status & JOB_INT_GLOBAL_IF))
> @@ -1072,6 +1079,12 @@ static void panthor_job_irq_handler(struct panthor_device *ptdev, u32 status)
> return;
>
> panthor_sched_report_fw_events(ptdev, status);
> +
> + if (tracepoint_enabled(gpu_job_irq) && start) {
> + if (check_sub_overflow(ktime_get_ns(), start, &duration))
> + duration = U32_MAX;
> + trace_gpu_job_irq(ptdev->base.dev, status, duration);
> + }
> }
> PANTHOR_IRQ_HANDLER(job, JOB, panthor_job_irq_handler);
>
> diff --git a/drivers/gpu/drm/panthor/panthor_trace.h b/drivers/gpu/drm/panthor/panthor_trace.h
> index 5bd420894745..6ffeb4fe6599 100644
> --- a/drivers/gpu/drm/panthor/panthor_trace.h
> +++ b/drivers/gpu/drm/panthor/panthor_trace.h
> @@ -48,6 +48,34 @@ TRACE_EVENT_FN(gpu_power_status,
> panthor_hw_power_status_register, panthor_hw_power_status_unregister
> );
>
> +/**
> + * gpu_job_irq - called after a job interrupt from firmware completes
> + * @dev: pointer to the &struct device, for printing the device name
> + * @events: bitmask of BIT(CSG id) | BIT(31) for a global event
> + * @duration_ns: Nanoseconds between job IRQ handler entry and exit
> + *
> + * The panthor_job_irq_handler() function instrumented by this tracepoint exits
> + * once it has queued the firmware interrupts for processing, not when the
> + * firmware interrupts are fully processed. This tracepoint allows for debugging
> + * issues with delays in the workqueue's processing of events.
> + */
> +TRACE_EVENT(gpu_job_irq,
> + TP_PROTO(const struct device *dev, u32 events, u32 duration_ns),
> + TP_ARGS(dev, events, duration_ns),
> + TP_STRUCT__entry(
> + __string(dev_name, dev_name(dev))
> + __field(u32, events)
> + __field(u32, duration_ns)
> + ),
> + TP_fast_assign(
> + __assign_str(dev_name);
> + __entry->events = events;
> + __entry->duration_ns = duration_ns;
> + ),
> + TP_printk("%s: events=0x%x duration_ns=%d", __get_str(dev_name),
> + __entry->events, __entry->duration_ns)
> +);
> +
> #endif /* __PANTHOR_TRACE_H__ */
>
> #undef TRACE_INCLUDE_PATH
>
next prev parent reply other threads:[~2026-01-16 14:00 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-01-16 12:57 [PATCH v10 0/4] Add a few tracepoints to panthor Nicolas Frattaroli
2026-01-16 12:57 ` [PATCH v10 1/4] drm/panthor: Rework panthor_irq::suspended into panthor_irq::state Nicolas Frattaroli
2026-01-16 13:21 ` Boris Brezillon
2026-01-16 15:55 ` Steven Price
2026-01-16 12:57 ` [PATCH v10 2/4] drm/panthor: Extend IRQ helpers for mask modification/restoration Nicolas Frattaroli
2026-01-16 13:41 ` Boris Brezillon
2026-01-16 14:41 ` Nicolas Frattaroli
2026-01-16 15:06 ` Boris Brezillon
2026-01-16 15:56 ` Steven Price
2026-01-16 12:57 ` [PATCH v10 3/4] drm/panthor: Add tracepoint for hardware utilisation changes Nicolas Frattaroli
2026-01-16 13:59 ` Boris Brezillon
2026-01-16 15:56 ` Steven Price
2026-01-23 4:02 ` Sasha Levin
2026-01-23 12:52 ` Nicolas Frattaroli
2026-01-23 19:45 ` Nathan Chancellor
2026-01-16 12:57 ` [PATCH v10 4/4] drm/panthor: Add gpu_job_irq tracepoint Nicolas Frattaroli
2026-01-16 14:00 ` Boris Brezillon [this message]
2026-01-16 15:56 ` Steven Price
2026-01-22 14:40 ` [PATCH v10 0/4] Add a few tracepoints to panthor Boris Brezillon
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=20260116150044.0e45c232@fedora \
--to=boris.brezillon@collabora.com \
--cc=airlied@gmail.com \
--cc=dri-devel@lists.freedesktop.org \
--cc=karunika.choo@arm.com \
--cc=kernel@collabora.com \
--cc=linux-kernel@vger.kernel.org \
--cc=liviu.dudau@arm.com \
--cc=maarten.lankhorst@linux.intel.com \
--cc=mripard@kernel.org \
--cc=nicolas.frattaroli@collabora.com \
--cc=olvaffe@gmail.com \
--cc=simona@ffwll.ch \
--cc=steven.price@arm.com \
--cc=tzimmermann@suse.de \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.