]> git.baikalelectronics.ru Git - kernel.git/commit
drm/amdkfd: Track unified memory when switching xnack mode
authorPhilip Yang <Philip.Yang@amd.com>
Thu, 8 Sep 2022 02:38:00 +0000 (22:38 -0400)
committerAlex Deucher <alexander.deucher@amd.com>
Fri, 30 Sep 2022 15:21:14 +0000 (11:21 -0400)
commite68f86a760bfed42490b474c13d8e0fa7d13c9e1
treec7210a7ac7411d49496237e578e5d46bf7e91e27
parent3adc338840d52463bad51270433b1a9790e5620b
drm/amdkfd: Track unified memory when switching xnack mode

Unified memory usage with xnack off is tracked to avoid oversubscribe
system memory, with xnack on, we don't track unified memory usage to
allow memory oversubscribe. When switching xnack mode from off to on,
subsequent free ranges allocated with xnack off will not unreserve
memory. When switching xnack mode from on to off, subsequent free ranges
allocated with xnack on will unreserve memory. Both cases cause memory
accounting unbalanced.

When switching xnack mode from on to off, need reserve already allocated
svm range memory. When switching xnack mode from off to on, need
unreserve already allocated svm range memory.

v6: Take prange lock to access range child list
v5: Handle prange child ranges
v4: Handle reservation memory failure
v3: Handle switching xnack mode race with svm_range_deferred_list_work
v2: Handle both switching xnack from on to off and from off to on cases

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>
drivers/gpu/drm/amd/amdkfd/kfd_chardev.c
drivers/gpu/drm/amd/amdkfd/kfd_svm.c
drivers/gpu/drm/amd/amdkfd/kfd_svm.h