Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

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

authored by

Sebastian Andrzej Siewior and committed by
Maxime Ripard
f85376c8 b9578c49

+7 -1
+7 -1
drivers/gpu/drm/ttm/tests/ttm_bo_test.c
··· 18 18 19 19 #define BO_SIZE SZ_8K 20 20 21 + #ifdef CONFIG_PREEMPT_RT 22 + #define ww_mutex_base_lock(b) rt_mutex_lock(b) 23 + #else 24 + #define ww_mutex_base_lock(b) mutex_lock(b) 25 + #endif 26 + 21 27 struct ttm_bo_test_case { 22 28 const char *description; 23 29 bool interruptible; ··· 148 142 bo2 = ttm_bo_kunit_init(test, test->priv, BO_SIZE); 149 143 150 144 ww_acquire_init(&ctx1, &reservation_ww_class); 151 - mutex_lock(&bo2->base.resv->lock.base); 145 + ww_mutex_base_lock(&bo2->base.resv->lock.base); 152 146 153 147 /* The deadlock will be caught by WW mutex, don't warn about it */ 154 148 lock_release(&bo2->base.resv->lock.base.dep_map, 1);