drm/ttm: Restore ttm prefaulting
Subsystems (4)
PATCH 1/1 drm/ttm: Restore ttm prefaulting
From: Thomas Hellstrom <[email protected]>
Commit 4daa4fba3a38 ("gpu: drm: ttm: Adding new return type vm_fault_t") broke TTM prefaulting. Since vmf_insert_mixed() typically always returns VM_FAULT_NOPAGE, prefaulting stops after the second PTE.
Restore (almost) the original behaviour. Unfortunately we can no longer with the new vm_fault_t return type determine whether a prefaulting PTE insertion hit an already populated PTE, and terminate the insertion loop. Instead we continue with the pre-determined number of prefaults.
--- drivers/gpu/drm/ttm/ttm_bo_vm.c | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-)
drivers/gpu/drm/ttm/ttm_bo_vm.c +7 -9
@@ -290,15 +290,13 @@ vm_fault_t ttm_bo_vm_fault_reserved(struct vm_fault *vmf,else ret =vmf_insert_pfn (&cvma, address, pfn); -/* -* Somebody beat us to this PTE or prefaulting to -* an already populated PTE, or prefaulting error. -*/ - -if (unlikely ((ret ==VM_FAULT_NOPAGE && i >0 ))) -break ; -else if (unlikely (ret &VM_FAULT_ERROR )) - goto out_io_unlock; +/* Never error on prefaulted PTEs */ +if (unlikely ((ret &VM_FAULT_ERROR ))) { +if (i ==0 ) + goto out_io_unlock; +else +break ; + } address +=PAGE_SIZE ;if (unlikely (++page_offset >= page_last))
Signature · 6 lines
2.20.1 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
Quoted 12 lines · Thomas Hellström (VMware)
From: Thomas Hellstrom <[email protected]>
Commit
4daa4fba3a38("gpu: drm: ttm: Adding new return typevm_fault_t") broke TTM prefaulting. Sincevmf_insert_mixed()typically always returnsVM_FAULT_NOPAGE, prefaulting stops after the second PTE.Restore (almost) the original behaviour. Unfortunately we can no longer with the new
vm_fault_treturn type determine whether a prefaulting PTE insertion hit an already populated PTE, and terminate the insertion loop. Instead we continue with the pre-determined number of prefaults.
Quoted 4 lines
Fixes 4daa4fba3a38 ("gpu: drm: ttm: Adding new return type vm_fault_t")Cc Souptick Joarder <[email protected]>Cc Christian König <[email protected]>Signed-off-by Thomas Hellstrom <[email protected]>
This commit merged into 4.19. Need to Cc stable.
Quoted 34 lines
--- drivers/gpu/drm/ttm/ttm_bo_vm.c | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-)drivers/gpu/drm/ttm/ttm_bo_vm.c +7
-10@@ -290,15 +290,13 @@ vm_fault_t ttm_bo_vm_fault_reserved(struct vm_fault *vmf,else ret =vmf_insert_pfn (&cvma, address, pfn); -/* -* Somebody beat us to this PTE or prefaulting to -* an already populated PTE, or prefaulting error. -*/ - -if (unlikely ((ret ==VM_FAULT_NOPAGE && i >0 ))) -break ; -else if (unlikely (ret &VM_FAULT_ERROR )) - goto out_io_unlock; +/* Never error on prefaulted PTEs */ +if (unlikely ((ret &VM_FAULT_ERROR ))) { +if (i ==0 ) + goto out_io_unlock; +else +break ; + } address +=PAGE_SIZE ;if (unlikely (++page_offset >= page_last)) --2.20.1
Am 12.09.19 um 20:38 schrieb Thomas Hellström (VMware):
Quoted 11 lines
From: Thomas Hellstrom <[email protected]>
Commit
4daa4fba3a38("gpu: drm: ttm: Adding new return typevm_fault_t") broke TTM prefaulting. Sincevmf_insert_mixed()typically always returnsVM_FAULT_NOPAGE, prefaulting stops after the second PTE.Restore (almost) the original behaviour. Unfortunately we can no longer with the new
vm_fault_treturn type determine whether a prefaulting PTE insertion hit an already populated PTE, and terminate the insertion loop. Instead we continue with the pre-determined number of prefaults.
Quoted 4 lines
Fixes 4daa4fba3a38 ("gpu: drm: ttm: Adding new return type vm_fault_t")Cc Souptick Joarder <[email protected]>Cc Christian König <[email protected]>Signed-off-by Thomas Hellstrom <[email protected]>
Going to pick that up when Alex rebases our upstream branch.
Christian.
Quoted 21 lines
--- drivers/gpu/drm/ttm/ttm_bo_vm.c | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-)drivers/gpu/drm/ttm/ttm_bo_vm.c +0
-9@@ -290,15 +290,13 @@ vm_fault_t ttm_bo_vm_fault_reserved(struct vm_fault *vmf,else ret =vmf_insert_pfn (&cvma, address, pfn); -/* -* Somebody beat us to this PTE or prefaulting to -* an already populated PTE, or prefaulting error. -*/ - -if (unlikely ((ret ==VM_FAULT_NOPAGE && i >0 ))) -break ; -else if (unlikely (ret &VM_FAULT_ERROR )) - goto out_io_unlock;
drivers/gpu/drm/ttm/ttm_bo_vm.c vm_fault_t ttm_bo_vm_fault_reserved(struct vm_fault *vmf, · line 302
Quoted 10 lines
drivers/gpu/drm/ttm/ttm_bo_vm.c +7
-0+/* Never error on prefaulted PTEs */ +if (unlikely ((ret &VM_FAULT_ERROR ))) { +if (i ==0 ) + goto out_io_unlock; +else +break ; + } address +=PAGE_SIZE ;if (unlikely (++page_offset >= page_last))
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
Quoted 34 lines · Christian
Am 12.09.19 um 20:38 schrieb Thomas Hellström (VMware):
Quoted 11 lines
From: Thomas Hellstrom <[email protected]>
Commit
4daa4fba3a38("gpu: drm: ttm: Adding new return typevm_fault_t") broke TTM prefaulting. Sincevmf_insert_mixed()typically always returnsVM_FAULT_NOPAGE, prefaulting stops after the second PTE.Restore (almost) the original behaviour. Unfortunately we can no longer with the new
vm_fault_treturn type determine whether a prefaulting PTE insertion hit an already populated PTE, and terminate the insertion loop. Instead we continue with the pre-determined number of prefaults.Quoted 4 lines
Fixes 4daa4fba3a38 ("gpu: drm: ttm: Adding new return type vm_fault_t")Cc Souptick Joarder <[email protected]>Cc Christian König <[email protected]>Signed-off-by Thomas Hellstrom <[email protected]>Reviewed-by Christian König <[email protected]>Going to pick that up when Alex rebases our upstream branch.
Christian.
Quoted 12 lines
--- drivers/gpu/drm/ttm/ttm_bo_vm.c | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-)drivers/gpu/drm/ttm/ttm_bo_vm.c +0
-0@@ -290,15 +290,13 @@ vm_fault_t ttm_bo_vm_fault_reserved(struct vm_fault *vmf,else ret =vmf_insert_pfn (&cvma, address, pfn);
Quoted 14 lines
Quoted 4 lines
drivers/gpu/drm/ttm/ttm_bo_vm.c +0
-4-/* -* Somebody beat us to this PTE or prefaulting to -* an already populated PTE, or prefaulting error. -*/ drivers/gpu/drm/ttm/ttm_bo_vm.c vm_fault_t ttm_bo_vm_fault_reserved(struct vm_fault *vmf, · line 297
Quoted 10 lines
drivers/gpu/drm/ttm/ttm_bo_vm.c +5
-5- -if (unlikely ((ret ==VM_FAULT_NOPAGE && i >0 ))) -break ; -else if (unlikely (ret &VM_FAULT_ERROR )) - goto out_io_unlock; +/* Never error on prefaulted PTEs */ +if (unlikely ((ret &VM_FAULT_ERROR ))) { +if (i ==0 ) + goto out_io_unlock; +else
We could perhaps skip that else. Let me know if you want me to respin.
/Thomas
Quoted 5 lines
drivers/gpu/drm/ttm/ttm_bo_vm.c vm_fault_t ttm_bo_vm_fault_reserved(struct vm_fault *vmf, · line 302
Quoted 5 lines
drivers/gpu/drm/ttm/ttm_bo_vm.c +2
-0+break ; + } address +=PAGE_SIZE ;if (unlikely (++page_offset >= page_last))
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
Am 13.09.19 um 13:07 schrieb Thomas Hellström (VMware):
Quoted 47 lines · Christian
Quoted 46 lines
Am 12.09.19 um 20:38 schrieb Thomas Hellström (VMware):
Quoted 13 lines
From: Thomas Hellstrom <[email protected]>
Commit
4daa4fba3a38("gpu: drm: ttm: Adding new return typevm_fault_t")
broke TTM prefaulting. Sincevmf_insert_mixed()typically always returnsVM_FAULT_NOPAGE, prefaulting stops after the second PTE.Restore (almost) the original behaviour. Unfortunately we can no longer with the new
vm_fault_treturn type determine whether a prefaulting PTE insertion hit an already populated PTE, and terminate the insertion loop. Instead we continue with the pre-determined number of prefaults.Quoted 5 lines
Fixes 4daa4fba3a38 ("gpu: drm: ttm: Adding new return type
vm_fault_t")Cc Souptick Joarder <[email protected]>Cc Christian König <[email protected]>Signed-off-by Thomas Hellstrom <[email protected]>Reviewed-by Christian König <[email protected]>Going to pick that up when Alex rebases our upstream branch.
Christian.
Quoted 21 lines
---
drivers/gpu/drm/ttm/ttm_bo_vm.c| 16 +++++++---------1 file changed, 7 insertions(+), 9 deletions(-)drivers/gpu/drm/ttm/ttm_bo_vm.c +0
-0@@ -290,15 +290,13 @@ vm_fault_t ttm_bo_vm_fault_reserved(struct vm_fault *vmf,else
ret =vmf_insert_pfn(&cvma, address, pfn); - /*
- * Somebody beat us to this PTE or prefaulting to - * an already populated PTE, or prefaulting error. - */
-
- if (unlikely((ret == VM_FAULT_NOPAGE && i > 0))) - break;
- else if (unlikely(ret & VM_FAULT_ERROR))
Quoted 8 lines
Quoted 6 lines
Quoted 6 lines
- goto
out_io_unlock;
+ /* Never error on prefaulted PTEs */
+ if (unlikely((ret & VM_FAULT_ERROR))) {
+ if (i == 0)
+ gotoout_io_unlock;
+ elseWe could perhaps skip that else. Let me know if you want me to respin.
I would rather like to keep it, when something goes wrong we should really stop faulting in more.
Christian.
Quoted 11 lines
/Thomas
Quoted 4 lines
Quoted 4 lines
+ break;
+ }
address +=PAGE_SIZE;
if (unlikely(++page_offset >= page_last))
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel