[PATCH] drm/panfrost: Only display fdinfo's engine and cycle tags when profiling is on

Adrián Larumbe posted 1 patch 2 years, 3 months ago
drivers/gpu/drm/panfrost/panfrost_drv.c | 10 ++++++----
1 file changed, 6 insertions(+), 4 deletions(-)
[PATCH] drm/panfrost: Only display fdinfo's engine and cycle tags when profiling is on
Posted by Adrián Larumbe 2 years, 3 months ago
If job accounting is disabled, then both fdinfo's drm-engine and drm-cycle
key values will remain immutable. In that case, it makes more sense not to
display them at all to avoid confusing user space profiling tools.

Signed-off-by: Adrián Larumbe <adrian.larumbe@collabora.com>
---
 drivers/gpu/drm/panfrost/panfrost_drv.c | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/drivers/gpu/drm/panfrost/panfrost_drv.c b/drivers/gpu/drm/panfrost/panfrost_drv.c
index eec250114114..ef9f6c0716d5 100644
--- a/drivers/gpu/drm/panfrost/panfrost_drv.c
+++ b/drivers/gpu/drm/panfrost/panfrost_drv.c
@@ -550,10 +550,12 @@ static void panfrost_gpu_show_fdinfo(struct panfrost_device *pfdev,
 	BUILD_BUG_ON(ARRAY_SIZE(engine_names) != NUM_JOB_SLOTS);
 
 	for (i = 0; i < NUM_JOB_SLOTS - 1; i++) {
-		drm_printf(p, "drm-engine-%s:\t%llu ns\n",
-			   engine_names[i], panfrost_priv->engine_usage.elapsed_ns[i]);
-		drm_printf(p, "drm-cycles-%s:\t%llu\n",
-			   engine_names[i], panfrost_priv->engine_usage.cycles[i]);
+		if (pfdev->profile_mode) {
+			drm_printf(p, "drm-engine-%s:\t%llu ns\n",
+				   engine_names[i], panfrost_priv->engine_usage.elapsed_ns[i]);
+			drm_printf(p, "drm-cycles-%s:\t%llu\n",
+				   engine_names[i], panfrost_priv->engine_usage.cycles[i]);
+		}
 		drm_printf(p, "drm-maxfreq-%s:\t%lu Hz\n",
 			   engine_names[i], pfdev->pfdevfreq.fast_rate);
 		drm_printf(p, "drm-curfreq-%s:\t%lu Hz\n",

base-commit: 97252d0a4bfbb07079503d059f7522d305fe0f7a
-- 
2.43.0

Re: [PATCH] drm/panfrost: Only display fdinfo's engine and cycle tags when profiling is on
Posted by Steven Price 2 years, 3 months ago
On 16/03/2024 23:13, Adrián Larumbe wrote:
> If job accounting is disabled, then both fdinfo's drm-engine and drm-cycle
> key values will remain immutable. In that case, it makes more sense not to
> display them at all to avoid confusing user space profiling tools.
> 
> Signed-off-by: Adrián Larumbe <adrian.larumbe@collabora.com>

Pushed to drm-misc-next

Thanks,

Steve

> ---
>  drivers/gpu/drm/panfrost/panfrost_drv.c | 10 ++++++----
>  1 file changed, 6 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/gpu/drm/panfrost/panfrost_drv.c b/drivers/gpu/drm/panfrost/panfrost_drv.c
> index eec250114114..ef9f6c0716d5 100644
> --- a/drivers/gpu/drm/panfrost/panfrost_drv.c
> +++ b/drivers/gpu/drm/panfrost/panfrost_drv.c
> @@ -550,10 +550,12 @@ static void panfrost_gpu_show_fdinfo(struct panfrost_device *pfdev,
>  	BUILD_BUG_ON(ARRAY_SIZE(engine_names) != NUM_JOB_SLOTS);
>  
>  	for (i = 0; i < NUM_JOB_SLOTS - 1; i++) {
> -		drm_printf(p, "drm-engine-%s:\t%llu ns\n",
> -			   engine_names[i], panfrost_priv->engine_usage.elapsed_ns[i]);
> -		drm_printf(p, "drm-cycles-%s:\t%llu\n",
> -			   engine_names[i], panfrost_priv->engine_usage.cycles[i]);
> +		if (pfdev->profile_mode) {
> +			drm_printf(p, "drm-engine-%s:\t%llu ns\n",
> +				   engine_names[i], panfrost_priv->engine_usage.elapsed_ns[i]);
> +			drm_printf(p, "drm-cycles-%s:\t%llu\n",
> +				   engine_names[i], panfrost_priv->engine_usage.cycles[i]);
> +		}
>  		drm_printf(p, "drm-maxfreq-%s:\t%lu Hz\n",
>  			   engine_names[i], pfdev->pfdevfreq.fast_rate);
>  		drm_printf(p, "drm-curfreq-%s:\t%lu Hz\n",
> 
> base-commit: 97252d0a4bfbb07079503d059f7522d305fe0f7a

Re: [PATCH] drm/panfrost: Only display fdinfo's engine and cycle tags when profiling is on
Posted by Steven Price 2 years, 3 months ago
On 16/03/2024 23:13, Adrián Larumbe wrote:
> If job accounting is disabled, then both fdinfo's drm-engine and drm-cycle
> key values will remain immutable. In that case, it makes more sense not to
> display them at all to avoid confusing user space profiling tools.
> 
> Signed-off-by: Adrián Larumbe <adrian.larumbe@collabora.com>

Reviewed-by: Steven Price <steven.price@arm.com>

> ---
>  drivers/gpu/drm/panfrost/panfrost_drv.c | 10 ++++++----
>  1 file changed, 6 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/gpu/drm/panfrost/panfrost_drv.c b/drivers/gpu/drm/panfrost/panfrost_drv.c
> index eec250114114..ef9f6c0716d5 100644
> --- a/drivers/gpu/drm/panfrost/panfrost_drv.c
> +++ b/drivers/gpu/drm/panfrost/panfrost_drv.c
> @@ -550,10 +550,12 @@ static void panfrost_gpu_show_fdinfo(struct panfrost_device *pfdev,
>  	BUILD_BUG_ON(ARRAY_SIZE(engine_names) != NUM_JOB_SLOTS);
>  
>  	for (i = 0; i < NUM_JOB_SLOTS - 1; i++) {
> -		drm_printf(p, "drm-engine-%s:\t%llu ns\n",
> -			   engine_names[i], panfrost_priv->engine_usage.elapsed_ns[i]);
> -		drm_printf(p, "drm-cycles-%s:\t%llu\n",
> -			   engine_names[i], panfrost_priv->engine_usage.cycles[i]);
> +		if (pfdev->profile_mode) {
> +			drm_printf(p, "drm-engine-%s:\t%llu ns\n",
> +				   engine_names[i], panfrost_priv->engine_usage.elapsed_ns[i]);
> +			drm_printf(p, "drm-cycles-%s:\t%llu\n",
> +				   engine_names[i], panfrost_priv->engine_usage.cycles[i]);
> +		}
>  		drm_printf(p, "drm-maxfreq-%s:\t%lu Hz\n",
>  			   engine_names[i], pfdev->pfdevfreq.fast_rate);
>  		drm_printf(p, "drm-curfreq-%s:\t%lu Hz\n",
> 
> base-commit: 97252d0a4bfbb07079503d059f7522d305fe0f7a