drm/amdgpu: Fix VRAM memory accounting
authorjsg <jsg@openbsd.org>
Sat, 15 Jun 2024 03:47:56 +0000 (03:47 +0000)
committerjsg <jsg@openbsd.org>
Sat, 15 Jun 2024 03:47:56 +0000 (03:47 +0000)
From Mukul Joshi
422f3259ac6508e7289232fd7cb915914a527c70 in linux-6.6.y/6.6.33
f06446ef23216090d1ee8ede1a7d7ae430c22dcc in mainline linux

sys/dev/pci/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c

index 6044d3f..6bbd18c 100644 (file)
@@ -213,7 +213,7 @@ int amdgpu_amdkfd_reserve_mem_limit(struct amdgpu_device *adev,
            (kfd_mem_limit.ttm_mem_used + ttm_mem_needed >
             kfd_mem_limit.max_ttm_mem_limit) ||
            (adev && xcp_id >= 0 && adev->kfd.vram_used[xcp_id] + vram_needed >
-            vram_size - reserved_for_pt)) {
+            vram_size - reserved_for_pt - atomic64_read(&adev->vram_pin_size))) {
                ret = -ENOMEM;
                goto release;
        }