Top | ![]() |
![]() |
![]() |
![]() |
void | igt_require_hang_ring () |
struct igt_hang_ring | igt_hang_ctx () |
struct igt_hang_ring | igt_hang_ring () |
void | igt_post_hang_ring () |
void | igt_force_gpu_reset () |
void | igt_fork_hang_helper () |
void | igt_stop_hang_helper () |
int | igt_open_forcewake_handle () |
enum stop_ring_flags | igt_to_stop_ring_flag () |
void | igt_set_stop_rings () |
enum stop_ring_flags | igt_get_stop_rings () |
int | igt_setup_clflush () |
void | igt_clflush_range () |
unsigned | intel_detect_and_clear_missed_interrupts () |
igt_hang_ring_t | |
#define | HANG_POISON |
#define | HANG_ALLOW_BAN |
#define | HANG_ALLOW_CAPTURE |
enum | stop_ring_flags |
This library provides various auxiliary helper functions to handle general interactions with the GT like forcewake handling, injecting hangs or stopping engines.
void igt_require_hang_ring (int fd
,int ring
);
Convenience helper to check whether advanced hang injection is supported by the kernel. Uses igt_skip to automatically skip the test/subtest if this isn't the case.
Note that we can't simply just call this from igt_hang_ring since some
tests want to exercise gpu wedging behavior. For which we intentionally
disable gpu reset support, but still want to inject a hang, see for example
tests/gem_eio.c Instead, we expect that the first invocation of
igt_require_hand_ring be from a vanilla context and use the has_gpu_reset()
determined then for all later instances. This allows us the convenience
of double checking when injecting hangs, whilst pushing the complexity
to the tests that are deliberating trying to break the box.
This function is also controlled by the environment variables:
IGT_HANG (boolean) - if false, skip all tests that try to inject a hang. Default: true
IGT_HANG_WITHOUT_RESET (boolean) - if true, allow the hang even if the kernel does not support GPU recovery. The machine will be wedged afterwards (and so require a reboot between testing), but it does allow limited testing to be done under hang injection. Default: false
struct igt_hang_ring igt_hang_ctx (int fd
,uint32_t ctx
,int ring
,unsigned flags
,uint64_t *offset
);
struct igt_hang_ring igt_hang_ring (int fd
,int ring
);
This helper function injects a hanging batch into ring
. It returns a
igt_hang_ring_t structure which must be passed to igt_post_hang_ring()
for
hang post-processing (after the gpu hang interaction has been tested.
void igt_post_hang_ring (int fd
,struct igt_hang_ring arg
);
This function does the necessary post-processing after a gpu hang injected
with igt_hang_ring()
.
void
igt_force_gpu_reset (void
);
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_fork_hang_helper (void
);
Fork a child process using igt_fork_helper to hang the default engine of the GPU at regular intervals.
This is useful to exercise slow running code (such as aperture placement) which needs to be robust against a GPU reset.
This function automatically skips when test requirements aren't met using
igt_skip()
.
void
igt_stop_hang_helper (void
);
Stops the child process spawned with igt_fork_hang_helper()
.
In tests with subtests this function can be called outside of failure catching code blocks like igt_fixture or igt_subtest.
int
igt_open_forcewake_handle (void
);
This functions opens the debugfs forcewake file and so prevents the GT from suspending. The reference is automatically dropped when the is closed.
enum stop_ring_flags
igt_to_stop_ring_flag (int ring
);
This converts the specified ring to a ring flag to be used
with igt_get_stop_rings()
and igt_set_stop_rings()
.
void
igt_set_stop_rings (enum stop_ring_flags flags
);
This writes flags
to 'i915_ring_stop' debugfs entry. Driver will
prevent the CPU from writing tail pointer for the ring that flags
specify. Note that the ring is not stopped right away. Instead any
further command emissions won't be executed after the flag is set.
This is the least invasive way to make the GPU stuck. Hence you must set this after a batch submission with it's own invalid or endless looping instructions. In this case it is merely for giving notification for the driver that this was simulated hang, as the batch would have caused hang in any case. On the other hand if you use a valid or noop batch and want to hang the ring (GPU), you must set corresponding flag before submitting the batch.
Driver checks periodically if a ring is making any progress, and if it is not, it will declare the ring to be hung and will reset the GPU. After reset, the driver will clear flags in 'i915_ring_stop'
Note: Always when hanging the GPU, use igt_set_stop_rings()
to
notify the driver. Driver controls hang log messaging based on
these flags and thus prevents false positives on logs.
enum stop_ring_flags
igt_get_stop_rings (void
);
Read current ring flags from 'i915_ring_stop' debugfs entry.
typedef struct { unsigned handle; unsigned ctx; unsigned ban; unsigned flags; } igt_hang_ring_t;
Enumeration of all supported flags for igt_set_stop_rings()
.
Can be used to clear the pending stop (warning: hang might
be declared already). Returned by |
||
Render ring |
||
Video encoding/decoding ring |
||
Blitter ring |
||
Video enhancement ring |
||
All rings |
||
Driver will not omit expected DRM_ERRORS |
||
Driver will use context ban policy |
||
STOP_RING_ALL | STOP_RING_ALLOW_ERRORS |