[PATCH 5/7] ttm: add initial memcg integration. (v4)
kernel test robot
lkp at intel.com
Mon May 12 14:42:46 UTC 2025
Hi Dave,
kernel test robot noticed the following build errors:
[auto build test ERROR on akpm-mm/mm-everything]
url: https://github.com/intel-lab-lkp/linux/commits/Dave-Airlie/ttm-use-gpu-mm-stats-to-track-gpu-memory-allocations/20250512-182204
base: https://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm.git mm-everything
patch link: https://lore.kernel.org/r/20250512061913.3522902-6-airlied%40gmail.com
patch subject: [PATCH 5/7] ttm: add initial memcg integration. (v4)
config: riscv-randconfig-001-20250512 (https://download.01.org/0day-ci/archive/20250512/202505122244.IEuTPfWF-lkp@intel.com/config)
compiler: riscv64-linux-gcc (GCC) 7.5.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20250512/202505122244.IEuTPfWF-lkp@intel.com/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 <lkp at intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202505122244.IEuTPfWF-lkp@intel.com/
All error/warnings (new ones prefixed by >>):
drivers/gpu/drm/xe/xe_bo.c: In function 'xe_bo_evict_pinned':
>> drivers/gpu/drm/xe/xe_bo.c:1147:2: warning: the address of 'ctx' will always evaluate as 'true' [-Waddress]
ret = ttm_bo_populate(&bo->ttm, &ctx);
^~~
>> drivers/gpu/drm/xe/xe_bo.c:1147:8: error: too few arguments to function 'ttm_bo_populate'
ret = ttm_bo_populate(&bo->ttm, &ctx);
^~~~~~~~~~~~~~~
In file included from drivers/gpu/drm/xe/xe_bo_types.h:12:0,
from drivers/gpu/drm/xe/xe_bo.h:11,
from drivers/gpu/drm/xe/xe_bo.c:6:
include/drm/ttm/ttm_bo.h:494:5: note: declared here
int ttm_bo_populate(struct ttm_buffer_object *bo,
^~~~~~~~~~~~~~~
drivers/gpu/drm/xe/xe_bo.c: In function 'xe_bo_restore_pinned':
drivers/gpu/drm/xe/xe_bo.c:1208:2: warning: the address of 'ctx' will always evaluate as 'true' [-Waddress]
ret = ttm_bo_populate(&bo->ttm, &ctx);
^~~
drivers/gpu/drm/xe/xe_bo.c:1208:8: error: too few arguments to function 'ttm_bo_populate'
ret = ttm_bo_populate(&bo->ttm, &ctx);
^~~~~~~~~~~~~~~
In file included from drivers/gpu/drm/xe/xe_bo_types.h:12:0,
from drivers/gpu/drm/xe/xe_bo.h:11,
from drivers/gpu/drm/xe/xe_bo.c:6:
include/drm/ttm/ttm_bo.h:494:5: note: declared here
int ttm_bo_populate(struct ttm_buffer_object *bo,
^~~~~~~~~~~~~~~
vim +/ttm_bo_populate +1147 drivers/gpu/drm/xe/xe_bo.c
00c8efc3180f0c Thomas Hellström 2025-03-05 1096
36919ebeaacab3 Matthew Auld 2023-04-06 1097 /**
36919ebeaacab3 Matthew Auld 2023-04-06 1098 * xe_bo_evict_pinned() - Evict a pinned VRAM object to system memory
36919ebeaacab3 Matthew Auld 2023-04-06 1099 * @bo: The buffer object to move.
36919ebeaacab3 Matthew Auld 2023-04-06 1100 *
75fd04f276de31 Nitin Gote 2025-01-06 1101 * On successful completion, the object memory will be moved to system memory.
36919ebeaacab3 Matthew Auld 2023-04-06 1102 *
36919ebeaacab3 Matthew Auld 2023-04-06 1103 * This is needed to for special handling of pinned VRAM object during
36919ebeaacab3 Matthew Auld 2023-04-06 1104 * suspend-resume.
36919ebeaacab3 Matthew Auld 2023-04-06 1105 *
36919ebeaacab3 Matthew Auld 2023-04-06 1106 * Return: 0 on success. Negative error code on failure.
36919ebeaacab3 Matthew Auld 2023-04-06 1107 */
36919ebeaacab3 Matthew Auld 2023-04-06 1108 int xe_bo_evict_pinned(struct xe_bo *bo)
36919ebeaacab3 Matthew Auld 2023-04-06 1109 {
36919ebeaacab3 Matthew Auld 2023-04-06 1110 struct ttm_place place = {
36919ebeaacab3 Matthew Auld 2023-04-06 1111 .mem_type = XE_PL_TT,
36919ebeaacab3 Matthew Auld 2023-04-06 1112 };
36919ebeaacab3 Matthew Auld 2023-04-06 1113 struct ttm_placement placement = {
36919ebeaacab3 Matthew Auld 2023-04-06 1114 .placement = &place,
36919ebeaacab3 Matthew Auld 2023-04-06 1115 .num_placement = 1,
36919ebeaacab3 Matthew Auld 2023-04-06 1116 };
36919ebeaacab3 Matthew Auld 2023-04-06 1117 struct ttm_operation_ctx ctx = {
36919ebeaacab3 Matthew Auld 2023-04-06 1118 .interruptible = false,
6bd49cc1a8924c Thomas Hellström 2024-10-31 1119 .gfp_retry_mayfail = true,
36919ebeaacab3 Matthew Auld 2023-04-06 1120 };
36919ebeaacab3 Matthew Auld 2023-04-06 1121 struct ttm_resource *new_mem;
36919ebeaacab3 Matthew Auld 2023-04-06 1122 int ret;
36919ebeaacab3 Matthew Auld 2023-04-06 1123
36919ebeaacab3 Matthew Auld 2023-04-06 1124 xe_bo_assert_held(bo);
36919ebeaacab3 Matthew Auld 2023-04-06 1125
36919ebeaacab3 Matthew Auld 2023-04-06 1126 if (WARN_ON(!bo->ttm.resource))
36919ebeaacab3 Matthew Auld 2023-04-06 1127 return -EINVAL;
36919ebeaacab3 Matthew Auld 2023-04-06 1128
36919ebeaacab3 Matthew Auld 2023-04-06 1129 if (WARN_ON(!xe_bo_is_pinned(bo)))
36919ebeaacab3 Matthew Auld 2023-04-06 1130 return -EINVAL;
36919ebeaacab3 Matthew Auld 2023-04-06 1131
a19d1db9a3fa89 Matthew Brost 2024-10-31 1132 if (!xe_bo_is_vram(bo))
a19d1db9a3fa89 Matthew Brost 2024-10-31 1133 return 0;
36919ebeaacab3 Matthew Auld 2023-04-06 1134
36919ebeaacab3 Matthew Auld 2023-04-06 1135 ret = ttm_bo_mem_space(&bo->ttm, &placement, &new_mem, &ctx);
36919ebeaacab3 Matthew Auld 2023-04-06 1136 if (ret)
36919ebeaacab3 Matthew Auld 2023-04-06 1137 return ret;
36919ebeaacab3 Matthew Auld 2023-04-06 1138
36919ebeaacab3 Matthew Auld 2023-04-06 1139 if (!bo->ttm.ttm) {
36919ebeaacab3 Matthew Auld 2023-04-06 1140 bo->ttm.ttm = xe_ttm_tt_create(&bo->ttm, 0);
36919ebeaacab3 Matthew Auld 2023-04-06 1141 if (!bo->ttm.ttm) {
36919ebeaacab3 Matthew Auld 2023-04-06 1142 ret = -ENOMEM;
36919ebeaacab3 Matthew Auld 2023-04-06 1143 goto err_res_free;
36919ebeaacab3 Matthew Auld 2023-04-06 1144 }
36919ebeaacab3 Matthew Auld 2023-04-06 1145 }
36919ebeaacab3 Matthew Auld 2023-04-06 1146
fc5d96670eb254 Thomas Hellström 2024-09-11 @1147 ret = ttm_bo_populate(&bo->ttm, &ctx);
36919ebeaacab3 Matthew Auld 2023-04-06 1148 if (ret)
36919ebeaacab3 Matthew Auld 2023-04-06 1149 goto err_res_free;
36919ebeaacab3 Matthew Auld 2023-04-06 1150
36919ebeaacab3 Matthew Auld 2023-04-06 1151 ret = dma_resv_reserve_fences(bo->ttm.base.resv, 1);
36919ebeaacab3 Matthew Auld 2023-04-06 1152 if (ret)
36919ebeaacab3 Matthew Auld 2023-04-06 1153 goto err_res_free;
36919ebeaacab3 Matthew Auld 2023-04-06 1154
36919ebeaacab3 Matthew Auld 2023-04-06 1155 ret = xe_bo_move(&bo->ttm, false, &ctx, new_mem, NULL);
36919ebeaacab3 Matthew Auld 2023-04-06 1156 if (ret)
36919ebeaacab3 Matthew Auld 2023-04-06 1157 goto err_res_free;
36919ebeaacab3 Matthew Auld 2023-04-06 1158
36919ebeaacab3 Matthew Auld 2023-04-06 1159 return 0;
36919ebeaacab3 Matthew Auld 2023-04-06 1160
36919ebeaacab3 Matthew Auld 2023-04-06 1161 err_res_free:
36919ebeaacab3 Matthew Auld 2023-04-06 1162 ttm_resource_free(&bo->ttm, &new_mem);
36919ebeaacab3 Matthew Auld 2023-04-06 1163 return ret;
36919ebeaacab3 Matthew Auld 2023-04-06 1164 }
36919ebeaacab3 Matthew Auld 2023-04-06 1165
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
More information about the dri-devel
mailing list