All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] drm/amdgpu: refuse to reserve io mem for split VRAM buffers
@ 2017-02-16 22:55 Nicolai Hähnle
       [not found] ` <20170216225545.3515-1-nhaehnle-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
  0 siblings, 1 reply; 9+ messages in thread
From: Nicolai Hähnle @ 2017-02-16 22:55 UTC (permalink / raw)
  To: amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW; +Cc: Nicolai Hähnle

From: Nicolai Hähnle <nicolai.haehnle@amd.com>

When the fast blit path fails while attempting to move a buffer from RAM
to VRAM, we fall back to a CPU-based memcpy that cannot handle split VRAM
buffers. Instead of crashing, simply fail the buffer move.

Ideally, we would teach TTM about split buffers so that the fallback still
works in this case, but that is quite involved. So for now, apply the
simplest possible fix.

Fixes: 40361bb1704b ("drm/amdgpu: add VRAM manager v2")
Signed-off-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
--
I ran into this bug during testing. Unfortunately it does not fix the
memory corruption bug that I mentioned elsewhere... oh well.
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c
index 8d6a68f..f8b578d 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c
@@ -529,6 +529,9 @@ static int amdgpu_ttm_io_mem_reserve(struct ttm_bo_device *bdev, struct ttm_mem_
 	case TTM_PL_TT:
 		break;
 	case TTM_PL_VRAM:
+		if (mem->start == AMDGPU_BO_INVALID_OFFSET)
+			return -EINVAL;
+
 		mem->bus.offset = mem->start << PAGE_SHIFT;
 		/* check if it's visible */
 		if ((mem->bus.offset + mem->bus.size) > adev->mc.visible_vram_size)
-- 
2.9.3

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

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

* Re: [PATCH] drm/amdgpu: refuse to reserve io mem for split VRAM buffers
       [not found] ` <20170216225545.3515-1-nhaehnle-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
@ 2017-02-16 23:02   ` Alex Deucher
       [not found]     ` <CADnq5_OOcfke79Wkr37vD6Dgw7ySsTjEAoFCTpHZY-QPG4P6aQ-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
  2017-02-20 17:23   ` Nicolai Hähnle
  1 sibling, 1 reply; 9+ messages in thread
From: Alex Deucher @ 2017-02-16 23:02 UTC (permalink / raw)
  To: Nicolai Hähnle; +Cc: Nicolai Hähnle, amd-gfx list

On Thu, Feb 16, 2017 at 5:55 PM, Nicolai Hähnle <nhaehnle@gmail.com> wrote:
> From: Nicolai Hähnle <nicolai.haehnle@amd.com>
>
> When the fast blit path fails while attempting to move a buffer from RAM
> to VRAM, we fall back to a CPU-based memcpy that cannot handle split VRAM
> buffers. Instead of crashing, simply fail the buffer move.
>
> Ideally, we would teach TTM about split buffers so that the fallback still
> works in this case, but that is quite involved. So for now, apply the
> simplest possible fix.
>
> Fixes: 40361bb1704b ("drm/amdgpu: add VRAM manager v2")
> Signed-off-by: Nicolai Hähnle <nicolai.haehnle@amd.com>

Possibly fixes this bug report?
https://bugzilla.kernel.org/show_bug.cgi?id=194579

Alex

> --
> I ran into this bug during testing. Unfortunately it does not fix the
> memory corruption bug that I mentioned elsewhere... oh well.
> ---
>  drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c | 3 +++
>  1 file changed, 3 insertions(+)
>
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c
> index 8d6a68f..f8b578d 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c
> @@ -529,6 +529,9 @@ static int amdgpu_ttm_io_mem_reserve(struct ttm_bo_device *bdev, struct ttm_mem_
>         case TTM_PL_TT:
>                 break;
>         case TTM_PL_VRAM:
> +               if (mem->start == AMDGPU_BO_INVALID_OFFSET)
> +                       return -EINVAL;
> +
>                 mem->bus.offset = mem->start << PAGE_SHIFT;
>                 /* check if it's visible */
>                 if ((mem->bus.offset + mem->bus.size) > adev->mc.visible_vram_size)
> --
> 2.9.3
>
> _______________________________________________
> amd-gfx mailing list
> amd-gfx@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/amd-gfx
_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

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

* Re: [PATCH] drm/amdgpu: refuse to reserve io mem for split VRAM buffers
       [not found]     ` <CADnq5_OOcfke79Wkr37vD6Dgw7ySsTjEAoFCTpHZY-QPG4P6aQ-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
@ 2017-02-16 23:21       ` Nicolai Hähnle
       [not found]         ` <0aa5b052-a748-8cd2-8ba7-9efa7e9a769a-5C7GfCeVMHo@public.gmane.org>
  0 siblings, 1 reply; 9+ messages in thread
From: Nicolai Hähnle @ 2017-02-16 23:21 UTC (permalink / raw)
  To: Alex Deucher, Nicolai Hähnle; +Cc: amd-gfx list

On 17.02.2017 00:02, Alex Deucher wrote:
> On Thu, Feb 16, 2017 at 5:55 PM, Nicolai Hähnle <nhaehnle@gmail.com> wrote:
>> From: Nicolai Hähnle <nicolai.haehnle@amd.com>
>>
>> When the fast blit path fails while attempting to move a buffer from RAM
>> to VRAM, we fall back to a CPU-based memcpy that cannot handle split VRAM
>> buffers. Instead of crashing, simply fail the buffer move.
>>
>> Ideally, we would teach TTM about split buffers so that the fallback still
>> works in this case, but that is quite involved. So for now, apply the
>> simplest possible fix.
>>
>> Fixes: 40361bb1704b ("drm/amdgpu: add VRAM manager v2")
>> Signed-off-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
>
> Possibly fixes this bug report?
> https://bugzilla.kernel.org/show_bug.cgi?id=194579

It's related, but I think that report is a false positive. It does point 
at code that is not too pretty, though. I've commented on that bug 
report as well.

In any case, that overflow should indeed happen whenever the bug 
addressed by this patch happens, but (a) this patch doesn't change that, 
and (b) I'm pretty sure that the overflow reported by PaX is benign.

We may still have other bugs with split BOs, though.

Cheers,
Nicolai

>
> Alex
>
>> --
>> I ran into this bug during testing. Unfortunately it does not fix the
>> memory corruption bug that I mentioned elsewhere... oh well.
>> ---
>>  drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c | 3 +++
>>  1 file changed, 3 insertions(+)
>>
>> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c
>> index 8d6a68f..f8b578d 100644
>> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c
>> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c
>> @@ -529,6 +529,9 @@ static int amdgpu_ttm_io_mem_reserve(struct ttm_bo_device *bdev, struct ttm_mem_
>>         case TTM_PL_TT:
>>                 break;
>>         case TTM_PL_VRAM:
>> +               if (mem->start == AMDGPU_BO_INVALID_OFFSET)
>> +                       return -EINVAL;
>> +
>>                 mem->bus.offset = mem->start << PAGE_SHIFT;
>>                 /* check if it's visible */
>>                 if ((mem->bus.offset + mem->bus.size) > adev->mc.visible_vram_size)
>> --
>> 2.9.3
>>
>> _______________________________________________
>> amd-gfx mailing list
>> amd-gfx@lists.freedesktop.org
>> https://lists.freedesktop.org/mailman/listinfo/amd-gfx

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

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

* Re: [PATCH] drm/amdgpu: refuse to reserve io mem for split VRAM buffers
       [not found]         ` <0aa5b052-a748-8cd2-8ba7-9efa7e9a769a-5C7GfCeVMHo@public.gmane.org>
@ 2017-02-17 10:08           ` Christian König
       [not found]             ` <afdc021d-b768-4ec5-06d1-e783bf2d226d-ANTagKRnAhcb1SvskN2V4Q@public.gmane.org>
  0 siblings, 1 reply; 9+ messages in thread
From: Christian König @ 2017-02-17 10:08 UTC (permalink / raw)
  To: Nicolai Hähnle, Alex Deucher, Nicolai Hähnle; +Cc: amd-gfx list

Am 17.02.2017 um 00:21 schrieb Nicolai Hähnle:
> On 17.02.2017 00:02, Alex Deucher wrote:
>> On Thu, Feb 16, 2017 at 5:55 PM, Nicolai Hähnle <nhaehnle@gmail.com> 
>> wrote:
>>> From: Nicolai Hähnle <nicolai.haehnle@amd.com>
>>>
>>> When the fast blit path fails while attempting to move a buffer from 
>>> RAM
>>> to VRAM, we fall back to a CPU-based memcpy that cannot handle split 
>>> VRAM
>>> buffers. Instead of crashing, simply fail the buffer move.
>>>
>>> Ideally, we would teach TTM about split buffers so that the fallback 
>>> still
>>> works in this case, but that is quite involved. So for now, apply the
>>> simplest possible fix.
>>>
>>> Fixes: 40361bb1704b ("drm/amdgpu: add VRAM manager v2")
>>> Signed-off-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
>>
>> Possibly fixes this bug report?
>> https://bugzilla.kernel.org/show_bug.cgi?id=194579
>
> It's related, but I think that report is a false positive. It does 
> point at code that is not too pretty, though. I've commented on that 
> bug report as well.
>
> In any case, that overflow should indeed happen whenever the bug 
> addressed by this patch happens, but (a) this patch doesn't change 
> that, and (b) I'm pretty sure that the overflow reported by PaX is 
> benign.

Yes, agree. The bug report is indeed a false positive.

Nicolai what do you think about removing the offset from the BO 
structure and only calculate it on demand?

>
> We may still have other bugs with split BOs, though.

Yeah, agree as well. I was also considering disabling that feature by 
default for the moment if it helps with your corruption bug.

Regards,
Christian.

>
> Cheers,
> Nicolai
>
>>
>> Alex
>>
>>> -- 
>>> I ran into this bug during testing. Unfortunately it does not fix the
>>> memory corruption bug that I mentioned elsewhere... oh well.
>>> ---
>>>  drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c | 3 +++
>>>  1 file changed, 3 insertions(+)
>>>
>>> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c 
>>> b/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c
>>> index 8d6a68f..f8b578d 100644
>>> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c
>>> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c
>>> @@ -529,6 +529,9 @@ static int amdgpu_ttm_io_mem_reserve(struct 
>>> ttm_bo_device *bdev, struct ttm_mem_
>>>         case TTM_PL_TT:
>>>                 break;
>>>         case TTM_PL_VRAM:
>>> +               if (mem->start == AMDGPU_BO_INVALID_OFFSET)
>>> +                       return -EINVAL;
>>> +
>>>                 mem->bus.offset = mem->start << PAGE_SHIFT;
>>>                 /* check if it's visible */
>>>                 if ((mem->bus.offset + mem->bus.size) > 
>>> adev->mc.visible_vram_size)
>>> -- 
>>> 2.9.3
>>>
>>> _______________________________________________
>>> amd-gfx mailing list
>>> amd-gfx@lists.freedesktop.org
>>> https://lists.freedesktop.org/mailman/listinfo/amd-gfx
>
> _______________________________________________
> amd-gfx mailing list
> amd-gfx@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/amd-gfx


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

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

* Re: [PATCH] drm/amdgpu: refuse to reserve io mem for split VRAM buffers
       [not found]             ` <afdc021d-b768-4ec5-06d1-e783bf2d226d-ANTagKRnAhcb1SvskN2V4Q@public.gmane.org>
@ 2017-02-17 10:42               ` Nicolai Hähnle
  2017-02-21 10:17               ` Nicolai Hähnle
  1 sibling, 0 replies; 9+ messages in thread
From: Nicolai Hähnle @ 2017-02-17 10:42 UTC (permalink / raw)
  To: Christian König, Alex Deucher, Nicolai Hähnle; +Cc: amd-gfx list

On 17.02.2017 11:08, Christian König wrote:
> Am 17.02.2017 um 00:21 schrieb Nicolai Hähnle:
>> On 17.02.2017 00:02, Alex Deucher wrote:
>>> On Thu, Feb 16, 2017 at 5:55 PM, Nicolai Hähnle <nhaehnle@gmail.com>
>>> wrote:
>>>> From: Nicolai Hähnle <nicolai.haehnle@amd.com>
>>>>
>>>> When the fast blit path fails while attempting to move a buffer from
>>>> RAM
>>>> to VRAM, we fall back to a CPU-based memcpy that cannot handle split
>>>> VRAM
>>>> buffers. Instead of crashing, simply fail the buffer move.
>>>>
>>>> Ideally, we would teach TTM about split buffers so that the fallback
>>>> still
>>>> works in this case, but that is quite involved. So for now, apply the
>>>> simplest possible fix.
>>>>
>>>> Fixes: 40361bb1704b ("drm/amdgpu: add VRAM manager v2")
>>>> Signed-off-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
>>>
>>> Possibly fixes this bug report?
>>> https://bugzilla.kernel.org/show_bug.cgi?id=194579
>>
>> It's related, but I think that report is a false positive. It does
>> point at code that is not too pretty, though. I've commented on that
>> bug report as well.
>>
>> In any case, that overflow should indeed happen whenever the bug
>> addressed by this patch happens, but (a) this patch doesn't change
>> that, and (b) I'm pretty sure that the overflow reported by PaX is
>> benign.
>
> Yes, agree. The bug report is indeed a false positive.
>
> Nicolai what do you think about removing the offset from the BO
> structure and only calculate it on demand?

I think it's a good idea. There are lots of uses in other drivers, 
though, so a first step would be adding a helper analogous to 
amdgpu_bo_gpu_offset in ttm_bo_api.h.


>> We may still have other bugs with split BOs, though.
>
> Yeah, agree as well. I was also considering disabling that feature by
> default for the moment if it helps with your corruption bug.

Good point, I'll give that a try as well.

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

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

* Re: [PATCH] drm/amdgpu: refuse to reserve io mem for split VRAM buffers
       [not found] ` <20170216225545.3515-1-nhaehnle-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
  2017-02-16 23:02   ` Alex Deucher
@ 2017-02-20 17:23   ` Nicolai Hähnle
       [not found]     ` <eed2cf3c-abf2-ef32-60c2-f5c5be407634-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
  1 sibling, 1 reply; 9+ messages in thread
From: Nicolai Hähnle @ 2017-02-20 17:23 UTC (permalink / raw)
  To: amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW; +Cc: Nicolai Hähnle

Ping? People seem to agree, but I haven't seen an explicit R-b...

On 16.02.2017 23:55, Nicolai Hähnle wrote:
> From: Nicolai Hähnle <nicolai.haehnle@amd.com>
>
> When the fast blit path fails while attempting to move a buffer from RAM
> to VRAM, we fall back to a CPU-based memcpy that cannot handle split VRAM
> buffers. Instead of crashing, simply fail the buffer move.
>
> Ideally, we would teach TTM about split buffers so that the fallback still
> works in this case, but that is quite involved. So for now, apply the
> simplest possible fix.
>
> Fixes: 40361bb1704b ("drm/amdgpu: add VRAM manager v2")
> Signed-off-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
> --
> I ran into this bug during testing. Unfortunately it does not fix the
> memory corruption bug that I mentioned elsewhere... oh well.
> ---
>  drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c | 3 +++
>  1 file changed, 3 insertions(+)
>
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c
> index 8d6a68f..f8b578d 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c
> @@ -529,6 +529,9 @@ static int amdgpu_ttm_io_mem_reserve(struct ttm_bo_device *bdev, struct ttm_mem_
>  	case TTM_PL_TT:
>  		break;
>  	case TTM_PL_VRAM:
> +		if (mem->start == AMDGPU_BO_INVALID_OFFSET)
> +			return -EINVAL;
> +
>  		mem->bus.offset = mem->start << PAGE_SHIFT;
>  		/* check if it's visible */
>  		if ((mem->bus.offset + mem->bus.size) > adev->mc.visible_vram_size)
>

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

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

* Re: [PATCH] drm/amdgpu: refuse to reserve io mem for split VRAM buffers
       [not found]     ` <eed2cf3c-abf2-ef32-60c2-f5c5be407634-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
@ 2017-02-20 17:29       ` Christian König
       [not found]         ` <95bce921-2f09-b632-854e-14a523f43795-ANTagKRnAhcb1SvskN2V4Q@public.gmane.org>
  0 siblings, 1 reply; 9+ messages in thread
From: Christian König @ 2017-02-20 17:29 UTC (permalink / raw)
  To: Nicolai Hähnle, amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW
  Cc: Nicolai Hähnle

Sorry, patch is Reviewed-by: Christian König <christian.koenig@amd.com>.

Christian.

Am 20.02.2017 um 18:23 schrieb Nicolai Hähnle:
> Ping? People seem to agree, but I haven't seen an explicit R-b...
>
> On 16.02.2017 23:55, Nicolai Hähnle wrote:
>> From: Nicolai Hähnle <nicolai.haehnle@amd.com>
>>
>> When the fast blit path fails while attempting to move a buffer from RAM
>> to VRAM, we fall back to a CPU-based memcpy that cannot handle split 
>> VRAM
>> buffers. Instead of crashing, simply fail the buffer move.
>>
>> Ideally, we would teach TTM about split buffers so that the fallback 
>> still
>> works in this case, but that is quite involved. So for now, apply the
>> simplest possible fix.
>>
>> Fixes: 40361bb1704b ("drm/amdgpu: add VRAM manager v2")
>> Signed-off-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
>> -- 
>> I ran into this bug during testing. Unfortunately it does not fix the
>> memory corruption bug that I mentioned elsewhere... oh well.
>> ---
>>  drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c | 3 +++
>>  1 file changed, 3 insertions(+)
>>
>> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c 
>> b/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c
>> index 8d6a68f..f8b578d 100644
>> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c
>> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c
>> @@ -529,6 +529,9 @@ static int amdgpu_ttm_io_mem_reserve(struct 
>> ttm_bo_device *bdev, struct ttm_mem_
>>      case TTM_PL_TT:
>>          break;
>>      case TTM_PL_VRAM:
>> +        if (mem->start == AMDGPU_BO_INVALID_OFFSET)
>> +            return -EINVAL;
>> +
>>          mem->bus.offset = mem->start << PAGE_SHIFT;
>>          /* check if it's visible */
>>          if ((mem->bus.offset + mem->bus.size) > 
>> adev->mc.visible_vram_size)
>>
>
> _______________________________________________
> amd-gfx mailing list
> amd-gfx@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/amd-gfx


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

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

* Re: [PATCH] drm/amdgpu: refuse to reserve io mem for split VRAM buffers
       [not found]         ` <95bce921-2f09-b632-854e-14a523f43795-ANTagKRnAhcb1SvskN2V4Q@public.gmane.org>
@ 2017-02-20 17:30           ` Nicolai Hähnle
  0 siblings, 0 replies; 9+ messages in thread
From: Nicolai Hähnle @ 2017-02-20 17:30 UTC (permalink / raw)
  To: Christian König, amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW
  Cc: Nicolai Hähnle

On 20.02.2017 18:29, Christian König wrote:
> Sorry, patch is Reviewed-by: Christian König <christian.koenig@amd.com>.

Thanks!

>
> Christian.
>
> Am 20.02.2017 um 18:23 schrieb Nicolai Hähnle:
>> Ping? People seem to agree, but I haven't seen an explicit R-b...
>>
>> On 16.02.2017 23:55, Nicolai Hähnle wrote:
>>> From: Nicolai Hähnle <nicolai.haehnle@amd.com>
>>>
>>> When the fast blit path fails while attempting to move a buffer from RAM
>>> to VRAM, we fall back to a CPU-based memcpy that cannot handle split
>>> VRAM
>>> buffers. Instead of crashing, simply fail the buffer move.
>>>
>>> Ideally, we would teach TTM about split buffers so that the fallback
>>> still
>>> works in this case, but that is quite involved. So for now, apply the
>>> simplest possible fix.
>>>
>>> Fixes: 40361bb1704b ("drm/amdgpu: add VRAM manager v2")
>>> Signed-off-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
>>> --
>>> I ran into this bug during testing. Unfortunately it does not fix the
>>> memory corruption bug that I mentioned elsewhere... oh well.
>>> ---
>>>  drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c | 3 +++
>>>  1 file changed, 3 insertions(+)
>>>
>>> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c
>>> b/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c
>>> index 8d6a68f..f8b578d 100644
>>> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c
>>> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c
>>> @@ -529,6 +529,9 @@ static int amdgpu_ttm_io_mem_reserve(struct
>>> ttm_bo_device *bdev, struct ttm_mem_
>>>      case TTM_PL_TT:
>>>          break;
>>>      case TTM_PL_VRAM:
>>> +        if (mem->start == AMDGPU_BO_INVALID_OFFSET)
>>> +            return -EINVAL;
>>> +
>>>          mem->bus.offset = mem->start << PAGE_SHIFT;
>>>          /* check if it's visible */
>>>          if ((mem->bus.offset + mem->bus.size) >
>>> adev->mc.visible_vram_size)
>>>
>>
>> _______________________________________________
>> amd-gfx mailing list
>> amd-gfx@lists.freedesktop.org
>> https://lists.freedesktop.org/mailman/listinfo/amd-gfx
>
>

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

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

* Re: [PATCH] drm/amdgpu: refuse to reserve io mem for split VRAM buffers
       [not found]             ` <afdc021d-b768-4ec5-06d1-e783bf2d226d-ANTagKRnAhcb1SvskN2V4Q@public.gmane.org>
  2017-02-17 10:42               ` Nicolai Hähnle
@ 2017-02-21 10:17               ` Nicolai Hähnle
  1 sibling, 0 replies; 9+ messages in thread
From: Nicolai Hähnle @ 2017-02-21 10:17 UTC (permalink / raw)
  To: Christian König, Nicolai Hähnle, Alex Deucher; +Cc: amd-gfx list

On 17.02.2017 11:08, Christian König wrote:
> Am 17.02.2017 um 00:21 schrieb Nicolai Hähnle:
>> We may still have other bugs with split BOs, though.
>
> Yeah, agree as well. I was also considering disabling that feature by
> default for the moment if it helps with your corruption bug.

The corruption still occurs with amdgpu.vram_page_split = -1, unfortunately.

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

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

end of thread, other threads:[~2017-02-21 10:17 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-02-16 22:55 [PATCH] drm/amdgpu: refuse to reserve io mem for split VRAM buffers Nicolai Hähnle
     [not found] ` <20170216225545.3515-1-nhaehnle-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2017-02-16 23:02   ` Alex Deucher
     [not found]     ` <CADnq5_OOcfke79Wkr37vD6Dgw7ySsTjEAoFCTpHZY-QPG4P6aQ-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2017-02-16 23:21       ` Nicolai Hähnle
     [not found]         ` <0aa5b052-a748-8cd2-8ba7-9efa7e9a769a-5C7GfCeVMHo@public.gmane.org>
2017-02-17 10:08           ` Christian König
     [not found]             ` <afdc021d-b768-4ec5-06d1-e783bf2d226d-ANTagKRnAhcb1SvskN2V4Q@public.gmane.org>
2017-02-17 10:42               ` Nicolai Hähnle
2017-02-21 10:17               ` Nicolai Hähnle
2017-02-20 17:23   ` Nicolai Hähnle
     [not found]     ` <eed2cf3c-abf2-ef32-60c2-f5c5be407634-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2017-02-20 17:29       ` Christian König
     [not found]         ` <95bce921-2f09-b632-854e-14a523f43795-ANTagKRnAhcb1SvskN2V4Q@public.gmane.org>
2017-02-20 17:30           ` Nicolai Hähnle

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.