All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] drm/amd/pm: Fix incorrect avg vcn utilization in gpu_metrics
@ 2026-08-05 14:02 Boqun Feng
  2026-08-13 21:36 ` Boqun Feng
  0 siblings, 1 reply; 8+ messages in thread
From: Boqun Feng @ 2026-08-05 14:02 UTC (permalink / raw)
  To: amd-gfx
  Cc: Boqun Feng, Mark Janes, Kenneth Feng, Alex Deucher,
	Christian König, David Airlie, Simona Vetter, Lijo Lazar,
	Asad Kamal, Yang Wang, Priya Hosur, mythilam, Mario Limonciello,
	dri-devel, linux-kernel

In a Strix Halo system, a >100 average_vcn_activity in gpu_metrics can
be observed by running the following command:

    ffmpeg -hwaccel vappi -vappi_device /dev/dri/renderD128 -i \
    ~/sample-10s.mp4 -vf hwupload,scale_vappi=format=nv12 -c:v \
    h264_vappi /tmp/output.mp4

This is incorrect because the value is supposed to be in [0-100] range.

The cause of the issue is that the metrics.VcnActivity reported by
smu_cmn_get_metrics_table() is a permyriad value instead of a percentage
value (e.g. smu_v14_0_0_get_smu_metrics_data() has a division by 100 to
report the vcn_busy_percent). Therefore fix this by applying the same
division in smu_v14_0_0_get_gpu_metrics().

Reported-by: Mark Janes <mjanes@netflix.com>
Signed-off-by: Boqun Feng <boqun@kernel.org>
---
 drivers/gpu/drm/amd/pm/swsmu/smu14/smu_v14_0_0_ppt.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/amd/pm/swsmu/smu14/smu_v14_0_0_ppt.c b/drivers/gpu/drm/amd/pm/swsmu/smu14/smu_v14_0_0_ppt.c
index 568665265a13..1058338344b0 100644
--- a/drivers/gpu/drm/amd/pm/swsmu/smu14/smu_v14_0_0_ppt.c
+++ b/drivers/gpu/drm/amd/pm/swsmu/smu14/smu_v14_0_0_ppt.c
@@ -566,7 +566,8 @@ static ssize_t smu_v14_0_0_get_gpu_metrics(struct smu_context *smu,
 	gpu_metrics->temperature_skin = metrics.SkinTemp;
 
 	gpu_metrics->average_gfx_activity = metrics.GfxActivity;
-	gpu_metrics->average_vcn_activity = metrics.VcnActivity;
+	/* metrics.VcnActivity is permyriad, convert it to percentage. */
+	gpu_metrics->average_vcn_activity = metrics.VcnActivity / 100;
 	memcpy(&gpu_metrics->average_ipu_activity[0],
 		&metrics.IpuBusy[0],
 		sizeof(uint16_t) * 8);
-- 
2.50.1 (Apple Git-155)


^ permalink raw reply related	[flat|nested] 8+ messages in thread

* Re: [PATCH] drm/amd/pm: Fix incorrect avg vcn utilization in gpu_metrics
  2026-08-05 14:02 [PATCH] drm/amd/pm: Fix incorrect avg vcn utilization in gpu_metrics Boqun Feng
@ 2026-08-13 21:36 ` Boqun Feng
  2026-08-13 22:01   ` Alex Deucher
  0 siblings, 1 reply; 8+ messages in thread
From: Boqun Feng @ 2026-08-13 21:36 UTC (permalink / raw)
  To: amd-gfx
  Cc: Mark Janes, Kenneth Feng, Alex Deucher, Christian König,
	David Airlie, Simona Vetter, Lijo Lazar, Asad Kamal, Yang Wang,
	Priya Hosur, mythilam, Mario Limonciello, dri-devel, linux-kernel

On Wed, Aug 05, 2026 at 07:02:21AM -0700, Boqun Feng wrote:
> In a Strix Halo system, a >100 average_vcn_activity in gpu_metrics can
> be observed by running the following command:
> 
>     ffmpeg -hwaccel vappi -vappi_device /dev/dri/renderD128 -i \
>     ~/sample-10s.mp4 -vf hwupload,scale_vappi=format=nv12 -c:v \
>     h264_vappi /tmp/output.mp4
> 
> This is incorrect because the value is supposed to be in [0-100] range.
> 
> The cause of the issue is that the metrics.VcnActivity reported by
> smu_cmn_get_metrics_table() is a permyriad value instead of a percentage
> value (e.g. smu_v14_0_0_get_smu_metrics_data() has a division by 100 to
> report the vcn_busy_percent). Therefore fix this by applying the same
> division in smu_v14_0_0_get_gpu_metrics().
> 
> Reported-by: Mark Janes <mjanes@netflix.com>
> Signed-off-by: Boqun Feng <boqun@kernel.org>

Ping?

Regards,
Boqun

> ---
>  drivers/gpu/drm/amd/pm/swsmu/smu14/smu_v14_0_0_ppt.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/gpu/drm/amd/pm/swsmu/smu14/smu_v14_0_0_ppt.c b/drivers/gpu/drm/amd/pm/swsmu/smu14/smu_v14_0_0_ppt.c
> index 568665265a13..1058338344b0 100644
> --- a/drivers/gpu/drm/amd/pm/swsmu/smu14/smu_v14_0_0_ppt.c
> +++ b/drivers/gpu/drm/amd/pm/swsmu/smu14/smu_v14_0_0_ppt.c
> @@ -566,7 +566,8 @@ static ssize_t smu_v14_0_0_get_gpu_metrics(struct smu_context *smu,
>  	gpu_metrics->temperature_skin = metrics.SkinTemp;
>  
>  	gpu_metrics->average_gfx_activity = metrics.GfxActivity;
> -	gpu_metrics->average_vcn_activity = metrics.VcnActivity;
> +	/* metrics.VcnActivity is permyriad, convert it to percentage. */
> +	gpu_metrics->average_vcn_activity = metrics.VcnActivity / 100;
>  	memcpy(&gpu_metrics->average_ipu_activity[0],
>  		&metrics.IpuBusy[0],
>  		sizeof(uint16_t) * 8);
> -- 
> 2.50.1 (Apple Git-155)
> 

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH] drm/amd/pm: Fix incorrect avg vcn utilization in gpu_metrics
  2026-08-13 21:36 ` Boqun Feng
@ 2026-08-13 22:01   ` Alex Deucher
  2026-08-13 22:25     ` Boqun Feng
  0 siblings, 1 reply; 8+ messages in thread
From: Alex Deucher @ 2026-08-13 22:01 UTC (permalink / raw)
  To: Boqun Feng
  Cc: amd-gfx, Mark Janes, Kenneth Feng, Alex Deucher,
	Christian König, David Airlie, Simona Vetter, Lijo Lazar,
	Asad Kamal, Yang Wang, Priya Hosur, mythilam, Mario Limonciello,
	dri-devel, linux-kernel

On Thu, Aug 13, 2026 at 5:36 PM Boqun Feng <boqun@kernel.org> wrote:
>
> On Wed, Aug 05, 2026 at 07:02:21AM -0700, Boqun Feng wrote:
> > In a Strix Halo system, a >100 average_vcn_activity in gpu_metrics can
> > be observed by running the following command:
> >
> >     ffmpeg -hwaccel vappi -vappi_device /dev/dri/renderD128 -i \
> >     ~/sample-10s.mp4 -vf hwupload,scale_vappi=format=nv12 -c:v \
> >     h264_vappi /tmp/output.mp4
> >
> > This is incorrect because the value is supposed to be in [0-100] range.
> >
> > The cause of the issue is that the metrics.VcnActivity reported by
> > smu_cmn_get_metrics_table() is a permyriad value instead of a percentage
> > value (e.g. smu_v14_0_0_get_smu_metrics_data() has a division by 100 to
> > report the vcn_busy_percent). Therefore fix this by applying the same
> > division in smu_v14_0_0_get_gpu_metrics().

I think this is correct as is.  smu_v14_0_0_get_smu_metrics_data() is
used to fetch data for standardized formats like hwmon while
smu_v14_0_0_get_gpu_metrics() is for dumping the raw metrics data.

Alex

> >
> > Reported-by: Mark Janes <mjanes@netflix.com>
> > Signed-off-by: Boqun Feng <boqun@kernel.org>
>
> Ping?
>
> Regards,
> Boqun
>
> > ---
> >  drivers/gpu/drm/amd/pm/swsmu/smu14/smu_v14_0_0_ppt.c | 3 ++-
> >  1 file changed, 2 insertions(+), 1 deletion(-)
> >
> > diff --git a/drivers/gpu/drm/amd/pm/swsmu/smu14/smu_v14_0_0_ppt.c b/drivers/gpu/drm/amd/pm/swsmu/smu14/smu_v14_0_0_ppt.c
> > index 568665265a13..1058338344b0 100644
> > --- a/drivers/gpu/drm/amd/pm/swsmu/smu14/smu_v14_0_0_ppt.c
> > +++ b/drivers/gpu/drm/amd/pm/swsmu/smu14/smu_v14_0_0_ppt.c
> > @@ -566,7 +566,8 @@ static ssize_t smu_v14_0_0_get_gpu_metrics(struct smu_context *smu,
> >       gpu_metrics->temperature_skin = metrics.SkinTemp;
> >
> >       gpu_metrics->average_gfx_activity = metrics.GfxActivity;
> > -     gpu_metrics->average_vcn_activity = metrics.VcnActivity;
> > +     /* metrics.VcnActivity is permyriad, convert it to percentage. */
> > +     gpu_metrics->average_vcn_activity = metrics.VcnActivity / 100;
> >       memcpy(&gpu_metrics->average_ipu_activity[0],
> >               &metrics.IpuBusy[0],
> >               sizeof(uint16_t) * 8);
> > --
> > 2.50.1 (Apple Git-155)
> >

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH] drm/amd/pm: Fix incorrect avg vcn utilization in gpu_metrics
  2026-08-13 22:01   ` Alex Deucher
@ 2026-08-13 22:25     ` Boqun Feng
  2026-08-14  0:51       ` Alex Deucher
  2026-08-14 15:14       ` Umio-Yasuno - coelacanth_dream
  0 siblings, 2 replies; 8+ messages in thread
From: Boqun Feng @ 2026-08-13 22:25 UTC (permalink / raw)
  To: Alex Deucher
  Cc: amd-gfx, Mark Janes, Kenneth Feng, Alex Deucher,
	Christian König, David Airlie, Simona Vetter, Lijo Lazar,
	Asad Kamal, Yang Wang, Priya Hosur, mythilam, Mario Limonciello,
	dri-devel, linux-kernel, Umio Yasuno

On Thu, Aug 13, 2026 at 06:01:47PM -0400, Alex Deucher wrote:
> On Thu, Aug 13, 2026 at 5:36 PM Boqun Feng <boqun@kernel.org> wrote:
> >
> > On Wed, Aug 05, 2026 at 07:02:21AM -0700, Boqun Feng wrote:
> > > In a Strix Halo system, a >100 average_vcn_activity in gpu_metrics can
> > > be observed by running the following command:
> > >
> > >     ffmpeg -hwaccel vappi -vappi_device /dev/dri/renderD128 -i \
> > >     ~/sample-10s.mp4 -vf hwupload,scale_vappi=format=nv12 -c:v \
> > >     h264_vappi /tmp/output.mp4
> > >
> > > This is incorrect because the value is supposed to be in [0-100] range.
> > >
> > > The cause of the issue is that the metrics.VcnActivity reported by
> > > smu_cmn_get_metrics_table() is a permyriad value instead of a percentage
> > > value (e.g. smu_v14_0_0_get_smu_metrics_data() has a division by 100 to
> > > report the vcn_busy_percent). Therefore fix this by applying the same
> > > division in smu_v14_0_0_get_gpu_metrics().
> 
> I think this is correct as is.  smu_v14_0_0_get_smu_metrics_data() is
> used to fetch data for standardized formats like hwmon while
> smu_v14_0_0_get_gpu_metrics() is for dumping the raw metrics data.
> 

Well, then kgd_pp_interface.h needs some help?

struct gpu_metrics_v3_0 {
	...
	/* Utilization */
	/* time filtered GFX busy % [0-100] */
	uint16_t			average_gfx_activity;
	/* time filtered VCN busy % [0-100] */
	uint16_t			average_vcn_activity;
	...
}

Clearly it's not true.

[Cc amdgpu_top]

Regards,
Boqun

> Alex
> 
> > >
> > > Reported-by: Mark Janes <mjanes@netflix.com>
> > > Signed-off-by: Boqun Feng <boqun@kernel.org>
> >
> > Ping?
> >
> > Regards,
> > Boqun
> >
> > > ---
> > >  drivers/gpu/drm/amd/pm/swsmu/smu14/smu_v14_0_0_ppt.c | 3 ++-
> > >  1 file changed, 2 insertions(+), 1 deletion(-)
> > >
> > > diff --git a/drivers/gpu/drm/amd/pm/swsmu/smu14/smu_v14_0_0_ppt.c b/drivers/gpu/drm/amd/pm/swsmu/smu14/smu_v14_0_0_ppt.c
> > > index 568665265a13..1058338344b0 100644
> > > --- a/drivers/gpu/drm/amd/pm/swsmu/smu14/smu_v14_0_0_ppt.c
> > > +++ b/drivers/gpu/drm/amd/pm/swsmu/smu14/smu_v14_0_0_ppt.c
> > > @@ -566,7 +566,8 @@ static ssize_t smu_v14_0_0_get_gpu_metrics(struct smu_context *smu,
> > >       gpu_metrics->temperature_skin = metrics.SkinTemp;
> > >
> > >       gpu_metrics->average_gfx_activity = metrics.GfxActivity;
> > > -     gpu_metrics->average_vcn_activity = metrics.VcnActivity;
> > > +     /* metrics.VcnActivity is permyriad, convert it to percentage. */
> > > +     gpu_metrics->average_vcn_activity = metrics.VcnActivity / 100;
> > >       memcpy(&gpu_metrics->average_ipu_activity[0],
> > >               &metrics.IpuBusy[0],
> > >               sizeof(uint16_t) * 8);
> > > --
> > > 2.50.1 (Apple Git-155)
> > >

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH] drm/amd/pm: Fix incorrect avg vcn utilization in gpu_metrics
  2026-08-13 22:25     ` Boqun Feng
@ 2026-08-14  0:51       ` Alex Deucher
  2026-08-14  2:24         ` Boqun Feng
  2026-08-14  3:23         ` Wang, Yang(Kevin)
  2026-08-14 15:14       ` Umio-Yasuno - coelacanth_dream
  1 sibling, 2 replies; 8+ messages in thread
From: Alex Deucher @ 2026-08-14  0:51 UTC (permalink / raw)
  To: Boqun Feng
  Cc: amd-gfx, Mark Janes, Kenneth Feng, Alex Deucher,
	Christian König, David Airlie, Simona Vetter, Lijo Lazar,
	Asad Kamal, Yang Wang, Priya Hosur, mythilam, Mario Limonciello,
	dri-devel, linux-kernel, Umio Yasuno

On Thu, Aug 13, 2026 at 6:25 PM Boqun Feng <boqun@kernel.org> wrote:
>
> On Thu, Aug 13, 2026 at 06:01:47PM -0400, Alex Deucher wrote:
> > On Thu, Aug 13, 2026 at 5:36 PM Boqun Feng <boqun@kernel.org> wrote:
> > >
> > > On Wed, Aug 05, 2026 at 07:02:21AM -0700, Boqun Feng wrote:
> > > > In a Strix Halo system, a >100 average_vcn_activity in gpu_metrics can
> > > > be observed by running the following command:
> > > >
> > > >     ffmpeg -hwaccel vappi -vappi_device /dev/dri/renderD128 -i \
> > > >     ~/sample-10s.mp4 -vf hwupload,scale_vappi=format=nv12 -c:v \
> > > >     h264_vappi /tmp/output.mp4
> > > >
> > > > This is incorrect because the value is supposed to be in [0-100] range.
> > > >
> > > > The cause of the issue is that the metrics.VcnActivity reported by
> > > > smu_cmn_get_metrics_table() is a permyriad value instead of a percentage
> > > > value (e.g. smu_v14_0_0_get_smu_metrics_data() has a division by 100 to
> > > > report the vcn_busy_percent). Therefore fix this by applying the same
> > > > division in smu_v14_0_0_get_gpu_metrics().
> >
> > I think this is correct as is.  smu_v14_0_0_get_smu_metrics_data() is
> > used to fetch data for standardized formats like hwmon while
> > smu_v14_0_0_get_gpu_metrics() is for dumping the raw metrics data.
> >
>
> Well, then kgd_pp_interface.h needs some help?
>
> struct gpu_metrics_v3_0 {
>         ...
>         /* Utilization */
>         /* time filtered GFX busy % [0-100] */
>         uint16_t                        average_gfx_activity;
>         /* time filtered VCN busy % [0-100] */
>         uint16_t                        average_vcn_activity;
>         ...
> }
>
> Clearly it's not true.

That was likely copy and pasted from the firmware interface
(smu14_driver_if_v14_0_0.h):
uint16_t VcnActivity;                //Time filtered VCN busy % [0-100]

Other generations seem to do the same thing (raw data in metrics table
and % in the hwmon type interfaces). E.g., smu_v13_0_4_ppt.c:
smu_v13_0_4_get_gpu_metrics()
gpu_metrics->average_mm_activity = metrics.UvdActivity;
vs smu_v13_0_4_get_smu_metrics_data():
*value = metrics->UvdActivity / 100;

Alex

>
> [Cc amdgpu_top]
>
> Regards,
> Boqun
>
> > Alex
> >
> > > >
> > > > Reported-by: Mark Janes <mjanes@netflix.com>
> > > > Signed-off-by: Boqun Feng <boqun@kernel.org>
> > >
> > > Ping?
> > >
> > > Regards,
> > > Boqun
> > >
> > > > ---
> > > >  drivers/gpu/drm/amd/pm/swsmu/smu14/smu_v14_0_0_ppt.c | 3 ++-
> > > >  1 file changed, 2 insertions(+), 1 deletion(-)
> > > >
> > > > diff --git a/drivers/gpu/drm/amd/pm/swsmu/smu14/smu_v14_0_0_ppt.c b/drivers/gpu/drm/amd/pm/swsmu/smu14/smu_v14_0_0_ppt.c
> > > > index 568665265a13..1058338344b0 100644
> > > > --- a/drivers/gpu/drm/amd/pm/swsmu/smu14/smu_v14_0_0_ppt.c
> > > > +++ b/drivers/gpu/drm/amd/pm/swsmu/smu14/smu_v14_0_0_ppt.c
> > > > @@ -566,7 +566,8 @@ static ssize_t smu_v14_0_0_get_gpu_metrics(struct smu_context *smu,
> > > >       gpu_metrics->temperature_skin = metrics.SkinTemp;
> > > >
> > > >       gpu_metrics->average_gfx_activity = metrics.GfxActivity;
> > > > -     gpu_metrics->average_vcn_activity = metrics.VcnActivity;
> > > > +     /* metrics.VcnActivity is permyriad, convert it to percentage. */
> > > > +     gpu_metrics->average_vcn_activity = metrics.VcnActivity / 100;
> > > >       memcpy(&gpu_metrics->average_ipu_activity[0],
> > > >               &metrics.IpuBusy[0],
> > > >               sizeof(uint16_t) * 8);
> > > > --
> > > > 2.50.1 (Apple Git-155)
> > > >

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH] drm/amd/pm: Fix incorrect avg vcn utilization in gpu_metrics
  2026-08-14  0:51       ` Alex Deucher
@ 2026-08-14  2:24         ` Boqun Feng
  2026-08-14  3:23         ` Wang, Yang(Kevin)
  1 sibling, 0 replies; 8+ messages in thread
From: Boqun Feng @ 2026-08-14  2:24 UTC (permalink / raw)
  To: Alex Deucher
  Cc: amd-gfx, Mark Janes, Kenneth Feng, Alex Deucher,
	Christian König, David Airlie, Simona Vetter, Lijo Lazar,
	Asad Kamal, Yang Wang, Priya Hosur, mythilam, Mario Limonciello,
	dri-devel, linux-kernel, Umio Yasuno

On Thu, Aug 13, 2026 at 08:51:22PM -0400, Alex Deucher wrote:
> On Thu, Aug 13, 2026 at 6:25 PM Boqun Feng <boqun@kernel.org> wrote:
> >
> > On Thu, Aug 13, 2026 at 06:01:47PM -0400, Alex Deucher wrote:
> > > On Thu, Aug 13, 2026 at 5:36 PM Boqun Feng <boqun@kernel.org> wrote:
> > > >
> > > > On Wed, Aug 05, 2026 at 07:02:21AM -0700, Boqun Feng wrote:
> > > > > In a Strix Halo system, a >100 average_vcn_activity in gpu_metrics can
> > > > > be observed by running the following command:
> > > > >
> > > > >     ffmpeg -hwaccel vappi -vappi_device /dev/dri/renderD128 -i \
> > > > >     ~/sample-10s.mp4 -vf hwupload,scale_vappi=format=nv12 -c:v \
> > > > >     h264_vappi /tmp/output.mp4
> > > > >
> > > > > This is incorrect because the value is supposed to be in [0-100] range.
> > > > >
> > > > > The cause of the issue is that the metrics.VcnActivity reported by
> > > > > smu_cmn_get_metrics_table() is a permyriad value instead of a percentage
> > > > > value (e.g. smu_v14_0_0_get_smu_metrics_data() has a division by 100 to
> > > > > report the vcn_busy_percent). Therefore fix this by applying the same
> > > > > division in smu_v14_0_0_get_gpu_metrics().
> > >
> > > I think this is correct as is.  smu_v14_0_0_get_smu_metrics_data() is
> > > used to fetch data for standardized formats like hwmon while
> > > smu_v14_0_0_get_gpu_metrics() is for dumping the raw metrics data.
> > >
> >
> > Well, then kgd_pp_interface.h needs some help?
> >
> > struct gpu_metrics_v3_0 {
> >         ...
> >         /* Utilization */
> >         /* time filtered GFX busy % [0-100] */
> >         uint16_t                        average_gfx_activity;
> >         /* time filtered VCN busy % [0-100] */
> >         uint16_t                        average_vcn_activity;
> >         ...
> > }
> >
> > Clearly it's not true.
> 
> That was likely copy and pasted from the firmware interface
> (smu14_driver_if_v14_0_0.h):
> uint16_t VcnActivity;                //Time filtered VCN busy % [0-100]
> 
> Other generations seem to do the same thing (raw data in metrics table
> and % in the hwmon type interfaces). E.g., smu_v13_0_4_ppt.c:
> smu_v13_0_4_get_gpu_metrics()
> gpu_metrics->average_mm_activity = metrics.UvdActivity;
> vs smu_v13_0_4_get_smu_metrics_data():
> *value = metrics->UvdActivity / 100;
> 

Could you help fix the document while you're at it? I cannot confirm by
myself the valid range of that raw data. Thanks!

Regards,
Boqun

> Alex
> 
> >
> > [Cc amdgpu_top]
> >
> > Regards,
> > Boqun
> >
> > > Alex
> > >
> > > > >
> > > > > Reported-by: Mark Janes <mjanes@netflix.com>
> > > > > Signed-off-by: Boqun Feng <boqun@kernel.org>
> > > >
> > > > Ping?
> > > >
> > > > Regards,
> > > > Boqun
> > > >
> > > > > ---
> > > > >  drivers/gpu/drm/amd/pm/swsmu/smu14/smu_v14_0_0_ppt.c | 3 ++-
> > > > >  1 file changed, 2 insertions(+), 1 deletion(-)
> > > > >
> > > > > diff --git a/drivers/gpu/drm/amd/pm/swsmu/smu14/smu_v14_0_0_ppt.c b/drivers/gpu/drm/amd/pm/swsmu/smu14/smu_v14_0_0_ppt.c
> > > > > index 568665265a13..1058338344b0 100644
> > > > > --- a/drivers/gpu/drm/amd/pm/swsmu/smu14/smu_v14_0_0_ppt.c
> > > > > +++ b/drivers/gpu/drm/amd/pm/swsmu/smu14/smu_v14_0_0_ppt.c
> > > > > @@ -566,7 +566,8 @@ static ssize_t smu_v14_0_0_get_gpu_metrics(struct smu_context *smu,
> > > > >       gpu_metrics->temperature_skin = metrics.SkinTemp;
> > > > >
> > > > >       gpu_metrics->average_gfx_activity = metrics.GfxActivity;
> > > > > -     gpu_metrics->average_vcn_activity = metrics.VcnActivity;
> > > > > +     /* metrics.VcnActivity is permyriad, convert it to percentage. */
> > > > > +     gpu_metrics->average_vcn_activity = metrics.VcnActivity / 100;
> > > > >       memcpy(&gpu_metrics->average_ipu_activity[0],
> > > > >               &metrics.IpuBusy[0],
> > > > >               sizeof(uint16_t) * 8);
> > > > > --
> > > > > 2.50.1 (Apple Git-155)
> > > > >

^ permalink raw reply	[flat|nested] 8+ messages in thread

* RE: [PATCH] drm/amd/pm: Fix incorrect avg vcn utilization in gpu_metrics
  2026-08-14  0:51       ` Alex Deucher
  2026-08-14  2:24         ` Boqun Feng
@ 2026-08-14  3:23         ` Wang, Yang(Kevin)
  1 sibling, 0 replies; 8+ messages in thread
From: Wang, Yang(Kevin) @ 2026-08-14  3:23 UTC (permalink / raw)
  To: Alex Deucher, Boqun Feng
  Cc: amd-gfx@lists.freedesktop.org, Mark Janes, Feng, Kenneth,
	Deucher,  Alexander, Koenig, Christian, David Airlie,
	Simona Vetter, Lazar, Lijo, Kamal, Asad, Hosur, Priya, M, Mythila,
	Limonciello, Mario, dri-devel@lists.freedesktop.org,
	linux-kernel@vger.kernel.org, Umio Yasuno

AMD General

> -----Original Message-----
> From: Alex Deucher <alexdeucher@gmail.com>
> Sent: Friday, August 14, 2026 8:51 AM
> To: Boqun Feng <boqun@kernel.org>
> Cc: amd-gfx@lists.freedesktop.org; Mark Janes <mjanes@netflix.com>; Feng,
> Kenneth <Kenneth.Feng@amd.com>; Deucher, Alexander
> <Alexander.Deucher@amd.com>; Koenig, Christian
> <Christian.Koenig@amd.com>; David Airlie <airlied@gmail.com>; Simona
> Vetter <simona@ffwll.ch>; Lazar, Lijo <Lijo.Lazar@amd.com>; Kamal, Asad
> <Asad.Kamal@amd.com>; Wang, Yang(Kevin) <KevinYang.Wang@amd.com>;
> Hosur, Priya <Priya.Hosur@amd.com>; M, Mythila <Mythila.M@amd.com>;
> Limonciello, Mario <Mario.Limonciello@amd.com>; dri-
> devel@lists.freedesktop.org; linux-kernel@vger.kernel.org; Umio Yasuno
> <coelacanth_dream@protonmail.com>
> Subject: Re: [PATCH] drm/amd/pm: Fix incorrect avg vcn utilization in
> gpu_metrics
>
> On Thu, Aug 13, 2026 at 6:25 PM Boqun Feng <boqun@kernel.org> wrote:
> >
> > On Thu, Aug 13, 2026 at 06:01:47PM -0400, Alex Deucher wrote:
> > > On Thu, Aug 13, 2026 at 5:36 PM Boqun Feng <boqun@kernel.org> wrote:
> > > >
> > > > On Wed, Aug 05, 2026 at 07:02:21AM -0700, Boqun Feng wrote:
> > > > > In a Strix Halo system, a >100 average_vcn_activity in
> > > > > gpu_metrics can be observed by running the following command:
> > > > >
> > > > >     ffmpeg -hwaccel vappi -vappi_device /dev/dri/renderD128 -i \
> > > > >     ~/sample-10s.mp4 -vf hwupload,scale_vappi=format=nv12 -c:v \
> > > > >     h264_vappi /tmp/output.mp4
> > > > >
> > > > > This is incorrect because the value is supposed to be in [0-100] range.
> > > > >
> > > > > The cause of the issue is that the metrics.VcnActivity reported
> > > > > by
> > > > > smu_cmn_get_metrics_table() is a permyriad value instead of a
> > > > > percentage value (e.g. smu_v14_0_0_get_smu_metrics_data() has a
> > > > > division by 100 to report the vcn_busy_percent). Therefore fix
> > > > > this by applying the same division in smu_v14_0_0_get_gpu_metrics().
> > >
> > > I think this is correct as is.  smu_v14_0_0_get_smu_metrics_data()
> > > is used to fetch data for standardized formats like hwmon while
> > > smu_v14_0_0_get_gpu_metrics() is for dumping the raw metrics data.
> > >
> >
> > Well, then kgd_pp_interface.h needs some help?
> >
> > struct gpu_metrics_v3_0 {
> >         ...
> >         /* Utilization */
> >         /* time filtered GFX busy % [0-100] */
> >         uint16_t                        average_gfx_activity;
> >         /* time filtered VCN busy % [0-100] */
> >         uint16_t                        average_vcn_activity;
> >         ...
> > }
> >
> > Clearly it's not true.
>
> That was likely copy and pasted from the firmware interface
> (smu14_driver_if_v14_0_0.h):
> uint16_t VcnActivity;                //Time filtered VCN busy % [0-100]
>
> Other generations seem to do the same thing (raw data in metrics table
> and % in the hwmon type interfaces). E.g., smu_v13_0_4_ppt.c:
> smu_v13_0_4_get_gpu_metrics()
> gpu_metrics->average_mm_activity = metrics.UvdActivity; vs
> smu_v13_0_4_get_smu_metrics_data():
> *value = metrics->UvdActivity / 100;

For SMU 14.0.0, the VCN activity value returned from PMFW ranges from 0 to 10000, and the driver shall divide this value by 100 before reporting it.
This scaling does **not** apply to GFX activity.

Best Regards,
Kevin
>
> Alex
>
> >
> > [Cc amdgpu_top]
> >
> > Regards,
> > Boqun
> >
> > > Alex
> > >
> > > > >
> > > > > Reported-by: Mark Janes <mjanes@netflix.com>
> > > > > Signed-off-by: Boqun Feng <boqun@kernel.org>
> > > >
> > > > Ping?
> > > >
> > > > Regards,
> > > > Boqun
> > > >
> > > > > ---
> > > > >  drivers/gpu/drm/amd/pm/swsmu/smu14/smu_v14_0_0_ppt.c | 3 ++-
> > > > >  1 file changed, 2 insertions(+), 1 deletion(-)
> > > > >
> > > > > diff --git
> > > > > a/drivers/gpu/drm/amd/pm/swsmu/smu14/smu_v14_0_0_ppt.c
> > > > > b/drivers/gpu/drm/amd/pm/swsmu/smu14/smu_v14_0_0_ppt.c
> > > > > index 568665265a13..1058338344b0 100644
> > > > > --- a/drivers/gpu/drm/amd/pm/swsmu/smu14/smu_v14_0_0_ppt.c
> > > > > +++ b/drivers/gpu/drm/amd/pm/swsmu/smu14/smu_v14_0_0_ppt.c
> > > > > @@ -566,7 +566,8 @@ static ssize_t
> smu_v14_0_0_get_gpu_metrics(struct smu_context *smu,
> > > > >       gpu_metrics->temperature_skin = metrics.SkinTemp;
> > > > >
> > > > >       gpu_metrics->average_gfx_activity = metrics.GfxActivity;
> > > > > -     gpu_metrics->average_vcn_activity = metrics.VcnActivity;
> > > > > +     /* metrics.VcnActivity is permyriad, convert it to percentage. */
> > > > > +     gpu_metrics->average_vcn_activity = metrics.VcnActivity /
> > > > > + 100;
> > > > >       memcpy(&gpu_metrics->average_ipu_activity[0],
> > > > >               &metrics.IpuBusy[0],
> > > > >               sizeof(uint16_t) * 8);
> > > > > --
> > > > > 2.50.1 (Apple Git-155)
> > > > >

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH] drm/amd/pm: Fix incorrect avg vcn utilization in gpu_metrics
  2026-08-13 22:25     ` Boqun Feng
  2026-08-14  0:51       ` Alex Deucher
@ 2026-08-14 15:14       ` Umio-Yasuno - coelacanth_dream
  1 sibling, 0 replies; 8+ messages in thread
From: Umio-Yasuno - coelacanth_dream @ 2026-08-14 15:14 UTC (permalink / raw)
  To: Boqun Feng
  Cc: Alex Deucher, amd-gfx, Mark Janes, Kenneth Feng, Alex Deucher,
	Christian König, David Airlie, Simona Vetter, Lijo Lazar,
	Asad Kamal, Yang Wang, Priya Hosur, mythilam, Mario Limonciello,
	dri-devel, linux-kernel

Apologies, I forgot to set the CC. Below is my opinion that I wrote outside the thread.

---
amdgpu_top already divides average_vcn_activity in gpu_metrics_v3_0 by 100, so this patch would unfortunately end up affecting user-space applications.

In my view, if users want to obtain media engine usage that is properly corrected based on the firmware (or firmware version) in the AMDGPU driver, the best option is to use the vcn_busy_percent sysfs interface.
However, that adds extra reading cost.

Alternatively, since gpu_metrics is designed as an interface that provides raw data[^1] (but undocumented it[^2]), it would be better to have the correction applied on the user-space.

[^1]: https://gitlab.freedesktop.org/drm/amd/-/work_items/3251#note_2904104
[^2]: https://www.kernel.org/doc/html/latest/gpu/amdgpu/thermal.html#gpu-metrics
---

On Friday, August 14th, 2026 at 7:25, Boqun Feng <boqun@kernel.org> wrote:

> On Thu, Aug 13, 2026 at 06:01:47PM -0400, Alex Deucher wrote:
> > On Thu, Aug 13, 2026 at 5:36 PM Boqun Feng <boqun@kernel.org> wrote:
> > >
> > > On Wed, Aug 05, 2026 at 07:02:21AM -0700, Boqun Feng wrote:
> > > > In a Strix Halo system, a >100 average_vcn_activity in gpu_metrics can
> > > > be observed by running the following command:
> > > >
> > > >     ffmpeg -hwaccel vappi -vappi_device /dev/dri/renderD128 -i \
> > > >     ~/sample-10s.mp4 -vf hwupload,scale_vappi=format=nv12 -c:v \
> > > >     h264_vappi /tmp/output.mp4
> > > >
> > > > This is incorrect because the value is supposed to be in [0-100] range.
> > > >
> > > > The cause of the issue is that the metrics.VcnActivity reported by
> > > > smu_cmn_get_metrics_table() is a permyriad value instead of a percentage
> > > > value (e.g. smu_v14_0_0_get_smu_metrics_data() has a division by 100 to
> > > > report the vcn_busy_percent). Therefore fix this by applying the same
> > > > division in smu_v14_0_0_get_gpu_metrics().
> >
> > I think this is correct as is.  smu_v14_0_0_get_smu_metrics_data() is
> > used to fetch data for standardized formats like hwmon while
> > smu_v14_0_0_get_gpu_metrics() is for dumping the raw metrics data.
> >
> 
> Well, then kgd_pp_interface.h needs some help?
> 
> struct gpu_metrics_v3_0 {
> 	...
> 	/* Utilization */
> 	/* time filtered GFX busy % [0-100] */
> 	uint16_t			average_gfx_activity;
> 	/* time filtered VCN busy % [0-100] */
> 	uint16_t			average_vcn_activity;
> 	...
> }
> 
> Clearly it's not true.
> 
> [Cc amdgpu_top]
> 
> Regards,
> Boqun
> 
> > Alex
> >
> > > >
> > > > Reported-by: Mark Janes <mjanes@netflix.com>
> > > > Signed-off-by: Boqun Feng <boqun@kernel.org>
> > >
> > > Ping?
> > >
> > > Regards,
> > > Boqun
> > >
> > > > ---
> > > >  drivers/gpu/drm/amd/pm/swsmu/smu14/smu_v14_0_0_ppt.c | 3 ++-
> > > >  1 file changed, 2 insertions(+), 1 deletion(-)
> > > >
> > > > diff --git a/drivers/gpu/drm/amd/pm/swsmu/smu14/smu_v14_0_0_ppt.c b/drivers/gpu/drm/amd/pm/swsmu/smu14/smu_v14_0_0_ppt.c
> > > > index 568665265a13..1058338344b0 100644
> > > > --- a/drivers/gpu/drm/amd/pm/swsmu/smu14/smu_v14_0_0_ppt.c
> > > > +++ b/drivers/gpu/drm/amd/pm/swsmu/smu14/smu_v14_0_0_ppt.c
> > > > @@ -566,7 +566,8 @@ static ssize_t smu_v14_0_0_get_gpu_metrics(struct smu_context *smu,
> > > >       gpu_metrics->temperature_skin = metrics.SkinTemp;
> > > >
> > > >       gpu_metrics->average_gfx_activity = metrics.GfxActivity;
> > > > -     gpu_metrics->average_vcn_activity = metrics.VcnActivity;
> > > > +     /* metrics.VcnActivity is permyriad, convert it to percentage. */
> > > > +     gpu_metrics->average_vcn_activity = metrics.VcnActivity / 100;
> > > >       memcpy(&gpu_metrics->average_ipu_activity[0],
> > > >               &metrics.IpuBusy[0],
> > > >               sizeof(uint16_t) * 8);
> > > > --
> > > > 2.50.1 (Apple Git-155)
> > > >
>

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2026-08-14 15:14 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-08-05 14:02 [PATCH] drm/amd/pm: Fix incorrect avg vcn utilization in gpu_metrics Boqun Feng
2026-08-13 21:36 ` Boqun Feng
2026-08-13 22:01   ` Alex Deucher
2026-08-13 22:25     ` Boqun Feng
2026-08-14  0:51       ` Alex Deucher
2026-08-14  2:24         ` Boqun Feng
2026-08-14  3:23         ` Wang, Yang(Kevin)
2026-08-14 15:14       ` Umio-Yasuno - coelacanth_dream

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.