[PATCH] drm/scheduler: Partially revert "drm/scheduler: track GPU active time per entity"

2023-08-16 Thread xinhui pan
access job->entity //memory overwitten As long as we can NOT guarantee entity is alive in this case, lets revert it for now. Signed-off-by: xinhui pan --- drivers/gpu/drm/scheduler/sched_main.c | 6 -- 1 file changed, 6 deletions(-) diff --git a/drivers/gpu/drm/scheduler/sched_main.c b/dr

[PATCH v6] drm: Optimise for continuous memory allocation

2022-12-17 Thread xinhui pan
. Signed-off-by: xinhui pan --- change from v5: reworked --- drivers/gpu/drm/drm_buddy.c | 161 ++-- 1 file changed, 154 insertions(+), 7 deletions(-) diff --git a/drivers/gpu/drm/drm_buddy.c b/drivers/gpu/drm/drm_buddy.c index 11bb59399471..6c795e1b3247 100644 --- a

[PATCH v5] drm: Optimise for continuous memory allocation

2022-11-29 Thread xinhui pan
+1 or 0+1+2+0 or 0+2+1+0. Without this patch, eviction is the final step to cleanup memory. Now there is a chance to delay the evction and then reduce the total count of evction. Signed-off-by: xinhui pan --- change from v4: Fix offset check by using <= instead of < Change patch descr

[PATCH v4] drm: Optimise for continuous memory allocation

2022-11-29 Thread xinhui pan
this patch aims to implement the rest cases. Adding a new member leaf_link which links all leaf blocks in asceding order. Now we can find more than 2 sub-order blocks easier. Say, order 4 can be combined with corresponding order 4, 2+2, 1+2+1, 0+1+2+0, 0+2+1+0. Signed-off-by: xinhui pan

[PATCH v3] drm: Optimise for continuous memory allocation

2022-11-27 Thread xinhui pan
this patch aims to implement the LR+RL case. Signed-off-by: xinhui pan --- change from v2: search continuous block in nearby root if needed change from v1: implement top-down continuous allocation --- drivers/gpu/drm/drm_buddy.c | 78 + 1 file changed, 71

[PATCH v2] drm: Optimise for continuous memory allocation

2022-11-26 Thread xinhui pan
this patch aims to implement the LR+RL case. Signed-off-by: xinhui pan --- change from v1: implement top-down continuous allocation --- drivers/gpu/drm/drm_buddy.c | 66 + 1 file changed, 59 insertions(+), 7 deletions(-) diff --git a/drivers/gpu/drm

[PATCH] drm: Optimise for continuous memory allocation

2022-11-26 Thread xinhui pan
this patch aims to implement the LR+RL case. Signed-off-by: xinhui pan --- drivers/gpu/drm/drm_buddy.c | 56 - 1 file changed, 49 insertions(+), 7 deletions(-) diff --git a/drivers/gpu/drm/drm_buddy.c b/drivers/gpu/drm/drm_buddy.c index 11bb59399471

[PATCH] dma-buf: Fix one use-after-free of fence

2022-07-07 Thread xinhui pan
Need get the new fence when we replace the old one. Fixes: 047a1b877ed48 ("dma-buf & drm/amdgpu: remove dma_resv workaround") Signed-off-by: xinhui pan --- drivers/dma-buf/dma-resv.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/dma-buf/dma-resv.c b/d

[PATCH 2/2] drm/ttm: Double check mem_type of BO while eviction

2021-11-09 Thread xinhui pan
BO might sit in a wrong lru list as there is a small period of memory moving and lru list updating. Lets skip eviction if we hit such mismatch. Suggested-by: Christian König Signed-off-by: xinhui pan --- drivers/gpu/drm/ttm/ttm_bo.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion

[PATCH 1/2] drm/ttm: Put BO in its memory manager's lru list

2021-11-09 Thread xinhui pan
After we move BO to a new memory region, we should put it to the new memory manager's lru list regardless we unlock the resv or not. Cc: sta...@vger.kernel.org Reviewed-by: Christian König Signed-off-by: xinhui pan --- drivers/gpu/drm/ttm/ttm_bo.c | 2 ++ 1 file changed, 2 insertions(+)

[PATCH] drm/ttm: Put BO in its memory manager's lru list

2021-11-09 Thread xinhui pan
After we move BO to a new memory region, we should put it to the new memory manager's lru list regardless we unlock the resv or not. Signed-off-by: xinhui pan --- drivers/gpu/drm/ttm/ttm_bo.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/gpu/drm/ttm/ttm_bo.c b/drivers/gp

[RFC PATCH v2] drm/ttm: Try to check if new ttm man out of bounds during compile

2021-09-13 Thread xinhui pan
Allow TTM know if vendor set new ttm mananger out of bounds by adding build_bug_on. Signed-off-by: xinhui pan --- drivers/gpu/drm/ttm/ttm_range_manager.c | 8 include/drm/ttm/ttm_device.h| 3 +++ include/drm/ttm/ttm_range_manager.h | 18 -- 3 files

[RFC PATCH] drm/ttm: Try to check if new ttm man out of bounds during compile

2021-09-12 Thread xinhui pan
Allow TTM know if vendor set new ttm mananger out of bounds by adding build_bug_on. Signed-off-by: xinhui pan --- drivers/gpu/drm/ttm/ttm_range_manager.c | 2 ++ include/drm/ttm/ttm_device.h| 3 +++ include/drm/ttm/ttm_range_manager.h | 10 ++ 3 files changed, 15

[resend PATCH] drm/ttm: Fix a deadlock if the target BO is not idle during swap

2021-09-06 Thread xinhui pan
ill be stuck as we actually did not free any BO memory. This usually happens when the fence is not signaled for a long time. Signed-off-by: xinhui pan Reviewed-by: Christian König --- drivers/gpu/drm/ttm/ttm_bo.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/g

[PATCH v2 1/2] drm/ttm: Fix a deadlock if the target BO is not idle during swap

2021-09-05 Thread xinhui pan
ill be stuck as we actually did not free any BO memory. This usually happens when the fence is not signaled for a long time. Signed-off-by: xinhui pan Reviewed-by: Christian König --- drivers/gpu/drm/ttm/ttm_bo.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/g

[PATCH v2 2/2] drm/amdpgu: Use VRAM domain in UVD IB test

2021-09-05 Thread xinhui pan
Like vce/vcn does, visible VRAM is OK for ib test. While commit a11d9ff3ebe0 ("drm/amdgpu: use GTT for uvd_get_create/destory_msg") says VRAM is not mapped correctly in his platform which is likely an arm64. So lets change back to use VRAM on x86_64 platform. Signed-off-by:

[PATCH v2 0/2] Fix a hung during memory pressure test

2021-09-05 Thread xinhui pan
r = amdgpu_bo_unmap_and_free(bo1, bo1_va_handle, bo1_mc, sdma_write_length); CU_ASSERT_EQUAL(r, 0); -- *** BLURB HERE *** xinhui pan (2): drm/ttm: Fix a deadlock if the target BO is not idle during swap drm/amdpgu: Use VRAM domain in UVD IB test dr

[RFC PATCH] drm/ttm: Do page counting after populate callback succeed

2021-06-15 Thread xinhui pan
: xinhui pan --- drivers/gpu/drm/ttm/ttm_tt.c | 32 +--- 1 file changed, 13 insertions(+), 19 deletions(-) diff --git a/drivers/gpu/drm/ttm/ttm_tt.c b/drivers/gpu/drm/ttm/ttm_tt.c index a1a25410ec74..4fa0a8cd71c0 100644 --- a/drivers/gpu/drm/ttm/ttm_tt.c +++ b/drivers/gpu

[PATCH] drm/ttm: Skip swapout if ttm object is not populated

2021-05-21 Thread xinhui pan
Swapping a ttm object which has no backend pages makes no sense. Suggested-by: Christian König Signed-off-by: xinhui pan --- drivers/gpu/drm/ttm/ttm_device.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/gpu/drm/ttm/ttm_device.c b/drivers/gpu/drm/ttm/ttm_device.c

[PATCH] drm/amdgpu: Let userptr BO ttm have TTM_PAGE_FLAG_SG set

2021-05-19 Thread xinhui pan
n BO A // memory overwritten To fix this issue, we can set TTM_PAGE_FLAG_SG when we create userptr BO ttm. Then swapout function would not swap it. Signed-off-by: xinhui pan --- drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c | 4 +--- drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c | 4

[RFC PATCH 2/2] drm/ttm: skip swapout when ttm has no backend page.

2021-05-18 Thread xinhui pan
Signed-off-by: xinhui pan --- drivers/gpu/drm/ttm/ttm_device.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/gpu/drm/ttm/ttm_device.c b/drivers/gpu/drm/ttm/ttm_device.c index 510e3e001dab..a9772fcc8f9c 100644 --- a/drivers/gpu/drm/ttm/ttm_device.c +++ b/drivers/gpu/drm/ttm

[RFC PATCH 1/2] drm/amdgpu: Fix memory corruption due to swapout and swapin

2021-05-18 Thread xinhui pan
ion too. But I hit page fault mostly. Signed-off-by: xinhui pan --- drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c | 16 +++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c b/drivers/gpu/drm/amd/amdgpu/amdg

[PATCH] drm/ttm: Do not add non-system domain BO into swap list

2021-02-23 Thread xinhui pan
BO would be added into swap list if it is validated into system domain. If BO is validated again into non-system domain, say, VRAM domain. It actually should not be in the swap list. Signed-off-by: xinhui pan --- drivers/gpu/drm/ttm/ttm_bo.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a

[PATCH] drm/ttm: Break out the loops if need_resched in bo delayed delete worker

2020-04-10 Thread xinhui pan
The delayed delete list is per device which might be very huge. And in a heavy workload test, the list might always not be empty. That will trigger any RCU stall warnings or softlockups in non-preemptible kernels Lets do break out the loops in that case. Signed-off-by: xinhui pan --- drivers

[PATCH] drm/ttm: Schedule out if possibe in bo delayed delete worker

2020-04-08 Thread xinhui pan
The delayed delete list is per device which might be very huge. And in a heavy workload test, the list might always not be empty. That will trigger any RCU stall warnings or softlockups in non-preemptible kernels Lets do schedule out if possible in that case. Signed-off-by: xinhui pan