drm/i915/selftests: Use clear_and_wake_up_bit() for the per-engine reset bitlocks
authorThomas Hellström <thomas.hellstrom@linux.intel.com>
Fri, 5 Nov 2021 15:01:45 +0000 (16:01 +0100)
committerThomas Hellström <thomas.hellstrom@linux.intel.com>
Wed, 10 Nov 2021 08:04:30 +0000 (09:04 +0100)
commit9030e39cd115db3a93a6a5eebd70f5f9c462e4eb
tree372e351e8508fc325f6e56b701ee9f9153a4a02e
parent775affb06a5bc6051f48c935c86c99f849e2da09
drm/i915/selftests: Use clear_and_wake_up_bit() for the per-engine reset bitlocks

Some selftests assume that nothing will attempt to grab these bitlocks
while they are held by the selftests. With GuC, for example, that is
not true because the hanging workloads may cause the GuC code to attempt
to grab them for a global reset, and that may cause it to end up
sleeping on the bit never waking up. Regardless whether that will be
the final solution for GuC, use clear_and_wake_up_bit() pending a more
thorough investigation on how this should be handled moving forward.

To be clear this needs to be a temporary solution. If we can't find
an in-kernel locking primitive to use here, we should at the very least
add lockdep annotation to these bitlocks with a thorough explanation
as to why we need to use bits.

v3:
- Use GEM_BUG_ON(test_and_set_bit()) rather than set_bit() to verify
  the assumption that nothing is holding the reset locks when we
  attempt to grab them. (Chris Wilson)

Signed-off-by: Thomas Hellström <thomas.hellstrom@linux.intel.com>
Reviewed-by: Matthew Brost <matthew.brost@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20211105150146.834052-1-thomas.hellstrom@linux.intel.com
drivers/gpu/drm/i915/gt/selftest_hangcheck.c
drivers/gpu/drm/i915/selftests/igt_reset.c