]> git.baikalelectronics.ru Git - kernel.git/commit
drm/amdkfd: Fix partial migration bugs
authorPhilip Yang <Philip.Yang@amd.com>
Fri, 3 Jun 2022 13:19:34 +0000 (09:19 -0400)
committerAlex Deucher <alexander.deucher@amd.com>
Fri, 3 Jun 2022 20:43:22 +0000 (16:43 -0400)
commit8bf5383ca410b4513f7b09eb4a62845c094fc5c6
tree49225b0f804c49cab86f1bb65292ee6201ecd25e
parent9275c992dcbf6da648171255da29de9192c01ab1
drm/amdkfd: Fix partial migration bugs

Migration range from system memory to VRAM, if system page can not be
locked or unmapped, we do partial migration and leave some pages in
system memory. Several bugs found to copy pages and update GPU mapping
for this situation:

1. copy to vram should use migrate->npage which is total pages of range
as npages, not migrate->cpages which is number of pages can be migrated.

2. After partial copy, set VRAM res cursor as j + 1, j is number of
system pages copied plus 1 page to skip copy.

3. copy to ram, should collect all continuous VRAM pages and copy
together.

4. Call amdgpu_vm_update_range, should pass in offset as bytes, not
as number of pages.

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>
Cc: stable@vger.kernel.org
drivers/gpu/drm/amd/amdkfd/kfd_migrate.c
drivers/gpu/drm/amd/amdkfd/kfd_svm.c