[PATCH] drm/xe: Get XE_FORCEWAKE_ALL to read RING_TIMESTAMP

Lucas De Marchi lucas.demarchi at intel.com
Mon Jun 24 14:44:03 UTC 2024


On Sat, Jun 22, 2024 at 03:23:25AM GMT, Umesh Nerlige Ramappa wrote:
>Per client engine utilization uses RING_TIMESTAMP to return
>drm-total-cycles to the user. We read only the rcs RING_TIMESTAMP in
>platforms that have render. While this works for rcs and
>ccs, it is observed that this value is 0 when running work on bcs, vcs
>and vecs. Ideally we should read the engine specific RING_TIMESTAMP, but

what do you mean by engine specific RING_TIMESTAMP? We are already
reading the engine specific copy of the same timestamp. AFAIR just
getting the gt fw was working for reading this register from vcs, vecs,
bcs. Can you demonstrate the failure with a bug open or a series of
intel_reg invocations showing otherwise?

I think the simplest way to show it doesn't work is to call
`intel_reg write` to get a GT forcewake, then `intel_reg read` to read
this register.

Lucas De Marchi

>to keep the logic simple, just get XE_FORCEWAKE_ALL instead of XE_GT_FW.
>
>This should work fine on multi-gt platforms as well since the
>gt_timestamp is in sync on all GTs.
>
>Fixes: 188ced1e0ff8 ("drm/xe/client: Print runtime to fdinfo")
>Signed-off-by: Umesh Nerlige Ramappa <umesh.nerlige.ramappa at intel.com>
>---
> drivers/gpu/drm/xe/xe_drm_client.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
>diff --git a/drivers/gpu/drm/xe/xe_drm_client.c b/drivers/gpu/drm/xe/xe_drm_client.c
>index 4a19b771e3a0..74f2244679f3 100644
>--- a/drivers/gpu/drm/xe/xe_drm_client.c
>+++ b/drivers/gpu/drm/xe/xe_drm_client.c
>@@ -264,9 +264,9 @@ static void show_run_ticks(struct drm_printer *p, struct drm_file *file)
> 		if (!hwe)
> 			continue;
>
>-		xe_force_wake_get(gt_to_fw(gt), XE_FW_GT);
>+		xe_force_wake_get(gt_to_fw(gt), XE_FORCEWAKE_ALL);
> 		gpu_timestamp = xe_hw_engine_read_timestamp(hwe);
>-		xe_force_wake_put(gt_to_fw(gt), XE_FW_GT);
>+		xe_force_wake_put(gt_to_fw(gt), XE_FORCEWAKE_ALL);
> 		break;
> 	}
>
>-- 
>2.34.1
>


More information about the Intel-xe mailing list