Skip to contentSkip to conversation

drivers/gpu/drm/xe/display/intel_fb_bo.c:43:7: error: expected expression

PATCH New kernel test robot 2 participants 4 messages May 20, 2024 – May 21, 2024

Subsystems (3)
lore
Share & tools
lore

kernel test robot

author build bot
#0 lore raw
tree:   https://github.com/jimc/linux.git dd-classmap-fix-8c
head:   19c77819e39e4e7e74eef7f78bea70e004c6724c
commit: 51b0efcbcf9a4cfe4bdd5033286e703ed1d74b87 [32/34] drm: restore CONFIG_DRM_USE_DYNAMIC_DEBUG un-BROKEN
config: riscv-allmodconfig (https://download.01.org/0day-ci/archive/20240521/[email protected]/config)
compiler: clang version 19.0.0git (https://github.com/llvm/llvm-project fa9b1be45088dce1e4b602d451f118128b94237b)
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20240521/[email protected]/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <[email protected]>
| Closes: https://lore.kernel.org/oe-kbuild-all/[email protected]/

All errors (new ones prefixed by >>):

In file included from drivers/gpu/drm/xe/display/intel_fb_bo.c:8:
In file included from drivers/gpu/drm/xe/compat-i915-headers/i915_drv.h:15:
In file included from drivers/gpu/drm/xe/compat-i915-headers/gem/i915_gem_object.h:11:
In file included from drivers/gpu/drm/xe/xe_bo.h:9:
In file included from include/drm/ttm/ttm_tt.h:30:
In file included from include/linux/pagemap.h:8:
In file included from include/linux/mm.h:2210:
include/linux/vmstat.h:508:43: warning: arithmetic between different enumeration types ('enum zone_stat_item' and 'enum numa_stat_item') [-Wenum-enum-conversion]

     508 |         return vmstat_text[NR_VM_ZONE_STAT_ITEMS +
         |                            ~~~~~~~~~~~~~~~~~~~~~ ^
     509 |                            item];
         |                            ~~~~
   include/linux/vmstat.h:515:43: warning: arithmetic between different enumeration types ('enum zone_stat_item' and 'enum numa_stat_item') [-Wenum-enum-conversion]
     515 |         return vmstat_text[NR_VM_ZONE_STAT_ITEMS +
         |                            ~~~~~~~~~~~~~~~~~~~~~ ^
     516 |                            NR_VM_NUMA_EVENT_ITEMS +
         |                            ~~~~~~~~~~~~~~~~~~~~~~
   include/linux/vmstat.h:522:36: warning: arithmetic between different enumeration types ('enum node_stat_item' and 'enum lru_list') [-Wenum-enum-conversion]
     522 |         return node_stat_name(NR_LRU_BASE + lru) + 3; // skip "nr_"
         |                               ~~~~~~~~~~~ ^ ~~~
   include/linux/vmstat.h:527:43: warning: arithmetic between different enumeration types ('enum zone_stat_item' and 'enum numa_stat_item') [-Wenum-enum-conversion]
     527 |         return vmstat_text[NR_VM_ZONE_STAT_ITEMS +
         |                            ~~~~~~~~~~~~~~~~~~~~~ ^
     528 |                            NR_VM_NUMA_EVENT_ITEMS +
         |                            ~~~~~~~~~~~~~~~~~~~~~~
   include/linux/vmstat.h:536:43: warning: arithmetic between different enumeration types ('enum zone_stat_item' and 'enum numa_stat_item') [-Wenum-enum-conversion]
     536 |         return vmstat_text[NR_VM_ZONE_STAT_ITEMS +
         |                            ~~~~~~~~~~~~~~~~~~~~~ ^
     537 |                            NR_VM_NUMA_EVENT_ITEMS +
         |                            ~~~~~~~~~~~~~~~~~~~~~~
>> drivers/gpu/drm/xe/display/intel_fb_bo.c:43:7: error: expected expression
      43 |                 if (XE_IOCTL_DBG(i915, !list_empty(&bo->ttm.base.gpuva.list))) {
         |                     ^
   drivers/gpu/drm/xe/xe_macros.h:14:14: note: expanded from macro 'XE_IOCTL_DBG'
      14 |         ((cond) && (drm_dbg(&(xe)->drm, \
         |                     ^
   include/drm/drm_print.h:532:32: note: expanded from macro 'drm_dbg'
     532 | #define drm_dbg(drm, fmt, ...)  drm_dbg_driver(drm, fmt, ##__VA_ARGS__)
         |                                 ^
   include/drm/drm_print.h:514:2: note: expanded from macro 'drm_dbg_driver'
     514 |         drm_dev_dbg((drm) ? (drm)->dev : NULL, DRM_UT_DRIVER, fmt, ##__VA_ARGS__)
         |         ^
   include/drm/drm_print.h:435:2: note: expanded from macro 'drm_dev_dbg'
     435 |         _dynamic_func_call_cls(cat, fmt, __drm_dev_dbg,         \
         |         ^
   include/linux/dynamic_debug.h:317:2: note: expanded from macro '_dynamic_func_call_cls'
     317 |         __dynamic_func_call_cls(__UNIQUE_ID(ddebug), cls, fmt, func, ##__VA_ARGS__)
         |         ^
   include/linux/dynamic_debug.h:290:58: note: expanded from macro '__dynamic_func_call_cls'
     290 | #define __dynamic_func_call_cls(id, cls, fmt, func, ...) do {   \
         |                                                          ^

5 warnings and 1 error generated.

vim +43 drivers/gpu/drm/xe/display/intel_fb_bo.c

44e694958b95395 Maarten Lankhorst 2023-08-17  22  
44e694958b95395 Maarten Lankhorst 2023-08-17  23  int intel_fb_bo_framebuffer_init(struct intel_framebuffer *intel_fb,
44e694958b95395 Maarten Lankhorst 2023-08-17  24  				 struct xe_bo *bo,
44e694958b95395 Maarten Lankhorst 2023-08-17  25  				 struct drm_mode_fb_cmd2 *mode_cmd)
44e694958b95395 Maarten Lankhorst 2023-08-17  26  {
44e694958b95395 Maarten Lankhorst 2023-08-17  27  	struct drm_i915_private *i915 = to_i915(bo->ttm.base.dev);
44e694958b95395 Maarten Lankhorst 2023-08-17  28  	int ret;
44e694958b95395 Maarten Lankhorst 2023-08-17  29  
44e694958b95395 Maarten Lankhorst 2023-08-17  30  	xe_bo_get(bo);
44e694958b95395 Maarten Lankhorst 2023-08-17  31  
44e694958b95395 Maarten Lankhorst 2023-08-17  32  	ret = ttm_bo_reserve(&bo->ttm, true, false, NULL);
44e694958b95395 Maarten Lankhorst 2023-08-17  33  	if (ret)
652ead9b746a63e Maarten Lankhorst 2024-04-04  34  		goto err;
44e694958b95395 Maarten Lankhorst 2023-08-17  35  
44e694958b95395 Maarten Lankhorst 2023-08-17  36  	if (!(bo->flags & XE_BO_SCANOUT_BIT)) {
44e694958b95395 Maarten Lankhorst 2023-08-17  37  		/*
44e694958b95395 Maarten Lankhorst 2023-08-17  38  		 * XE_BO_SCANOUT_BIT should ideally be set at creation, or is
44e694958b95395 Maarten Lankhorst 2023-08-17  39  		 * automatically set when creating FB. We cannot change caching
44e694958b95395 Maarten Lankhorst 2023-08-17  40  		 * mode when the boect is VM_BINDed, so we can only set
44e694958b95395 Maarten Lankhorst 2023-08-17  41  		 * coherency with display when unbound.
44e694958b95395 Maarten Lankhorst 2023-08-17  42  		 */
44e694958b95395 Maarten Lankhorst 2023-08-17 @43  		if (XE_IOCTL_DBG(i915, !list_empty(&bo->ttm.base.gpuva.list))) {
44e694958b95395 Maarten Lankhorst 2023-08-17  44  			ttm_bo_unreserve(&bo->ttm);
652ead9b746a63e Maarten Lankhorst 2024-04-04  45  			ret = -EINVAL;
652ead9b746a63e Maarten Lankhorst 2024-04-04  46  			goto err;
44e694958b95395 Maarten Lankhorst 2023-08-17  47  		}
44e694958b95395 Maarten Lankhorst 2023-08-17  48  		bo->flags |= XE_BO_SCANOUT_BIT;
44e694958b95395 Maarten Lankhorst 2023-08-17  49  	}
44e694958b95395 Maarten Lankhorst 2023-08-17  50  	ttm_bo_unreserve(&bo->ttm);
652ead9b746a63e Maarten Lankhorst 2024-04-04  51  	return 0;
44e694958b95395 Maarten Lankhorst 2023-08-17  52  
652ead9b746a63e Maarten Lankhorst 2024-04-04  53  err:
652ead9b746a63e Maarten Lankhorst 2024-04-04  54  	xe_bo_put(bo);
44e694958b95395 Maarten Lankhorst 2023-08-17  55  	return ret;
44e694958b95395 Maarten Lankhorst 2023-08-17  56  }
44e694958b95395 Maarten Lankhorst 2023-08-17  57  

:::::: The code at line 43 was first introduced by commit
:::::: 44e694958b95395bd1c41508c88c8ca141bf9bd7 drm/xe/display: Implement display support

:::::: TO: Maarten Lankhorst <[email protected]> :::::: CC: Rodrigo Vivi <[email protected]>

Signature · 2 lines
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
maintainer
#1 lore raw

PATCH 1/2 dyndbg: make __dynamic_func_call_cls_no_desc an expression

The Xe driver has XE_IOCTL_DBG macro which calls drm_dbg() from inside an if (expression). This breaks when CONFIG_DRM_USE_DYNAMIC_DEBUG implements the call inside a do{}while(0) wrapper.

Fix it by changing __dynamic_func_call_cls_no_desc macro into an expression, by replacing the do-while(0) with a ({ }) wrapper.

---
 include/linux/dynamic_debug.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
include/linux/dynamic_debug.h +2 -2
index 19f959f9a6b4..7df67c4a917c 100644
@@ -296,11 +296,11 @@ void __dynamic_ibdev_dbg(struct _ddebug *descriptor,
 	__dynamic_func_call_cls(id, _DPRINTK_CLASS_DFLT, fmt,		\
 				func, ##__VA_ARGS__)
 
-#define __dynamic_func_call_cls_no_desc(id, cls, fmt, func, ...) do {	\
+#define __dynamic_func_call_cls_no_desc(id, cls, fmt, func, ...) ({	\
 	DEFINE_DYNAMIC_DEBUG_METADATA_CLS(id, cls, fmt);		\
 	if (DYNAMIC_DEBUG_BRANCH(id))					\
 		func(__VA_ARGS__);					\
-} while (0)
+})
 #define __dynamic_func_call_no_desc(id, fmt, func, ...)			\
 	__dynamic_func_call_cls_no_desc(id, _DPRINTK_CLASS_DFLT,	\
 					fmt, func, ##__VA_ARGS__)
Signature · 1 line
2.45.1
maintainer
#2 lore raw

PATCH 2/2 drm-xe: add DYNDBG_CLASSMAP_USE to Xe driver

Invoke DYNDBG_CLASSMAP_USE from xe_drm_client.c. When built with CONFIG_DRM_USE_DYNAMIC_DEBUG=y, all the drm_dbg_*() calls are implemented by dyndbg with JUMP_LABELS, and it needs to be authorized to adjust the callsites via drm.debug

---
 drivers/gpu/drm/xe/xe_drm_client.c | 2 ++
 1 file changed, 2 insertions(+)
drivers/gpu/drm/xe/xe_drm_client.c +2 -0
index 87c10bd7958b..c61163d0d945 100644
@@ -15,6 +15,8 @@
 #include "xe_drm_client.h"
 #include "xe_trace.h"
 
+DRM_CLASSMAP_USE(drm_debug_classes);
+
 /**
  * xe_drm_client_alloc() - Allocate drm client
  * @void: No arg
Signature · 1 line
2.45.1
maintainer
#3 lore raw

PATCH 1/2 dyndbg: make __dynamic_func_call_cls_no_desc an expression

In reply to kernel test robot

The Xe driver has XE_IOCTL_DBG macro which calls drm_dbg() from inside an if (expression). This breaks when CONFIG_DRM_USE_DYNAMIC_DEBUG implements the call inside a do{}while(0) wrapper.

Fix it by changing __dynamic_func_call_cls_no_desc macro into an expression, by replacing the do-while(0) with a ({ }) wrapper.

---
 include/linux/dynamic_debug.h | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
include/linux/dynamic_debug.h +4 -4
index 19f959f9a6b4..121a66b0ca25 100644
@@ -287,20 +287,20 @@ void __dynamic_ibdev_dbg(struct _ddebug *descriptor,
  * (|_cls):	adds in _DPRINT_CLASS_DFLT as needed
  * (|_no_desc):	former gets callsite descriptor as 1st arg (for prdbgs)
  */
-#define __dynamic_func_call_cls(id, cls, fmt, func, ...) do {	\
+#define __dynamic_func_call_cls(id, cls, fmt, func, ...) ({	\
 	DEFINE_DYNAMIC_DEBUG_METADATA_CLS(id, cls, fmt);	\
 	if (DYNAMIC_DEBUG_BRANCH(id))				\
 		func(&id, ##__VA_ARGS__);			\
-} while (0)
+})
 #define __dynamic_func_call(id, fmt, func, ...)				\
 	__dynamic_func_call_cls(id, _DPRINTK_CLASS_DFLT, fmt,		\
 				func, ##__VA_ARGS__)
 
-#define __dynamic_func_call_cls_no_desc(id, cls, fmt, func, ...) do {	\
+#define __dynamic_func_call_cls_no_desc(id, cls, fmt, func, ...) ({	\
 	DEFINE_DYNAMIC_DEBUG_METADATA_CLS(id, cls, fmt);		\
 	if (DYNAMIC_DEBUG_BRANCH(id))					\
 		func(__VA_ARGS__);					\
-} while (0)
+})
 #define __dynamic_func_call_no_desc(id, fmt, func, ...)			\
 	__dynamic_func_call_cls_no_desc(id, _DPRINTK_CLASS_DFLT,	\
 					fmt, func, ##__VA_ARGS__)
Signature · 1 line
2.45.1