[PATCH 8/9] drm/xe/client: Check return value of xe_force_wake_get
Nirmoy Das
nirmoy.das at intel.com
Tue Jun 4 11:02:24 UTC 2024
xe_force_wake_get() can return error so check it's return value
before reading gpu_timestamp value.
v3: Do not skip xe_force_wake_put(Himal)
v2: set HWE to NULL instead of setting timestamp to 0(Lucas)
Add a warn on for xe_force_wake_put(Himal)
Fixes: 188ced1e0ff8 ("drm/xe/client: Print runtime to fdinfo")
Cc: Himal Prasad Ghimiray <himal.prasad.ghimiray at intel.com>
Cc: Lucas De Marchi <lucas.demarchi at intel.com>
Cc: Rodrigo Vivi <rodrigo.vivi at intel.com>
Signed-off-by: Nirmoy Das <nirmoy.das at intel.com>
---
drivers/gpu/drm/xe/xe_drm_client.c | 10 +++++++---
1 file changed, 7 insertions(+), 3 deletions(-)
diff --git a/drivers/gpu/drm/xe/xe_drm_client.c b/drivers/gpu/drm/xe/xe_drm_client.c
index 4a19b771e3a0..0d6c7b813af4 100644
--- a/drivers/gpu/drm/xe/xe_drm_client.c
+++ b/drivers/gpu/drm/xe/xe_drm_client.c
@@ -264,9 +264,13 @@ 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);
- gpu_timestamp = xe_hw_engine_read_timestamp(hwe);
- xe_force_wake_put(gt_to_fw(gt), XE_FW_GT);
+ if (xe_force_wake_get(gt_to_fw(gt), XE_FW_GT))
+ hwe = NULL;
+
+ if (hwe)
+ gpu_timestamp = xe_hw_engine_read_timestamp(hwe);
+
+ XE_WARN_ON(xe_force_wake_put(gt_to_fw(gt), XE_FW_GT));
break;
}
--
2.42.0
More information about the Intel-xe
mailing list