[1/2] drm/amdgpu: Remove unnecessary TLB workaround

Submitted by Felix Kuehling on Aug. 30, 2019, 5:14 a.m.

Details

Message ID 20190830051443.3906-1-Felix.Kuehling@amd.com
State New
Headers show
Series "Series without cover letter" ( rev: 2 1 ) in AMD X.Org drivers

Not browsing as part of any series.

Commit Message

Felix Kuehling Aug. 30, 2019, 5:14 a.m.
This workaround is better handled in user mode in a way that doesn't
require allocating extra memory and breaking userptr BOs.

The TLB bug is a performance bug, not a functional or security bug.
Hence it is safe to remove this kernel part of the workaround to
allow a better workaround using only virtual address alignments in
user mode.

Signed-off-by: Felix Kuehling <Felix.Kuehling@amd.com>
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c | 12 +-----------
 1 file changed, 1 insertion(+), 11 deletions(-)

Patch hide | download patch | download mbox

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c
index 42d209f5fd18..2c73ea7c425c 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c
@@ -1110,7 +1110,6 @@  int amdgpu_amdkfd_gpuvm_alloc_memory_of_gpu(
 	uint64_t user_addr = 0;
 	struct amdgpu_bo *bo;
 	struct amdgpu_bo_param bp;
-	int byte_align;
 	u32 domain, alloc_domain;
 	u64 alloc_flags;
 	int ret;
@@ -1165,15 +1164,6 @@  int amdgpu_amdkfd_gpuvm_alloc_memory_of_gpu(
 	if ((*mem)->aql_queue)
 		size = size >> 1;
 
-	/* Workaround for TLB bug on older VI chips */
-	byte_align = (adev->family == AMDGPU_FAMILY_VI &&
-			adev->asic_type != CHIP_FIJI &&
-			adev->asic_type != CHIP_POLARIS10 &&
-			adev->asic_type != CHIP_POLARIS11 &&
-			adev->asic_type != CHIP_POLARIS12 &&
-			adev->asic_type != CHIP_VEGAM) ?
-			VI_BO_SIZE_ALIGN : 1;
-
 	(*mem)->alloc_flags = flags;
 
 	amdgpu_sync_create(&(*mem)->sync);
@@ -1189,7 +1179,7 @@  int amdgpu_amdkfd_gpuvm_alloc_memory_of_gpu(
 
 	memset(&bp, 0, sizeof(bp));
 	bp.size = size;
-	bp.byte_align = byte_align;
+	bp.byte_align = 1;
 	bp.domain = alloc_domain;
 	bp.flags = alloc_flags;
 	bp.type = bo_type;

Comments

Am 30.08.19 um 07:14 schrieb Kuehling, Felix:
> This workaround is better handled in user mode in a way that doesn't
> require allocating extra memory and breaking userptr BOs.
>
> The TLB bug is a performance bug, not a functional or security bug.
> Hence it is safe to remove this kernel part of the workaround to
> allow a better workaround using only virtual address alignments in
> user mode.
>
> Signed-off-by: Felix Kuehling <Felix.Kuehling@amd.com>

Maybe the VI_BO_SIZE_ALIGN define can now be removed as well?

Apart from that this patch is Reviewed-by: Christian König 
<christian.koenig@amd.com>.

> ---
>   drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c | 12 +-----------
>   1 file changed, 1 insertion(+), 11 deletions(-)
>
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c
> index 42d209f5fd18..2c73ea7c425c 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c
> @@ -1110,7 +1110,6 @@ int amdgpu_amdkfd_gpuvm_alloc_memory_of_gpu(
>   	uint64_t user_addr = 0;
>   	struct amdgpu_bo *bo;
>   	struct amdgpu_bo_param bp;
> -	int byte_align;
>   	u32 domain, alloc_domain;
>   	u64 alloc_flags;
>   	int ret;
> @@ -1165,15 +1164,6 @@ int amdgpu_amdkfd_gpuvm_alloc_memory_of_gpu(
>   	if ((*mem)->aql_queue)
>   		size = size >> 1;
>   
> -	/* Workaround for TLB bug on older VI chips */
> -	byte_align = (adev->family == AMDGPU_FAMILY_VI &&
> -			adev->asic_type != CHIP_FIJI &&
> -			adev->asic_type != CHIP_POLARIS10 &&
> -			adev->asic_type != CHIP_POLARIS11 &&
> -			adev->asic_type != CHIP_POLARIS12 &&
> -			adev->asic_type != CHIP_VEGAM) ?
> -			VI_BO_SIZE_ALIGN : 1;
> -
>   	(*mem)->alloc_flags = flags;
>   
>   	amdgpu_sync_create(&(*mem)->sync);
> @@ -1189,7 +1179,7 @@ int amdgpu_amdkfd_gpuvm_alloc_memory_of_gpu(
>   
>   	memset(&bp, 0, sizeof(bp));
>   	bp.size = size;
> -	bp.byte_align = byte_align;
> +	bp.byte_align = 1;
>   	bp.domain = alloc_domain;
>   	bp.flags = alloc_flags;
>   	bp.type = bo_type;