Commit 1c621f2a authored by John Harrison's avatar John Harrison

drm/i915/guc: More debug print updates - GuC selftests

Update a bunch more debug prints to use the new GT based scheme.

v2: Also change prints to use %pe for error values (MichalW).
Fix a context leak on error due to a -- being too early.
Use the correct header file for the debug macros.
Signed-off-by: default avatarJohn Harrison <John.C.Harrison@Intel.com>
Reviewed-by: default avatarMichal Wajdeczko <michal.wajdeczko@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20230207050717.1833718-5-John.C.Harrison@Intel.com
parent 96eecf9b
...@@ -3,6 +3,8 @@ ...@@ -3,6 +3,8 @@
* Copyright �� 2021 Intel Corporation * Copyright �� 2021 Intel Corporation
*/ */
#include "gt/intel_gt_print.h"
#include "intel_guc_print.h"
#include "selftests/igt_spinner.h" #include "selftests/igt_spinner.h"
#include "selftests/intel_scheduler_helpers.h" #include "selftests/intel_scheduler_helpers.h"
...@@ -65,7 +67,7 @@ static int intel_guc_scrub_ctbs(void *arg) ...@@ -65,7 +67,7 @@ static int intel_guc_scrub_ctbs(void *arg)
ce = intel_context_create(engine); ce = intel_context_create(engine);
if (IS_ERR(ce)) { if (IS_ERR(ce)) {
ret = PTR_ERR(ce); ret = PTR_ERR(ce);
drm_err(&gt->i915->drm, "Failed to create context, %d: %d\n", i, ret); gt_err(gt, "Failed to create context %d: %pe\n", i, ce);
goto err; goto err;
} }
...@@ -86,7 +88,7 @@ static int intel_guc_scrub_ctbs(void *arg) ...@@ -86,7 +88,7 @@ static int intel_guc_scrub_ctbs(void *arg)
if (IS_ERR(rq)) { if (IS_ERR(rq)) {
ret = PTR_ERR(rq); ret = PTR_ERR(rq);
drm_err(&gt->i915->drm, "Failed to create request, %d: %d\n", i, ret); gt_err(gt, "Failed to create request %d: %pe\n", i, rq);
goto err; goto err;
} }
...@@ -96,7 +98,7 @@ static int intel_guc_scrub_ctbs(void *arg) ...@@ -96,7 +98,7 @@ static int intel_guc_scrub_ctbs(void *arg)
for (i = 0; i < 3; ++i) { for (i = 0; i < 3; ++i) {
ret = i915_request_wait(last[i], 0, HZ); ret = i915_request_wait(last[i], 0, HZ);
if (ret < 0) { if (ret < 0) {
drm_err(&gt->i915->drm, "Last request failed to complete: %d\n", ret); gt_err(gt, "Last request failed to complete: %pe\n", ERR_PTR(ret));
goto err; goto err;
} }
i915_request_put(last[i]); i915_request_put(last[i]);
...@@ -113,7 +115,7 @@ static int intel_guc_scrub_ctbs(void *arg) ...@@ -113,7 +115,7 @@ static int intel_guc_scrub_ctbs(void *arg)
/* GT will not idle if G2H are lost */ /* GT will not idle if G2H are lost */
ret = intel_gt_wait_for_idle(gt, HZ); ret = intel_gt_wait_for_idle(gt, HZ);
if (ret < 0) { if (ret < 0) {
drm_err(&gt->i915->drm, "GT failed to idle: %d\n", ret); gt_err(gt, "GT failed to idle: %pe\n", ERR_PTR(ret));
goto err; goto err;
} }
...@@ -153,7 +155,7 @@ static int intel_guc_steal_guc_ids(void *arg) ...@@ -153,7 +155,7 @@ static int intel_guc_steal_guc_ids(void *arg)
ce = kcalloc(GUC_MAX_CONTEXT_ID, sizeof(*ce), GFP_KERNEL); ce = kcalloc(GUC_MAX_CONTEXT_ID, sizeof(*ce), GFP_KERNEL);
if (!ce) { if (!ce) {
drm_err(&gt->i915->drm, "Context array allocation failed\n"); guc_err(guc, "Context array allocation failed\n");
return -ENOMEM; return -ENOMEM;
} }
...@@ -166,25 +168,25 @@ static int intel_guc_steal_guc_ids(void *arg) ...@@ -166,25 +168,25 @@ static int intel_guc_steal_guc_ids(void *arg)
ce[context_index] = intel_context_create(engine); ce[context_index] = intel_context_create(engine);
if (IS_ERR(ce[context_index])) { if (IS_ERR(ce[context_index])) {
ret = PTR_ERR(ce[context_index]); ret = PTR_ERR(ce[context_index]);
guc_err(guc, "Failed to create context: %pe\n", ce[context_index]);
ce[context_index] = NULL; ce[context_index] = NULL;
drm_err(&gt->i915->drm, "Failed to create context: %d\n", ret);
goto err_wakeref; goto err_wakeref;
} }
ret = igt_spinner_init(&spin, engine->gt); ret = igt_spinner_init(&spin, engine->gt);
if (ret) { if (ret) {
drm_err(&gt->i915->drm, "Failed to create spinner: %d\n", ret); guc_err(guc, "Failed to create spinner: %pe\n", ERR_PTR(ret));
goto err_contexts; goto err_contexts;
} }
spin_rq = igt_spinner_create_request(&spin, ce[context_index], spin_rq = igt_spinner_create_request(&spin, ce[context_index],
MI_ARB_CHECK); MI_ARB_CHECK);
if (IS_ERR(spin_rq)) { if (IS_ERR(spin_rq)) {
ret = PTR_ERR(spin_rq); ret = PTR_ERR(spin_rq);
drm_err(&gt->i915->drm, "Failed to create spinner request: %d\n", ret); guc_err(guc, "Failed to create spinner request: %pe\n", spin_rq);
goto err_contexts; goto err_contexts;
} }
ret = request_add_spin(spin_rq, &spin); ret = request_add_spin(spin_rq, &spin);
if (ret) { if (ret) {
drm_err(&gt->i915->drm, "Failed to add Spinner request: %d\n", ret); guc_err(guc, "Failed to add Spinner request: %pe\n", ERR_PTR(ret));
goto err_spin_rq; goto err_spin_rq;
} }
...@@ -192,9 +194,9 @@ static int intel_guc_steal_guc_ids(void *arg) ...@@ -192,9 +194,9 @@ static int intel_guc_steal_guc_ids(void *arg)
while (ret != -EAGAIN) { while (ret != -EAGAIN) {
ce[++context_index] = intel_context_create(engine); ce[++context_index] = intel_context_create(engine);
if (IS_ERR(ce[context_index])) { if (IS_ERR(ce[context_index])) {
ret = PTR_ERR(ce[context_index--]); ret = PTR_ERR(ce[context_index]);
ce[context_index] = NULL; guc_err(guc, "Failed to create context: %pe\n", ce[context_index]);
drm_err(&gt->i915->drm, "Failed to create context: %d\n", ret); ce[context_index--] = NULL;
goto err_spin_rq; goto err_spin_rq;
} }
...@@ -203,8 +205,8 @@ static int intel_guc_steal_guc_ids(void *arg) ...@@ -203,8 +205,8 @@ static int intel_guc_steal_guc_ids(void *arg)
ret = PTR_ERR(rq); ret = PTR_ERR(rq);
rq = NULL; rq = NULL;
if (ret != -EAGAIN) { if (ret != -EAGAIN) {
drm_err(&gt->i915->drm, "Failed to create request, %d: %d\n", guc_err(guc, "Failed to create request %d: %pe\n",
context_index, ret); context_index, ERR_PTR(ret));
goto err_spin_rq; goto err_spin_rq;
} }
} else { } else {
...@@ -218,7 +220,7 @@ static int intel_guc_steal_guc_ids(void *arg) ...@@ -218,7 +220,7 @@ static int intel_guc_steal_guc_ids(void *arg)
igt_spinner_end(&spin); igt_spinner_end(&spin);
ret = intel_selftest_wait_for_rq(spin_rq); ret = intel_selftest_wait_for_rq(spin_rq);
if (ret) { if (ret) {
drm_err(&gt->i915->drm, "Spin request failed to complete: %d\n", ret); guc_err(guc, "Spin request failed to complete: %pe\n", ERR_PTR(ret));
i915_request_put(last); i915_request_put(last);
goto err_spin_rq; goto err_spin_rq;
} }
...@@ -230,7 +232,7 @@ static int intel_guc_steal_guc_ids(void *arg) ...@@ -230,7 +232,7 @@ static int intel_guc_steal_guc_ids(void *arg)
ret = i915_request_wait(last, 0, HZ * 30); ret = i915_request_wait(last, 0, HZ * 30);
i915_request_put(last); i915_request_put(last);
if (ret < 0) { if (ret < 0) {
drm_err(&gt->i915->drm, "Last request failed to complete: %d\n", ret); guc_err(guc, "Last request failed to complete: %pe\n", ERR_PTR(ret));
goto err_spin_rq; goto err_spin_rq;
} }
...@@ -238,7 +240,7 @@ static int intel_guc_steal_guc_ids(void *arg) ...@@ -238,7 +240,7 @@ static int intel_guc_steal_guc_ids(void *arg)
rq = nop_user_request(ce[context_index], NULL); rq = nop_user_request(ce[context_index], NULL);
if (IS_ERR(rq)) { if (IS_ERR(rq)) {
ret = PTR_ERR(rq); ret = PTR_ERR(rq);
drm_err(&gt->i915->drm, "Failed to steal guc_id, %d: %d\n", context_index, ret); guc_err(guc, "Failed to steal guc_id %d: %pe\n", context_index, rq);
goto err_spin_rq; goto err_spin_rq;
} }
...@@ -246,20 +248,20 @@ static int intel_guc_steal_guc_ids(void *arg) ...@@ -246,20 +248,20 @@ static int intel_guc_steal_guc_ids(void *arg)
ret = i915_request_wait(rq, 0, HZ); ret = i915_request_wait(rq, 0, HZ);
i915_request_put(rq); i915_request_put(rq);
if (ret < 0) { if (ret < 0) {
drm_err(&gt->i915->drm, "Request with stolen guc_id failed to complete: %d\n", ret); guc_err(guc, "Request with stolen guc_id failed to complete: %pe\n", ERR_PTR(ret));
goto err_spin_rq; goto err_spin_rq;
} }
/* Wait for idle */ /* Wait for idle */
ret = intel_gt_wait_for_idle(gt, HZ * 30); ret = intel_gt_wait_for_idle(gt, HZ * 30);
if (ret < 0) { if (ret < 0) {
drm_err(&gt->i915->drm, "GT failed to idle: %d\n", ret); guc_err(guc, "GT failed to idle: %pe\n", ERR_PTR(ret));
goto err_spin_rq; goto err_spin_rq;
} }
/* Verify a guc_id was stolen */ /* Verify a guc_id was stolen */
if (guc->number_guc_id_stolen == number_guc_id_stolen) { if (guc->number_guc_id_stolen == number_guc_id_stolen) {
drm_err(&gt->i915->drm, "No guc_id was stolen"); guc_err(guc, "No guc_id was stolen");
ret = -EINVAL; ret = -EINVAL;
} else { } else {
ret = 0; ret = 0;
......
...@@ -3,6 +3,7 @@ ...@@ -3,6 +3,7 @@
* Copyright © 2022 Intel Corporation * Copyright © 2022 Intel Corporation
*/ */
#include "gt/intel_gt_print.h"
#include "selftests/igt_spinner.h" #include "selftests/igt_spinner.h"
#include "selftests/igt_reset.h" #include "selftests/igt_reset.h"
#include "selftests/intel_scheduler_helpers.h" #include "selftests/intel_scheduler_helpers.h"
...@@ -45,7 +46,7 @@ static int intel_hang_guc(void *arg) ...@@ -45,7 +46,7 @@ static int intel_hang_guc(void *arg)
ctx = kernel_context(gt->i915, NULL); ctx = kernel_context(gt->i915, NULL);
if (IS_ERR(ctx)) { if (IS_ERR(ctx)) {
drm_err(&gt->i915->drm, "Failed get kernel context: %ld\n", PTR_ERR(ctx)); gt_err(gt, "Failed get kernel context: %pe\n", ctx);
return PTR_ERR(ctx); return PTR_ERR(ctx);
} }
...@@ -54,7 +55,7 @@ static int intel_hang_guc(void *arg) ...@@ -54,7 +55,7 @@ static int intel_hang_guc(void *arg)
ce = intel_context_create(engine); ce = intel_context_create(engine);
if (IS_ERR(ce)) { if (IS_ERR(ce)) {
ret = PTR_ERR(ce); ret = PTR_ERR(ce);
drm_err(&gt->i915->drm, "Failed to create spinner request: %d\n", ret); gt_err(gt, "Failed to create spinner request: %pe\n", ce);
goto err; goto err;
} }
...@@ -63,13 +64,13 @@ static int intel_hang_guc(void *arg) ...@@ -63,13 +64,13 @@ static int intel_hang_guc(void *arg)
old_beat = engine->props.heartbeat_interval_ms; old_beat = engine->props.heartbeat_interval_ms;
ret = intel_engine_set_heartbeat(engine, BEAT_INTERVAL); ret = intel_engine_set_heartbeat(engine, BEAT_INTERVAL);
if (ret) { if (ret) {
drm_err(&gt->i915->drm, "Failed to boost heatbeat interval: %d\n", ret); gt_err(gt, "Failed to boost heatbeat interval: %pe\n", ERR_PTR(ret));
goto err; goto err;
} }
ret = igt_spinner_init(&spin, engine->gt); ret = igt_spinner_init(&spin, engine->gt);
if (ret) { if (ret) {
drm_err(&gt->i915->drm, "Failed to create spinner: %d\n", ret); gt_err(gt, "Failed to create spinner: %pe\n", ERR_PTR(ret));
goto err; goto err;
} }
...@@ -77,28 +78,28 @@ static int intel_hang_guc(void *arg) ...@@ -77,28 +78,28 @@ static int intel_hang_guc(void *arg)
intel_context_put(ce); intel_context_put(ce);
if (IS_ERR(rq)) { if (IS_ERR(rq)) {
ret = PTR_ERR(rq); ret = PTR_ERR(rq);
drm_err(&gt->i915->drm, "Failed to create spinner request: %d\n", ret); gt_err(gt, "Failed to create spinner request: %pe\n", rq);
goto err_spin; goto err_spin;
} }
ret = request_add_spin(rq, &spin); ret = request_add_spin(rq, &spin);
if (ret) { if (ret) {
i915_request_put(rq); i915_request_put(rq);
drm_err(&gt->i915->drm, "Failed to add Spinner request: %d\n", ret); gt_err(gt, "Failed to add Spinner request: %pe\n", ERR_PTR(ret));
goto err_spin; goto err_spin;
} }
ret = intel_reset_guc(gt); ret = intel_reset_guc(gt);
if (ret) { if (ret) {
i915_request_put(rq); i915_request_put(rq);
drm_err(&gt->i915->drm, "Failed to reset GuC, ret = %d\n", ret); gt_err(gt, "Failed to reset GuC: %pe\n", ERR_PTR(ret));
goto err_spin; goto err_spin;
} }
guc_status = intel_uncore_read(gt->uncore, GUC_STATUS); guc_status = intel_uncore_read(gt->uncore, GUC_STATUS);
if (!(guc_status & GS_MIA_IN_RESET)) { if (!(guc_status & GS_MIA_IN_RESET)) {
i915_request_put(rq); i915_request_put(rq);
drm_err(&gt->i915->drm, "GuC failed to reset: status = 0x%08X\n", guc_status); gt_err(gt, "Failed to reset GuC: status = 0x%08X\n", guc_status);
ret = -EIO; ret = -EIO;
goto err_spin; goto err_spin;
} }
...@@ -107,12 +108,12 @@ static int intel_hang_guc(void *arg) ...@@ -107,12 +108,12 @@ static int intel_hang_guc(void *arg)
ret = intel_selftest_wait_for_rq(rq); ret = intel_selftest_wait_for_rq(rq);
i915_request_put(rq); i915_request_put(rq);
if (ret) { if (ret) {
drm_err(&gt->i915->drm, "Request failed to complete: %d\n", ret); gt_err(gt, "Request failed to complete: %pe\n", ERR_PTR(ret));
goto err_spin; goto err_spin;
} }
if (i915_reset_count(global) == reset_count) { if (i915_reset_count(global) == reset_count) {
drm_err(&gt->i915->drm, "Failed to record a GPU reset\n"); gt_err(gt, "Failed to record a GPU reset\n");
ret = -EINVAL; ret = -EINVAL;
goto err_spin; goto err_spin;
} }
...@@ -132,7 +133,7 @@ static int intel_hang_guc(void *arg) ...@@ -132,7 +133,7 @@ static int intel_hang_guc(void *arg)
ret = intel_selftest_wait_for_rq(rq); ret = intel_selftest_wait_for_rq(rq);
i915_request_put(rq); i915_request_put(rq);
if (ret) { if (ret) {
drm_err(&gt->i915->drm, "No-op failed to complete: %d\n", ret); gt_err(gt, "No-op failed to complete: %pe\n", ERR_PTR(ret));
goto err; goto err;
} }
} }
......
...@@ -3,6 +3,7 @@ ...@@ -3,6 +3,7 @@
* Copyright �� 2019 Intel Corporation * Copyright �� 2019 Intel Corporation
*/ */
#include "gt/intel_gt_print.h"
#include "selftests/igt_spinner.h" #include "selftests/igt_spinner.h"
#include "selftests/igt_reset.h" #include "selftests/igt_reset.h"
#include "selftests/intel_scheduler_helpers.h" #include "selftests/intel_scheduler_helpers.h"
...@@ -115,30 +116,30 @@ static int __intel_guc_multi_lrc_basic(struct intel_gt *gt, unsigned int class) ...@@ -115,30 +116,30 @@ static int __intel_guc_multi_lrc_basic(struct intel_gt *gt, unsigned int class)
parent = multi_lrc_create_parent(gt, class, 0); parent = multi_lrc_create_parent(gt, class, 0);
if (IS_ERR(parent)) { if (IS_ERR(parent)) {
drm_err(&gt->i915->drm, "Failed creating contexts: %ld", PTR_ERR(parent)); gt_err(gt, "Failed creating contexts: %pe\n", parent);
return PTR_ERR(parent); return PTR_ERR(parent);
} else if (!parent) { } else if (!parent) {
drm_dbg(&gt->i915->drm, "Not enough engines in class: %d", class); gt_dbg(gt, "Not enough engines in class: %d\n", class);
return 0; return 0;
} }
rq = multi_lrc_nop_request(parent); rq = multi_lrc_nop_request(parent);
if (IS_ERR(rq)) { if (IS_ERR(rq)) {
ret = PTR_ERR(rq); ret = PTR_ERR(rq);
drm_err(&gt->i915->drm, "Failed creating requests: %d", ret); gt_err(gt, "Failed creating requests: %pe\n", rq);
goto out; goto out;
} }
ret = intel_selftest_wait_for_rq(rq); ret = intel_selftest_wait_for_rq(rq);
if (ret) if (ret)
drm_err(&gt->i915->drm, "Failed waiting on request: %d", ret); gt_err(gt, "Failed waiting on request: %pe\n", ERR_PTR(ret));
i915_request_put(rq); i915_request_put(rq);
if (ret >= 0) { if (ret >= 0) {
ret = intel_gt_wait_for_idle(gt, HZ * 5); ret = intel_gt_wait_for_idle(gt, HZ * 5);
if (ret < 0) if (ret < 0)
drm_err(&gt->i915->drm, "GT failed to idle: %d\n", ret); gt_err(gt, "GT failed to idle: %pe\n", ERR_PTR(ret));
} }
out: out:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment