drm/ttm/tests: Let ttm_bo_test consider different ww_mutex implementation.
authorSebastian Andrzej Siewior <bigeasy@linutronix.de>
Wed, 19 Jun 2024 14:46:30 +0000 (16:46 +0200)
committerMaxime Ripard <mripard@kernel.org>
Thu, 20 Jun 2024 08:02:03 +0000 (10:02 +0200)
commitf85376c890ef470b64a7fea22eea5af18822f05c
tree1954fa7a1f5f369c613dcf7c2632795f44f85473
parentb9578c49456340ca4d3c7ddbaca054ffc2b51bc1
drm/ttm/tests: Let ttm_bo_test consider different ww_mutex implementation.

PREEMPT_RT has a different locking implementation for ww_mutex. The
base mutex of struct ww_mutex is declared as struct WW_MUTEX_BASE. The
latter is defined as `mutex' for non-PREEMPT_RT builds and `rt_mutex'
for PREEMPT_RT builds.

Using mutex_lock() directly on the base mutex in
ttm_bo_reserve_deadlock() leads to compile error on PREEMPT_RT.

The locking-selftest has its own defines to deal with this and it is
probably best to defines the needed one within the test program since
their usefulness is limited outside of well known selftests.

Provide ww_mutex_base_lock() which points to the correct function for
PREEMPT_RT and non-PREEMPT_RT builds.

Fixes: 995279d280d1e ("drm/ttm/tests: Add tests for ttm_bo functions")
Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Signed-off-by: Maxime Ripard <mripard@kernel.org>
Link: https://patchwork.freedesktop.org/patch/msgid/20240619144630.4DliKOmr@linutronix.de
drivers/gpu/drm/ttm/tests/ttm_bo_test.c