[1/8] drm/amdgpu: fix waiting for BO moves with CPU based PD/PT updates

Submitted by Christian König on Feb. 4, 2019, 12:42 p.m.

Details

Message ID 20190204124256.1765-1-christian.koenig@amd.com
State Accepted
Series "Series without cover letter"
Commit 90d647222a8f004bf1430ecea3099ebcc54bfc21
Headers show

Commit Message

Christian König Feb. 4, 2019, 12:42 p.m.
Otherwise we open up the possibility to use uninitialized memory.

Signed-off-by: Christian König <christian.koenig@amd.com>
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

Patch hide | download patch | download mbox

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c
index c70621db3bb7..44950f3b8801 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c
@@ -1779,13 +1779,18 @@  static int amdgpu_vm_bo_update_mapping(struct amdgpu_device *adev,
 		if (pages_addr)
 			params.src = ~0;
 
-		/* Wait for PT BOs to be free. PTs share the same resv. object
+		/* Wait for PT BOs to be idle. PTs share the same resv. object
 		 * as the root PD BO
 		 */
 		r = amdgpu_vm_wait_pd(adev, vm, owner);
 		if (unlikely(r))
 			return r;
 
+		/* Wait for any BO move to be completed */
+		r = dma_fence_wait(exclusive, true);
+		if (unlikely(r))
+			return r;
+
 		params.func = amdgpu_vm_cpu_set_ptes;
 		params.pages_addr = pages_addr;
 		return amdgpu_vm_update_ptes(&params, start, last + 1,

Comments

Kuehling, Felix Feb. 4, 2019, 8:19 p.m.
On 2019-02-04 7:42 a.m., Christian König wrote:
> Otherwise we open up the possibility to use uninitialized memory.

>

> Signed-off-by: Christian König <christian.koenig@amd.com>


This patch is Reviewed-by: Felix Kuehling <Felix.Kuehling@amd.com>


> ---

>   drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c | 7 ++++++-

>   1 file changed, 6 insertions(+), 1 deletion(-)

>

> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c

> index c70621db3bb7..44950f3b8801 100644

> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c

> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c

> @@ -1779,13 +1779,18 @@ static int amdgpu_vm_bo_update_mapping(struct amdgpu_device *adev,

>   		if (pages_addr)

>   			params.src = ~0;

>   

> -		/* Wait for PT BOs to be free. PTs share the same resv. object

> +		/* Wait for PT BOs to be idle. PTs share the same resv. object

>   		 * as the root PD BO

>   		 */

>   		r = amdgpu_vm_wait_pd(adev, vm, owner);

>   		if (unlikely(r))

>   			return r;

>   

> +		/* Wait for any BO move to be completed */

> +		r = dma_fence_wait(exclusive, true);

> +		if (unlikely(r))

> +			return r;

> +

>   		params.func = amdgpu_vm_cpu_set_ptes;

>   		params.pages_addr = pages_addr;

>   		return amdgpu_vm_update_ptes(&params, start, last + 1,