Skip to contentSkip to conversation

drm/amdgpu: Don't need to call csb_vram_unpin

PATCH In review Emily Deng 4 participants 8 messages May 27, 2019 – May 28, 2019 6 messages not in the archive

Subsystems (2)
lore
Share & tools
lore

Emily Deng

author
#0 lore raw

PATCH 1/1 drm/amdgpu: Don't need to call csb_vram_unpin

As it will destroy clear_state_obj, and also will unpin it in the gfx_v9_0_sw_fini, so don't need to call csb_vram unpin in gfx_v9_0_hw_fini, or it will have unpin warning.

v2: For suspend, still need to do unpin

---
 drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c +2 -1
index 5eb70e8..5b1ff48 100644
@@ -3395,7 +3395,8 @@ static int gfx_v9_0_hw_fini(void *handle)
 	gfx_v9_0_cp_enable(adev, false);
 	adev->gfx.rlc.funcs->stop(adev);
 
-	gfx_v9_0_csb_vram_unpin(adev);
+	if (adev->in_suspend)
+		gfx_v9_0_csb_vram_unpin(adev);
 
 	return 0;
 }
Signature · 6 lines
2.7.4

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

A message that is not in the archive (sent off-list or not yet received): 1558946487-18034-1-git-send-email-Emily.Deng-5C7GfCeVMHo@public.gmane.org

Reviewed-by Evan Quan
#2 lore raw
Quoted 37 lines

-----Original Message-----
From: amd-gfx <[email protected]> On Behalf Of Emily Deng
Sent: Monday, May 27, 2019 4:41 PM
To: [email protected]
Cc: Deng, Emily <[email protected]>
Subject: [PATCH] drm/amdgpu: Don't need to call csb_vram_unpin

As it will destroy clear_state_obj, and also will unpin it in the gfx_v9_0_sw_fini, so don't need to call csb_vram unpin in gfx_v9_0_hw_fini, or it will have unpin warning.

v2: For suspend, still need to do unpin

---
 drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c +2 -2
index 5eb70e8..5b1ff48 100644
@@ -3395,7 +3395,8 @@ static int gfx_v9_0_hw_fini(void *handle)
 	gfx_v9_0_cp_enable(adev, false);
 	adev->gfx.rlc.funcs->stop(adev);
 
-	gfx_v9_0_csb_vram_unpin(adev);
+	if (adev->in_suspend)
+		gfx_v9_0_csb_vram_unpin(adev);
 
 	return 0;
 }
--

2.7.4

Quoted 4 lines

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

#3 lore raw
In reply to a message not in the archive

Am 27.05.19 um 10:41 schrieb Emily Deng:

Quoted 17 lines

As it will destroy clear_state_obj, and also will unpin it in the gfx_v9_0_sw_fini, so don't need to call csb_vram unpin in gfx_v9_0_hw_fini, or it will have unpin warning.

v2: For suspend, still need to do unpin

---
  drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c | 3 ++-
  1 file changed, 2 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c +0 -0
index 5eb70e8..5b1ff48 100644

drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c static int gfx_v9_0_hw_fini(void *handle) · line 3399

Quoted 6 lines
drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c +2 -1
@@ -3395,7 +3395,8 @@ static int gfx_v9_0_hw_fini(void *handle)
  	gfx_v9_0_cp_enable(adev, false);
  	adev->gfx.rlc.funcs->stop(adev);
 
-	gfx_v9_0_csb_vram_unpin(adev);
+	if (adev->in_suspend)
+		gfx_v9_0_csb_vram_unpin(adev);

That doesn't looks like a good idea to me.

Why do we have unpin both in the sw_fini as well as the hw_fini code paths?

Regards,
Christian.

drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c static int gfx_v9_0_hw_fini(void *handle) · line 3402

Quoted 3 lines
drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c +0 -0
  	return 0;
  }

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

A message that is not in the archive (sent off-list or not yet received): e15ac75c-fb1a-2a05-b857-d3761f5c905e-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org

#5 lore raw

The original unpin in hw_fini was introduced by
https://lists.freedesktop.org/archives/amd-gfx/2018-July/023681.html

Evan

Quoted 40 lines

-----Original Message-----
From: amd-gfx <[email protected]> On Behalf Of Christian K?nig
Sent: Monday, May 27, 2019 7:02 PM
To: Deng, Emily <[email protected]>; [email protected]
Subject: Re: [PATCH] drm/amdgpu: Don't need to call csb_vram_unpin

Am 27.05.19 um 10:41 schrieb Emily Deng:

Quoted 17 lines

As it will destroy clear_state_obj, and also will unpin it in the gfx_v9_0_sw_fini, so don't need to call csb_vram unpin in gfx_v9_0_hw_fini, or it will have unpin warning.

v2: For suspend, still need to do unpin

---
  drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c | 3 ++-
  1 file changed, 2 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c +0 -0
index 5eb70e8..5b1ff48 100644

drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c static int gfx_v9_0_hw_fini(void *handle) · line 3399

Quoted 6 lines
drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c +2 -1
@@ -3395,7 +3395,8 @@ static int gfx_v9_0_hw_fini(void *handle)
  	gfx_v9_0_cp_enable(adev, false);
  	adev->gfx.rlc.funcs->stop(adev);
 
-	gfx_v9_0_csb_vram_unpin(adev);
+	if (adev->in_suspend)
+		gfx_v9_0_csb_vram_unpin(adev);

That doesn't looks like a good idea to me.

Why do we have unpin both in the sw_fini as well as the hw_fini code paths?

Regards,
Christian.

Quoted 1 line
Quoted 7 lines
Quoted 2 lines
  	return 0;
  }

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

A message that is not in the archive (sent off-list or not yet received): MN2PR12MB3344714A52B709FCE058F48DE41E0-rweVpJHSKToDMgCC8P//[email protected]

#7 lore raw

Ok in this case the patch is a NAK.

The correct solution is to stop using amdgpu_bo_free_kernel in gfx_v9_0_sw_fini.

BTW: Are we using the kernel pointer somewhere? Cause that one became completely invalid because of patch "drm/amdgpu: pin the csb buffer on hw init".

Christian.

Am 28.05.19 um 03:42 schrieb Quan, Evan:

Quoted 48 lines

The original unpin in hw_fini was introduced by
https://lists.freedesktop.org/archives/amd-gfx/2018-July/023681.html

Evan

Quoted 44 lines

-----Original Message-----
From: amd-gfx <[email protected]> On Behalf Of Christian K?nig
Sent: Monday, May 27, 2019 7:02 PM
To: Deng, Emily <[email protected]>; [email protected]
Subject: Re: [PATCH] drm/amdgpu: Don't need to call csb_vram_unpin

Am 27.05.19 um 10:41 schrieb Emily Deng:

Quoted 17 lines

As it will destroy clear_state_obj, and also will unpin it in the gfx_v9_0_sw_fini, so don't need to call csb_vram unpin in gfx_v9_0_hw_fini, or it will have unpin warning.

v2: For suspend, still need to do unpin

---
   drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c | 3 ++-
   1 file changed, 2 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c +0 -0
index 5eb70e8..5b1ff48 100644

drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c static int gfx_v9_0_hw_fini(void *handle) · line 3399

Quoted 6 lines
drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c +2 -1
@@ -3395,7 +3395,8 @@ static int gfx_v9_0_hw_fini(void *handle)
   	gfx_v9_0_cp_enable(adev, false);
   	adev->gfx.rlc.funcs->stop(adev);
 
-	gfx_v9_0_csb_vram_unpin(adev);
+	if (adev->in_suspend)
+		gfx_v9_0_csb_vram_unpin(adev);

That doesn't looks like a good idea to me.

Why do we have unpin both in the sw_fini as well as the hw_fini code paths?

Regards,
Christian.

drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c static int gfx_v9_0_hw_fini(void *handle) · line 3402

Quoted 2 lines
drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c +0 -0
   	return 0;
   }

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

A message that is not in the archive (sent off-list or not yet received): 82dfcb34-109c-b7d6-c511-404008589869-5C7GfCeVMHo@public.gmane.org

#9 lore raw
Quoted 11 lines

-----Original Message-----
From: Koenig, Christian <[email protected]>
Sent: Tuesday, May 28, 2019 3:04 PM
To: Quan, Evan <[email protected]>; Deng, Emily <[email protected]>; [email protected]
Subject: Re: [PATCH] drm/amdgpu: Don't need to call csb_vram_unpin

Ok in this case the patch is a NAK.

The correct solution is to stop using amdgpu_bo_free_kernel in gfx_v9_0_sw_fini.

So we just lead the memory leak here and not destroy the bo? I don't think it is correct.

Quoted 40 lines

BTW: Are we using the kernel pointer somewhere? Cause that one became completely invalid because of patch "drm/amdgpu: pin the csb buffer on hw init".

Christian.

Am 28.05.19 um 03:42 schrieb Quan, Evan:

Quoted 32 lines

The original unpin in hw_fini was introduced by
https://lists.freedesktop.org/archives/amd-gfx/2018-July/023681.html

Evan

Quoted 28 lines

-----Original Message-----
From: amd-gfx <[email protected]> On Behalf Of Christian K?nig
Sent: Monday, May 27, 2019 7:02 PM
To: Deng, Emily <[email protected]>; [email protected]
Subject: Re: [PATCH] drm/amdgpu: Don't need to call csb_vram_unpin

Am 27.05.19 um 10:41 schrieb Emily Deng:

Quoted 20 lines

As it will destroy clear_state_obj, and also will unpin it in the gfx_v9_0_sw_fini, so don't need to call csb_vram unpin in gfx_v9_0_hw_fini, or it will have unpin warning.

v2: For suspend, still need to do unpin

---
   drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c | 3 ++-
   1 file changed, 2 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c +0 -0
index 5eb70e8..5b1ff48 100644
@@ -3395,7 +3395,8 @@ static int gfx_v9_0_hw_fini(void *handle)
   	gfx_v9_0_cp_enable(adev, false);
   	adev->gfx.rlc.funcs->stop(adev);
 
Quoted 17 lines
Quoted 6 lines
Quoted 6 lines

drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c static int gfx_v9_0_hw_fini(void *handle) · line 3399

Quoted 3 lines
drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c +2 -1
-	gfx_v9_0_csb_vram_unpin(adev);
+	if (adev->in_suspend)
+		gfx_v9_0_csb_vram_unpin(adev);

That doesn't looks like a good idea to me.

Why do we have unpin both in the sw_fini as well as the hw_fini code

paths?

Quoted 10 lines
Quoted 10 lines

Regards,
Christian.

drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c static int gfx_v9_0_hw_fini(void *handle) · line 3401

Quoted 2 lines
drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c +0 -0
   	return 0;
   }

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

A message that is not in the archive (sent off-list or not yet received): MWHPR12MB132646027A5B99282AB6557A8F1E0-Gy0DoCVfaSVaj5rVPFIlogdYzm3356FpvxpqHgZTriW3zl9H0oFU5g@public.gmane.org

#11 lore raw

Am 28.05.19 um 09:38 schrieb Deng, Emily:

Quoted 7 lines
Quoted 7 lines

-----Original Message-----
From: Koenig, Christian <[email protected]>
Sent: Tuesday, May 28, 2019 3:04 PM
To: Quan, Evan <[email protected]>; Deng, Emily <[email protected]>; [email protected]
Subject: Re: [PATCH] drm/amdgpu: Don't need to call csb_vram_unpin

Quoted 5 lines
Quoted 4 lines

Ok in this case the patch is a NAK.

The correct solution is to stop using amdgpu_bo_free_kernel in gfx_v9_0_sw_fini.

So we just lead the memory leak here and not destroy the bo? I don't think it is correct.

Oh, no. That's not what I meant.

We should stop using amdgpu_bo_free_kernel and instead use amdgpu_bo_free!

Sorry for not being clear here,
Christian.

Quoted 49 lines
Quoted 49 lines

BTW: Are we using the kernel pointer somewhere? Cause that one became completely invalid because of patch "drm/amdgpu: pin the csb buffer on hw init".

Christian.

Am 28.05.19 um 03:42 schrieb Quan, Evan:

Quoted 38 lines

The original unpin in hw_fini was introduced by
https://lists.freedesktop.org/archives/amd-gfx/2018-July/023681.html

Evan

Quoted 34 lines

-----Original Message-----
From: amd-gfx <[email protected]> On Behalf Of Christian K?nig
Sent: Monday, May 27, 2019 7:02 PM
To: Deng, Emily <[email protected]>; [email protected]
Subject: Re: [PATCH] drm/amdgpu: Don't need to call csb_vram_unpin

Am 27.05.19 um 10:41 schrieb Emily Deng:

Quoted 17 lines

As it will destroy clear_state_obj, and also will unpin it in the gfx_v9_0_sw_fini, so don't need to call csb_vram unpin in gfx_v9_0_hw_fini, or it will have unpin warning.

v2: For suspend, still need to do unpin

---
    drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c | 3 ++-
    1 file changed, 2 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c +0 -0
index 5eb70e8..5b1ff48 100644

drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c static int gfx_v9_0_hw_fini(void *handle) · line 3399

Quoted 6 lines
drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c +2 -1
@@ -3395,7 +3395,8 @@ static int gfx_v9_0_hw_fini(void *handle)
    	gfx_v9_0_cp_enable(adev, false);
    	adev->gfx.rlc.funcs->stop(adev);
 
-	gfx_v9_0_csb_vram_unpin(adev);
+	if (adev->in_suspend)
+		gfx_v9_0_csb_vram_unpin(adev);

That doesn't looks like a good idea to me.

Why do we have unpin both in the sw_fini as well as the hw_fini code

paths?

Quoted 3 lines
Quoted 3 lines

Regards,
Christian.

Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines

drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c static int gfx_v9_0_hw_fini(void *handle) · line 3401

Quoted 2 lines
drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c +0 -0
    	return 0;
    }

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

A message that is not in the archive (sent off-list or not yet received): daf490f4-49fd-3688-84ff-5dc47eaa535c-5C7GfCeVMHo@public.gmane.org

#13 lore raw
Quoted 23 lines

-----Original Message-----
From: Koenig, Christian <[email protected]>
Sent: Tuesday, May 28, 2019 3:43 PM
To: Deng, Emily <[email protected]>; Quan, Evan <[email protected]>; [email protected]
Subject: Re: [PATCH] drm/amdgpu: Don't need to call csb_vram_unpin

Am 28.05.19 um 09:38 schrieb Deng, Emily:

Quoted 4 lines
Quoted 4 lines

-----Original Message-----
From: Koenig, Christian <[email protected]>
Sent: Tuesday, May 28, 2019 3:04 PM
To: Quan, Evan <[email protected]>; Deng, Emily

<[email protected]>;

Quoted 8 lines
Quoted 7 lines

[email protected]
Subject: Re: [PATCH] drm/amdgpu: Don't need to call csb_vram_unpin

Ok in this case the patch is a NAK.

The correct solution is to stop using amdgpu_bo_free_kernel in gfx_v9_0_sw_fini.

So we just lead the memory leak here and not destroy the bo? I don't think

it is correct.

Quoted 7 lines

Oh, no. That's not what I meant.

We should stop using amdgpu_bo_free_kernel and instead use amdgpu_bo_free!

Sorry for not being clear here,
Christian.

Thanks for your good suggestion. Will revert this patch, and submit another patch.

Best wishes
Emily Deng

Quoted 12 lines
Quoted 2 lines
Quoted 2 lines

BTW: Are we using the kernel pointer somewhere? Cause that one

became

Quoted 9 lines
Quoted 9 lines

completely invalid because of patch "drm/amdgpu: pin the csb buffer on hw init".

Christian.

Am 28.05.19 um 03:42 schrieb Quan, Evan:

Quoted 3 lines

The original unpin in hw_fini was introduced by
https://lists.freedesktop.org/archives/amd-gfx/2018-July/023681.html

Quoted 47 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines

Evan

Quoted 5 lines

-----Original Message-----
From: amd-gfx <[email protected]> On Behalf Of Christian K?nig
Sent: Monday, May 27, 2019 7:02 PM
To: Deng, Emily <[email protected]>; amd-

[email protected]

Quoted 40 lines
Quoted 40 lines
Quoted 23 lines
Quoted 23 lines

Subject: Re: [PATCH] drm/amdgpu: Don't need to call csb_vram_unpin

Am 27.05.19 um 10:41 schrieb Emily Deng:

Quoted 20 lines

As it will destroy clear_state_obj, and also will unpin it in the gfx_v9_0_sw_fini, so don't need to call csb_vram unpin in gfx_v9_0_hw_fini, or it will have unpin warning.

v2: For suspend, still need to do unpin

---
    drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c | 3 ++-
    1 file changed, 2 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c +0 -0
index 5eb70e8..5b1ff48 100644
@@ -3395,7 +3395,8 @@ static int gfx_v9_0_hw_fini(void *handle)
    	gfx_v9_0_cp_enable(adev, false);
    	adev->gfx.rlc.funcs->stop(adev);
 
Quoted 7 lines
Quoted 7 lines

drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c static int gfx_v9_0_hw_fini(void *handle) · line 3399

Quoted 3 lines
drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c +2 -1
-	gfx_v9_0_csb_vram_unpin(adev);
+	if (adev->in_suspend)
+		gfx_v9_0_csb_vram_unpin(adev);

That doesn't looks like a good idea to me.

Why do we have unpin both in the sw_fini as well as the hw_fini code

paths?

Quoted 9 lines
Quoted 9 lines

Regards,
Christian.

drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c static int gfx_v9_0_hw_fini(void *handle) · line 3401

Quoted 2 lines
drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c +0 -0
    	return 0;
    }

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx