All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] drm/amdgpu: Fix CSA buffer alloc failed on Vega
@ 2018-11-12 10:33 Rex Zhu
       [not found] ` <1542018800-998-1-git-send-email-Rex.Zhu-5C7GfCeVMHo@public.gmane.org>
  0 siblings, 1 reply; 3+ messages in thread
From: Rex Zhu @ 2018-11-12 10:33 UTC (permalink / raw)
  To: amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW; +Cc: Rex Zhu

Alloc_pte failed when the VA address located in
the higher arrange of 256T.

so reserve the csa buffer under 128T as a work around.

[  122.979425] amdgpu 0000:03:00.0: va above limit (0xFFFFFFFFFFF1F >= 0x1000000000)
[  122.987080] BUG: unable to handle kernel paging request at ffff880e1a79fff8

Signed-off-by: Rex Zhu <Rex.Zhu@amd.com>
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_csa.c | 4 ++--
 drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c | 2 +-
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_csa.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_csa.c
index fea4555..e2f325b 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_csa.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_csa.c
@@ -36,9 +36,9 @@ uint64_t amdgpu_csa_vaddr(struct amdgpu_device *adev, uint32_t id)
 {
 	uint64_t addr = adev->vm_manager.max_pfn << AMDGPU_GPU_PAGE_SHIFT;
 
-	addr -= AMDGPU_VA_RESERVED_SIZE * id;
+	addr = min(addr, AMDGPU_GMC_HOLE_START);
 
-	addr = amdgpu_gmc_sign_extend(addr);
+	addr -= (uint64_t)AMDGPU_VA_RESERVED_SIZE * id;
 
 	return addr;
 }
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c
index 338a091..ea6a12a 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c
@@ -711,7 +711,7 @@ static int amdgpu_info_ioctl(struct drm_device *dev, void *data, struct drm_file
 
 		dev_info.virtual_address_offset = AMDGPU_VA_RESERVED_SIZE;
 		dev_info.virtual_address_max =
-			min(vm_size, AMDGPU_GMC_HOLE_START);
+			min(vm_size, AMDGPU_GMC_HOLE_START - adev->vm_manager.reserved_vm_size);
 
 		if (vm_size > AMDGPU_GMC_HOLE_START) {
 			dev_info.high_va_offset = AMDGPU_GMC_HOLE_END;
-- 
1.9.1

_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] drm/amdgpu: Fix CSA buffer alloc failed on Vega
       [not found] ` <1542018800-998-1-git-send-email-Rex.Zhu-5C7GfCeVMHo@public.gmane.org>
@ 2018-11-12 10:42   ` Christian König
       [not found]     ` <e7909a29-fddd-9c65-d748-49f51e72afa9-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
  0 siblings, 1 reply; 3+ messages in thread
From: Christian König @ 2018-11-12 10:42 UTC (permalink / raw)
  To: Rex Zhu, amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW

Am 12.11.18 um 11:33 schrieb Rex Zhu:
> Alloc_pte failed when the VA address located in
> the higher arrange of 256T.
>
> so reserve the csa buffer under 128T as a work around.
>
> [  122.979425] amdgpu 0000:03:00.0: va above limit (0xFFFFFFFFFFF1F >= 0x1000000000)
> [  122.987080] BUG: unable to handle kernel paging request at ffff880e1a79fff8
>
> Signed-off-by: Rex Zhu <Rex.Zhu@amd.com>

Well NAK, userspace wants to use the full address space below 128T for SVM.

The problem is rather that you incorrectly use amdgpu_csa_vaddr(). See 
the code in amdgpu_driver_open_kms() how to do it correctly:

>                 uint64_t csa_addr = amdgpu_csa_vaddr(adev) & 
> AMDGPU_GMC_HOLE_MASK;
>
>                 r = amdgpu_map_static_csa(adev, &fpriv->vm, 
> adev->virt.csa_obj,
> &fpriv->csa_va, csa_addr, AMDGPU_CSA_SIZE);
>                 if (r)
>                         goto error_vm;

Christian.


> ---
>   drivers/gpu/drm/amd/amdgpu/amdgpu_csa.c | 4 ++--
>   drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c | 2 +-
>   2 files changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_csa.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_csa.c
> index fea4555..e2f325b 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_csa.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_csa.c
> @@ -36,9 +36,9 @@ uint64_t amdgpu_csa_vaddr(struct amdgpu_device *adev, uint32_t id)
>   {
>   	uint64_t addr = adev->vm_manager.max_pfn << AMDGPU_GPU_PAGE_SHIFT;
>   
> -	addr -= AMDGPU_VA_RESERVED_SIZE * id;
> +	addr = min(addr, AMDGPU_GMC_HOLE_START);
>   
> -	addr = amdgpu_gmc_sign_extend(addr);
> +	addr -= (uint64_t)AMDGPU_VA_RESERVED_SIZE * id;
>   
>   	return addr;
>   }
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c
> index 338a091..ea6a12a 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c
> @@ -711,7 +711,7 @@ static int amdgpu_info_ioctl(struct drm_device *dev, void *data, struct drm_file
>   
>   		dev_info.virtual_address_offset = AMDGPU_VA_RESERVED_SIZE;
>   		dev_info.virtual_address_max =
> -			min(vm_size, AMDGPU_GMC_HOLE_START);
> +			min(vm_size, AMDGPU_GMC_HOLE_START - adev->vm_manager.reserved_vm_size);
>   
>   		if (vm_size > AMDGPU_GMC_HOLE_START) {
>   			dev_info.high_va_offset = AMDGPU_GMC_HOLE_END;

_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] drm/amdgpu: Fix CSA buffer alloc failed on Vega
       [not found]     ` <e7909a29-fddd-9c65-d748-49f51e72afa9-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
@ 2018-11-12 11:16       ` Zhu, Rex
  0 siblings, 0 replies; 3+ messages in thread
From: Zhu, Rex @ 2018-11-12 11:16 UTC (permalink / raw)
  To: amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW, Koenig, Christian


[-- Attachment #1.1: Type: text/plain, Size: 2876 bytes --]

Got it .

Thanks.


Best Regards

Rex


________________________________
From: Christian König <ckoenig.leichtzumerken-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
Sent: Monday, November 12, 2018 6:42 PM
To: Zhu, Rex; amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org
Subject: Re: [PATCH] drm/amdgpu: Fix CSA buffer alloc failed on Vega

Am 12.11.18 um 11:33 schrieb Rex Zhu:
> Alloc_pte failed when the VA address located in
> the higher arrange of 256T.
>
> so reserve the csa buffer under 128T as a work around.
>
> [  122.979425] amdgpu 0000:03:00.0: va above limit (0xFFFFFFFFFFF1F >= 0x1000000000)
> [  122.987080] BUG: unable to handle kernel paging request at ffff880e1a79fff8
>
> Signed-off-by: Rex Zhu <Rex.Zhu-5C7GfCeVMHo@public.gmane.org>

Well NAK, userspace wants to use the full address space below 128T for SVM.

The problem is rather that you incorrectly use amdgpu_csa_vaddr(). See
the code in amdgpu_driver_open_kms() how to do it correctly:

>                 uint64_t csa_addr = amdgpu_csa_vaddr(adev) &
> AMDGPU_GMC_HOLE_MASK;
>
>                 r = amdgpu_map_static_csa(adev, &fpriv->vm,
> adev->virt.csa_obj,
> &fpriv->csa_va, csa_addr, AMDGPU_CSA_SIZE);
>                 if (r)
>                         goto error_vm;

Christian.


> ---
>   drivers/gpu/drm/amd/amdgpu/amdgpu_csa.c | 4 ++--
>   drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c | 2 +-
>   2 files changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_csa.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_csa.c
> index fea4555..e2f325b 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_csa.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_csa.c
> @@ -36,9 +36,9 @@ uint64_t amdgpu_csa_vaddr(struct amdgpu_device *adev, uint32_t id)
>   {
>        uint64_t addr = adev->vm_manager.max_pfn << AMDGPU_GPU_PAGE_SHIFT;
>
> -     addr -= AMDGPU_VA_RESERVED_SIZE * id;
> +     addr = min(addr, AMDGPU_GMC_HOLE_START);
>
> -     addr = amdgpu_gmc_sign_extend(addr);
> +     addr -= (uint64_t)AMDGPU_VA_RESERVED_SIZE * id;
>
>        return addr;
>   }
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c
> index 338a091..ea6a12a 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c
> @@ -711,7 +711,7 @@ static int amdgpu_info_ioctl(struct drm_device *dev, void *data, struct drm_file
>
>                dev_info.virtual_address_offset = AMDGPU_VA_RESERVED_SIZE;
>                dev_info.virtual_address_max =
> -                     min(vm_size, AMDGPU_GMC_HOLE_START);
> +                     min(vm_size, AMDGPU_GMC_HOLE_START - adev->vm_manager.reserved_vm_size);
>
>                if (vm_size > AMDGPU_GMC_HOLE_START) {
>                        dev_info.high_va_offset = AMDGPU_GMC_HOLE_END;


[-- Attachment #1.2: Type: text/html, Size: 5519 bytes --]

[-- Attachment #2: Type: text/plain, Size: 154 bytes --]

_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2018-11-12 11:16 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-11-12 10:33 [PATCH] drm/amdgpu: Fix CSA buffer alloc failed on Vega Rex Zhu
     [not found] ` <1542018800-998-1-git-send-email-Rex.Zhu-5C7GfCeVMHo@public.gmane.org>
2018-11-12 10:42   ` Christian König
     [not found]     ` <e7909a29-fddd-9c65-d748-49f51e72afa9-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2018-11-12 11:16       ` Zhu, Rex

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.