All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/2] drm/radeon: fix the crash in benchmark functions
@ 2015-01-30  5:38 Ilija Hadzic
  2015-01-30  5:38 ` [PATCH 2/2] drm/radeon: fix the crash in test functions Ilija Hadzic
  2015-01-30  9:20 ` [PATCH 1/2] drm/radeon: fix the crash in benchmark functions Christian König
  0 siblings, 2 replies; 4+ messages in thread
From: Ilija Hadzic @ 2015-01-30  5:38 UTC (permalink / raw)
  To: dri-devel; +Cc: Ilija Hadzic, stable

radeon_copy_dma and radeon_copy_blit must be called with
a valid reservation object. Otherwise a crash will be provoked.
We borrow the object from destination BO.

Cc: stable@vger.kernel.org
Signed-off-by: Ilija Hadzic <ihadzic@research.bell-labs.com>
---
 drivers/gpu/drm/radeon/radeon_benchmark.c | 13 ++++++++-----
 1 file changed, 8 insertions(+), 5 deletions(-)

diff --git a/drivers/gpu/drm/radeon/radeon_benchmark.c b/drivers/gpu/drm/radeon/radeon_benchmark.c
index 9e7f23d..87d5fb2 100644
--- a/drivers/gpu/drm/radeon/radeon_benchmark.c
+++ b/drivers/gpu/drm/radeon/radeon_benchmark.c
@@ -34,7 +34,8 @@
 
 static int radeon_benchmark_do_move(struct radeon_device *rdev, unsigned size,
 				    uint64_t saddr, uint64_t daddr,
-				    int flag, int n)
+				    int flag, int n,
+				    struct reservation_object *resv)
 {
 	unsigned long start_jiffies;
 	unsigned long end_jiffies;
@@ -47,12 +48,12 @@ static int radeon_benchmark_do_move(struct radeon_device *rdev, unsigned size,
 		case RADEON_BENCHMARK_COPY_DMA:
 			fence = radeon_copy_dma(rdev, saddr, daddr,
 						size / RADEON_GPU_PAGE_SIZE,
-						NULL);
+						resv);
 			break;
 		case RADEON_BENCHMARK_COPY_BLIT:
 			fence = radeon_copy_blit(rdev, saddr, daddr,
 						 size / RADEON_GPU_PAGE_SIZE,
-						 NULL);
+						 resv);
 			break;
 		default:
 			DRM_ERROR("Unknown copy method\n");
@@ -120,7 +121,8 @@ static void radeon_benchmark_move(struct radeon_device *rdev, unsigned size,
 
 	if (rdev->asic->copy.dma) {
 		time = radeon_benchmark_do_move(rdev, size, saddr, daddr,
-						RADEON_BENCHMARK_COPY_DMA, n);
+						RADEON_BENCHMARK_COPY_DMA, n,
+						dobj->tbo.resv);
 		if (time < 0)
 			goto out_cleanup;
 		if (time > 0)
@@ -130,7 +132,8 @@ static void radeon_benchmark_move(struct radeon_device *rdev, unsigned size,
 
 	if (rdev->asic->copy.blit) {
 		time = radeon_benchmark_do_move(rdev, size, saddr, daddr,
-						RADEON_BENCHMARK_COPY_BLIT, n);
+						RADEON_BENCHMARK_COPY_BLIT, n,
+						dobj->tbo.resv);
 		if (time < 0)
 			goto out_cleanup;
 		if (time > 0)
-- 
2.2.0

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

* [PATCH 2/2] drm/radeon: fix the crash in test functions
  2015-01-30  5:38 [PATCH 1/2] drm/radeon: fix the crash in benchmark functions Ilija Hadzic
@ 2015-01-30  5:38 ` Ilija Hadzic
  2015-01-30  9:20 ` [PATCH 1/2] drm/radeon: fix the crash in benchmark functions Christian König
  1 sibling, 0 replies; 4+ messages in thread
From: Ilija Hadzic @ 2015-01-30  5:38 UTC (permalink / raw)
  To: dri-devel; +Cc: Ilija Hadzic, stable

radeon_copy_dma and radeon_copy_blit must be called with
a valid reservation object. Otherwise a crash will be provoked.
We borrow the object from vram BO.

Cc: stable@vger.kernel.org
Signed-off-by: Ilija Hadzic <ihadzic@research.bell-labs.com>
---
 drivers/gpu/drm/radeon/radeon_test.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/gpu/drm/radeon/radeon_test.c b/drivers/gpu/drm/radeon/radeon_test.c
index 07b506b..79181816 100644
--- a/drivers/gpu/drm/radeon/radeon_test.c
+++ b/drivers/gpu/drm/radeon/radeon_test.c
@@ -119,11 +119,11 @@ static void radeon_do_test_moves(struct radeon_device *rdev, int flag)
 		if (ring == R600_RING_TYPE_DMA_INDEX)
 			fence = radeon_copy_dma(rdev, gtt_addr, vram_addr,
 						size / RADEON_GPU_PAGE_SIZE,
-						NULL);
+						vram_obj->tbo.resv);
 		else
 			fence = radeon_copy_blit(rdev, gtt_addr, vram_addr,
 						 size / RADEON_GPU_PAGE_SIZE,
-						 NULL);
+						 vram_obj->tbo.resv);
 		if (IS_ERR(fence)) {
 			DRM_ERROR("Failed GTT->VRAM copy %d\n", i);
 			r = PTR_ERR(fence);
@@ -170,11 +170,11 @@ static void radeon_do_test_moves(struct radeon_device *rdev, int flag)
 		if (ring == R600_RING_TYPE_DMA_INDEX)
 			fence = radeon_copy_dma(rdev, vram_addr, gtt_addr,
 						size / RADEON_GPU_PAGE_SIZE,
-						NULL);
+						vram_obj->tbo.resv);
 		else
 			fence = radeon_copy_blit(rdev, vram_addr, gtt_addr,
 						 size / RADEON_GPU_PAGE_SIZE,
-						 NULL);
+						 vram_obj->tbo.resv);
 		if (IS_ERR(fence)) {
 			DRM_ERROR("Failed VRAM->GTT copy %d\n", i);
 			r = PTR_ERR(fence);
-- 
2.2.0

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

* Re: [PATCH 1/2] drm/radeon: fix the crash in benchmark functions
  2015-01-30  5:38 [PATCH 1/2] drm/radeon: fix the crash in benchmark functions Ilija Hadzic
  2015-01-30  5:38 ` [PATCH 2/2] drm/radeon: fix the crash in test functions Ilija Hadzic
@ 2015-01-30  9:20 ` Christian König
  2015-01-30 15:05   ` Alex Deucher
  1 sibling, 1 reply; 4+ messages in thread
From: Christian König @ 2015-01-30  9:20 UTC (permalink / raw)
  To: Ilija Hadzic, dri-devel; +Cc: Ilija Hadzic, stable

Am 30.01.2015 um 06:38 schrieb Ilija Hadzic:
> radeon_copy_dma and radeon_copy_blit must be called with
> a valid reservation object. Otherwise a crash will be provoked.
> We borrow the object from destination BO.
>
> Cc: stable@vger.kernel.org
> Signed-off-by: Ilija Hadzic <ihadzic@research.bell-labs.com>

Ah, yes stumbled over that as well but didn't had time to make a patch 
for it. So thanks a lot for taking care.

Both patches are Reviewed-by: Christian König <christian.koenig@amd.com>

Regards,
Christian.

> ---
>   drivers/gpu/drm/radeon/radeon_benchmark.c | 13 ++++++++-----
>   1 file changed, 8 insertions(+), 5 deletions(-)
>
> diff --git a/drivers/gpu/drm/radeon/radeon_benchmark.c b/drivers/gpu/drm/radeon/radeon_benchmark.c
> index 9e7f23d..87d5fb2 100644
> --- a/drivers/gpu/drm/radeon/radeon_benchmark.c
> +++ b/drivers/gpu/drm/radeon/radeon_benchmark.c
> @@ -34,7 +34,8 @@
>   
>   static int radeon_benchmark_do_move(struct radeon_device *rdev, unsigned size,
>   				    uint64_t saddr, uint64_t daddr,
> -				    int flag, int n)
> +				    int flag, int n,
> +				    struct reservation_object *resv)
>   {
>   	unsigned long start_jiffies;
>   	unsigned long end_jiffies;
> @@ -47,12 +48,12 @@ static int radeon_benchmark_do_move(struct radeon_device *rdev, unsigned size,
>   		case RADEON_BENCHMARK_COPY_DMA:
>   			fence = radeon_copy_dma(rdev, saddr, daddr,
>   						size / RADEON_GPU_PAGE_SIZE,
> -						NULL);
> +						resv);
>   			break;
>   		case RADEON_BENCHMARK_COPY_BLIT:
>   			fence = radeon_copy_blit(rdev, saddr, daddr,
>   						 size / RADEON_GPU_PAGE_SIZE,
> -						 NULL);
> +						 resv);
>   			break;
>   		default:
>   			DRM_ERROR("Unknown copy method\n");
> @@ -120,7 +121,8 @@ static void radeon_benchmark_move(struct radeon_device *rdev, unsigned size,
>   
>   	if (rdev->asic->copy.dma) {
>   		time = radeon_benchmark_do_move(rdev, size, saddr, daddr,
> -						RADEON_BENCHMARK_COPY_DMA, n);
> +						RADEON_BENCHMARK_COPY_DMA, n,
> +						dobj->tbo.resv);
>   		if (time < 0)
>   			goto out_cleanup;
>   		if (time > 0)
> @@ -130,7 +132,8 @@ static void radeon_benchmark_move(struct radeon_device *rdev, unsigned size,
>   
>   	if (rdev->asic->copy.blit) {
>   		time = radeon_benchmark_do_move(rdev, size, saddr, daddr,
> -						RADEON_BENCHMARK_COPY_BLIT, n);
> +						RADEON_BENCHMARK_COPY_BLIT, n,
> +						dobj->tbo.resv);
>   		if (time < 0)
>   			goto out_cleanup;
>   		if (time > 0)

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/dri-devel

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

* Re: [PATCH 1/2] drm/radeon: fix the crash in benchmark functions
  2015-01-30  9:20 ` [PATCH 1/2] drm/radeon: fix the crash in benchmark functions Christian König
@ 2015-01-30 15:05   ` Alex Deucher
  0 siblings, 0 replies; 4+ messages in thread
From: Alex Deucher @ 2015-01-30 15:05 UTC (permalink / raw)
  To: Christian König; +Cc: Ilija Hadzic, for 3.8, Maling list - DRI developers

On Fri, Jan 30, 2015 at 4:20 AM, Christian König
<deathsimple@vodafone.de> wrote:
> Am 30.01.2015 um 06:38 schrieb Ilija Hadzic:
>>
>> radeon_copy_dma and radeon_copy_blit must be called with
>> a valid reservation object. Otherwise a crash will be provoked.
>> We borrow the object from destination BO.
>>
>> Cc: stable@vger.kernel.org
>> Signed-off-by: Ilija Hadzic <ihadzic@research.bell-labs.com>
>
>
> Ah, yes stumbled over that as well but didn't had time to make a patch for
> it. So thanks a lot for taking care.
>
> Both patches are Reviewed-by: Christian König <christian.koenig@amd.com>

Applied to my fixes tree.  thanks.  Also noted the relevant bug:
https://bugs.freedesktop.org/show_bug.cgi?id=88464

Alex

>
> Regards,
> Christian.
>
>
>> ---
>>   drivers/gpu/drm/radeon/radeon_benchmark.c | 13 ++++++++-----
>>   1 file changed, 8 insertions(+), 5 deletions(-)
>>
>> diff --git a/drivers/gpu/drm/radeon/radeon_benchmark.c
>> b/drivers/gpu/drm/radeon/radeon_benchmark.c
>> index 9e7f23d..87d5fb2 100644
>> --- a/drivers/gpu/drm/radeon/radeon_benchmark.c
>> +++ b/drivers/gpu/drm/radeon/radeon_benchmark.c
>> @@ -34,7 +34,8 @@
>>     static int radeon_benchmark_do_move(struct radeon_device *rdev,
>> unsigned size,
>>                                     uint64_t saddr, uint64_t daddr,
>> -                                   int flag, int n)
>> +                                   int flag, int n,
>> +                                   struct reservation_object *resv)
>>   {
>>         unsigned long start_jiffies;
>>         unsigned long end_jiffies;
>> @@ -47,12 +48,12 @@ static int radeon_benchmark_do_move(struct
>> radeon_device *rdev, unsigned size,
>>                 case RADEON_BENCHMARK_COPY_DMA:
>>                         fence = radeon_copy_dma(rdev, saddr, daddr,
>>                                                 size /
>> RADEON_GPU_PAGE_SIZE,
>> -                                               NULL);
>> +                                               resv);
>>                         break;
>>                 case RADEON_BENCHMARK_COPY_BLIT:
>>                         fence = radeon_copy_blit(rdev, saddr, daddr,
>>                                                  size /
>> RADEON_GPU_PAGE_SIZE,
>> -                                                NULL);
>> +                                                resv);
>>                         break;
>>                 default:
>>                         DRM_ERROR("Unknown copy method\n");
>> @@ -120,7 +121,8 @@ static void radeon_benchmark_move(struct radeon_device
>> *rdev, unsigned size,
>>         if (rdev->asic->copy.dma) {
>>                 time = radeon_benchmark_do_move(rdev, size, saddr, daddr,
>> -                                               RADEON_BENCHMARK_COPY_DMA,
>> n);
>> +                                               RADEON_BENCHMARK_COPY_DMA,
>> n,
>> +                                               dobj->tbo.resv);
>>                 if (time < 0)
>>                         goto out_cleanup;
>>                 if (time > 0)
>> @@ -130,7 +132,8 @@ static void radeon_benchmark_move(struct radeon_device
>> *rdev, unsigned size,
>>         if (rdev->asic->copy.blit) {
>>                 time = radeon_benchmark_do_move(rdev, size, saddr, daddr,
>> -
>> RADEON_BENCHMARK_COPY_BLIT, n);
>> +
>> RADEON_BENCHMARK_COPY_BLIT, n,
>> +                                               dobj->tbo.resv);
>>                 if (time < 0)
>>                         goto out_cleanup;
>>                 if (time > 0)
>
>
> _______________________________________________
> dri-devel mailing list
> dri-devel@lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/dri-devel
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/dri-devel

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

end of thread, other threads:[~2015-01-30 15:05 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-01-30  5:38 [PATCH 1/2] drm/radeon: fix the crash in benchmark functions Ilija Hadzic
2015-01-30  5:38 ` [PATCH 2/2] drm/radeon: fix the crash in test functions Ilija Hadzic
2015-01-30  9:20 ` [PATCH 1/2] drm/radeon: fix the crash in benchmark functions Christian König
2015-01-30 15:05   ` Alex Deucher

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.