✗ CI.checkpatch: warning for drm/ttm, drm/xe: Consolidate the Buffer Object LRU walks (rev2)

Patchwork patchwork at emeril.freedesktop.org
Mon Jun 23 16:00:20 UTC 2025


== Series Details ==

Series: drm/ttm, drm/xe: Consolidate the Buffer Object LRU walks (rev2)
URL   : https://patchwork.freedesktop.org/series/150242/
State : warning

== Summary ==

+ KERNEL=/kernel
+ git clone https://gitlab.freedesktop.org/drm/maintainer-tools mt
Cloning into 'mt'...
warning: redirecting to https://gitlab.freedesktop.org/drm/maintainer-tools.git/
+ git -C mt rev-list -n1 origin/master
f8ff75ae1d2127635239b134695774ed4045d05b
+ cd /kernel
+ git config --global --add safe.directory /kernel
+ git log -n1
commit cbd6c4ec7611685b346c4ad093431a4dcfd01877
Author: Thomas Hellström <thomas.hellstrom at linux.intel.com>
Date:   Mon Jun 23 17:53:13 2025 +0200

    drm/ttm, drm_xe, Implement ttm_lru_walk_for_evict() using the guarded LRU iteration
    
    To avoid duplicating the tricky bo locking implementation,
    Implement ttm_lru_walk_for_evict() using the guarded bo LRU iteration.
    
    To facilitate this, support ticketlocking from the guarded bo LRU
    iteration.
    
    v2:
    - Clean up some static function interfaces (Christian König)
    - Fix Handling -EALREADY from ticketlocking in the loop by
      skipping to the next item. (Intel CI)
    
    Signed-off-by: Thomas Hellström <thomas.hellstrom at linux.intel.com>
+ /mt/dim checkpatch 4d6ffa14a20201e284cfa94292fef8c73f618a90 drm-intel
315cc96d0dad drm/ttm: Use a struct for the common part of struct ttm_lru_walk and struct ttm_bo_lru_cursor
6d3c55d593de drm/ttm, drm/xe: Modify the struct ttm_bo_lru_walk_cursor initialization
-:127: ERROR:COMPLEX_MACRO: Macros with complex values should be enclosed in parentheses
#127: FILE: include/drm/ttm/ttm_bo.h:533:
+#define ttm_bo_lru_for_each_reserved_guarded(_cursor, _man, _arg, _bo)	\
+	scoped_guard(ttm_bo_lru_cursor, _cursor, _man, _arg)		\
 		for ((_bo) = ttm_bo_lru_cursor_first(_cursor); (_bo);	\
 		     (_bo) = ttm_bo_lru_cursor_next(_cursor))

BUT SEE:

   do {} while (0) advice is over-stated in a few situations:

   The more obvious case is macros, like MODULE_PARM_DESC, invoked at
   file-scope, where C disallows code (it must be in functions).  See
   $exceptions if you have one to add by name.

   More troublesome is declarative macros used at top of new scope,
   like DECLARE_PER_CPU.  These might just compile with a do-while-0
   wrapper, but would be incorrect.  Most of these are handled by
   detecting struct,union,etc declaration primitives in $exceptions.

   Theres also macros called inside an if (block), which "return" an
   expression.  These cannot do-while, and need a ({}) wrapper.

   Enjoy this qualification while we work to improve our heuristics.

-:127: CHECK:MACRO_ARG_REUSE: Macro argument reuse '_cursor' - possible side-effects?
#127: FILE: include/drm/ttm/ttm_bo.h:533:
+#define ttm_bo_lru_for_each_reserved_guarded(_cursor, _man, _arg, _bo)	\
+	scoped_guard(ttm_bo_lru_cursor, _cursor, _man, _arg)		\
 		for ((_bo) = ttm_bo_lru_cursor_first(_cursor); (_bo);	\
 		     (_bo) = ttm_bo_lru_cursor_next(_cursor))

-:127: CHECK:MACRO_ARG_REUSE: Macro argument reuse '_bo' - possible side-effects?
#127: FILE: include/drm/ttm/ttm_bo.h:533:
+#define ttm_bo_lru_for_each_reserved_guarded(_cursor, _man, _arg, _bo)	\
+	scoped_guard(ttm_bo_lru_cursor, _cursor, _man, _arg)		\
 		for ((_bo) = ttm_bo_lru_cursor_first(_cursor); (_bo);	\
 		     (_bo) = ttm_bo_lru_cursor_next(_cursor))

total: 1 errors, 0 warnings, 2 checks, 94 lines checked
cbd6c4ec7611 drm/ttm, drm_xe, Implement ttm_lru_walk_for_evict() using the guarded LRU iteration




More information about the Intel-xe mailing list