This reverts commit 2ddef17678bc2ea1d20517dd2b4ed4aa967ffa8b.
As it turned out VMWGFX needs a much wider audit to fix this.
Signed-off-by: Christian König christian.koenig@amd.com --- drivers/gpu/drm/ttm/ttm_bo.c | 19 ++++++++++++++++--- drivers/gpu/drm/ttm/ttm_bo_util.c | 7 ++----- drivers/gpu/drm/ttm/ttm_bo_vm.c | 5 ----- drivers/gpu/drm/ttm/ttm_tt.c | 1 + 4 files changed, 19 insertions(+), 13 deletions(-)
diff --git a/drivers/gpu/drm/ttm/ttm_bo.c b/drivers/gpu/drm/ttm/ttm_bo.c index ad09329b62d3..42386bda32fe 100644 --- a/drivers/gpu/drm/ttm/ttm_bo.c +++ b/drivers/gpu/drm/ttm/ttm_bo.c @@ -656,7 +656,7 @@ static int ttm_bo_evict(struct ttm_buffer_object *bo, ttm_bo_wait(bo, false, false);
ttm_bo_cleanup_memtype_use(bo); - return 0; + return ttm_tt_create(bo, false); }
evict_mem = bo->mem; @@ -1191,8 +1191,13 @@ int ttm_bo_validate(struct ttm_buffer_object *bo, /* * Remove the backing store if no placement is given. */ - if (!placement->num_placement && !placement->num_busy_placement) - return ttm_bo_pipeline_gutting(bo); + if (!placement->num_placement && !placement->num_busy_placement) { + ret = ttm_bo_pipeline_gutting(bo); + if (ret) + return ret; + + return ttm_tt_create(bo, false); + }
/* * Check whether we need to move buffer. @@ -1209,6 +1214,14 @@ int ttm_bo_validate(struct ttm_buffer_object *bo, ttm_flag_masked(&bo->mem.placement, new_flags, ~TTM_PL_MASK_MEMTYPE); } + /* + * We might need to add a TTM. + */ + if (bo->mem.mem_type == TTM_PL_SYSTEM && bo->ttm == NULL) { + ret = ttm_tt_create(bo, true); + if (ret) + return ret; + } return 0; } EXPORT_SYMBOL(ttm_bo_validate); diff --git a/drivers/gpu/drm/ttm/ttm_bo_util.c b/drivers/gpu/drm/ttm/ttm_bo_util.c index 496158acd5b9..76376dc71f25 100644 --- a/drivers/gpu/drm/ttm/ttm_bo_util.c +++ b/drivers/gpu/drm/ttm/ttm_bo_util.c @@ -531,15 +531,12 @@ static int ttm_bo_kmap_ttm(struct ttm_buffer_object *bo, .interruptible = false, .no_wait_gpu = false }; - struct ttm_tt *ttm; + struct ttm_tt *ttm = bo->ttm; pgprot_t prot; int ret;
- ret = ttm_tt_create(bo, true); - if (ret) - return ret; + BUG_ON(!ttm);
- ttm = bo->ttm; ret = ttm_tt_populate(ttm, &ctx); if (ret) return ret; diff --git a/drivers/gpu/drm/ttm/ttm_bo_vm.c b/drivers/gpu/drm/ttm/ttm_bo_vm.c index ba2e8bd198ad..e90c5c806645 100644 --- a/drivers/gpu/drm/ttm/ttm_bo_vm.c +++ b/drivers/gpu/drm/ttm/ttm_bo_vm.c @@ -347,11 +347,6 @@ vm_fault_t ttm_bo_vm_fault_reserved(struct vm_fault *vmf,
};
- if (ttm_tt_create(bo, true)) { - ret = VM_FAULT_OOM; - goto out_io_unlock; - } - ttm = bo->ttm; if (ttm_tt_populate(bo->ttm, &ctx)) { ret = VM_FAULT_OOM; diff --git a/drivers/gpu/drm/ttm/ttm_tt.c b/drivers/gpu/drm/ttm/ttm_tt.c index bdd6169cef13..05c9147ac6d3 100644 --- a/drivers/gpu/drm/ttm/ttm_tt.c +++ b/drivers/gpu/drm/ttm/ttm_tt.c @@ -70,6 +70,7 @@ int ttm_tt_create(struct ttm_buffer_object *bo, bool zero_alloc) page_flags |= TTM_PAGE_FLAG_SG; break; default: + bo->ttm = NULL; pr_err("Illegal buffer object type\n"); return -EINVAL; }
Am 11.08.20 um 11:24 schrieb Christian König:
This reverts commit 2ddef17678bc2ea1d20517dd2b4ed4aa967ffa8b.
As it turned out VMWGFX needs a much wider audit to fix this.
Signed-off-by: Christian König christian.koenig@amd.com
Dare to give me an rb for this? I already tested on amdgpu and it should be fixing the VMWGFX problems we currently have.
Thanks, Christian.
drivers/gpu/drm/ttm/ttm_bo.c | 19 ++++++++++++++++--- drivers/gpu/drm/ttm/ttm_bo_util.c | 7 ++----- drivers/gpu/drm/ttm/ttm_bo_vm.c | 5 ----- drivers/gpu/drm/ttm/ttm_tt.c | 1 + 4 files changed, 19 insertions(+), 13 deletions(-)
diff --git a/drivers/gpu/drm/ttm/ttm_bo.c b/drivers/gpu/drm/ttm/ttm_bo.c index ad09329b62d3..42386bda32fe 100644 --- a/drivers/gpu/drm/ttm/ttm_bo.c +++ b/drivers/gpu/drm/ttm/ttm_bo.c @@ -656,7 +656,7 @@ static int ttm_bo_evict(struct ttm_buffer_object *bo, ttm_bo_wait(bo, false, false);
ttm_bo_cleanup_memtype_use(bo);
return 0;
return ttm_tt_create(bo, false);
}
evict_mem = bo->mem;
@@ -1191,8 +1191,13 @@ int ttm_bo_validate(struct ttm_buffer_object *bo, /* * Remove the backing store if no placement is given. */
- if (!placement->num_placement && !placement->num_busy_placement)
return ttm_bo_pipeline_gutting(bo);
if (!placement->num_placement && !placement->num_busy_placement) {
ret = ttm_bo_pipeline_gutting(bo);
if (ret)
return ret;
return ttm_tt_create(bo, false);
}
/*
- Check whether we need to move buffer.
@@ -1209,6 +1214,14 @@ int ttm_bo_validate(struct ttm_buffer_object *bo, ttm_flag_masked(&bo->mem.placement, new_flags, ~TTM_PL_MASK_MEMTYPE); }
- /*
* We might need to add a TTM.
*/
- if (bo->mem.mem_type == TTM_PL_SYSTEM && bo->ttm == NULL) {
ret = ttm_tt_create(bo, true);
if (ret)
return ret;
- } return 0; } EXPORT_SYMBOL(ttm_bo_validate);
diff --git a/drivers/gpu/drm/ttm/ttm_bo_util.c b/drivers/gpu/drm/ttm/ttm_bo_util.c index 496158acd5b9..76376dc71f25 100644 --- a/drivers/gpu/drm/ttm/ttm_bo_util.c +++ b/drivers/gpu/drm/ttm/ttm_bo_util.c @@ -531,15 +531,12 @@ static int ttm_bo_kmap_ttm(struct ttm_buffer_object *bo, .interruptible = false, .no_wait_gpu = false };
- struct ttm_tt *ttm;
- struct ttm_tt *ttm = bo->ttm; pgprot_t prot; int ret;
- ret = ttm_tt_create(bo, true);
- if (ret)
return ret;
- BUG_ON(!ttm);
- ttm = bo->ttm; ret = ttm_tt_populate(ttm, &ctx); if (ret) return ret;
diff --git a/drivers/gpu/drm/ttm/ttm_bo_vm.c b/drivers/gpu/drm/ttm/ttm_bo_vm.c index ba2e8bd198ad..e90c5c806645 100644 --- a/drivers/gpu/drm/ttm/ttm_bo_vm.c +++ b/drivers/gpu/drm/ttm/ttm_bo_vm.c @@ -347,11 +347,6 @@ vm_fault_t ttm_bo_vm_fault_reserved(struct vm_fault *vmf,
};
if (ttm_tt_create(bo, true)) {
ret = VM_FAULT_OOM;
goto out_io_unlock;
}
- ttm = bo->ttm; if (ttm_tt_populate(bo->ttm, &ctx)) { ret = VM_FAULT_OOM;
diff --git a/drivers/gpu/drm/ttm/ttm_tt.c b/drivers/gpu/drm/ttm/ttm_tt.c index bdd6169cef13..05c9147ac6d3 100644 --- a/drivers/gpu/drm/ttm/ttm_tt.c +++ b/drivers/gpu/drm/ttm/ttm_tt.c @@ -70,6 +70,7 @@ int ttm_tt_create(struct ttm_buffer_object *bo, bool zero_alloc) page_flags |= TTM_PAGE_FLAG_SG; break; default:
pr_err("Illegal buffer object type\n"); return -EINVAL; }bo->ttm = NULL;
Am 11.08.20 um 14:52 schrieb Christian König:
Am 11.08.20 um 11:24 schrieb Christian König:
This reverts commit 2ddef17678bc2ea1d20517dd2b4ed4aa967ffa8b.
As it turned out VMWGFX needs a much wider audit to fix this.
Signed-off-by: Christian König christian.koenig@amd.com
Dare to give me an rb for this? I already tested on amdgpu and it should be fixing the VMWGFX problems we currently have.
Ups, that was your old AMD address :)
So once more with feeling, Christian.
Thanks, Christian.
drivers/gpu/drm/ttm/ttm_bo.c | 19 ++++++++++++++++--- drivers/gpu/drm/ttm/ttm_bo_util.c | 7 ++----- drivers/gpu/drm/ttm/ttm_bo_vm.c | 5 ----- drivers/gpu/drm/ttm/ttm_tt.c | 1 + 4 files changed, 19 insertions(+), 13 deletions(-)
diff --git a/drivers/gpu/drm/ttm/ttm_bo.c b/drivers/gpu/drm/ttm/ttm_bo.c index ad09329b62d3..42386bda32fe 100644 --- a/drivers/gpu/drm/ttm/ttm_bo.c +++ b/drivers/gpu/drm/ttm/ttm_bo.c @@ -656,7 +656,7 @@ static int ttm_bo_evict(struct ttm_buffer_object *bo, ttm_bo_wait(bo, false, false); ttm_bo_cleanup_memtype_use(bo); - return 0; + return ttm_tt_create(bo, false); } evict_mem = bo->mem; @@ -1191,8 +1191,13 @@ int ttm_bo_validate(struct ttm_buffer_object *bo, /* * Remove the backing store if no placement is given. */ - if (!placement->num_placement && !placement->num_busy_placement) - return ttm_bo_pipeline_gutting(bo); + if (!placement->num_placement && !placement->num_busy_placement) { + ret = ttm_bo_pipeline_gutting(bo); + if (ret) + return ret;
+ return ttm_tt_create(bo, false); + } /* * Check whether we need to move buffer. @@ -1209,6 +1214,14 @@ int ttm_bo_validate(struct ttm_buffer_object *bo, ttm_flag_masked(&bo->mem.placement, new_flags, ~TTM_PL_MASK_MEMTYPE); } + /* + * We might need to add a TTM. + */ + if (bo->mem.mem_type == TTM_PL_SYSTEM && bo->ttm == NULL) { + ret = ttm_tt_create(bo, true); + if (ret) + return ret; + } return 0; } EXPORT_SYMBOL(ttm_bo_validate); diff --git a/drivers/gpu/drm/ttm/ttm_bo_util.c b/drivers/gpu/drm/ttm/ttm_bo_util.c index 496158acd5b9..76376dc71f25 100644 --- a/drivers/gpu/drm/ttm/ttm_bo_util.c +++ b/drivers/gpu/drm/ttm/ttm_bo_util.c @@ -531,15 +531,12 @@ static int ttm_bo_kmap_ttm(struct ttm_buffer_object *bo, .interruptible = false, .no_wait_gpu = false }; - struct ttm_tt *ttm; + struct ttm_tt *ttm = bo->ttm; pgprot_t prot; int ret; - ret = ttm_tt_create(bo, true); - if (ret) - return ret; + BUG_ON(!ttm); - ttm = bo->ttm; ret = ttm_tt_populate(ttm, &ctx); if (ret) return ret; diff --git a/drivers/gpu/drm/ttm/ttm_bo_vm.c b/drivers/gpu/drm/ttm/ttm_bo_vm.c index ba2e8bd198ad..e90c5c806645 100644 --- a/drivers/gpu/drm/ttm/ttm_bo_vm.c +++ b/drivers/gpu/drm/ttm/ttm_bo_vm.c @@ -347,11 +347,6 @@ vm_fault_t ttm_bo_vm_fault_reserved(struct vm_fault *vmf, }; - if (ttm_tt_create(bo, true)) { - ret = VM_FAULT_OOM; - goto out_io_unlock; - }
ttm = bo->ttm; if (ttm_tt_populate(bo->ttm, &ctx)) { ret = VM_FAULT_OOM; diff --git a/drivers/gpu/drm/ttm/ttm_tt.c b/drivers/gpu/drm/ttm/ttm_tt.c index bdd6169cef13..05c9147ac6d3 100644 --- a/drivers/gpu/drm/ttm/ttm_tt.c +++ b/drivers/gpu/drm/ttm/ttm_tt.c @@ -70,6 +70,7 @@ int ttm_tt_create(struct ttm_buffer_object *bo, bool zero_alloc) page_flags |= TTM_PAGE_FLAG_SG; break; default: + bo->ttm = NULL; pr_err("Illegal buffer object type\n"); return -EINVAL; }
On 2020-08-11 2:53 p.m., Christian König wrote:
Am 11.08.20 um 14:52 schrieb Christian König:
Am 11.08.20 um 11:24 schrieb Christian König:
This reverts commit 2ddef17678bc2ea1d20517dd2b4ed4aa967ffa8b.
As it turned out VMWGFX needs a much wider audit to fix this.
Signed-off-by: Christian König christian.koenig@amd.com
Dare to give me an rb for this? I already tested on amdgpu and it should be fixing the VMWGFX problems we currently have.
Ups, that was your old AMD address :)
So once more with feeling,
:)
However, I'm afraid I'm not deep enough into TTM code anymore to give you an R-b, given it's not a straight revert (presumably due to other changes in the meantime).
Am 11.08.20 um 18:42 schrieb Michel Dänzer:
On 2020-08-11 2:53 p.m., Christian König wrote:
Am 11.08.20 um 14:52 schrieb Christian König:
Am 11.08.20 um 11:24 schrieb Christian König:
This reverts commit 2ddef17678bc2ea1d20517dd2b4ed4aa967ffa8b.
As it turned out VMWGFX needs a much wider audit to fix this.
Signed-off-by: Christian König christian.koenig@amd.com
Dare to give me an rb for this? I already tested on amdgpu and it should be fixing the VMWGFX problems we currently have.
Ups, that was your old AMD address :)
So once more with feeling,
:)
However, I'm afraid I'm not deep enough into TTM code anymore to give you an R-b, given it's not a straight revert (presumably due to other changes in the meantime).
Yeah, indeed had to keep Daves changes intact.
Dave can you take a look then?
Thanks in advance, Christian.
On Wed, 12 Aug 2020 at 03:11, Christian König ckoenig.leichtzumerken@gmail.com wrote:
Am 11.08.20 um 18:42 schrieb Michel Dänzer:
On 2020-08-11 2:53 p.m., Christian König wrote:
Am 11.08.20 um 14:52 schrieb Christian König:
Am 11.08.20 um 11:24 schrieb Christian König:
This reverts commit 2ddef17678bc2ea1d20517dd2b4ed4aa967ffa8b.
As it turned out VMWGFX needs a much wider audit to fix this.
Signed-off-by: Christian König christian.koenig@amd.com
Dare to give me an rb for this? I already tested on amdgpu and it should be fixing the VMWGFX problems we currently have.
Ups, that was your old AMD address :)
So once more with feeling,
:)
However, I'm afraid I'm not deep enough into TTM code anymore to give you an R-b, given it's not a straight revert (presumably due to other changes in the meantime).
Yeah, indeed had to keep Daves changes intact.
Dave can you take a look then?
Yup just came in after my "stop working Dave" time.
Did you have an amdgpu patch that worked on top of this? does that need reverting or did it not land yet?
Otherwise,
Reviewed-by: Dave Airlie airlied@redhat.com
On Wed, 12 Aug 2020 at 05:34, Dave Airlie airlied@gmail.com wrote:
On Wed, 12 Aug 2020 at 03:11, Christian König ckoenig.leichtzumerken@gmail.com wrote:
Am 11.08.20 um 18:42 schrieb Michel Dänzer:
On 2020-08-11 2:53 p.m., Christian König wrote:
Am 11.08.20 um 14:52 schrieb Christian König:
Am 11.08.20 um 11:24 schrieb Christian König:
This reverts commit 2ddef17678bc2ea1d20517dd2b4ed4aa967ffa8b.
As it turned out VMWGFX needs a much wider audit to fix this.
Signed-off-by: Christian König christian.koenig@amd.com
Dare to give me an rb for this? I already tested on amdgpu and it should be fixing the VMWGFX problems we currently have.
Ups, that was your old AMD address :)
So once more with feeling,
:)
However, I'm afraid I'm not deep enough into TTM code anymore to give you an R-b, given it's not a straight revert (presumably due to other changes in the meantime).
Yeah, indeed had to keep Daves changes intact.
Dave can you take a look then?
Yup just came in after my "stop working Dave" time.
Did you have an amdgpu patch that worked on top of this? does that need reverting or did it not land yet?
Oh I confused this with the ttm_mem_reg handling fix that had an amdgpu patch.
I'll pull this into my fixes tree for Linus now.
Dave.
Otherwise,
Reviewed-by: Dave Airlie airlied@redhat.com
Am 12.08.20 um 05:02 schrieb Dave Airlie:
On Wed, 12 Aug 2020 at 05:34, Dave Airlie airlied@gmail.com wrote:
On Wed, 12 Aug 2020 at 03:11, Christian König ckoenig.leichtzumerken@gmail.com wrote:
Am 11.08.20 um 18:42 schrieb Michel Dänzer:
On 2020-08-11 2:53 p.m., Christian König wrote:
Am 11.08.20 um 14:52 schrieb Christian König:
Am 11.08.20 um 11:24 schrieb Christian König: > This reverts commit 2ddef17678bc2ea1d20517dd2b4ed4aa967ffa8b. > > As it turned out VMWGFX needs a much wider audit to fix this. > > Signed-off-by: Christian König christian.koenig@amd.com Dare to give me an rb for this? I already tested on amdgpu and it should be fixing the VMWGFX problems we currently have.
Ups, that was your old AMD address :)
So once more with feeling,
:)
However, I'm afraid I'm not deep enough into TTM code anymore to give you an R-b, given it's not a straight revert (presumably due to other changes in the meantime).
Yeah, indeed had to keep Daves changes intact.
Dave can you take a look then?
Yup just came in after my "stop working Dave" time.
Did you have an amdgpu patch that worked on top of this? does that need reverting or did it not land yet?
Oh I confused this with the ttm_mem_reg handling fix that had an amdgpu patch.
I'll pull this into my fixes tree for Linus now.
Should I push it to drm-misc-next then?
Christian.
Dave.
Otherwise,
Reviewed-by: Dave Airlie airlied@redhat.com
Am 11.08.20 um 21:34 schrieb Dave Airlie:
On Wed, 12 Aug 2020 at 03:11, Christian König ckoenig.leichtzumerken@gmail.com wrote:
Am 11.08.20 um 18:42 schrieb Michel Dänzer:
On 2020-08-11 2:53 p.m., Christian König wrote:
Am 11.08.20 um 14:52 schrieb Christian König:
Am 11.08.20 um 11:24 schrieb Christian König:
This reverts commit 2ddef17678bc2ea1d20517dd2b4ed4aa967ffa8b.
As it turned out VMWGFX needs a much wider audit to fix this.
Signed-off-by: Christian König christian.koenig@amd.com
Dare to give me an rb for this? I already tested on amdgpu and it should be fixing the VMWGFX problems we currently have.
Ups, that was your old AMD address :)
So once more with feeling,
:)
However, I'm afraid I'm not deep enough into TTM code anymore to give you an R-b, given it's not a straight revert (presumably due to other changes in the meantime).
Yeah, indeed had to keep Daves changes intact.
Dave can you take a look then?
Yup just came in after my "stop working Dave" time.
Did you have an amdgpu patch that worked on top of this? does that need reverting or did it not land yet?
The amdgpu patch which I already pushed works with or without this. So no change needed here.
Otherwise,
Reviewed-by: Dave Airlie airlied@redhat.com
Thanks, Christian.
dri-devel@lists.freedesktop.org