tests/amd_dispatch: add reset subtest
PATCH 1/1 tests/amd_dispatch: add reset subtest
V2:
- improve subject and description (Kamil,Luben)
- sort the include alphabetically (Kamil)
- Optimize some code (Luben)
--- tests/amdgpu/amd_dispatch.c | 45 +++++++++++++++++++++++++++++++++++++ 1 file changed, 45 insertions(+)
tests/amdgpu/amd_dispatch.c +45 -0
@@ -5,6 +5,9 @@* Copyright 2023 Advanced Micro Devices, Inc. */ +#include <fcntl.h> +#include <sys/stat.h> +#include <sys/sysmacros.h> #include "lib/amdgpu/amd_memory.h" #include "lib/amdgpu/amd_command_submission.h" #include "lib/amdgpu/amd_dispatch.h"
@@ -21,6 +24,40 @@ amdgpu_dispatch_hang_slow_compute(amdgpu_device_handle device_handle)amdgpu_dispatch_hang_slow_helper (device_handle,AMDGPU_HW_IP_COMPUTE ); } +static void +amdgpu_gpu_reset_test (amdgpu_device_handle device_handle,int drm_amdgpu) +{ +amdgpu_context_handle context_handle; +char debugfs_path[256 ], tmp[10 ]; +uint32_t hang_state, hangs; +struct stat sbuf; +int r, fd; + + r =amdgpu_cs_ctx_create (device_handle, &context_handle); +igt_assert_eq (r,0 ); + + r =fstat (drm_amdgpu, &sbuf); +igt_assert_eq (r,0 ); + +sprintf (debugfs_path,"/sys/kernel/debug/dri/%d/amdgpu_gpu_recover" ,minor (sbuf.st_rdev)); + fd =open (debugfs_path,O_RDONLY ); +igt_assert_fd (fd); + + r =read (fd, tmp,ARRAY_SIZE (tmp)); +igt_assert_lt (0 ,r); + + r =amdgpu_cs_query_reset_state (context_handle, &hang_state, &hangs); +igt_assert_eq (r,0 ); +igt_assert_eq (hang_state,AMDGPU_CTX_UNKNOWN_RESET ); + +close (fd); + r =amdgpu_cs_ctx_free (context_handle); +igt_assert_eq (r,0 ); + +amdgpu_gfx_dispatch_test (device_handle,AMDGPU_HW_IP_GFX ); +amdgpu_gfx_dispatch_test (device_handle,AMDGPU_HW_IP_COMPUTE ); +} + igt_main {amdgpu_device_handle device;
@@ -64,6 +101,14 @@ igt_main } } +igt_describe ("Test-GPU-reset-using-amdgpu-debugfs-to-hang-the-job-on-gfx-ring" ); + igt_subtest_with_dynamic("amdgpu-reset-test-gfx-with-IP-GFX") { +if (arr_cap[AMD_IP_GFX ]) { + igt_dynamic_f("amdgpu-reset-gfx") +amdgpu_gpu_reset_test (device,fd); + } + } + igt_fixture {amdgpu_device_deinitialize (device);drm_close_driver (fd);
Signature · 1 line
2.25.1
[AMD Official Use Only - General]
Please ignore, will send a wrong version.
-----Original Message-----
From: Jesse Zhang <[email protected]>
Sent: Tuesday, September 26, 2023 1:55 PM
To: [email protected]
Cc: Prosyak, Vitaly <[email protected]>; Deucher, Alexander <[email protected]>; Tuikov, Luben <[email protected]>; Koenig, Christian <[email protected]>; Zhang, Jesse(Jie) <[email protected]>; Zhang, Jesse(Jie) <[email protected]>
Subject: [PATCH] tests/amd_dispatch: add reset subtest
V2:
- improve subject and description (Kamil,Luben)
- sort the include alphabetically (Kamil)
- Optimize some code (Luben)
--- tests/amdgpu/amd_dispatch.c | 45 +++++++++++++++++++++++++++++++++++++ 1 file changed, 45 insertions(+)
tests/amdgpu/amd_dispatch.c +44 -0
@@ -5,6 +5,9 @@* Copyright 2023 Advanced Micro Devices, Inc. */ +#include <fcntl.h> +#include <sys/stat.h> +#include <sys/sysmacros.h> #include "lib/amdgpu/amd_memory.h" #include "lib/amdgpu/amd_command_submission.h" #include "lib/amdgpu/amd_dispatch.h"
@@ -21,6 +24,40 @@ amdgpu_dispatch_hang_slow_compute(amdgpu_device_handle device_handle)amdgpu_dispatch_hang_slow_helper (device_handle,AMDGPU_HW_IP_COMPUTE ); } +static void +amdgpu_gpu_reset_test (amdgpu_device_handle device_handle,int +drm_amdgpu) { +amdgpu_context_handle context_handle; +char debugfs_path[256 ], tmp[10 ]; +uint32_t hang_state, hangs; +struct stat sbuf; +int r, fd; + + r =amdgpu_cs_ctx_create (device_handle, &context_handle); +igt_assert_eq (r,0 ); + + r =fstat (drm_amdgpu, &sbuf); +igt_assert_eq (r,0 ); + +sprintf (debugfs_path,"/sys/kernel/debug/dri/%d/amdgpu_gpu_recover" ,minor (sbuf.st_rdev)); + fd =open (debugfs_path,O_RDONLY ); +igt_assert_fd (fd); + + r =read (fd, tmp,ARRAY_SIZE (tmp)); +igt_assert_lt (0 ,r); + + r =amdgpu_cs_query_reset_state (context_handle, &hang_state, &hangs); +igt_assert_eq (r,0 ); +igt_assert_eq (hang_state,AMDGPU_CTX_UNKNOWN_RESET ); + +close (fd); + r =amdgpu_cs_ctx_free (context_handle); +igt_assert_eq (r,0 ); + +amdgpu_gfx_dispatch_test (device_handle,AMDGPU_HW_IP_GFX ); +amdgpu_gfx_dispatch_test (device_handle,AMDGPU_HW_IP_COMPUTE ); } + igt_main {amdgpu_device_handle device;
@@ -64,6 +101,14 @@ igt_main } } +igt_describe ("Test-GPU-reset-using-amdgpu-debugfs-to-hang-the-job-on-gfx-ring" ); + igt_subtest_with_dynamic("amdgpu-reset-test-gfx-with-IP-GFX") { +if (arr_cap[AMD_IP_GFX ]) { + igt_dynamic_f("amdgpu-reset-gfx") +amdgpu_gpu_reset_test (device,fd); + } + } + igt_fixture {amdgpu_device_deinitialize (device);drm_close_driver (fd);
--
2.25.1