Skip to content

Commit 65a618d

Browse files
PhilipYangAalexdeucher
authored andcommitted
drm/amdkfd: svm range always mapped flag not working on APU
On gfx943 APU there is no VRAM and page migration, queue CWSR area, svm range with always mapped flag, is not mapped to GPU correctly. This works fine if retry fault on CWSR area can be recovered, but could cause deadlock if there is another retry fault recover waiting for CWSR to finish. Fix this by mapping svm range with always mapped flag to GPU with ACCESS attribute if XNACK ON. There is side effect, because all GPUs have ACCESS attribute by default on new svm range with XNACK on, the CWSR area will be mapped to all GPUs after this change. This side effect will be fixed with Thunk change to set CWSR svm range with ACCESS_IN_PLACE attribute on the GPU that user queue is created. Signed-off-by: Philip Yang <Philip.Yang@amd.com> Reviewed-by: Felix Kuehling <felix.kuehling@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
1 parent 2414941 commit 65a618d

File tree

1 file changed

+12
-6
lines changed

1 file changed

+12
-6
lines changed

drivers/gpu/drm/amd/amdkfd/kfd_svm.c

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1607,18 +1607,24 @@ static int svm_range_validate_and_map(struct mm_struct *mm,
16071607
if (test_bit(gpuidx, prange->bitmap_access))
16081608
bitmap_set(ctx->bitmap, gpuidx, 1);
16091609
}
1610+
1611+
/*
1612+
* If prange is already mapped or with always mapped flag,
1613+
* update mapping on GPUs with ACCESS attribute
1614+
*/
1615+
if (bitmap_empty(ctx->bitmap, MAX_GPU_INSTANCE)) {
1616+
if (prange->mapped_to_gpu ||
1617+
prange->flags & KFD_IOCTL_SVM_FLAG_GPU_ALWAYS_MAPPED)
1618+
bitmap_copy(ctx->bitmap, prange->bitmap_access, MAX_GPU_INSTANCE);
1619+
}
16101620
} else {
16111621
bitmap_or(ctx->bitmap, prange->bitmap_access,
16121622
prange->bitmap_aip, MAX_GPU_INSTANCE);
16131623
}
16141624

16151625
if (bitmap_empty(ctx->bitmap, MAX_GPU_INSTANCE)) {
1616-
bitmap_copy(ctx->bitmap, prange->bitmap_access, MAX_GPU_INSTANCE);
1617-
if (!prange->mapped_to_gpu ||
1618-
bitmap_empty(ctx->bitmap, MAX_GPU_INSTANCE)) {
1619-
r = 0;
1620-
goto free_ctx;
1621-
}
1626+
r = 0;
1627+
goto free_ctx;
16221628
}
16231629

16241630
if (prange->actual_loc && !prange->ttm_res) {

0 commit comments

Comments
 (0)