From: Nicolas Frattaroli <nicolas.frattaroli@collabora.com>
To: 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>,
Chia-I Wu <olvaffe@gmail.com>,
Karunika Choo <karunika.choo@arm.com>
Cc: kernel@collabora.com, linux-kernel@vger.kernel.org,
dri-devel@lists.freedesktop.org
Subject: Re: [PATCH v3 2/3] drm/panthor: Add tracepoint for hardware utilisation changes
Date: Thu, 11 Dec 2025 21:15:43 +0100 [thread overview]
Message-ID: <2740907.taCxCBeP46@workhorse> (raw)
In-Reply-To: <6e261518-6b91-4790-8f95-b36f0435fb81@arm.com>
On Thursday, 11 December 2025 20:37:09 Central European Standard Time Karunika Choo wrote:
> On 11/12/2025 16:15, Nicolas Frattaroli wrote:
> > Mali GPUs have three registers that indicate which parts of the hardware
> > are powered at any moment. These take the form of bitmaps. In the case
> > of SHADER_READY for example, a high bit indicates that the shader core
> > corresponding to that bit index is powered on. 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 _READY registers will contain new interesting data. During
> > power transitions, the GPU_IRQ_POWER_CHANGED interrupt will fire, and
> > the registers will likewise contain potentially changed data.
> >
> > 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
> > _READY registers and corresponding interrupts are already available in
> > v9 and onwards.
> >
> > Expose the data 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 powered shader core, measuring when hardware
> > is allowed to go to a powered off state again, and so on.
> >
> > The registration/unregistration functions for the tracepoint go through
> > a wrapper in panthor_hw.c, so that v14+ can implement the same
> > tracepoint by adding its hardware specific IRQ on/off callbacks to the
> > panthor_hw.ops member.
> >
> > Signed-off-by: Nicolas Frattaroli <nicolas.frattaroli@collabora.com>
> > ---
> > drivers/gpu/drm/panthor/panthor_gpu.c | 38 ++++++++++++++++++--
> > drivers/gpu/drm/panthor/panthor_gpu.h | 2 ++
> > drivers/gpu/drm/panthor/panthor_hw.c | 62 +++++++++++++++++++++++++++++++++
> > drivers/gpu/drm/panthor/panthor_hw.h | 8 +++++
> > drivers/gpu/drm/panthor/panthor_trace.h | 59 +++++++++++++++++++++++++++++++
> > 5 files changed, 167 insertions(+), 2 deletions(-)
> >
> > [...]
> >
> > diff --git a/drivers/gpu/drm/panthor/panthor_trace.h b/drivers/gpu/drm/panthor/panthor_trace.h
> > new file mode 100644
> > index 000000000000..2b59d7f156b6
> > --- /dev/null
> > +++ b/drivers/gpu/drm/panthor/panthor_trace.h
> > @@ -0,0 +1,59 @@
> > +/* 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>
> > +
> > +int panthor_hw_power_status_register(void);
> > +void panthor_hw_power_status_unregister(void);
>
> Hello, not sure if I'm missing something but, would doing
>
> #include "panthor_hw.h"
>
> address the need to redeclare panthor_hw_power_status_* in this file?
> The change looks good otherwise.
It would, but only in that it now pulls in a whole bunch of header
definitions that the trace header does not want or need, all for
two function prototypes. Since the function signature of the reg/unreg
functions are fixed aside from the name, I don't see any harm in
this particular instance of duplicating it.
Similarly, panthor_hw.c probably doesn't want the special magic
tracepoint stuff from panthor_trace.h, but it does need to implement
those two functions, so it needs to have a prototype somewhere.
Maybe someone else has stronger opinions on this, I'm fine with
including panthor_hw.h as well (it's what I had it do originally
as well), but I suspect many more experienced kernel devs are
wary of overeager header inclusions, because it leads to really
slow compilation quite quickly.
Kind regards,
Nicolas Frattaroli
>
> Reviewed-by: Karunika Choo <karunika.choo@arm.com>
>
> > [...]
next prev parent reply other threads:[~2025-12-11 20:16 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-12-11 16:15 [PATCH v3 0/3] Add a few tracepoints to panthor Nicolas Frattaroli
2025-12-11 16:15 ` [PATCH v3 1/3] drm/panthor: Add panthor_*_irq_mask_set helper Nicolas Frattaroli
2025-12-11 16:15 ` [PATCH v3 2/3] drm/panthor: Add tracepoint for hardware utilisation changes Nicolas Frattaroli
2025-12-11 19:37 ` Karunika Choo
2025-12-11 20:15 ` Nicolas Frattaroli [this message]
2025-12-12 9:29 ` Boris Brezillon
2025-12-12 12:26 ` Nicolas Frattaroli
2025-12-15 17:21 ` Lukas Zapolskas
2025-12-15 19:13 ` Nicolas Frattaroli
2025-12-11 16:15 ` [PATCH v3 3/3] 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=2740907.taCxCBeP46@workhorse \
--to=nicolas.frattaroli@collabora.com \
--cc=airlied@gmail.com \
--cc=boris.brezillon@collabora.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=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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox