Skip to contentSkip to conversation

drm/amdgpu: improve GTT BO alloc speed in OGL

PATCH In review Alex Deucher 4 participants 5 messages Sep 12, 2016 – Sep 13, 2016 2 messages not in the archive

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

PATCH 1/1 drm/amdgpu: improve GTT BO alloc speed in OGL

From: "monk.liu" <[email protected]>

original we use ttm_dma path to allocate GTT bo, which is too much slower than the path of ttm_pool, in most cases.

The swiotlb checks don't seem to work and we always end up in the slow path even when an IOMMU is available.

---
 drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c | 13 -------------
 1 file changed, 13 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c +0 -13
index 3beb10b..e2fcd39 100644
@@ -783,12 +783,6 @@ static int amdgpu_ttm_tt_populate(struct ttm_tt *ttm)
 
 	adev = amdgpu_get_adev(ttm->bdev);
 
-#ifdef CONFIG_SWIOTLB
-	if (swiotlb_nr_tbl()) {
-		return ttm_dma_populate(&gtt->ttm, adev->dev);
-	}
-#endif
-
 	r = ttm_pool_populate(ttm);
 	if (r) {
 		return r;
@@ -829,13 +823,6 @@ static void amdgpu_ttm_tt_unpopulate(struct ttm_tt *ttm)
 
 	adev = amdgpu_get_adev(ttm->bdev);
 
-#ifdef CONFIG_SWIOTLB
-	if (swiotlb_nr_tbl()) {
-		ttm_dma_unpopulate(&gtt->ttm, adev->dev);
-		return;
-	}
-#endif
-
 	for (i = 0; i < ttm->num_pages; i++) {
 		if (gtt->ttm.dma_address[i]) {
 			pci_unmap_page(adev->pdev, gtt->ttm.dma_address[i],
Signature · 6 lines
2.5.5

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
#1 lore raw

Am 12.09.2016 um 18:44 schrieb Alex Deucher:

Quoted 7 lines

From: "monk.liu" <[email protected]>

original we use ttm_dma path to allocate GTT bo, which is too much slower than the path of ttm_pool, in most cases.

The swiotlb checks don't seem to work and we always end up in the slow path even when an IOMMU is available.

While the check is clearly not correct. Simply always using the direct mapping and not checking the fallback path can break as well.

So this patch is clearly not a good idea and needs to be fixed before it is pushed.

Christian.

Quoted 28 lines
---
  drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c | 13 -------------
  1 file changed, 13 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c +0 -6
index 3beb10b..e2fcd39 100644
@@ -783,12 +783,6 @@ static int amdgpu_ttm_tt_populate(struct ttm_tt *ttm)
 
  	adev = amdgpu_get_adev(ttm->bdev);
 
-#ifdef CONFIG_SWIOTLB
-	if (swiotlb_nr_tbl()) {
-		return ttm_dma_populate(&gtt->ttm, adev->dev);
-	}
-#endif
-
  	r = ttm_pool_populate(ttm);
  	if (r) {
  		return r;
@@ -829,13 +823,6 @@ static void amdgpu_ttm_tt_unpopulate(struct ttm_tt *ttm)
 
  	adev = amdgpu_get_adev(ttm->bdev);
 

drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c static void amdgpu_ttm_tt_unpopulate(struct ttm_tt *ttm) · line 828

Quoted 10 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c +0 -7
-#ifdef CONFIG_SWIOTLB
-	if (swiotlb_nr_tbl()) {
-		ttm_dma_unpopulate(&gtt->ttm, adev->dev);
-		return;
-	}
-#endif
-
  	for (i = 0; i < ttm->num_pages; i++) {
  		if (gtt->ttm.dma_address[i]) {
  			pci_unmap_page(adev->pdev, gtt->ttm.dma_address[i],

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel

A message that is not in the archive (sent off-list or not yet received): 579f1d1e-fd40-a670-08f9-172d2f596d62-ANTagKRnAhcb1SvskN2V4Q@public.gmane.org

#3 lore raw
Quoted 11 lines · Christian König

Am 12.09.2016 um 18:44 schrieb Alex Deucher:

Quoted 8 lines

From: "monk.liu" <[email protected]>

original we use ttm_dma path to allocate GTT bo, which is too much slower than the path of ttm_pool, in most cases.

The swiotlb checks don't seem to work and we always end up in the slow path even when an IOMMU is available.

Quoted 5 lines

While the check is clearly not correct. Simply always using the direct mapping and not checking the fallback path can break as well.

So this patch is clearly not a good idea and needs to be fixed before it is pushed.

Jerome looked into it when Monk first debugged this, but I don't think anything ever came of it:
https://patchwork.kernel.org/patch/7079521/

Alex

Quoted 33 lines

Christian.

Quoted 29 lines
---
  drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c | 13 -------------
  1 file changed, 13 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c +0 -7
index 3beb10b..e2fcd39 100644
@@ -783,12 +783,6 @@ static int amdgpu_ttm_tt_populate(struct ttm_tt *ttm)
        adev = amdgpu_get_adev(ttm->bdev);
  -#ifdef CONFIG_SWIOTLB
-       if (swiotlb_nr_tbl()) {
-               return ttm_dma_populate(&gtt->ttm, adev->dev);
-       }
-#endif
-
        r = ttm_pool_populate(ttm);
        if (r) {
                return r;
@@ -829,13 +823,6 @@ static void amdgpu_ttm_tt_unpopulate(struct ttm_tt
 *ttm)
        adev = amdgpu_get_adev(ttm->bdev);
  -#ifdef CONFIG_SWIOTLB
-       if (swiotlb_nr_tbl()) {
-               ttm_dma_unpopulate(&gtt->ttm, adev->dev);
Quoted 11 lines
Quoted 8 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c +0 -4
-               return;
-       }
-#endif
-
        for (i = 0; i < ttm->num_pages; i++) {
                if (gtt->ttm.dma_address[i]) {
                        pci_unmap_page(adev->pdev,

gtt->ttm.dma_address[i],

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

#4 lore raw
In reply to Alex Deucher
Quoted 7 lines · Alex Deucher

From: "monk.liu" <[email protected]>

original we use ttm_dma path to allocate GTT bo, which is too much slower than the path of ttm_pool, in most cases.

The swiotlb checks don't seem to work and we always end up in the slow path even when an IOMMU is available.

This change will break any cases where SWIOTLB is actually necessary though, won't it?

Signature · 6 lines
Earthling Michel Dänzer               |               http://www.amd.com
Libre software enthusiast             |             Mesa and X developer
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel

A message that is not in the archive (sent off-list or not yet received): ad77d18c-b74b-a73e-b412-2ce1bc06f9ff-otUistvHUpPR7s880joybQ@public.gmane.org

#6 lore raw
Quoted 11 lines · Michel Dänzer
Quoted 7 lines · Alex Deucher

From: "monk.liu" <[email protected]>

original we use ttm_dma path to allocate GTT bo, which is too much slower than the path of ttm_pool, in most cases.

The swiotlb checks don't seem to work and we always end up in the slow path even when an IOMMU is available.

This change will break any cases where SWIOTLB is actually necessary though, won't it?

Yes, theoretically.

Alex

Quoted 5 lines

--
Earthling Michel Dänzer | http://www.amd.com
Libre software enthusiast | Mesa and X developer

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx