Skip to contentSkip to conversation

drm/amdgpu: remove preferred domain judgement in pt/pd creation

PATCH In review Yifan Zhang 3 participants 5 messages Aug 25, 2021

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 drm/amdgpu: remove preferred domain judgement in pt/pd creation

amdgpu_bo_get_preferred_pin_domain was added to handle system memory page tables. Since system memory pt/pd is disabled now, remove preferred domain judgement to avoid confusion.

---
 drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c | 1 -
 1 file changed, 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c +0 -1
index 0b893aa21ffe..764822edba18 100644
@@ -926,7 +926,6 @@ static int amdgpu_vm_pt_create(struct amdgpu_device *adev,
 	bp.size = amdgpu_vm_bo_size(adev, level);
 	bp.byte_align = AMDGPU_GPU_PAGE_SIZE;
 	bp.domain = AMDGPU_GEM_DOMAIN_VRAM;
-	bp.domain = amdgpu_bo_get_preferred_pin_domain(adev, bp.domain);
 	bp.flags = AMDGPU_GEM_CREATE_VRAM_CONTIGUOUS |
 		AMDGPU_GEM_CREATE_CPU_GTT_USWC;
 
Signature · 1 line
2.25.1
maintainer
#1 lore raw

Am 25.08.21 um 09:44 schrieb Yifan Zhang:

Quoted 3 lines

amdgpu_bo_get_preferred_pin_domain was added to handle system memory page tables. Since system memory pt/pd is disabled now, remove preferred domain judgement to avoid confusion.

Well I would rather keep that and enable system memory page tables again.

We should probably add IOMMU checks to amdgpu_bo_get_preferred_pin_domain() anyway. My last status is that this has been causing problems with DC as well.

Alex, what do you think?

Regards,
Christian.

Quoted 18 lines
---
  drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c | 1 -
  1 file changed, 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c +0 -1
index 0b893aa21ffe..764822edba18 100644
@@ -926,7 +926,6 @@ static int amdgpu_vm_pt_create(struct amdgpu_device *adev,
  	bp.size = amdgpu_vm_bo_size(adev, level);
  	bp.byte_align = AMDGPU_GPU_PAGE_SIZE;
  	bp.domain = AMDGPU_GEM_DOMAIN_VRAM;
-	bp.domain = amdgpu_bo_get_preferred_pin_domain(adev, bp.domain);
  	bp.flags = AMDGPU_GEM_CREATE_VRAM_CONTIGUOUS |
  		AMDGPU_GEM_CREATE_CPU_GTT_USWC;
 
#2 lore raw

[Public]

Hi Christian,

OK. Then I think we should modify the document for amdgpu_bo_get_preferred_pin_domain since it is not only for display scanout, right ?

/**
* amdgpu_bo_get_preferred_pin_domain - get preferred domain for scanout
* @adev: amdgpu device object
* @domain: allowed :ref:memory domains <amdgpu_memory_domains> *
* Returns:
* Which of the allowed domains is preferred for pinning the BO for scanout. */
uint32_t amdgpu_bo_get_preferred_pin_domain(struct amdgpu_device *adev,
uint32_t domain)

 {
     if (domain == (AMDGPU_GEM_DOMAIN_VRAM | AMDGPU_GEM_DOMAIN_GTT)) {
         domain = AMDGPU_GEM_DOMAIN_VRAM;
         if (adev->gmc.real_vram_size <= AMDGPU_SG_THRESHOLD)
             domain = AMDGPU_GEM_DOMAIN_GTT;
     }
     return domain;

}

BRs,
Yifan
-----Original Message-----
From: Koenig, Christian <[email protected]>
Sent: Wednesday, August 25, 2021 3:47 PM
To: Zhang, Yifan <[email protected]>; [email protected]; Deucher, Alexander <[email protected]>
Subject: Re: [PATCH] drm/amdgpu: remove preferred domain judgement in pt/pd creation

Am 25.08.21 um 09:44 schrieb Yifan Zhang:

Quoted 3 lines

amdgpu_bo_get_preferred_pin_domain was added to handle system memory page tables. Since system memory pt/pd is disabled now, remove preferred domain judgement to avoid confusion.

Well I would rather keep that and enable system memory page tables again.

We should probably add IOMMU checks to
amdgpu_bo_get_preferred_pin_domain() anyway. My last status is that this has been causing problems with DC as well.

Alex, what do you think?

Regards,
Christian.

Quoted 19 lines
---
  drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c | 1 -
  1 file changed, 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c +0 -1
index 0b893aa21ffe..764822edba18 100644
@@ -926,7 +926,6 @@ static int amdgpu_vm_pt_create(struct amdgpu_device *adev,
  	bp.size = amdgpu_vm_bo_size(adev, level);
  	bp.byte_align = AMDGPU_GPU_PAGE_SIZE;
  	bp.domain = AMDGPU_GEM_DOMAIN_VRAM;
-	bp.domain = amdgpu_bo_get_preferred_pin_domain(adev, bp.domain);
  	bp.flags = AMDGPU_GEM_CREATE_VRAM_CONTIGUOUS |
  		AMDGPU_GEM_CREATE_CPU_GTT_USWC;
 
maintainer
#3 lore raw

Yes, good point. And we should probably also rename the functions since page tables are not pinned at all.

Christian.

Am 25.08.21 um 10:04 schrieb Zhang, Yifan:

Quoted 65 lines

[Public]

Hi Christian,

OK. Then I think we should modify the document for amdgpu_bo_get_preferred_pin_domain since it is not only for display scanout, right ?

/**
* amdgpu_bo_get_preferred_pin_domain - get preferred domain for scanout
* @adev: amdgpu device object
* @domain: allowed :ref:memory domains <amdgpu_memory_domains> *
* Returns:
* Which of the allowed domains is preferred for pinning the BO for scanout. */
uint32_t amdgpu_bo_get_preferred_pin_domain(struct amdgpu_device *adev,
uint32_t domain)

  {
      if (domain == (AMDGPU_GEM_DOMAIN_VRAM | AMDGPU_GEM_DOMAIN_GTT)) {
          domain = AMDGPU_GEM_DOMAIN_VRAM;
          if (adev->gmc.real_vram_size <= AMDGPU_SG_THRESHOLD)
              domain = AMDGPU_GEM_DOMAIN_GTT;
      }
      return domain;

}

BRs,
Yifan
-----Original Message-----
From: Koenig, Christian <[email protected]>
Sent: Wednesday, August 25, 2021 3:47 PM
To: Zhang, Yifan <[email protected]>; [email protected]; Deucher, Alexander <[email protected]>
Subject: Re: [PATCH] drm/amdgpu: remove preferred domain judgement in pt/pd creation

Am 25.08.21 um 09:44 schrieb Yifan Zhang:

Quoted 3 lines

amdgpu_bo_get_preferred_pin_domain was added to handle system memory page tables. Since system memory pt/pd is disabled now, remove preferred domain judgement to avoid confusion.

Well I would rather keep that and enable system memory page tables again.

We should probably add IOMMU checks to
amdgpu_bo_get_preferred_pin_domain() anyway. My last status is that this has been causing problems with DC as well.

Alex, what do you think?

Regards,
Christian.

Quoted 18 lines
---
   drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c | 1 -
   1 file changed, 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c +0 -1
index 0b893aa21ffe..764822edba18 100644
@@ -926,7 +926,6 @@ static int amdgpu_vm_pt_create(struct amdgpu_device *adev,
   	bp.size = amdgpu_vm_bo_size(adev, level);
   	bp.byte_align = AMDGPU_GPU_PAGE_SIZE;
   	bp.domain = AMDGPU_GEM_DOMAIN_VRAM;
-	bp.domain = amdgpu_bo_get_preferred_pin_domain(adev, bp.domain);
   	bp.flags = AMDGPU_GEM_CREATE_VRAM_CONTIGUOUS |
   		AMDGPU_GEM_CREATE_CPU_GTT_USWC;
 
#4 lore raw
In reply to Christian König
Quoted 6 lines · Christian König

Am 25.08.21 um 09:44 schrieb Yifan Zhang:

Quoted 3 lines

amdgpu_bo_get_preferred_pin_domain was added to handle system memory page tables. Since system memory pt/pd is disabled now, remove preferred domain judgement to avoid confusion.

Quoted 7 lines

Well I would rather keep that and enable system memory page tables again.

We should probably add IOMMU checks to amdgpu_bo_get_preferred_pin_domain() anyway. My last status is that this has been causing problems with DC as well.

Alex, what do you think?

I think we can just enable them on dGPUs and APUs >= Renoir.

Alex

Quoted 23 lines

Regards,
Christian.

Quoted 18 lines
---
  drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c | 1 -
  1 file changed, 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c +0 -1
index 0b893aa21ffe..764822edba18 100644
@@ -926,7 +926,6 @@ static int amdgpu_vm_pt_create(struct amdgpu_device *adev,
      bp.size = amdgpu_vm_bo_size(adev, level);
      bp.byte_align = AMDGPU_GPU_PAGE_SIZE;
      bp.domain = AMDGPU_GEM_DOMAIN_VRAM;
-     bp.domain = amdgpu_bo_get_preferred_pin_domain(adev, bp.domain);
      bp.flags = AMDGPU_GEM_CREATE_VRAM_CONTIGUOUS |
              AMDGPU_GEM_CREATE_CPU_GTT_USWC;