From mboxrd@z Thu Jan 1 00:00:00 1970 From: Claude Code Review Bot To: dri-devel-reviews@example.com Subject: Claude review: drm/ttm/tests: Fix build failure on PREEMPT_RT Date: Thu, 05 Mar 2026 13:40:45 +1000 Message-ID: In-Reply-To: <20260304085616.1216961-1-dev@lankhorst.se> References: <20260304085616.1216961-1-dev@lankhorst.se> <20260304085616.1216961-1-dev@lankhorst.se> X-Mailer: Claude Code Patch Reviewer Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Patch Review **Problem:** The test `ttm_bo_reserve_interrupted` directly locks the under= lying mutex of the dma_resv's ww_mutex via `mutex_lock(&bo->base.resv->lock= .base)`. On PREEMPT_RT, `struct mutex` becomes `struct rt_mutex` with a dif= ferent layout, causing a compile error. **Fix analysis:** The change from: ```c mutex_lock(&bo->base.resv->lock.base); ... mutex_unlock(&bo->base.resv->lock.base); ``` to: ```c dma_resv_lock(bo->base.resv, NULL); ... dma_resv_unlock(bo->base.resv); ``` is correct. Looking at the implementation in `include/linux/dma-resv.h:342`= , `dma_resv_lock()` with a NULL context calls `ww_mutex_lock(&obj->lock, NU= LL)`, which behaves as a plain lock without deadlock avoidance =E2=80=94 se= mantically equivalent to what the old code was doing by locking the base mu= tex directly. **Semantic correctness:** The test's purpose is for the main thread to hold= the reservation lock, then have `threaded_ttm_bo_reserve` (line 184) attem= pt to acquire it via `ttm_bo_reserve()` with a proper `ww_acquire_ctx`, exp= ecting the thread to be interrupted and return `-ERESTARTSYS`. Using `dma_r= esv_lock(NULL)` vs raw `mutex_lock` on the base doesn't change the contenti= on behavior =E2=80=94 the threaded locker will still block and get signaled. **Minor note:** `dma_resv_unlock()` (line 461) calls `dma_resv_reset_max_fe= nces(obj)` before `ww_mutex_unlock()`, which zeroes `obj->max_fences`. This= is a harmless side effect in this test context since no fences are attache= d. **v1 =E2=86=92 v2 change:** The changelog says "Use the correct locking pri= mitive (Jouni)", which aligns with this being the v2 improvement =E2=80=94 = using the proper API rather than some other workaround (likely `#ifdef PREE= MPT_RT` or similar in v1). **Reviewed-by worthy.** No issues found. --- Generated by Claude Code Patch Reviewer