All the mail mirrored from lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] drm/amdgpu: check correct allocated mqd_backup object after alloc
@ 2023-04-26  3:31 Guchun Chen
  2023-04-26  6:07 ` Ma, Le
  0 siblings, 1 reply; 2+ messages in thread
From: Guchun Chen @ 2023-04-26  3:31 UTC (permalink / raw
  To: amd-gfx, alexander.deucher, hawking.zhang, le.ma; +Cc: Guchun Chen

Instead of the default one, check the right mqd_backup object.

Signed-off-by: Guchun Chen <guchun.chen@amd.com>
Cc: Le Ma <le.ma@amd.com>
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.c | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.c
index 2cf1f88fde48..66b9740ec376 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.c
@@ -379,7 +379,7 @@ int amdgpu_gfx_kiq_init(struct amdgpu_device *adev,
 int amdgpu_gfx_mqd_sw_init(struct amdgpu_device *adev,
 			   unsigned mqd_size, int xcc_id)
 {
-	int r, i;
+	int r, i, j;
 	struct amdgpu_kiq *kiq = &adev->gfx.kiq[xcc_id];
 	struct amdgpu_ring *ring = &kiq->ring;
 
@@ -431,7 +431,8 @@ int amdgpu_gfx_mqd_sw_init(struct amdgpu_device *adev,
 
 	/* create MQD for each KCQ */
 	for (i = 0; i < adev->gfx.num_compute_rings; i++) {
-		ring = &adev->gfx.compute_ring[i + xcc_id * adev->gfx.num_compute_rings];
+		j = i + xcc_id * adev->gfx.num_compute_rings;
+		ring = &adev->gfx.compute_ring[j];
 		if (!ring->mqd_obj) {
 			r = amdgpu_bo_create_kernel(adev, mqd_size, PAGE_SIZE,
 						    AMDGPU_GEM_DOMAIN_GTT, &ring->mqd_obj,
@@ -443,8 +444,8 @@ int amdgpu_gfx_mqd_sw_init(struct amdgpu_device *adev,
 
 			ring->mqd_size = mqd_size;
 			/* prepare MQD backup */
-			adev->gfx.mec.mqd_backup[i + xcc_id * adev->gfx.num_compute_rings] = kmalloc(mqd_size, GFP_KERNEL);
-			if (!adev->gfx.mec.mqd_backup[i])
+			adev->gfx.mec.mqd_backup[j] = kmalloc(mqd_size, GFP_KERNEL);
+			if (!adev->gfx.mec.mqd_backup[j])
 				dev_warn(adev->dev, "no memory to create MQD backup for ring %s\n", ring->name);
 		}
 	}
-- 
2.25.1


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

* RE: [PATCH] drm/amdgpu: check correct allocated mqd_backup object after alloc
  2023-04-26  3:31 [PATCH] drm/amdgpu: check correct allocated mqd_backup object after alloc Guchun Chen
@ 2023-04-26  6:07 ` Ma, Le
  0 siblings, 0 replies; 2+ messages in thread
From: Ma, Le @ 2023-04-26  6:07 UTC (permalink / raw
  To: Chen, Guchun, amd-gfx@lists.freedesktop.org, Deucher, Alexander,
	Zhang, Hawking

[AMD Official Use Only - General]

Thanks for catching these. Double checked the two places are good in topic branch. The patch is Reviewed-by: Le Ma <le.ma@amd.com>

> -----Original Message-----
> From: Chen, Guchun <Guchun.Chen@amd.com>
> Sent: Wednesday, April 26, 2023 11:31 AM
> To: amd-gfx@lists.freedesktop.org; Deucher, Alexander
> <Alexander.Deucher@amd.com>; Zhang, Hawking <Hawking.Zhang@amd.com>;
> Ma, Le <Le.Ma@amd.com>
> Cc: Chen, Guchun <Guchun.Chen@amd.com>
> Subject: [PATCH] drm/amdgpu: check correct allocated mqd_backup object
> after alloc
>
> Instead of the default one, check the right mqd_backup object.
>
> Signed-off-by: Guchun Chen <guchun.chen@amd.com>
> Cc: Le Ma <le.ma@amd.com>
> ---
>  drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.c | 9 +++++----
>  1 file changed, 5 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.c
> b/drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.c
> index 2cf1f88fde48..66b9740ec376 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.c
> @@ -379,7 +379,7 @@ int amdgpu_gfx_kiq_init(struct amdgpu_device *adev,
> int amdgpu_gfx_mqd_sw_init(struct amdgpu_device *adev,
>                          unsigned mqd_size, int xcc_id)
>  {
> -     int r, i;
> +     int r, i, j;
>       struct amdgpu_kiq *kiq = &adev->gfx.kiq[xcc_id];
>       struct amdgpu_ring *ring = &kiq->ring;
>
> @@ -431,7 +431,8 @@ int amdgpu_gfx_mqd_sw_init(struct amdgpu_device
> *adev,
>
>       /* create MQD for each KCQ */
>       for (i = 0; i < adev->gfx.num_compute_rings; i++) {
> -             ring = &adev->gfx.compute_ring[i + xcc_id * adev-
> >gfx.num_compute_rings];
> +             j = i + xcc_id * adev->gfx.num_compute_rings;
> +             ring = &adev->gfx.compute_ring[j];
>               if (!ring->mqd_obj) {
>                       r = amdgpu_bo_create_kernel(adev, mqd_size,
> PAGE_SIZE,
>
> AMDGPU_GEM_DOMAIN_GTT, &ring->mqd_obj, @@ -443,8 +444,8 @@ int
> amdgpu_gfx_mqd_sw_init(struct amdgpu_device *adev,
>
>                       ring->mqd_size = mqd_size;
>                       /* prepare MQD backup */
> -                     adev->gfx.mec.mqd_backup[i + xcc_id * adev-
> >gfx.num_compute_rings] = kmalloc(mqd_size, GFP_KERNEL);
> -                     if (!adev->gfx.mec.mqd_backup[i])
> +                     adev->gfx.mec.mqd_backup[j] = kmalloc(mqd_size,
> GFP_KERNEL);
> +                     if (!adev->gfx.mec.mqd_backup[j])
>                               dev_warn(adev->dev, "no memory to create
> MQD backup for ring %s\n", ring->name);
>               }
>       }
> --
> 2.25.1


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

end of thread, other threads:[~2023-04-26  6:07 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-04-26  3:31 [PATCH] drm/amdgpu: check correct allocated mqd_backup object after alloc Guchun Chen
2023-04-26  6:07 ` Ma, Le

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.