CC: [email protected] CC: [email protected] CC: [email protected] TO: Felix Kuehling <[email protected]> CC: Alex Deucher <[email protected]>
tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master head: c741e49150dbb0c0aebe234389f4aa8b47958fa8 commit: c780b2eedbd0ddc9f594379fd39281100693fd3d drm/amdgpu: Rename kfd_bo_va_list to kfd_mem_attachment date: 7 months ago :::::: branch date: 6 hours ago :::::: commit date: 7 months ago config: x86_64-randconfig-c007-20211208 (https://download.01.org/0day-ci/archive/20211210/[email protected]/config) compiler: clang version 14.0.0 (https://github.com/llvm/llvm-project 097a1cb1d5ebb3a0ec4bcaed8ba3ff6a8e33c00a) reproduce (this is a W=1 build): wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross chmod +x ~/bin/make.cross # https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=c780b2eedbd0ddc9f594379fd39281100693fd3d git remote add linus https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git git fetch --no-tags linus master git checkout c780b2eedbd0ddc9f594379fd39281100693fd3d # save the config file to linux build tree COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=x86_64 clang-analyzer If you fix the issue, kindly add following tag as appropriate Reported-by: kernel test robot <[email protected]> clang-analyzer warnings: (new ones prefixed by >>) ^~~~~~~~~~~ fs/xfs/libxfs/xfs_iext_tree.c:521:18: note: Left side of '&&' is false if (node != new && pos == 0 && nr_entries > 0) ^ fs/xfs/libxfs/xfs_iext_tree.c:524:23: note: 'i' is <= 'pos' for (i = nr_entries; i > pos; i--) { ^ fs/xfs/libxfs/xfs_iext_tree.c:524:2: note: Loop condition is false. Execution continues on line 528 for (i = nr_entries; i > pos; i--) { ^ fs/xfs/libxfs/xfs_iext_tree.c:528:18: note: Array access (via field 'keys') results in a null pointer dereference node->keys[pos] = offset; ~~~~ ^ Suppressed 4 warnings (4 in non-user code). Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well. 16 warnings generated. Suppressed 16 warnings (8 in non-user code, 8 with check filters). Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well. 11 warnings generated. drivers/gpu/drm/amd/amdgpu/../pm/powerplay/hwmgr/smu7_hwmgr.c:2867:6: warning: Access to field 'disable_edc_leakage_controller' results in a dereference of a null pointer (loaded from variable 'data') [clang-analyzer-core.NullDereference] if (data->disable_edc_leakage_controller) ^ drivers/gpu/drm/amd/amdgpu/../pm/powerplay/hwmgr/smu7_hwmgr.c:2899:6: note: Assuming 'data' is not equal to NULL if (data == NULL) ^~~~~~~~~~~~ drivers/gpu/drm/amd/amdgpu/../pm/powerplay/hwmgr/smu7_hwmgr.c:2899:2: note: Taking false branch if (data == NULL) ^ drivers/gpu/drm/amd/amdgpu/../pm/powerplay/hwmgr/smu7_hwmgr.c:2903:2: note: Calling 'smu7_patch_voltage_workaround' smu7_patch_voltage_workaround(hwmgr); ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ drivers/gpu/drm/amd/amdgpu/../pm/powerplay/hwmgr/smu7_hwmgr.c:2436:6: note: Assuming 'table_info' is equal to NULL if (table_info != NULL) { ^~~~~~~~~~~~~~~~~~ drivers/gpu/drm/amd/amdgpu/../pm/powerplay/hwmgr/smu7_hwmgr.c:2436:2: note: Taking false branch if (table_info != NULL) { ^ drivers/gpu/drm/amd/amdgpu/../pm/powerplay/hwmgr/smu7_hwmgr.c:2440:3: note: Returning without writing to 'hwmgr->backend' return 0; ^ drivers/gpu/drm/amd/amdgpu/../pm/powerplay/hwmgr/smu7_hwmgr.c:2903:2: note: Returning from 'smu7_patch_voltage_workaround' smu7_patch_voltage_workaround(hwmgr); ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ drivers/gpu/drm/amd/amdgpu/../pm/powerplay/hwmgr/smu7_hwmgr.c:2907:2: note: Taking false branch if (phm_cap_enabled(hwmgr->platform_descriptor.platformCaps, ^ drivers/gpu/drm/amd/amdgpu/../pm/powerplay/hwmgr/smu7_hwmgr.c:2918:6: note: Assuming field 'pp_table_version' is not equal to PP_TABLE_V1 if (hwmgr->pp_table_version == PP_TABLE_V1) { ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ drivers/gpu/drm/amd/amdgpu/../pm/powerplay/hwmgr/smu7_hwmgr.c:2918:2: note: Taking false branch if (hwmgr->pp_table_version == PP_TABLE_V1) { ^ drivers/gpu/drm/amd/amdgpu/../pm/powerplay/hwmgr/smu7_hwmgr.c:2921:13: note: Assuming field 'pp_table_version' is not equal to PP_TABLE_V0 } else if (hwmgr->pp_table_version == PP_TABLE_V0) { ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ drivers/gpu/drm/amd/amdgpu/../pm/powerplay/hwmgr/smu7_hwmgr.c:2921:9: note: Taking false branch } else if (hwmgr->pp_table_version == PP_TABLE_V0) { ^ drivers/gpu/drm/amd/amdgpu/../pm/powerplay/hwmgr/smu7_hwmgr.c:2929:6: note: Assuming 'result' is not equal to 0 if (0 == result) { ^~~~~~~~~~~ drivers/gpu/drm/amd/amdgpu/../pm/powerplay/hwmgr/smu7_hwmgr.c:2929:2: note: Taking false branch if (0 == result) { ^ drivers/gpu/drm/amd/amdgpu/../pm/powerplay/hwmgr/smu7_hwmgr.c:2953:3: note: Calling 'smu7_hwmgr_backend_fini' smu7_hwmgr_backend_fini(hwmgr); ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ drivers/gpu/drm/amd/amdgpu/../pm/powerplay/hwmgr/smu7_hwmgr.c:2824:2: note: Null pointer value stored to field 'backend' hwmgr->backend = NULL; ^~~~~~~~~~~~~~~~~~~~~ drivers/gpu/drm/amd/amdgpu/../pm/powerplay/hwmgr/smu7_hwmgr.c:2953:3: note: Returning from 'smu7_hwmgr_backend_fini' smu7_hwmgr_backend_fini(hwmgr); ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ drivers/gpu/drm/amd/amdgpu/../pm/powerplay/hwmgr/smu7_hwmgr.c:2956:11: note: Calling 'smu7_update_edc_leakage_table' result = smu7_update_edc_leakage_table(hwmgr); ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ drivers/gpu/drm/amd/amdgpu/../pm/powerplay/hwmgr/smu7_hwmgr.c:2862:2: note: 'data' initialized to a null pointer value struct smu7_hwmgr *data = (struct smu7_hwmgr *)(hwmgr->backend); ^~~~~~~~~~~~~~~~~~~~~~~ drivers/gpu/drm/amd/amdgpu/../pm/powerplay/hwmgr/smu7_hwmgr.c:2867:6: note: Access to field 'disable_edc_leakage_controller' results in a dereference of a null pointer (loaded from variable 'data') if (data->disable_edc_leakage_controller) ^~~~ Suppressed 10 warnings (9 in non-user code, 1 with check filters). Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well. 10 warnings generated. Suppressed 10 warnings (10 in non-user code). Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well. 10 warnings generated. Suppressed 10 warnings (10 in non-user code). Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well. 2 warnings generated. Suppressed 2 warnings (2 in non-user code). Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well. 10 warnings generated. drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c:281:14: warning: Although the value stored to 'k' is used in the enclosing expression, the value is never actually read from 'k' [clang-analyzer-deadcode.DeadStores] for (i = j, k = 0; i < old->shared_count; ++i) { ^ ~ drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c:281:14: note: Although the value stored to 'k' is used in the enclosing expression, the value is never actually read from 'k' for (i = j, k = 0; i < old->shared_count; ++i) { ^ ~ >> drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c:1405:2: warning: Value >> stored to 'bo_size' is never read [clang-analyzer-deadcode.DeadStores] bo_size = bo->tbo.base.size; ^ ~~~~~~~~~~~~~~~~~ drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c:1405:2: note: Value stored to 'bo_size' is never read bo_size = bo->tbo.base.size; ^ ~~~~~~~~~~~~~~~~~ drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c:1508:16: warning: Value stored to 'bo_size' during its initialization is never read [clang-analyzer-deadcode.DeadStores] unsigned long bo_size = mem->bo->tbo.base.size; ^~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~ drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c:1508:16: note: Value stored to 'bo_size' during its initialization is never read unsigned long bo_size = mem->bo->tbo.base.size; ^~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~ Suppressed 7 warnings (7 in non-user code). Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well. 7 warnings generated. Suppressed 7 warnings (7 in non-user code). Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well. 7 warnings generated. Suppressed 7 warnings (7 in non-user code). Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well. 7 warnings generated. Suppressed 7 warnings (7 in non-user code). Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well. 7 warnings generated. Suppressed 7 warnings (7 in non-user code). Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well. 7 warnings generated. Suppressed 7 warnings (7 in non-user code). Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well. 2 warnings generated. Suppressed 2 warnings (2 in non-user code). Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well. 3 warnings generated. Suppressed 3 warnings (3 in non-user code). Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well. 2 warnings generated. Suppressed 2 warnings (2 in non-user code). Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well. 8 warnings generated. Suppressed 8 warnings (8 in non-user code). Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well. 8 warnings generated. Suppressed 8 warnings (8 in non-user code). Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well. 9 warnings generated. drivers/gpu/drm/i915/display/icl_dsi.c:141:11: warning: Dereference of null pointer [clang-analyzer-core.NullDereference] tmp |= *data++ << 8 * j; ^ drivers/gpu/drm/i915/display/icl_dsi.c:1746:6: note: Assuming 'ret' is >= 0 if (ret < 0) ^~~~~~~ drivers/gpu/drm/i915/display/icl_dsi.c:1746:2: note: Taking false branch if (ret < 0) ^ drivers/gpu/drm/i915/display/icl_dsi.c:1749:6: note: Assuming the condition is false if (msg->flags & MIPI_DSI_MSG_USE_LPM) ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ drivers/gpu/drm/i915/display/icl_dsi.c:1749:2: note: Taking false branch if (msg->flags & MIPI_DSI_MSG_USE_LPM) ^ drivers/gpu/drm/i915/display/icl_dsi.c:1754:6: note: 'ret' is >= 0 if (ret < 0) ^~~ drivers/gpu/drm/i915/display/icl_dsi.c:1754:2: note: Taking false branch if (ret < 0) ^ drivers/gpu/drm/i915/display/icl_dsi.c:1758:6: note: Assuming the condition is true if (mipi_dsi_packet_format_is_long(msg->type)) { ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ drivers/gpu/drm/i915/display/icl_dsi.c:1758:2: note: Taking true branch if (mipi_dsi_packet_format_is_long(msg->type)) { ^ drivers/gpu/drm/i915/display/icl_dsi.c:1759:9: note: Calling 'dsi_send_pkt_payld' ret = dsi_send_pkt_payld(intel_dsi_host, dsi_pkt); ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ drivers/gpu/drm/i915/display/icl_dsi.c:195:6: note: Assuming the condition is false if (pkt.payload_length > MAX_PLOAD_CREDIT * 4) { ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ drivers/gpu/drm/i915/display/icl_dsi.c:195:2: note: Taking false branch if (pkt.payload_length > MAX_PLOAD_CREDIT * 4) { ^ drivers/gpu/drm/i915/display/icl_dsi.c:201:7: note: Calling 'add_payld_to_queue' if (!add_payld_to_queue(host, pkt.payload, ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ drivers/gpu/drm/i915/display/icl_dsi.c:130:14: note: Assuming 'i' is < 'len' for (i = 0; i < len; i += 4) { ^~~~~~~ drivers/gpu/drm/i915/display/icl_dsi.c:130:2: note: Loop condition is true. Entering loop body for (i = 0; i < len; i += 4) { ^ drivers/gpu/drm/i915/display/icl_dsi.c:134:7: note: Assuming 'free_credits' is >= 1 if (free_credits < 1) { ^~~~~~~~~~~~~~~~ drivers/gpu/drm/i915/display/icl_dsi.c:134:3: note: Taking false branch if (free_credits < 1) { ^ drivers/gpu/drm/i915/display/icl_dsi.c:140:19: note: Assuming '__UNIQUE_ID___x587' is >= '__UNIQUE_ID___y588' for (j = 0; j < min_t(u32, len - i, 4); j++) ^ include/linux/minmax.h:110:27: note: expanded from macro 'min_t' #define min_t(type, x, y) __careful_cmp((type)(x), (type)(y), <) vim +/bo_size +1405 drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c a46a2cd103a8637 Felix Kuehling 2018-02-06 1364 a46a2cd103a8637 Felix Kuehling 2018-02-06 1365 int amdgpu_amdkfd_gpuvm_map_memory_to_gpu( b40a6ab2cf92139 Felix Kuehling 2021-04-07 1366 struct kgd_dev *kgd, struct kgd_mem *mem, void *drm_priv) a46a2cd103a8637 Felix Kuehling 2018-02-06 1367 { a46a2cd103a8637 Felix Kuehling 2018-02-06 1368 struct amdgpu_device *adev = get_amdgpu_device(kgd); b40a6ab2cf92139 Felix Kuehling 2021-04-07 1369 struct amdgpu_vm *avm = drm_priv_to_vm(drm_priv); a46a2cd103a8637 Felix Kuehling 2018-02-06 1370 int ret; a46a2cd103a8637 Felix Kuehling 2018-02-06 1371 struct amdgpu_bo *bo; a46a2cd103a8637 Felix Kuehling 2018-02-06 1372 uint32_t domain; c780b2eedbd0ddc Felix Kuehling 2021-04-08 1373 struct kfd_mem_attachment *entry; a46a2cd103a8637 Felix Kuehling 2018-02-06 1374 struct bo_vm_reservation_context ctx; c780b2eedbd0ddc Felix Kuehling 2021-04-08 1375 struct kfd_mem_attachment *attachment = NULL; c780b2eedbd0ddc Felix Kuehling 2021-04-08 1376 struct kfd_mem_attachment *attachment_aql = NULL; a46a2cd103a8637 Felix Kuehling 2018-02-06 1377 unsigned long bo_size; 5ae0283e831a94c Felix Kuehling 2018-03-23 1378 bool is_invalid_userptr = false; a46a2cd103a8637 Felix Kuehling 2018-02-06 1379 a46a2cd103a8637 Felix Kuehling 2018-02-06 1380 bo = mem->bo; a46a2cd103a8637 Felix Kuehling 2018-02-06 1381 if (!bo) { a46a2cd103a8637 Felix Kuehling 2018-02-06 1382 pr_err("Invalid BO when mapping memory to GPU\n"); 5ae0283e831a94c Felix Kuehling 2018-03-23 1383 return -EINVAL; 5ae0283e831a94c Felix Kuehling 2018-03-23 1384 } 5ae0283e831a94c Felix Kuehling 2018-03-23 1385 5ae0283e831a94c Felix Kuehling 2018-03-23 1386 /* Make sure restore is not running concurrently. Since we 5ae0283e831a94c Felix Kuehling 2018-03-23 1387 * don't map invalid userptr BOs, we rely on the next restore 5ae0283e831a94c Felix Kuehling 2018-03-23 1388 * worker to do the mapping 5ae0283e831a94c Felix Kuehling 2018-03-23 1389 */ 5ae0283e831a94c Felix Kuehling 2018-03-23 1390 mutex_lock(&mem->process_info->lock); 5ae0283e831a94c Felix Kuehling 2018-03-23 1391 5ae0283e831a94c Felix Kuehling 2018-03-23 1392 /* Lock mmap-sem. If we find an invalid userptr BO, we can be 5ae0283e831a94c Felix Kuehling 2018-03-23 1393 * sure that the MMU notifier is no longer running 5ae0283e831a94c Felix Kuehling 2018-03-23 1394 * concurrently and the queues are actually stopped 5ae0283e831a94c Felix Kuehling 2018-03-23 1395 */ 5ae0283e831a94c Felix Kuehling 2018-03-23 1396 if (amdgpu_ttm_tt_get_usermm(bo->tbo.ttm)) { d8ed45c5dcd455f Michel Lespinasse 2020-06-08 1397 mmap_write_lock(current->mm); 5ae0283e831a94c Felix Kuehling 2018-03-23 1398 is_invalid_userptr = atomic_read(&mem->invalid); d8ed45c5dcd455f Michel Lespinasse 2020-06-08 1399 mmap_write_unlock(current->mm); a46a2cd103a8637 Felix Kuehling 2018-02-06 1400 } a46a2cd103a8637 Felix Kuehling 2018-02-06 1401 5ae0283e831a94c Felix Kuehling 2018-03-23 1402 mutex_lock(&mem->lock); 5ae0283e831a94c Felix Kuehling 2018-03-23 1403 a46a2cd103a8637 Felix Kuehling 2018-02-06 1404 domain = mem->domain; 8c392cd5f1c638f Daniel Vetter 2020-12-14 @1405 bo_size = bo->tbo.base.size; a46a2cd103a8637 Felix Kuehling 2018-02-06 1406 a46a2cd103a8637 Felix Kuehling 2018-02-06 1407 pr_debug("Map VA 0x%llx - 0x%llx to vm %p domain %s\n", a46a2cd103a8637 Felix Kuehling 2018-02-06 1408 mem->va, a46a2cd103a8637 Felix Kuehling 2018-02-06 1409 mem->va + bo_size * (1 + mem->aql_queue), b40a6ab2cf92139 Felix Kuehling 2021-04-07 1410 avm, domain_string(domain)); a46a2cd103a8637 Felix Kuehling 2018-02-06 1411 b40a6ab2cf92139 Felix Kuehling 2021-04-07 1412 ret = reserve_bo_and_vm(mem, avm, &ctx); a46a2cd103a8637 Felix Kuehling 2018-02-06 1413 if (unlikely(ret)) a46a2cd103a8637 Felix Kuehling 2018-02-06 1414 goto out; a46a2cd103a8637 Felix Kuehling 2018-02-06 1415 5ae0283e831a94c Felix Kuehling 2018-03-23 1416 /* Userptr can be marked as "not invalid", but not actually be 5ae0283e831a94c Felix Kuehling 2018-03-23 1417 * validated yet (still in the system domain). In that case 5ae0283e831a94c Felix Kuehling 2018-03-23 1418 * the queues are still stopped and we can leave mapping for 5ae0283e831a94c Felix Kuehling 2018-03-23 1419 * the next restore worker 5ae0283e831a94c Felix Kuehling 2018-03-23 1420 */ 0f04e538580c086 Felix Kuehling 2018-05-03 1421 if (amdgpu_ttm_tt_get_usermm(bo->tbo.ttm) && 0f04e538580c086 Felix Kuehling 2018-05-03 1422 bo->tbo.mem.mem_type == TTM_PL_SYSTEM) 5ae0283e831a94c Felix Kuehling 2018-03-23 1423 is_invalid_userptr = true; 5ae0283e831a94c Felix Kuehling 2018-03-23 1424 c780b2eedbd0ddc Felix Kuehling 2021-04-08 1425 if (!kfd_mem_is_attached(avm, mem)) { c780b2eedbd0ddc Felix Kuehling 2021-04-08 1426 ret = kfd_mem_attach(adev, mem, avm, false, &attachment); a46a2cd103a8637 Felix Kuehling 2018-02-06 1427 if (ret) c780b2eedbd0ddc Felix Kuehling 2021-04-08 1428 goto attach_failed; a46a2cd103a8637 Felix Kuehling 2018-02-06 1429 if (mem->aql_queue) { c780b2eedbd0ddc Felix Kuehling 2021-04-08 1430 ret = kfd_mem_attach(adev, mem, avm, true, c780b2eedbd0ddc Felix Kuehling 2021-04-08 1431 &attachment_aql); a46a2cd103a8637 Felix Kuehling 2018-02-06 1432 if (ret) c780b2eedbd0ddc Felix Kuehling 2021-04-08 1433 goto attach_failed_aql; a46a2cd103a8637 Felix Kuehling 2018-02-06 1434 } a46a2cd103a8637 Felix Kuehling 2018-02-06 1435 } else { 5b21d3e5fd2110d Felix Kuehling 2018-03-15 1436 ret = vm_validate_pt_pd_bos(avm); a46a2cd103a8637 Felix Kuehling 2018-02-06 1437 if (unlikely(ret)) c780b2eedbd0ddc Felix Kuehling 2021-04-08 1438 goto attach_failed; a46a2cd103a8637 Felix Kuehling 2018-02-06 1439 } a46a2cd103a8637 Felix Kuehling 2018-02-06 1440 5ae0283e831a94c Felix Kuehling 2018-03-23 1441 if (mem->mapped_to_gpu_memory == 0 && 5ae0283e831a94c Felix Kuehling 2018-03-23 1442 !amdgpu_ttm_tt_get_usermm(bo->tbo.ttm)) { a46a2cd103a8637 Felix Kuehling 2018-02-06 1443 /* Validate BO only once. The eviction fence gets added to BO a46a2cd103a8637 Felix Kuehling 2018-02-06 1444 * the first time it is mapped. Validate will wait for all a46a2cd103a8637 Felix Kuehling 2018-02-06 1445 * background evictions to complete. a46a2cd103a8637 Felix Kuehling 2018-02-06 1446 */ a46a2cd103a8637 Felix Kuehling 2018-02-06 1447 ret = amdgpu_amdkfd_bo_validate(bo, domain, true); a46a2cd103a8637 Felix Kuehling 2018-02-06 1448 if (ret) { a46a2cd103a8637 Felix Kuehling 2018-02-06 1449 pr_debug("Validate failed\n"); a46a2cd103a8637 Felix Kuehling 2018-02-06 1450 goto map_bo_to_gpuvm_failed; a46a2cd103a8637 Felix Kuehling 2018-02-06 1451 } a46a2cd103a8637 Felix Kuehling 2018-02-06 1452 } a46a2cd103a8637 Felix Kuehling 2018-02-06 1453 c780b2eedbd0ddc Felix Kuehling 2021-04-08 1454 list_for_each_entry(entry, &mem->attachments, list) { c780b2eedbd0ddc Felix Kuehling 2021-04-08 1455 if (entry->bo_va->base.vm != avm || entry->is_mapped) c780b2eedbd0ddc Felix Kuehling 2021-04-08 1456 continue; c780b2eedbd0ddc Felix Kuehling 2021-04-08 1457 a46a2cd103a8637 Felix Kuehling 2018-02-06 1458 pr_debug("\t map VA 0x%llx - 0x%llx in entry %p\n", c780b2eedbd0ddc Felix Kuehling 2021-04-08 1459 entry->va, entry->va + bo_size, entry); a46a2cd103a8637 Felix Kuehling 2018-02-06 1460 5ae0283e831a94c Felix Kuehling 2018-03-23 1461 ret = map_bo_to_gpuvm(adev, entry, ctx.sync, 5ae0283e831a94c Felix Kuehling 2018-03-23 1462 is_invalid_userptr); a46a2cd103a8637 Felix Kuehling 2018-02-06 1463 if (ret) { 0d87c9cfc08e150 Kent Russell 2019-05-01 1464 pr_err("Failed to map bo to gpuvm\n"); a46a2cd103a8637 Felix Kuehling 2018-02-06 1465 goto map_bo_to_gpuvm_failed; a46a2cd103a8637 Felix Kuehling 2018-02-06 1466 } a46a2cd103a8637 Felix Kuehling 2018-02-06 1467 b40a6ab2cf92139 Felix Kuehling 2021-04-07 1468 ret = vm_update_pds(avm, ctx.sync); a46a2cd103a8637 Felix Kuehling 2018-02-06 1469 if (ret) { a46a2cd103a8637 Felix Kuehling 2018-02-06 1470 pr_err("Failed to update page directories\n"); a46a2cd103a8637 Felix Kuehling 2018-02-06 1471 goto map_bo_to_gpuvm_failed; a46a2cd103a8637 Felix Kuehling 2018-02-06 1472 } a46a2cd103a8637 Felix Kuehling 2018-02-06 1473 a46a2cd103a8637 Felix Kuehling 2018-02-06 1474 entry->is_mapped = true; a46a2cd103a8637 Felix Kuehling 2018-02-06 1475 mem->mapped_to_gpu_memory++; a46a2cd103a8637 Felix Kuehling 2018-02-06 1476 pr_debug("\t INC mapping count %d\n", a46a2cd103a8637 Felix Kuehling 2018-02-06 1477 mem->mapped_to_gpu_memory); a46a2cd103a8637 Felix Kuehling 2018-02-06 1478 } a46a2cd103a8637 Felix Kuehling 2018-02-06 1479 4671078eb8e390b Christian König 2020-09-21 1480 if (!amdgpu_ttm_tt_get_usermm(bo->tbo.ttm) && !bo->tbo.pin_count) a46a2cd103a8637 Felix Kuehling 2018-02-06 1481 amdgpu_bo_fence(bo, 5b21d3e5fd2110d Felix Kuehling 2018-03-15 1482 &avm->process_info->eviction_fence->base, a46a2cd103a8637 Felix Kuehling 2018-02-06 1483 true); a46a2cd103a8637 Felix Kuehling 2018-02-06 1484 ret = unreserve_bo_and_vms(&ctx, false, false); a46a2cd103a8637 Felix Kuehling 2018-02-06 1485 a46a2cd103a8637 Felix Kuehling 2018-02-06 1486 goto out; a46a2cd103a8637 Felix Kuehling 2018-02-06 1487 a46a2cd103a8637 Felix Kuehling 2018-02-06 1488 map_bo_to_gpuvm_failed: c780b2eedbd0ddc Felix Kuehling 2021-04-08 1489 if (attachment_aql) c780b2eedbd0ddc Felix Kuehling 2021-04-08 1490 kfd_mem_detach(attachment_aql); c780b2eedbd0ddc Felix Kuehling 2021-04-08 1491 attach_failed_aql: c780b2eedbd0ddc Felix Kuehling 2021-04-08 1492 if (attachment) c780b2eedbd0ddc Felix Kuehling 2021-04-08 1493 kfd_mem_detach(attachment); c780b2eedbd0ddc Felix Kuehling 2021-04-08 1494 attach_failed: a46a2cd103a8637 Felix Kuehling 2018-02-06 1495 unreserve_bo_and_vms(&ctx, false, false); a46a2cd103a8637 Felix Kuehling 2018-02-06 1496 out: a46a2cd103a8637 Felix Kuehling 2018-02-06 1497 mutex_unlock(&mem->process_info->lock); a46a2cd103a8637 Felix Kuehling 2018-02-06 1498 mutex_unlock(&mem->lock); a46a2cd103a8637 Felix Kuehling 2018-02-06 1499 return ret; a46a2cd103a8637 Felix Kuehling 2018-02-06 1500 } a46a2cd103a8637 Felix Kuehling 2018-02-06 1501 :::::: The code at line 1405 was first introduced by commit :::::: 8c392cd5f1c638f953ebf2c6f4baca9df9e699f4 drm/amdkfd: fix ttm size refactor fallout :::::: TO: Daniel Vetter <[email protected]> :::::: CC: Daniel Vetter <[email protected]> --- 0-DAY CI Kernel Test Service, Intel Corporation https://lists.01.org/hyperkitty/list/[email protected] _______________________________________________ kbuild mailing list -- [email protected] To unsubscribe send an email to [email protected]
