blob: f4192b7f376fe7f9db3ac57d164189f3a64da0cc (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
|
From 3798da0ad2634e392be4ddc2b52717577dab210f Mon Sep 17 00:00:00 2001
From: Lan Xiao <Lan.Xiao@amd.com>
Date: Tue, 18 Oct 2016 12:16:09 -0400
Subject: [PATCH 1541/4131] drm/amdgpu: Fix kernel warning caused by unreserved
BO
In reserve_bo_and_cond_vms, do not exit when ctx->n_vms = 0.
Instead, skip reserving the VM and only reserve BO.
Change-Id: Id23e0856ba6143bee4d1064c8fed93be8bbe14bd
Signed-off-by: Lan Xiao <Lan.Xiao@amd.com>
---
drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c | 16 +++++++---------
1 file changed, 7 insertions(+), 9 deletions(-)
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c
index 969769d..057a47b 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c
@@ -650,13 +650,12 @@ static int reserve_bo_and_cond_vms(struct kgd_mem *mem,
ctx->n_vms++;
}
- if (ctx->n_vms == 0)
- return 0;
-
- ctx->vm_pd = kzalloc(sizeof(struct amdgpu_bo_list_entry)
+ if (ctx->n_vms != 0) {
+ ctx->vm_pd = kzalloc(sizeof(struct amdgpu_bo_list_entry)
* ctx->n_vms, GFP_KERNEL);
- if (ctx->vm_pd == NULL)
- return -ENOMEM;
+ if (ctx->vm_pd == NULL)
+ return -ENOMEM;
+ }
ctx->kfd_bo.robj = bo;
ctx->kfd_bo.priority = 0;
@@ -702,9 +701,8 @@ static void unreserve_bo_and_vms(struct bo_vm_reservation_context *ctx,
if (ctx->reserved)
ttm_eu_backoff_reservation(&ctx->ticket, &ctx->list);
- if (ctx->vm_pd) {
- kfree(ctx->vm_pd);
- }
+ kfree(ctx->vm_pd);
+
amdgpu_sync_free(&ctx->sync);
ctx->reserved = false;
ctx->vm_pd = NULL;
--
2.7.4
|