Skip to content

Commit c445c16

Browse files
thellstrom-osairlied
authored andcommitted
drm/ttm: Temporarily disable the huge_fault() callback
With amdgpu and CONFIG_TRANSPARENT_HUGEPAGE_ALWAYS=y, there are errors like: BUG: non-zero pgtables_bytes on freeing mm and: BUG: Bad rss-counter state with TTM transparent huge-pages. Until we've figured out what other TTM drivers do differently compared to vmwgfx, disable the huge_fault() callback, eliminating transhuge page-table entries. Cc: Christian König <[email protected]> Signed-off-by: Thomas Hellstrom (VMware) <[email protected]> Reported-by: Alex Xu (Hello71) <[email protected]> Tested-by: Alex Xu (Hello71) <[email protected]> Acked-by: Christian König <[email protected]> Signed-off-by: Dave Airlie <[email protected]> Link: https://patchwork.freedesktop.org/patch/msgid/[email protected]
1 parent cb6d406 commit c445c16

File tree

1 file changed

+0
-63
lines changed

1 file changed

+0
-63
lines changed

drivers/gpu/drm/ttm/ttm_bo_vm.c

Lines changed: 0 additions & 63 deletions
Original file line numberDiff line numberDiff line change
@@ -436,66 +436,6 @@ vm_fault_t ttm_bo_vm_fault(struct vm_fault *vmf)
436436
}
437437
EXPORT_SYMBOL(ttm_bo_vm_fault);
438438

439-
#ifdef CONFIG_TRANSPARENT_HUGEPAGE
440-
/**
441-
* ttm_pgprot_is_wrprotecting - Is a page protection value write-protecting?
442-
* @prot: The page protection value
443-
*
444-
* Return: true if @prot is write-protecting. false otherwise.
445-
*/
446-
static bool ttm_pgprot_is_wrprotecting(pgprot_t prot)
447-
{
448-
/*
449-
* This is meant to say "pgprot_wrprotect(prot) == prot" in a generic
450-
* way. Unfortunately there is no generic pgprot_wrprotect.
451-
*/
452-
return pte_val(pte_wrprotect(__pte(pgprot_val(prot)))) ==
453-
pgprot_val(prot);
454-
}
455-
456-
static vm_fault_t ttm_bo_vm_huge_fault(struct vm_fault *vmf,
457-
enum page_entry_size pe_size)
458-
{
459-
struct vm_area_struct *vma = vmf->vma;
460-
pgprot_t prot;
461-
struct ttm_buffer_object *bo = vma->vm_private_data;
462-
vm_fault_t ret;
463-
pgoff_t fault_page_size = 0;
464-
bool write = vmf->flags & FAULT_FLAG_WRITE;
465-
466-
switch (pe_size) {
467-
case PE_SIZE_PMD:
468-
fault_page_size = HPAGE_PMD_SIZE >> PAGE_SHIFT;
469-
break;
470-
#ifdef CONFIG_HAVE_ARCH_TRANSPARENT_HUGEPAGE_PUD
471-
case PE_SIZE_PUD:
472-
fault_page_size = HPAGE_PUD_SIZE >> PAGE_SHIFT;
473-
break;
474-
#endif
475-
default:
476-
WARN_ON_ONCE(1);
477-
return VM_FAULT_FALLBACK;
478-
}
479-
480-
/* Fallback on write dirty-tracking or COW */
481-
if (write && ttm_pgprot_is_wrprotecting(vma->vm_page_prot))
482-
return VM_FAULT_FALLBACK;
483-
484-
ret = ttm_bo_vm_reserve(bo, vmf);
485-
if (ret)
486-
return ret;
487-
488-
prot = vm_get_page_prot(vma->vm_flags);
489-
ret = ttm_bo_vm_fault_reserved(vmf, prot, 1, fault_page_size);
490-
if (ret == VM_FAULT_RETRY && !(vmf->flags & FAULT_FLAG_RETRY_NOWAIT))
491-
return ret;
492-
493-
dma_resv_unlock(bo->base.resv);
494-
495-
return ret;
496-
}
497-
#endif
498-
499439
void ttm_bo_vm_open(struct vm_area_struct *vma)
500440
{
501441
struct ttm_buffer_object *bo = vma->vm_private_data;
@@ -598,9 +538,6 @@ static const struct vm_operations_struct ttm_bo_vm_ops = {
598538
.open = ttm_bo_vm_open,
599539
.close = ttm_bo_vm_close,
600540
.access = ttm_bo_vm_access,
601-
#ifdef CONFIG_TRANSPARENT_HUGEPAGE
602-
.huge_fault = ttm_bo_vm_huge_fault,
603-
#endif
604541
};
605542

606543
static struct ttm_buffer_object *ttm_bo_vm_lookup(struct ttm_bo_device *bdev,

0 commit comments

Comments
 (0)