Igt-dev Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: <vitaly.prosyak@amd.com>
To: <igt-dev@lists.freedesktop.org>
Cc: Luben Tuikov <luben.tuikov@amd.com>,
	Alex Deucher <alexander.deucher@amd.com>,
	Christian Koenig <christian.koenig@amd.com>
Subject: [igt-dev] [PATCH 1/2] tests/amdgpu: split deadlock tests
Date: Fri, 22 Sep 2023 19:42:03 -0400	[thread overview]
Message-ID: <20230922234204.9782-1-vitaly.prosyak@amd.com> (raw)

From: Vitaly Prosyak <vitaly.prosyak@amd.com>

Split GPU reset (known as deadlock) tests into
command-based (deadlock) and the other using binary shaders
(dispatch).The one of primary reasons for splitting is to use
new functions like 'amdgpu_cs_query_reset_state2' in next commits.
No functional change.
Some code formatting  improvements to meet IGT guidelines.
Added igt_describe for GPU reset tests known now as deadlock and
dispatch based tests.

Cc: Luben Tuikov <luben.tuikov@amd.com>
Cc: Alex Deucher <alexander.deucher@amd.com>
Cc: Christian Koenig <christian.koenig@amd.com>
Cc: Jesse Zhang <Jesse.Zhang@amd.com>
Cc: Kamil Konieczny <kamil.konieczny@linux.intel.com>

Signed-off-by: Vitaly Prosyak <vitaly.prosyak@amd.com>
Reviewed-by: Jesse Zhang <Jesse.Zhang@amd.com>
---
 tests/amdgpu/amd_deadlock.c | 60 +++++++++---------------------------
 tests/amdgpu/amd_dispatch.c | 61 +++++++++++++++++++++++++++++++++++++
 tests/amdgpu/meson.build    |  1 +
 3 files changed, 76 insertions(+), 46 deletions(-)
 create mode 100644 tests/amdgpu/amd_dispatch.c

diff --git a/tests/amdgpu/amd_deadlock.c b/tests/amdgpu/amd_deadlock.c
index d805b8d18..0a81f3717 100644
--- a/tests/amdgpu/amd_deadlock.c
+++ b/tests/amdgpu/amd_deadlock.c
@@ -1,45 +1,14 @@
-/* SPDX-License-Identifier: MIT
+// SPDX-License-Identifier: MIT
+/*
  * Copyright 2014 Advanced Micro Devices, Inc.
  * Copyright 2022 Advanced Micro Devices, Inc.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in
- * all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
- * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
- * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
- * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
- * OTHER DEALINGS IN THE SOFTWARE.
- *
- * Based on libdrm/tests/amdgpu/deadlock_tests.c
+ * Copyright 2023 Advanced Micro Devices, Inc.
  */
 
 #include "lib/amdgpu/amd_memory.h"
 #include "lib/amdgpu/amd_command_submission.h"
-#include "lib/amdgpu/amd_dispatch.h"
 #include "lib/amdgpu/amd_deadlock_helpers.h"
 
-static void
-amdgpu_dispatch_hang_slow_gfx(amdgpu_device_handle device_handle)
-{
-	amdgpu_dispatch_hang_slow_helper(device_handle, AMDGPU_HW_IP_GFX);
-}
-
-static void
-amdgpu_dispatch_hang_slow_compute(amdgpu_device_handle device_handle)
-{
-	amdgpu_dispatch_hang_slow_helper(device_handle, AMDGPU_HW_IP_COMPUTE);
-}
-
 static void
 amdgpu_deadlock_gfx(amdgpu_device_handle device_handle)
 {
@@ -91,31 +60,30 @@ igt_main
 
 		r = amdgpu_query_gpu_info(device, &gpu_info);
 		igt_assert_eq(r, 0);
-		r = setup_amdgpu_ip_blocks( major, minor,  &gpu_info, device);
+		r = setup_amdgpu_ip_blocks(major, minor, &gpu_info, device);
 		igt_assert_eq(r, 0);
 
 	}
-	igt_subtest("amdgpu_deadlock_sdma")
+	igt_describe("Test-GPU-reset-by-flooding-sdma-ring-with-jobs");
+	igt_subtest("amdgpu-deadlock-sdma")
 	amdgpu_deadlock_sdma(device);
 
-	igt_subtest("amdgpu_gfx_illegal_reg_access")
+	igt_describe("Test-GPU-reset-by-access-gfx-illegal-reg");
+	igt_subtest("amdgpu-gfx-illegal-reg-access")
 	amdgpu_gfx_illegal_reg_access(device);
 
-	igt_subtest("amdgpu_gfx_illegal_mem_access")
+	igt_describe("Test-GPU-reset-by-access-gfx-illegal-mem-addr");
+	igt_subtest("amdgpu-gfx-illegal-mem-access")
 	amdgpu_gfx_illegal_mem_access(device);
 
-	igt_subtest("amdgpu_deadlock_gfx")
+	igt_describe("Test-GPU-reset-by-flooding-gfx-ring-with-jobs");
+	igt_subtest("amdgpu-deadlock-gfx")
 	amdgpu_deadlock_gfx(device);
 
-	igt_subtest("amdgpu_deadlock_compute")
+	igt_describe("Test-GPU-reset-by-flooding-compute-ring-with-jobs");
+	igt_subtest("amdgpu-deadlock-compute")
 	amdgpu_deadlock_compute(device);
 
-	igt_subtest("dispatch_hang_slow_compute")
-	amdgpu_dispatch_hang_slow_compute(device);
-
-	igt_subtest("dispatch_hang_slow_gfx")
-	amdgpu_dispatch_hang_slow_gfx(device);
-
 	igt_fixture {
 		amdgpu_device_deinitialize(device);
 		drm_close_driver(fd);
diff --git a/tests/amdgpu/amd_dispatch.c b/tests/amdgpu/amd_dispatch.c
new file mode 100644
index 000000000..f87acbcae
--- /dev/null
+++ b/tests/amdgpu/amd_dispatch.c
@@ -0,0 +1,61 @@
+// SPDX-License-Identifier: MIT
+/*
+ * Copyright 2014 Advanced Micro Devices, Inc.
+ * Copyright 2022 Advanced Micro Devices, Inc.
+ * Copyright 2023 Advanced Micro Devices, Inc.
+ */
+
+#include "lib/amdgpu/amd_memory.h"
+#include "lib/amdgpu/amd_command_submission.h"
+#include "lib/amdgpu/amd_dispatch.h"
+
+static void
+amdgpu_dispatch_hang_slow_gfx(amdgpu_device_handle device_handle)
+{
+	amdgpu_dispatch_hang_slow_helper(device_handle, AMDGPU_HW_IP_GFX);
+}
+
+static void
+amdgpu_dispatch_hang_slow_compute(amdgpu_device_handle device_handle)
+{
+	amdgpu_dispatch_hang_slow_helper(device_handle, AMDGPU_HW_IP_COMPUTE);
+}
+
+igt_main
+{
+	amdgpu_device_handle device;
+	struct amdgpu_gpu_info gpu_info = {0};
+	int fd = -1;
+	int r;
+
+	igt_fixture {
+		uint32_t major, minor;
+		int err;
+
+		fd = drm_open_driver(DRIVER_AMDGPU);
+
+		err = amdgpu_device_initialize(fd, &major, &minor, &device);
+		igt_require(err == 0);
+
+		igt_info("Initialized amdgpu, driver version %d.%d\n",
+			 major, minor);
+
+		r = amdgpu_query_gpu_info(device, &gpu_info);
+		igt_assert_eq(r, 0);
+		r = setup_amdgpu_ip_blocks(major, minor, &gpu_info, device);
+		igt_assert_eq(r, 0);
+
+	}
+	igt_describe("Test-GPU-reset-using-a-binary-shader-to-hang-the-job-on-compute-ring");
+	igt_subtest("dispatch-hang-slow-compute")
+	amdgpu_dispatch_hang_slow_compute(device);
+
+	igt_describe("Test-GPU-reset-using-a-binary-shader-to-hang-the-job-on-gfx-ring");
+	igt_subtest("dispatch-hang-slow-gfx")
+	amdgpu_dispatch_hang_slow_gfx(device);
+
+	igt_fixture {
+		amdgpu_device_deinitialize(device);
+		drm_close_driver(fd);
+	}
+}
diff --git a/tests/amdgpu/meson.build b/tests/amdgpu/meson.build
index ebf52bf38..37e09b5fb 100644
--- a/tests/amdgpu/meson.build
+++ b/tests/amdgpu/meson.build
@@ -11,6 +11,7 @@ if libdrm_amdgpu.found()
 			  'amd_cp_dma_misc',
 			  'amd_cs_nop',
 			  'amd_deadlock',
+			  'amd_dispatch',
 			  'amd_dp_dsc',
 			  'amd_freesync_video_mode',
 			  'amd_hotplug',
-- 
2.25.1

             reply	other threads:[~2023-09-22 23:42 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-09-22 23:42 vitaly.prosyak [this message]
2023-09-22 23:42 ` [igt-dev] [PATCH 2/2] tests/amdgpu: add GFX11 to dispatch tests vitaly.prosyak
2023-09-23  0:05 ` [igt-dev] ✗ GitLab.Pipeline: warning for series starting with [1/2] tests/amdgpu: split deadlock tests Patchwork
2023-09-23  0:38 ` [igt-dev] ✓ Fi.CI.BAT: success " Patchwork
2023-09-23  1:20 ` [igt-dev] ✓ CI.xeBAT: " Patchwork
2023-09-24  4:49 ` [igt-dev] ✗ Fi.CI.IGT: failure " Patchwork
  -- strict thread matches above, loose matches on Subject: below --
2023-09-26  0:51 [igt-dev] [PATCH 1/2] " vitaly.prosyak

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=20230922234204.9782-1-vitaly.prosyak@amd.com \
    --to=vitaly.prosyak@amd.com \
    --cc=alexander.deucher@amd.com \
    --cc=christian.koenig@amd.com \
    --cc=igt-dev@lists.freedesktop.org \
    --cc=luben.tuikov@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