drm/amdgpu: add amdgpu.ttm_dma_allocation parameter
Subsystems (2)
PATCH 1/2 drm/amdgpu: add amdgpu.ttm_dma_allocation parameter
it will be used to set ttm dma allocation path.
--- drivers/gpu/drm/amd/amdgpu/amdgpu.h | 1 + drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c | 4 ++++ 2 files changed, 5 insertions(+)
drivers/gpu/drm/amd/amdgpu/amdgpu.h +1 -0
@@ -128,6 +128,7 @@ extern int amdgpu_job_hang_limit;extern int amdgpu_lbpw;extern int amdgpu_compute_multipipe;extern int amdgpu_gpu_recovery; +extern int amdgpu_ttm_dma_allocation;#ifdef CONFIG_DRM_AMDGPU_SI extern int amdgpu_si_support;
drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c +4 -0
@@ -131,6 +131,7 @@ int amdgpu_job_hang_limit = 0;int amdgpu_lbpw =-1 ;int amdgpu_compute_multipipe =-1 ;int amdgpu_gpu_recovery =-1 ;/* auto */ +int amdgpu_ttm_dma_allocation =0 ;MODULE_PARM_DESC (vramlimit,"Restrict VRAM for testing, in megabytes" );module_param_named (vramlimit, amdgpu_vram_limit, int,0600 );
@@ -286,6 +287,9 @@ module_param_named(compute_multipipe, amdgpu_compute_multipipe, int, 0444);MODULE_PARM_DESC (gpu_recovery,"Enable GPU recovery mechanism, (1 = enable, 0 = disable, -1 = auto" );module_param_named (gpu_recovery, amdgpu_gpu_recovery, int,0444 ); +MODULE_PARM_DESC (ttm_dma_allocation,"Enable TTM dma allocation, (1 = enable, 0 = disable" ); +module_param_named (amdgpu_ttm_dma_allocation, amdgpu_ttm_dma_allocation, int,0444 ); +#ifdef CONFIG_DRM_AMDGPU_SI #if defined(CONFIG_DRM_RADEON ) || defined(CONFIG_DRM_RADEON_MODULE )
Signature · 6 lines
2.14.1 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 2/2 drm/amdgpu: disable ttm dma allocation path by kernel parameter
In reply to a message not in the archivedma allocation is slower than ttm pool path, which is only needed when system memory iomapping is outside of GPU pci access address space.
In most case, ttm pool path can satisfy the requirement. If in some special case that needs to re-enable dma allocation, we can set amdgpu.ttm_dma_allocation kernel parameter in grub to enable it.
--- drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c +3 -3
@@ -1018,7 +1018,7 @@ static int amdgpu_ttm_tt_populate(struct ttm_tt *ttm, }#ifdef CONFIG_SWIOTLB -if (swiotlb_nr_tbl ()) { +if (amdgpu_ttm_dma_allocation &&swiotlb_nr_tbl ()) {return ttm_dma_populate (>t->ttm, adev->dev, ctx); }#endif
@@ -1045,7 +1045,7 @@ static void amdgpu_ttm_tt_unpopulate(struct ttm_tt *ttm) adev =amdgpu_ttm_adev (ttm->bdev);#ifdef CONFIG_SWIOTLB -if (swiotlb_nr_tbl ()) { +if (amdgpu_ttm_dma_allocation &&swiotlb_nr_tbl ()) {ttm_dma_unpopulate (>t->ttm, adev->dev);return ; }
@@ -2014,7 +2014,7 @@ static int amdgpu_ttm_debugfs_init(struct amdgpu_device *adev) count =ARRAY_SIZE (amdgpu_ttm_debugfs_list);#ifdef CONFIG_SWIOTLB -if (!swiotlb_nr_tbl ()) +if (!amdgpu_ttm_dma_allocation || !swiotlb_nr_tbl ()) --count;#endif
Signature · 6 lines
2.14.1 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
Christian König
NAKAm 25.01.2018 um 07:50 schrieb Chunming Zhou:
Quoted 1 line
it will be used to set ttm dma allocation path.
NAK, disabling swiotlb on the kernel command line should have the same effect.
If that doesn't work we really need to thing about how to improve the detection logic.
When I have a free minute I will try to hack something together.
Regards,
Christian.
Quoted 33 lines
Change-Id I9fa936db751811779cea66598bba0b8cf4cfd869Signed-off-by Chunming Zhou <[email protected]>--- drivers/gpu/drm/amd/amdgpu/amdgpu.h | 1 + drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c | 4 ++++ 2 files changed, 5 insertions(+)drivers/gpu/drm/amd/amdgpu/amdgpu.h +1
-0@@ -128,6 +128,7 @@ extern int amdgpu_job_hang_limit;extern int amdgpu_lbpw;extern int amdgpu_compute_multipipe;extern int amdgpu_gpu_recovery; +extern int amdgpu_ttm_dma_allocation;#ifdef CONFIG_DRM_AMDGPU_SI extern int amdgpu_si_support;drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c +1
-0@@ -131,6 +131,7 @@ int amdgpu_job_hang_limit = 0;int amdgpu_lbpw =-1 ;int amdgpu_compute_multipipe =-1 ;int amdgpu_gpu_recovery =-1 ;/* auto */ +int amdgpu_ttm_dma_allocation =0 ;MODULE_PARM_DESC (vramlimit,"Restrict VRAM for testing, in megabytes" );module_param_named (vramlimit, amdgpu_vram_limit, int,0600 );
drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c module_param_named(compute_multipipe, amdgpu_compute_multipipe, int, 0444); · line 295
Quoted 9 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c +3
-0@@ -286,6 +287,9 @@ module_param_named(compute_multipipe, amdgpu_compute_multipipe, int, 0444);MODULE_PARM_DESC (gpu_recovery,"Enable GPU recovery mechanism, (1 = enable, 0 = disable, -1 = auto" );module_param_named (gpu_recovery, amdgpu_gpu_recovery, int,0444 ); +MODULE_PARM_DESC (ttm_dma_allocation,"Enable TTM dma allocation, (1 = enable, 0 = disable" ); +module_param_named (amdgpu_ttm_dma_allocation, amdgpu_ttm_dma_allocation, int,0444 ); +#ifdef CONFIG_DRM_AMDGPU_SI #if defined(CONFIG_DRM_RADEON ) || defined(CONFIG_DRM_RADEON_MODULE )
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
Quoted 35 lines · Chunming Zhou
it will be used to set ttm dma allocation path.
Change-Id I9fa936db751811779cea66598bba0b8cf4cfd869Signed-off-by Chunming Zhou <[email protected]>--- drivers/gpu/drm/amd/amdgpu/amdgpu.h | 1 + drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c | 4 ++++ 2 files changed, 5 insertions(+)drivers/gpu/drm/amd/amdgpu/amdgpu.h +1
-0@@ -128,6 +128,7 @@ extern int amdgpu_job_hang_limit;extern int amdgpu_lbpw;extern int amdgpu_compute_multipipe;extern int amdgpu_gpu_recovery; +extern int amdgpu_ttm_dma_allocation;#ifdef CONFIG_DRM_AMDGPU_SI extern int amdgpu_si_support;drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c +1
-0@@ -131,6 +131,7 @@ int amdgpu_job_hang_limit = 0;int amdgpu_lbpw =-1 ;int amdgpu_compute_multipipe =-1 ;int amdgpu_gpu_recovery =-1 ;/* auto */ +int amdgpu_ttm_dma_allocation =0 ;MODULE_PARM_DESC (vramlimit,"Restrict VRAM for testing, in megabytes" );module_param_named (vramlimit, amdgpu_vram_limit, int,0600 );
drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c module_param_named(compute_multipipe, amdgpu_compute_multipipe, int, 0444); · line 295
Quoted 9 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c +3
-0@@ -286,6 +287,9 @@ module_param_named(compute_multipipe, amdgpu_compute_multipipe, int, 0444);MODULE_PARM_DESC (gpu_recovery,"Enable GPU recovery mechanism, (1 = enable, 0 = disable, -1 = auto" );module_param_named (gpu_recovery, amdgpu_gpu_recovery, int,0444 ); +MODULE_PARM_DESC (ttm_dma_allocation,"Enable TTM dma allocation, (1 = enable, 0 = disable" ); +module_param_named (amdgpu_ttm_dma_allocation, amdgpu_ttm_dma_allocation, int,0444 ); +#ifdef CONFIG_DRM_AMDGPU_SI #if defined(CONFIG_DRM_RADEON ) || defined(CONFIG_DRM_RADEON_MODULE )
NAK from me as well.
This isn't something that the administrator/user needs to decide. Somebody needs to figure out the exact conditions under which the DMA allocation path is needed, and make the code match those.
In general, amdgpu already has way too many module parameters. If we keep adding more like this, it'll become completely unmanageable soon.
Signature · 6 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
Quoted 4 lines · Christian König
Am 25.01.2018 um 07:50 schrieb Chunming Zhou:
Quoted 1 line
it will be used to set ttm dma allocation path.
NAK, disabling swiotlb on the kernel command line should have the same effect.
The tricky is swiotlb is enabled by default, and there may be some other drivers need it. We only need not to use it amdgpu driver, so making it be disabled by default makes sense, right?
Regards,
David Zhou
Quoted 40 lines
If that doesn't work we really need to thing about how to improve the detection logic.
When I have a free minute I will try to hack something together.
Regards,
Christian.Quoted 32 lines
Change-Id I9fa936db751811779cea66598bba0b8cf4cfd869Signed-off-by Chunming Zhou <[email protected]>---
drivers/gpu/drm/amd/amdgpu/amdgpu.h | 1 +drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c| 4 ++++2 files changed, 5 insertions(+)drivers/gpu/drm/amd/amdgpu/amdgpu.h +1
-0@@ -128,6 +128,7 @@ extern int amdgpu_job_hang_limit; extern int amdgpu_lbpw; extern int amdgpu_compute_multipipe; extern int amdgpu_gpu_recovery; +extern int amdgpu_ttm_dma_allocation; #ifdef CONFIG_DRM_AMDGPU_SI extern int amdgpu_si_support;drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c +0
-0@@ -131,6 +131,7 @@ int amdgpu_job_hang_limit = 0; int amdgpu_lbpw = -1; int amdgpu_compute_multipipe = -1;int
amdgpu_gpu_recovery= -1; /* auto */
+intamdgpu_ttm_dma_allocation= 0;
MODULE_PARM_DESC(vramlimit, "Restrict VRAM for testing, in megabytes");module_param_named(vramlimit, amdgpu_vram_limit, int, 0600);drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c +0
-0@@ -286,6 +287,9 @@ module_param_named(compute_multipipe, amdgpu_compute_multipipe, int, 0444);
Quoted 9 lines
Quoted 8 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c +2
-0MODULE_PARM_DESC(gpu_recovery, "Enable GPU recovery mechanism, (1 = enable, 0 = disable, -1 = auto"); module_param_named(gpu_recovery, amdgpu_gpu_recovery, int, 0444); +MODULE_PARM_DESC(ttm_dma_allocation, "Enable TTM dma allocation, (1 = enable, 0 = disable"); +module_param_named (amdgpu_ttm_dma_allocation, amdgpu_ttm_dma_allocation, int,0444 ); + #ifdef CONFIG_DRM_AMDGPU_SI#if
defined(CONFIG_DRM_RADEON)||defined(CONFIG_DRM_RADEON_MODULE)
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
Quoted 43 lines · Michel Dänzer
Quoted 42 lines · Chunming Zhou
it will be used to set ttm dma allocation path.
Change-Id I9fa936db751811779cea66598bba0b8cf4cfd869Signed-off-by Chunming Zhou <[email protected]>--- drivers/gpu/drm/amd/amdgpu/amdgpu.h | 1 + drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c | 4 ++++ 2 files changed, 5 insertions(+)drivers/gpu/drm/amd/amdgpu/amdgpu.h +1
-0@@ -128,6 +128,7 @@ extern int amdgpu_job_hang_limit;extern int amdgpu_lbpw;extern int amdgpu_compute_multipipe;extern int amdgpu_gpu_recovery; +extern int amdgpu_ttm_dma_allocation;#ifdef CONFIG_DRM_AMDGPU_SI extern int amdgpu_si_support;drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c +4
-0@@ -131,6 +131,7 @@ int amdgpu_job_hang_limit = 0;int amdgpu_lbpw =-1 ;int amdgpu_compute_multipipe =-1 ;int amdgpu_gpu_recovery =-1 ;/* auto */ +int amdgpu_ttm_dma_allocation =0 ;MODULE_PARM_DESC (vramlimit,"Restrict VRAM for testing, in megabytes" );module_param_named (vramlimit, amdgpu_vram_limit, int,0600 );@@ -286,6 +287,9 @@ module_param_named(compute_multipipe, amdgpu_compute_multipipe, int, 0444);MODULE_PARM_DESC (gpu_recovery,"Enable GPU recovery mechanism, (1 = enable, 0 = disable, -1 = auto" );module_param_named (gpu_recovery, amdgpu_gpu_recovery, int,0444 ); +MODULE_PARM_DESC (ttm_dma_allocation,"Enable TTM dma allocation, (1 = enable, 0 = disable" ); +module_param_named (amdgpu_ttm_dma_allocation, amdgpu_ttm_dma_allocation, int,0444 ); +#ifdef CONFIG_DRM_AMDGPU_SI
Quoted 5 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c module_param_named(compute_multipipe, amdgpu_compute_multipipe, int, 0444); · line 295
Quoted 2 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c +0
-0#if defined(CONFIG_DRM_RADEON ) || defined(CONFIG_DRM_RADEON_MODULE )NAK from me as well.
This isn't something that the administrator/user needs to decide.
We should select better path, shouldn't we?
Quoted 2 lines
Somebody needs to figure out the exact conditions under which the DMA allocation path is needed, and make the code match those.
Yeah, agree, this is the best choice, I tried to find out the max_pfn of system memory iomapping, but failed, so thought to this method, disabled by default in amdgpu driver only, if some platform or special case needs it, they can re-enable it again.
Regards,
David Zhou
Quoted 6 lines
In general, amdgpu already has way too many module parameters. If we keep adding more like this, it'll become completely unmanageable soon.
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
Am 25.01.2018 um 09:35 schrieb Chunming Zhou:
Quoted 9 lines · Christian König
Quoted 4 lines
Am 25.01.2018 um 07:50 schrieb Chunming Zhou:
Quoted 1 line
it will be used to set ttm dma allocation path.
NAK, disabling swiotlb on the kernel command line should have the same effect.
The tricky is swiotlb is enabled by default, and there may be some other drivers need it. We only need not to use it amdgpu driver, so making it be disabled by default makes sense, right?
No, as Michel also wrote that is nothing a system administrator should decide about.
There are simply to many cases where this won't work as intended.
But as a start to improve the check you could take a look at adev->dev->iommu_group.
If that is set to something then IOMMU should be active for our device and we can skip the DMA coherent allocator.
Regards,
Christian.
Quoted 53 lines
Regards,
David ZhouQuoted 49 lines
If that doesn't work we really need to thing about how to improve the detection logic.
When I have a free minute I will try to hack something together.
Regards,
Christian.Quoted 40 lines
Change-Id I9fa936db751811779cea66598bba0b8cf4cfd869Signed-off-by Chunming Zhou <[email protected]>---
drivers/gpu/drm/amd/amdgpu/amdgpu.h | 1 +drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c| 4 ++++2 files changed, 5 insertions(+)drivers/gpu/drm/amd/amdgpu/amdgpu.h +1
-0@@ -128,6 +128,7 @@ extern int amdgpu_job_hang_limit; extern int amdgpu_lbpw; extern int amdgpu_compute_multipipe; extern int amdgpu_gpu_recovery; +extern int amdgpu_ttm_dma_allocation; #ifdef CONFIG_DRM_AMDGPU_SI extern int amdgpu_si_support;drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c +0
-0@@ -131,6 +131,7 @@ int amdgpu_job_hang_limit = 0; int amdgpu_lbpw = -1; int amdgpu_compute_multipipe = -1;int
amdgpu_gpu_recovery= -1; /* auto */
+intamdgpu_ttm_dma_allocation= 0;
MODULE_PARM_DESC(vramlimit, "Restrict VRAM for testing, in megabytes");module_param_named(vramlimit, amdgpu_vram_limit, int, 0600);drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c +2
-0@@ -286,6 +287,9 @@ module_param_named(compute_multipipe, amdgpu_compute_multipipe, int, 0444); MODULE_PARM_DESC(gpu_recovery, "Enable GPU recovery mechanism, (1 = enable, 0 = disable, -1 = auto"); module_param_named(gpu_recovery, amdgpu_gpu_recovery, int, 0444); +MODULE_PARM_DESC(ttm_dma_allocation, "Enable TTM dma allocation, (1 = enable, 0 = disable"); +module_param_named (amdgpu_ttm_dma_allocation, amdgpu_ttm_dma_allocation, int,0444 ); + #ifdef CONFIG_DRM_AMDGPU_SI#if
defined(CONFIG_DRM_RADEON)||defined(CONFIG_DRM_RADEON_MODULE)
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx