[RFC 6/9] drm/xe/oa: Handle force_wake_get failure in xe_oa_stream_init()

Himal Prasad Ghimiray himal.prasad.ghimiray at intel.com
Fri Aug 30 05:23:23 UTC 2024


xe_force_wake_get failure doesn't increment the refcount of domain
anymore. So xe_force_wake_put shouldn't be called in case of failure.
If xe_force_wake_get() fails in xe_oa_stream_init() do the error handling
without calling xe_force_wake_put().

Cc: Ashutosh Dixit <ashutosh.dixit at intel.com>
Cc: Rodrigo Vivi <rodrigo.vivi at intel.com>
Cc: Lucas De Marchi <lucas.demarchi at intel.com>
Signed-off-by: Himal Prasad Ghimiray <himal.prasad.ghimiray at intel.com>
---
 drivers/gpu/drm/xe/xe_oa.c | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/drivers/gpu/drm/xe/xe_oa.c b/drivers/gpu/drm/xe/xe_oa.c
index 4d4541e0b24c..78ff4ab9ef57 100644
--- a/drivers/gpu/drm/xe/xe_oa.c
+++ b/drivers/gpu/drm/xe/xe_oa.c
@@ -1407,11 +1407,13 @@ static int xe_oa_stream_init(struct xe_oa_stream *stream,
 
 	/* Take runtime pm ref and forcewake to disable RC6 */
 	xe_pm_runtime_get(stream->oa->xe);
-	XE_WARN_ON(xe_force_wake_get(gt_to_fw(gt), XE_FORCEWAKE_ALL));
+	ret = xe_force_wake_get(gt_to_fw(gt), XE_FORCEWAKE_ALL);
+	if (ret)
+		goto err_fw_get;
 
 	ret = xe_oa_alloc_oa_buffer(stream);
 	if (ret)
-		goto err_fw_put;
+		goto err_alloc_oa_buf;
 
 	stream->k_exec_q = xe_exec_queue_create(stream->oa->xe, NULL,
 						BIT(stream->hwe->logical_instance), 1,
@@ -1448,8 +1450,9 @@ static int xe_oa_stream_init(struct xe_oa_stream *stream,
 	xe_exec_queue_put(stream->k_exec_q);
 err_free_oa_buf:
 	xe_oa_free_oa_buffer(stream);
-err_fw_put:
+err_alloc_oa_buf:
 	XE_WARN_ON(xe_force_wake_put(gt_to_fw(gt), XE_FORCEWAKE_ALL));
+err_fw_get:
 	xe_pm_runtime_put(stream->oa->xe);
 	if (stream->override_gucrc)
 		xe_gt_WARN_ON(gt, xe_guc_pc_unset_gucrc_mode(&gt->uc.guc.pc));
-- 
2.34.1



More information about the Intel-xe mailing list