mirror of
https://github.com/tiagovignatti/intel-gpu-tools.git
synced 2025-06-10 01:16:18 +00:00
lib: move i915_wedged_set to ig_gt.c
Upcoming tests will call it to recover from bad states caused by hangcheck bugs.the function was renamed to igt_force_gpu_reset to have a naming closer to other hang-related functions in the same file. The value written to the debugfs has also been changed to -1; this makes no differences with the current implementation but copes with upcoming TDR changes (still under discussion) that should allow the resetting of a mask of rings. Signed-off-by: Daniele Ceraolo Spurio <daniele.ceraolospurio@intel.com> Signed-off-by: Mika Kuoppala <mika.kuoppala@intel.com>
This commit is contained in:
parent
094e0cbabb
commit
03c7f84eb1
23
lib/igt_gt.c
23
lib/igt_gt.c
@ -269,6 +269,29 @@ void igt_post_hang_ring(int fd, struct igt_hang_ring arg)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* igt_force_gpu_reset:
|
||||||
|
*
|
||||||
|
* forces a gpu reset using the i915_wedged debugfs interface. To be used to
|
||||||
|
* recover from situations where the hangcheck didn't trigger and/or the gpu is
|
||||||
|
* stuck, either because the test manually disabled gpu resets or because the
|
||||||
|
* test hit an hangcheck bug
|
||||||
|
*/
|
||||||
|
void igt_force_gpu_reset(void)
|
||||||
|
{
|
||||||
|
int fd, ret;
|
||||||
|
|
||||||
|
igt_debug("Triggering GPU reset\n");
|
||||||
|
|
||||||
|
fd = igt_debugfs_open("i915_wedged", O_RDWR);
|
||||||
|
igt_require(fd >= 0);
|
||||||
|
|
||||||
|
ret = write(fd, "-1\n", 3);
|
||||||
|
close(fd);
|
||||||
|
|
||||||
|
igt_assert_eq(ret, 3);
|
||||||
|
}
|
||||||
|
|
||||||
/* GPU abusers */
|
/* GPU abusers */
|
||||||
static struct igt_helper_process hang_helper;
|
static struct igt_helper_process hang_helper;
|
||||||
static void __attribute__((noreturn))
|
static void __attribute__((noreturn))
|
||||||
|
@ -48,6 +48,8 @@ struct igt_hang_ring igt_hang_ctx(int fd,
|
|||||||
struct igt_hang_ring igt_hang_ring(int fd, int ring);
|
struct igt_hang_ring igt_hang_ring(int fd, int ring);
|
||||||
void igt_post_hang_ring(int fd, struct igt_hang_ring arg);
|
void igt_post_hang_ring(int fd, struct igt_hang_ring arg);
|
||||||
|
|
||||||
|
void igt_force_gpu_reset(void);
|
||||||
|
|
||||||
void igt_fork_hang_helper(void);
|
void igt_fork_hang_helper(void);
|
||||||
void igt_stop_hang_helper(void);
|
void igt_stop_hang_helper(void);
|
||||||
|
|
||||||
|
@ -58,24 +58,9 @@ static bool i915_reset_control(bool enable)
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool i915_wedged_set(void)
|
|
||||||
{
|
|
||||||
int fd, ret;
|
|
||||||
|
|
||||||
igt_debug("Triggering GPU reset\n");
|
|
||||||
|
|
||||||
fd = igt_debugfs_open("i915_wedged", O_RDWR);
|
|
||||||
igt_require(fd >= 0);
|
|
||||||
|
|
||||||
ret = write(fd, "1\n", 2) == 2;
|
|
||||||
close(fd);
|
|
||||||
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
|
|
||||||
static void trigger_reset(int fd)
|
static void trigger_reset(int fd)
|
||||||
{
|
{
|
||||||
igt_assert(i915_wedged_set());
|
igt_force_gpu_reset();
|
||||||
|
|
||||||
/* And just check the gpu is indeed running again */
|
/* And just check the gpu is indeed running again */
|
||||||
igt_debug("Checking that the GPU recovered\n");
|
igt_debug("Checking that the GPU recovered\n");
|
||||||
|
Loading…
x
Reference in New Issue
Block a user