All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] drm/amd/amdgpu: Remove static from variable in RLCG Reg RW.
@ 2022-04-13 15:26 Gavin Wan
  2022-04-14 14:24 ` Alex Deucher
  2022-04-14 17:58 ` Paul Menzel
  0 siblings, 2 replies; 4+ messages in thread
From: Gavin Wan @ 2022-04-13 15:26 UTC (permalink / raw)
  To: amd-gfx; +Cc: Gavin Wan

[why] These static variables saves the RLC Scratch registers address.
      When we installed multiple GPUs (for example: XGMI setting) and
      multiple GPUs call the function at same time. The RLC Scratch
      registers address are changed each other. Then it caused
      reading/writing to wrong GPU.

[fix] Removed the static from the variables. The variables are
      in stack.

Signed-off-by: Gavin Wan <Gavin.Wan@amd.com>
Change-Id: Iee78849291d4f7a9688ecc5165bec70ee85cdfbe
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_virt.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_virt.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_virt.c
index d5eea031c3e3..d18a05a20566 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_virt.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_virt.c
@@ -868,11 +868,11 @@ static u32 amdgpu_virt_rlcg_reg_rw(struct amdgpu_device *adev, u32 offset, u32 v
 	uint32_t timeout = 50000;
 	uint32_t i, tmp;
 	uint32_t ret = 0;
-	static void *scratch_reg0;
-	static void *scratch_reg1;
-	static void *scratch_reg2;
-	static void *scratch_reg3;
-	static void *spare_int;
+	void *scratch_reg0;
+	void *scratch_reg1;
+	void *scratch_reg2;
+	void *scratch_reg3;
+	void *spare_int;
 
 	if (!adev->gfx.rlc.rlcg_reg_access_supported) {
 		dev_err(adev->dev,
-- 
2.32.0


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

* Re: [PATCH] drm/amd/amdgpu: Remove static from variable in RLCG Reg RW.
  2022-04-13 15:26 [PATCH] drm/amd/amdgpu: Remove static from variable in RLCG Reg RW Gavin Wan
@ 2022-04-14 14:24 ` Alex Deucher
  2022-04-14 17:58 ` Paul Menzel
  1 sibling, 0 replies; 4+ messages in thread
From: Alex Deucher @ 2022-04-14 14:24 UTC (permalink / raw)
  To: Gavin Wan; +Cc: amd-gfx list

On Wed, Apr 13, 2022 at 11:27 AM Gavin Wan <Gavin.Wan@amd.com> wrote:
>
> [why] These static variables saves the RLC Scratch registers address.
>       When we installed multiple GPUs (for example: XGMI setting) and
>       multiple GPUs call the function at same time. The RLC Scratch
>       registers address are changed each other. Then it caused
>       reading/writing to wrong GPU.
>
> [fix] Removed the static from the variables. The variables are
>       in stack.

Please add:
Fixes: 5d447e29670148 ("drm/amdgpu: add helper for rlcg indirect reg access")

With that added.
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>

>
> Signed-off-by: Gavin Wan <Gavin.Wan@amd.com>
> Change-Id: Iee78849291d4f7a9688ecc5165bec70ee85cdfbe
> ---
>  drivers/gpu/drm/amd/amdgpu/amdgpu_virt.c | 10 +++++-----
>  1 file changed, 5 insertions(+), 5 deletions(-)
>
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_virt.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_virt.c
> index d5eea031c3e3..d18a05a20566 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_virt.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_virt.c
> @@ -868,11 +868,11 @@ static u32 amdgpu_virt_rlcg_reg_rw(struct amdgpu_device *adev, u32 offset, u32 v
>         uint32_t timeout = 50000;
>         uint32_t i, tmp;
>         uint32_t ret = 0;
> -       static void *scratch_reg0;
> -       static void *scratch_reg1;
> -       static void *scratch_reg2;
> -       static void *scratch_reg3;
> -       static void *spare_int;
> +       void *scratch_reg0;
> +       void *scratch_reg1;
> +       void *scratch_reg2;
> +       void *scratch_reg3;
> +       void *spare_int;
>
>         if (!adev->gfx.rlc.rlcg_reg_access_supported) {
>                 dev_err(adev->dev,
> --
> 2.32.0
>

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

* Re: [PATCH] drm/amd/amdgpu: Remove static from variable in RLCG Reg RW.
  2022-04-13 15:26 [PATCH] drm/amd/amdgpu: Remove static from variable in RLCG Reg RW Gavin Wan
  2022-04-14 14:24 ` Alex Deucher
@ 2022-04-14 17:58 ` Paul Menzel
  2022-04-14 18:34   ` Wan, Gavin
  1 sibling, 1 reply; 4+ messages in thread
From: Paul Menzel @ 2022-04-14 17:58 UTC (permalink / raw)
  To: Gavin Wan; +Cc: amd-gfx

Dear Gavin,


Thank you for your patch.

Am 13.04.22 um 17:26 schrieb Gavin Wan:

Should you re-roll your patch (v2), please remove the dot/period from 
the end of the git commit message summary (subject).

> [why] These static variables saves the RLC Scratch registers address.

s/saves/save/

>        When we installed multiple GPUs (for example: XGMI setting) and

s/installed/install/

>        multiple GPUs call the function at same time. The RLC Scratch

… same time, the RLC …

>        registers address are changed each other. Then it caused

s/caused/causes/

>        reading/writing to wrong GPU.

I see from other patches posted here, that [why] is put on a separate 
line, so you do not need to indent the text.

[why]

These static …

> 
> [fix] Removed the static from the variables. The variables are
>        in stack.

Same here, though *how* instead of *fix* seems more common.

s/Removed/Remove/
s/in stack/on the stack/

> 
> Signed-off-by: Gavin Wan <Gavin.Wan@amd.com>
> Change-Id: Iee78849291d4f7a9688ecc5165bec70ee85cdfbe

Without the Gerrit URL that line is useless.


Kind regards.

Paul


> ---
>   drivers/gpu/drm/amd/amdgpu/amdgpu_virt.c | 10 +++++-----
>   1 file changed, 5 insertions(+), 5 deletions(-)
> 
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_virt.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_virt.c
> index d5eea031c3e3..d18a05a20566 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_virt.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_virt.c
> @@ -868,11 +868,11 @@ static u32 amdgpu_virt_rlcg_reg_rw(struct amdgpu_device *adev, u32 offset, u32 v
>   	uint32_t timeout = 50000;
>   	uint32_t i, tmp;
>   	uint32_t ret = 0;
> -	static void *scratch_reg0;
> -	static void *scratch_reg1;
> -	static void *scratch_reg2;
> -	static void *scratch_reg3;
> -	static void *spare_int;
> +	void *scratch_reg0;
> +	void *scratch_reg1;
> +	void *scratch_reg2;
> +	void *scratch_reg3;
> +	void *spare_int;
>   
>   	if (!adev->gfx.rlc.rlcg_reg_access_supported) {
>   		dev_err(adev->dev,

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

* RE: [PATCH] drm/amd/amdgpu: Remove static from variable in RLCG Reg RW.
  2022-04-14 17:58 ` Paul Menzel
@ 2022-04-14 18:34   ` Wan, Gavin
  0 siblings, 0 replies; 4+ messages in thread
From: Wan, Gavin @ 2022-04-14 18:34 UTC (permalink / raw)
  To: Paul Menzel; +Cc: amd-gfx

[AMD Official Use Only]

Dear Paul,

Thanks for you comments. Let me do it.

Thanks,
Gavin

-----Original Message-----
From: Paul Menzel <pmenzel@molgen.mpg.de>
Sent: Thursday, April 14, 2022 1:59 PM
To: Wan, Gavin <Gavin.Wan@amd.com>
Cc: amd-gfx@lists.freedesktop.org
Subject: Re: [PATCH] drm/amd/amdgpu: Remove static from variable in RLCG Reg RW.

Dear Gavin,


Thank you for your patch.

Am 13.04.22 um 17:26 schrieb Gavin Wan:

Should you re-roll your patch (v2), please remove the dot/period from the end of the git commit message summary (subject).

> [why] These static variables saves the RLC Scratch registers address.

s/saves/save/

>        When we installed multiple GPUs (for example: XGMI setting) and

s/installed/install/

>        multiple GPUs call the function at same time. The RLC Scratch

… same time, the RLC …

>        registers address are changed each other. Then it caused

s/caused/causes/

>        reading/writing to wrong GPU.

I see from other patches posted here, that [why] is put on a separate line, so you do not need to indent the text.

[why]

These static …

>
> [fix] Removed the static from the variables. The variables are
>        in stack.

Same here, though *how* instead of *fix* seems more common.

s/Removed/Remove/
s/in stack/on the stack/

>
> Signed-off-by: Gavin Wan <Gavin.Wan@amd.com>
> Change-Id: Iee78849291d4f7a9688ecc5165bec70ee85cdfbe

Without the Gerrit URL that line is useless.


Kind regards.

Paul


> ---
>   drivers/gpu/drm/amd/amdgpu/amdgpu_virt.c | 10 +++++-----
>   1 file changed, 5 insertions(+), 5 deletions(-)
>
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_virt.c
> b/drivers/gpu/drm/amd/amdgpu/amdgpu_virt.c
> index d5eea031c3e3..d18a05a20566 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_virt.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_virt.c
> @@ -868,11 +868,11 @@ static u32 amdgpu_virt_rlcg_reg_rw(struct amdgpu_device *adev, u32 offset, u32 v
>       uint32_t timeout = 50000;
>       uint32_t i, tmp;
>       uint32_t ret = 0;
> -     static void *scratch_reg0;
> -     static void *scratch_reg1;
> -     static void *scratch_reg2;
> -     static void *scratch_reg3;
> -     static void *spare_int;
> +     void *scratch_reg0;
> +     void *scratch_reg1;
> +     void *scratch_reg2;
> +     void *scratch_reg3;
> +     void *spare_int;
>
>       if (!adev->gfx.rlc.rlcg_reg_access_supported) {
>               dev_err(adev->dev,

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

end of thread, other threads:[~2022-04-14 18:34 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-04-13 15:26 [PATCH] drm/amd/amdgpu: Remove static from variable in RLCG Reg RW Gavin Wan
2022-04-14 14:24 ` Alex Deucher
2022-04-14 17:58 ` Paul Menzel
2022-04-14 18:34   ` Wan, Gavin

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.