aboutsummaryrefslogtreecommitdiffstats
path: root/meta-amd-bsp/recipes-kernel/linux/linux-yocto-4.14.71/5671-drm-amdkfd-Error-if-trying-to-acquire-VM-for-a-PDD-t.patch
blob: e642e7d2f61a1551f8278e942da219fd399f00ca (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
From ddaefc39a8a975b84b43dad9875fc7ce4ce3f208 Mon Sep 17 00:00:00 2001
From: Felix Kuehling <Felix.Kuehling@amd.com>
Date: Thu, 26 Apr 2018 15:22:46 -0400
Subject: [PATCH 5671/5725] drm/amdkfd: Error if trying to acquire VM for a PDD
 twice

Return an error in kfd_process_device_init_vm is an attempt is made
to acquire a VM for a PDD that already has a VM. This could happen
if kfd_ioctl_acquire_vm is called multiple times for the same device
and process, or if it is called too late, after the process has
already been bound to the device by another ioctl.

Returning an error here can help detect potential future problems in
user mode code instead of silently masking them.

Change-Id: I55e46e2654e4d761ae4b43c194bd9a7f1dd3eefa
Signed-off-by: Felix Kuehling <Felix.Kuehling@amd.com>
---
 drivers/gpu/drm/amd/amdkfd/kfd_process.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_process.c b/drivers/gpu/drm/amd/amdkfd/kfd_process.c
index 182bf1c..3ecaad5 100644
--- a/drivers/gpu/drm/amd/amdkfd/kfd_process.c
+++ b/drivers/gpu/drm/amd/amdkfd/kfd_process.c
@@ -719,7 +719,7 @@ int kfd_process_device_init_vm(struct kfd_process_device *pdd,
 	int ret;
 
 	if (pdd->vm)
-		return 0;
+		return drm_file ? -EBUSY : 0;
 
 	p = pdd->process;
 	dev = pdd->dev;
-- 
2.7.4