[PATCH] drm/amdgpu: Fix the dead lock issue.

2018-09-09 Thread Emily Deng
It will ramdomly have the dead lock issue when test TDR: 1. amdgpu_device_handle_vram_lost gets the lock shadow_list_lock 2. amdgpu_bo_create locked the bo's resv lock 3. amdgpu_bo_create_shadow is waiting for the shadow_list_lock 4. amdgpu_device_recover_vram_from_shadow is waiting for the bo's

Re: [PATCH libdrm] tests/amdgpu: add unaligned VM test

2018-09-09 Thread Zhang, Jerry (Junwei)
On 09/10/2018 02:04 AM, Christian König wrote: Make a VM mapping which is as unaligned as possible. Is it going to test unaligned address between BO allocation and BO mapping and skip huge page mapping? Signed-off-by: Christian König --- tests/amdgpu/vm_tests.c | 45

[PATCH 2/2] gpu/radeon: use HMM mirror for userptr buffer object.

2018-09-09 Thread jglisse
From: Jérôme Glisse This replace existing code that rely on get_user_page() aka GUP with code that now use HMM mirror to mirror a range of virtual address as a buffer object accessible by the GPU. There is no functional changes from userspace point of view. From kernel point of view we no

[PATCH 0/2] [radeon] Getting rid of GUP and use HMM for user ptr features.

2018-09-09 Thread jglisse
From: Jérôme Glisse [This depends on some HMM patchset queued upstream see branch [1]] This is simple change to switch to use HMM for user ptr buffer object which conveniently avoid to pin pages. I have more things in the pipe to make HMM more usefull for such cases (like sharing more resources

[PATCH 1/2] gpu/radeon: use HMM mirror instead of mmu_notifier

2018-09-09 Thread jglisse
From: Jérôme Glisse HMM provide a sets of helpers to avoid individual drivers re-doing their own. This patch convert the radeon to use HMM mirror to track CPU page table update and invalidate accordingly for userptr object. Signed-off-by: Jérôme Glisse Cc: dri-de...@lists.freedesktop.org Cc:

[PATCH libdrm] tests/amdgpu: add unaligned VM test

2018-09-09 Thread Christian König
Make a VM mapping which is as unaligned as possible. Signed-off-by: Christian König --- tests/amdgpu/vm_tests.c | 45 - 1 file changed, 44 insertions(+), 1 deletion(-) diff --git a/tests/amdgpu/vm_tests.c b/tests/amdgpu/vm_tests.c index

[PATCH 09/11] drm/amdgpu: meld together VM fragment and huge page handling

2018-09-09 Thread Christian König
This optimizes the generating of PTEs by walking the hierarchy only once for a range and making changes as necessary. It allows for both huge (2MB) as well giant (1GB) pages to be used on Vega and Raven. Signed-off-by: Christian König --- drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c | 267

[PATCH 03/11] drm/amdgpu: add amdgpu_vm_update_func

2018-09-09 Thread Christian König
Add helper to call the update function for both BO and shadow. Signed-off-by: Christian König --- drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c | 32 +--- 1 file changed, 21 insertions(+), 11 deletions(-) diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c

[PATCH 06/11] drm/amdgpu: use dfs iterator to free PDs/PTs

2018-09-09 Thread Christian König
Allows us to free all PDs/PTs without recursion. Signed-off-by: Christian König --- drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c | 62 -- 1 file changed, 30 insertions(+), 32 deletions(-) diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c

[PATCH 02/11] drm/amdgpu: add amdgpu_vm_pt_parent helper

2018-09-09 Thread Christian König
Add a function to get the parent of a PD/PT. Signed-off-by: Christian König --- drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c | 36 ++ 1 file changed, 23 insertions(+), 13 deletions(-) diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c

Optimize VM handling a bit more

2018-09-09 Thread Christian König
Hi everyone, Especially on Vega and Raven VM handling is rather inefficient while creating PTEs because we originally only supported 2 level page tables and implemented 4 level page tables on top of that. This patch set reworks quite a bit of that handling and adds proper iterator and tree

[PATCH 07/11] drm/amdgpu: use the DFS iterator in amdgpu_vm_invalidate_level

2018-09-09 Thread Christian König
Less code and easier to maintain. Signed-off-by: Christian König --- drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c | 28 ++-- 1 file changed, 6 insertions(+), 22 deletions(-) diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c index

[PATCH 10/11] drm/amdgpu: use the maximum possible fragment size on Vega/Raven

2018-09-09 Thread Christian König
The fragment size controls only the L1 on Vega/Raven and we now don't have any extra overhead any more because of larger fragments. Signed-off-by: Christian König --- drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c | 7 ++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git

[PATCH 04/11] drm/amdgpu: add some VM PD/PT iterators

2018-09-09 Thread Christian König
Both a leaf as well as dfs iterator to walk over all the PDs/PTs. Signed-off-by: Christian König --- drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c | 221 + 1 file changed, 221 insertions(+) diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c

[PATCH 11/11] drm/amdgpu: allow fragment processing for invalid PTEs

2018-09-09 Thread Christian König
That should improve the PRT performance on Vega quite a bit. Signed-off-by: Christian König --- drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c index

[PATCH 05/11] drm/amdgpu: use leaf iterator for allocating PD/PT

2018-09-09 Thread Christian König
Less code and allows for easier error handling. Signed-off-by: Christian König --- drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c | 156 - 1 file changed, 55 insertions(+), 101 deletions(-) diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c

[PATCH 01/11] drm/amdgpu: try allocating VRAM as power of two

2018-09-09 Thread Christian König
Try to allocate VRAM in power of two sizes and only fallback to vram split sizes if that fails. Signed-off-by: Christian König --- drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c | 52 +--- 1 file changed, 40 insertions(+), 12 deletions(-) diff --git

Re: [PATCH] drm/amdgpu: set bulk_moveable to false when a per VM is released

2018-09-09 Thread Tom St Denis
On 2018-09-08 5:12 a.m., Huang Rui wrote: On Wed, Sep 05, 2018 at 05:08:26PM +0200, Christian König wrote: Otherwise we might run into a use after free during bulk move. Signed-off-by: Christian König Is this patch able to fix the KASAN? [ 66.143009]