From: Karunika Choo <karunika.choo@arm.com>
To: Nicolas Frattaroli <nicolas.frattaroli@collabora.com>,
Boris Brezillon <boris.brezillon@collabora.com>,
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>
Cc: kernel@collabora.com, linux-kernel@vger.kernel.org,
dri-devel@lists.freedesktop.org
Subject: Re: [PATCH 1/2] drm/panthor: Add tracepoint for hardware utilisation changes
Date: Mon, 8 Dec 2025 17:21:06 +0000 [thread overview]
Message-ID: <fb6cac11-6166-42c5-a5c2-afce1a902437@arm.com> (raw)
In-Reply-To: <20251203-panthor-tracepoints-v1-1-871c8917e084@collabora.com>
On 03/12/2025 13:56, Nicolas Frattaroli wrote:
> Mali GPUs have three registers that indicate which parts of the hardware
> are powered and active at any moment. These take the form of bitmaps. In
> the case of SHADER_PWRACTIVE for example, a high bit indicates that the
> shader core corresponding to that bit index is active. These bitmaps
> aren't solely contiguous bits, as it's common to have holes in the
> sequence of shader core indices, and the actual set of which cores are
> present is defined by the "shader present" register.
>
> When the GPU finishes a power state transition, it fires a
> GPU_IRQ_POWER_CHANGED_ALL interrupt. After such an interrupt is
> received, the PWRACTIVE registers will likely contain interesting new
> information.
>
> This is not to be confused with the PWR_IRQ_POWER_CHANGED_ALL interrupt,
> which is something related to Mali v14+'s power control logic. The
> PWRACTIVE registers and corresponding interrupts are already available
> in v9 and onwards.
>
> Expose this as a tracepoint to userspace. This allows users to debug
> various scenarios and gather interesting information, such as: knowing
> how much hardware is lit up at any given time, correlating graphics
> corruption with a specific active shader core, measuring when hardware
> is allowed to go to an inactive state again, and so on.
>
> Signed-off-by: Nicolas Frattaroli <nicolas.frattaroli@collabora.com>
> ---
> drivers/gpu/drm/panthor/panthor_device.c | 1 +
> drivers/gpu/drm/panthor/panthor_gpu.c | 9 ++++++++
> drivers/gpu/drm/panthor/panthor_trace.h | 38 ++++++++++++++++++++++++++++++++
> 3 files changed, 48 insertions(+)
>
> diff --git a/drivers/gpu/drm/panthor/panthor_device.c b/drivers/gpu/drm/panthor/panthor_device.c
> index e133b1e0ad6d..a3cb934104b8 100644
> --- a/drivers/gpu/drm/panthor/panthor_device.c
> +++ b/drivers/gpu/drm/panthor/panthor_device.c
> @@ -548,6 +548,7 @@ int panthor_device_resume(struct device *dev)
> DRM_PANTHOR_USER_MMIO_OFFSET, 0, 1);
> atomic_set(&ptdev->pm.state, PANTHOR_DEVICE_PM_STATE_ACTIVE);
> mutex_unlock(&ptdev->pm.mmio_lock);
> +
> return 0;
>
> err_suspend_devfreq:
> diff --git a/drivers/gpu/drm/panthor/panthor_gpu.c b/drivers/gpu/drm/panthor/panthor_gpu.c
> index 9cb5dee93212..8830aa9a5c4b 100644
> --- a/drivers/gpu/drm/panthor/panthor_gpu.c
> +++ b/drivers/gpu/drm/panthor/panthor_gpu.c
> @@ -22,6 +22,9 @@
> #include "panthor_hw.h"
> #include "panthor_regs.h"
>
> +#define CREATE_TRACE_POINTS
> +#include "panthor_trace.h"
> +
> /**
> * struct panthor_gpu - GPU block management data.
> */
> @@ -46,6 +49,7 @@ struct panthor_gpu {
> (GPU_IRQ_FAULT | \
> GPU_IRQ_PROTM_FAULT | \
> GPU_IRQ_RESET_COMPLETED | \
> + GPU_IRQ_POWER_CHANGED_ALL | \
Also, we've seen customers complain about too many IRQs originating
from this event, is there any chance we can enable this conditionally
i.e. only when the trace point is enabled?
Kind regards,
Karunika
> GPU_IRQ_CLEAN_CACHES_COMPLETED)
>
> static void panthor_gpu_coherency_set(struct panthor_device *ptdev)
> @@ -97,6 +101,11 @@ static void panthor_gpu_irq_handler(struct panthor_device *ptdev, u32 status)
> wake_up_all(&ptdev->gpu->reqs_acked);
> }
> spin_unlock(&ptdev->gpu->reqs_lock);
> +
> + if (status & GPU_IRQ_POWER_CHANGED_ALL)
> + trace_gpu_power_active(gpu_read64(ptdev, SHADER_PWRACTIVE),
> + gpu_read64(ptdev, TILER_PWRACTIVE),
> + gpu_read64(ptdev, L2_PWRACTIVE));
> }
> PANTHOR_IRQ_HANDLER(gpu, GPU, panthor_gpu_irq_handler);
>
> diff --git a/drivers/gpu/drm/panthor/panthor_trace.h b/drivers/gpu/drm/panthor/panthor_trace.h
> new file mode 100644
> index 000000000000..01013f81e68a
> --- /dev/null
> +++ b/drivers/gpu/drm/panthor/panthor_trace.h
> @@ -0,0 +1,38 @@
> +/* SPDX-License-Identifier: GPL-2.0 or MIT */
> +/* Copyright 2025 Collabora ltd. */
> +
> +#undef TRACE_SYSTEM
> +#define TRACE_SYSTEM panthor
> +
> +#if !defined(__PANTHOR_TRACE_H__) || defined(TRACE_HEADER_MULTI_READ)
> +#define __PANTHOR_TRACE_H__
> +
> +#include <linux/tracepoint.h>
> +#include <linux/types.h>
> +
> +TRACE_EVENT(gpu_power_active,
> + TP_PROTO(u64 shader_bitmap, u64 tiler_bitmap, u64 l2_bitmap),
> + TP_ARGS(shader_bitmap, tiler_bitmap, l2_bitmap),
> + TP_STRUCT__entry(
> + __field(u64, shader_bitmap)
> + __field(u64, tiler_bitmap)
> + __field(u64, l2_bitmap)
> + ),
> + TP_fast_assign(
> + __entry->shader_bitmap = shader_bitmap;
> + __entry->tiler_bitmap = tiler_bitmap;
> + __entry->l2_bitmap = l2_bitmap;
> + ),
> + TP_printk("shader_bitmap=0x%llx tiler_bitmap=0x%llx l2_bitmap=0x%llx",
> + __entry->shader_bitmap, __entry->tiler_bitmap, __entry->l2_bitmap
> + )
> +);
> +
> +#endif /* __PANTHOR_TRACE_H__ */
> +
> +#undef TRACE_INCLUDE_PATH
> +#define TRACE_INCLUDE_PATH .
> +#undef TRACE_INCLUDE_FILE
> +#define TRACE_INCLUDE_FILE panthor_trace
> +
> +#include <trace/define_trace.h>
>
next prev parent reply other threads:[~2025-12-08 17:22 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-12-03 13:56 [PATCH 0/2] Add a few tracepoints to panthor Nicolas Frattaroli
2025-12-03 13:56 ` [PATCH 1/2] drm/panthor: Add tracepoint for hardware utilisation changes Nicolas Frattaroli
2025-12-04 20:21 ` Chia-I Wu
2025-12-05 10:47 ` Nicolas Frattaroli
2025-12-05 21:16 ` Chia-I Wu
2025-12-08 7:48 ` Nicolas Frattaroli
2025-12-08 18:28 ` Chia-I Wu
2025-12-09 10:32 ` Karunika Choo
2025-12-08 17:14 ` Karunika Choo
2025-12-09 13:01 ` Nicolas Frattaroli
2025-12-09 16:22 ` Karunika Choo
2025-12-09 17:10 ` Marcin Ślusarz
2025-12-08 17:21 ` Karunika Choo [this message]
2025-12-09 12:55 ` Nicolas Frattaroli
2025-12-03 13:56 ` [PATCH 2/2] drm/panthor: Add gpu_job_irq tracepoint Nicolas Frattaroli
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=fb6cac11-6166-42c5-a5c2-afce1a902437@arm.com \
--to=karunika.choo@arm.com \
--cc=airlied@gmail.com \
--cc=boris.brezillon@collabora.com \
--cc=dri-devel@lists.freedesktop.org \
--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=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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®