Igt-dev Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Jesse Zhang <Jesse.Zhang@amd.com>
To: <igt-dev@lists.freedesktop.org>
Cc: Vitaly Prosyak <vitaly.prosyak@amd.com>,
	Alex Deucher <alexander.deucher@amd.com>,
	Christian Koenig <christian.koenig@amd.com>,
	Jesse Zhang <Jesse.Zhang@amd.com>,
	Jesse Zhang <jesse.zhang@amd.com>
Subject: [PATCH i-g-t] tests/amdgpu/amd_queue_reset: Fix random hang during queue reset stress
Date: Thu, 9 Jul 2026 16:43:15 +0800	[thread overview]
Message-ID: <20260709084324.1913977-1-Jesse.Zhang@amd.com> (raw)

A concurrent "good" background job can be collateral-cancelled by the queue
reset and return an error the good-job path did not tolerate, tripping
igt_assert_eq() and aborting the background process. Its death breaks the
fixed NUM_CHILD_PROCESSES barrier, so the survivors block forever in
sem_wait().

Tolerate every reset-induced error on good jobs: unify the two asymmetric
allow-lists in amdgpu_test_exec_cs_helper() and add -EHWPOISON in
run_background(), so the process never aborts and the barrier cannot deadlock.

Signed-off-by: Jesse Zhang <jesse.zhang@amd.com>
---
 lib/amdgpu/amd_command_submission.c | 14 ++++++++++----
 tests/amdgpu/amd_queue_reset.c      | 10 +++++++++-
 2 files changed, 19 insertions(+), 5 deletions(-)

diff --git a/lib/amdgpu/amd_command_submission.c b/lib/amdgpu/amd_command_submission.c
index a0777e5ae..0334c2ded 100644
--- a/lib/amdgpu/amd_command_submission.c
+++ b/lib/amdgpu/amd_command_submission.c
@@ -119,8 +119,11 @@ int amdgpu_test_exec_cs_helper(amdgpu_device_handle device, unsigned int ip_type
 		if (expect_failure)
 			igt_info("amdgpu_cs_submit %d PID %d\n", r, getpid());
 		else {
-			/* we allow ECANCELED, ENODATA or -EHWPOISON for good jobs temporally */
-			if (r != -ECANCELED && r != -ENODATA && r != -EHWPOISON)
+			/* a good job may be collateral-cancelled by a concurrent
+			 * queue reset; tolerate every reset-induced error
+			 */
+			if (r != -ECANCELED && r != -ENODATA && r != -EHWPOISON &&
+			    r != -ETIME)
 				igt_assert_eq(r, 0);
 		}
 
@@ -142,8 +145,11 @@ int amdgpu_test_exec_cs_helper(amdgpu_device_handle device, unsigned int ip_type
 			igt_info("EXPECT FAILURE amdgpu_cs_query_fence_status %d\n"
 				 "expired %d PID %d\n", r, expired, getpid());
 		} else {
-			/* we allow ECANCELED or ENODATA for good jobs temporally */
-			if (r != -ECANCELED && r != -ENODATA && r != -ETIME)
+			/* a good job may be collateral-cancelled by a concurrent
+			 * queue reset; tolerate every reset-induced error
+			 */
+			if (r != -ECANCELED && r != -ENODATA && r != -ETIME &&
+			    r != -EHWPOISON)
 				igt_assert_eq(r, 0);
 		}
 	}
diff --git a/tests/amdgpu/amd_queue_reset.c b/tests/amdgpu/amd_queue_reset.c
index 546845d29..ebd7c8682 100644
--- a/tests/amdgpu/amd_queue_reset.c
+++ b/tests/amdgpu/amd_queue_reset.c
@@ -840,7 +840,15 @@ run_background(amdgpu_device_handle device, struct shmbuf *sh_mem,
 				//if entire gpu reset then stop back ground jobs
 				break;
 			}
-			if (r != -ECANCELED && r != -ETIME && r != -ENODATA)
+			/*
+			 * A "good" background job can be collateral-cancelled by
+			 * the concurrent queue reset triggered by the bad job.
+			 * Tolerate every reset-induced error so the helper never
+			 * aborts this process - its death would break the
+			 * NUM_CHILD_PROCESSES barrier and hang the whole test.
+			 */
+			if (r != -ECANCELED && r != -ETIME && r != -ENODATA &&
+			    r != -EHWPOISON)
 				igt_assert_eq(r, 0);
 			//igt_assert_eq(err_codes.err_code_wait_for_fence, job.reset_err_result);
 			counter++;
-- 
2.49.0


             reply	other threads:[~2026-07-09  8:44 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-07-09  8:43 Jesse Zhang [this message]
2026-07-09 19:09 ` [PATCH i-g-t] tests/amdgpu/amd_queue_reset: Fix random hang during queue reset stress vitaly prosyak
2026-07-09 22:10 ` ✗ Fi.CI.BAT: failure for " Patchwork

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260709084324.1913977-1-Jesse.Zhang@amd.com \
    --to=jesse.zhang@amd.com \
    --cc=alexander.deucher@amd.com \
    --cc=christian.koenig@amd.com \
    --cc=igt-dev@lists.freedesktop.org \
    --cc=vitaly.prosyak@amd.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox