Re: [Intel-gfx] [PATCH] drm/ttm: replace busy placement with flags v3
Hi Somalapuram, kernel test robot noticed the following build warnings: [auto build test WARNING on drm-tip/drm-tip] url: https://github.com/intel-lab-lkp/linux/commits/Somalapuram-Amaranath/drm-ttm-replace-busy-placement-with-flags-v3/20231113-190252 base: git://anongit.freedesktop.org/drm/drm-tip drm-tip patch link: https://lore.kernel.org/r/20231113110016.462621-1-Amaranath.Somalapuram%40amd.com patch subject: [Intel-gfx] [PATCH] drm/ttm: replace busy placement with flags v3 config: i386-randconfig-061-20231123 (https://download.01.org/0day-ci/archive/20231123/202311231106.fulszizp-...@intel.com/config) compiler: gcc-12 (Debian 12.2.0-14) 12.2.0 reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20231123/202311231106.fulszizp-...@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 | Closes: https://lore.kernel.org/oe-kbuild-all/202311231106.fulszizp-...@intel.com/ sparse warnings: (new ones prefixed by >>) >> drivers/gpu/drm/vmwgfx/vmwgfx_ttm_buffer.c:77:22: sparse: sparse: symbol >> 'vmw_vram_sys_placement' was not declared. Should it be static? drivers/gpu/drm/vmwgfx/vmwgfx_ttm_buffer.c:101:22: sparse: sparse: symbol 'vmw_pt_sys_placement' was not declared. Should it be static? >> drivers/gpu/drm/vmwgfx/vmwgfx_ttm_buffer.c:120:22: sparse: sparse: symbol >> 'vmw_srf_placement' was not declared. Should it be static? >> drivers/gpu/drm/vmwgfx/vmwgfx_ttm_buffer.c:144:22: sparse: sparse: symbol >> 'vmw_nonfixed_placement' was not declared. Should it be static? vim +/vmw_vram_sys_placement +77 drivers/gpu/drm/vmwgfx/vmwgfx_ttm_buffer.c 76 > 77 struct ttm_placement vmw_vram_sys_placement = { 78 .num_placement = 2, 79 .placement = vram_sys_placement_flags, 80 }; 81 82 static const struct ttm_place sys_placement_flags = { 83 .fpfn = 0, 84 .lpfn = 0, 85 .mem_type = TTM_PL_SYSTEM, 86 .flags = 0 87 }; 88 89 struct ttm_placement vmw_sys_placement = { 90 .num_placement = 1, 91 .placement = _placement_flags, 92 }; 93 94 static const struct ttm_place vmw_sys_placement_flags = { 95 .fpfn = 0, 96 .lpfn = 0, 97 .mem_type = VMW_PL_SYSTEM, 98 .flags = 0 99 }; 100 101 struct ttm_placement vmw_pt_sys_placement = { 102 .num_placement = 1, 103 .placement = _sys_placement_flags, 104 }; 105 106 static const struct ttm_place gmr_vram_placement_flags[] = { 107 { 108 .fpfn = 0, 109 .lpfn = 0, 110 .mem_type = VMW_PL_GMR, 111 .flags = 0 112 }, { 113 .fpfn = 0, 114 .lpfn = 0, 115 .mem_type = TTM_PL_VRAM, 116 .flags = TTM_PL_FLAG_BUSY 117 } 118 }; 119 > 120 struct ttm_placement vmw_srf_placement = { 121 .num_placement = 2, 122 .placement = gmr_vram_placement_flags 123 }; 124 125 static const struct ttm_place nonfixed_placement_flags[] = { 126 { 127 .fpfn = 0, 128 .lpfn = 0, 129 .mem_type = TTM_PL_SYSTEM, 130 .flags = 0 131 }, { 132 .fpfn = 0, 133 .lpfn = 0, 134 .mem_type = VMW_PL_GMR, 135 .flags = TTM_PL_FLAG_IDLE 136 }, { 137 .fpfn = 0, 138 .lpfn = 0, 139 .mem_type = VMW_PL_MOB, 140 .flags = TTM_PL_FLAG_IDLE 141 } 142 }; 143 > 144 struct ttm_placement vmw_nonfixed_placement = { 145 .num_placement = 3, 146 .placement = nonfixed_placement_flags, 147 }; 148 -- 0-DAY CI Kernel Test Service https://github.com/intel/lkp-tests/wiki
[Intel-gfx] [PATCH] drm/ttm: replace busy placement with flags v3
Instead of a list of separate busy placement add flags which indicate that a placement should only be used when there is room or if we need to evict. v2: add missing TTM_PL_FLAG_IDLE for i915 v3: fix auto build test ERROR on drm-tip/drm-tip Signed-off-by: Christian König --- drivers/gpu/drm/amd/amdgpu/amdgpu_object.c | 6 +- drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c| 11 +-- drivers/gpu/drm/drm_gem_vram_helper.c | 2 - drivers/gpu/drm/i915/gem/i915_gem_ttm.c| 37 drivers/gpu/drm/loongson/lsdc_ttm.c| 2 - drivers/gpu/drm/nouveau/nouveau_bo.c | 59 + drivers/gpu/drm/nouveau/nouveau_bo.h | 1 - drivers/gpu/drm/qxl/qxl_object.c | 2 - drivers/gpu/drm/qxl/qxl_ttm.c | 2 - drivers/gpu/drm/radeon/radeon_object.c | 2 - drivers/gpu/drm/radeon/radeon_ttm.c| 8 +- drivers/gpu/drm/radeon/radeon_uvd.c| 1 - drivers/gpu/drm/ttm/ttm_bo.c | 21 +++-- drivers/gpu/drm/ttm/ttm_resource.c | 73 drivers/gpu/drm/vmwgfx/vmwgfx_bo.c | 3 +- drivers/gpu/drm/vmwgfx/vmwgfx_ttm_buffer.c | 99 +- include/drm/ttm/ttm_placement.h| 10 ++- include/drm/ttm/ttm_resource.h | 8 +- 18 files changed, 160 insertions(+), 187 deletions(-) diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c index ace837cfa0a6..e4a0cace14da 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c @@ -220,9 +220,6 @@ void amdgpu_bo_placement_from_domain(struct amdgpu_bo *abo, u32 domain) placement->num_placement = c; placement->placement = places; - - placement->num_busy_placement = c; - placement->busy_placement = places; } /** @@ -1411,8 +1408,7 @@ vm_fault_t amdgpu_bo_fault_reserve_notify(struct ttm_buffer_object *bo) AMDGPU_GEM_DOMAIN_GTT); /* Avoid costly evictions; only set GTT as a busy placement */ - abo->placement.num_busy_placement = 1; - abo->placement.busy_placement = >placements[1]; + abo->placements[0].flags |= TTM_PL_FLAG_IDLE; r = ttm_bo_validate(bo, >placement, ); if (unlikely(r == -EBUSY || r == -ERESTARTSYS)) diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c index 4e51dce3aab5..2d9d57d27030 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c @@ -102,23 +102,19 @@ static void amdgpu_evict_flags(struct ttm_buffer_object *bo, /* Don't handle scatter gather BOs */ if (bo->type == ttm_bo_type_sg) { placement->num_placement = 0; - placement->num_busy_placement = 0; return; } /* Object isn't an AMDGPU object so ignore */ if (!amdgpu_bo_is_amdgpu_bo(bo)) { placement->placement = - placement->busy_placement = placement->num_placement = 1; - placement->num_busy_placement = 1; return; } abo = ttm_to_amdgpu_bo(bo); if (abo->flags & AMDGPU_GEM_CREATE_DISCARDABLE) { placement->num_placement = 0; - placement->num_busy_placement = 0; return; } @@ -128,13 +124,13 @@ static void amdgpu_evict_flags(struct ttm_buffer_object *bo, case AMDGPU_PL_OA: case AMDGPU_PL_DOORBELL: placement->num_placement = 0; - placement->num_busy_placement = 0; return; case TTM_PL_VRAM: if (!adev->mman.buffer_funcs_enabled) { /* Move to system memory */ amdgpu_bo_placement_from_domain(abo, AMDGPU_GEM_DOMAIN_CPU); + } else if (!amdgpu_gmc_vram_full_visible(>gmc) && !(abo->flags & AMDGPU_GEM_CREATE_CPU_ACCESS_REQUIRED) && amdgpu_bo_in_cpu_visible_vram(abo)) { @@ -149,8 +145,7 @@ static void amdgpu_evict_flags(struct ttm_buffer_object *bo, AMDGPU_GEM_DOMAIN_CPU); abo->placements[0].fpfn = adev->gmc.visible_vram_size >> PAGE_SHIFT; abo->placements[0].lpfn = 0; - abo->placement.busy_placement = >placements[1]; - abo->placement.num_busy_placement = 1; + abo->placements[0].flags |= TTM_PL_FLAG_IDLE; } else { /* Move to GTT memory */ amdgpu_bo_placement_from_domain(abo, AMDGPU_GEM_DOMAIN_GTT | @@ -967,8 +962,6 @@ int amdgpu_ttm_alloc_gart(struct ttm_buffer_object *bo) /* allocate GART space */ placement.num_placement = 1; placement.placement = - placement.num_busy_placement = 1;