Skip to contentSkip to conversation

drm/amd/amdgpu: disable GFXOFF around debugfs access to MMIO

PATCH In review Tom St Denis 7 participants 18 messages Feb 19, 2020 – Feb 22, 2020

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 drm/amd/amdgpu: disable GFXOFF around debugfs access to MMIO

---
 drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c | 3 +++
 1 file changed, 3 insertions(+)
drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c +3 -0
index 7379910790c9..66f763300c96 100644
@@ -169,6 +169,7 @@ static int  amdgpu_debugfs_process_reg_op(bool read, struct file *f,
 	if (pm_pg_lock)
 		mutex_lock(&adev->pm.mutex);
 
+	amdgpu_gfx_off_ctrl(adev, false);
 	while (size) {
 		uint32_t value;
 
@@ -192,6 +193,8 @@ static int  amdgpu_debugfs_process_reg_op(bool read, struct file *f,
 	}
 
 end:
+	amdgpu_gfx_off_ctrl(adev, true);
+
 	if (use_bank) {
 		amdgpu_gfx_select_se_sh(adev, 0xffffffff, 0xffffffff, 0xffffffff);
 		mutex_unlock(&adev->grbm_idx_mutex);
Signature · 6 lines
2.24.1

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
Reviewed-by on v1 1/1
#1 lore raw
Quoted 2 lines · Tom St Denis

Please add a patch description. With that fixed:

Quoted 28 lines
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c | 3 +++
 1 file changed, 3 insertions(+)
drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c +3 -1
index 7379910790c9..66f763300c96 100644
@@ -169,6 +169,7 @@ static int  amdgpu_debugfs_process_reg_op(bool read, struct file *f,
        if (pm_pg_lock)
                mutex_lock(&adev->pm.mutex);
 
+       amdgpu_gfx_off_ctrl(adev, false);
        while (size) {
                uint32_t value;
 
@@ -192,6 +193,8 @@ static int  amdgpu_debugfs_process_reg_op(bool read, struct file *f,
        }
 
 end:
+       amdgpu_gfx_off_ctrl(adev, true);
+
        if (use_bank) {
                amdgpu_gfx_select_se_sh(adev, 0xffffffff, 0xffffffff, 0xffffffff);
                mutex_unlock(&adev->grbm_idx_mutex);
--

2.24.1

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

#2 lore raw

I got some messages after a while:

[  741.788564] Failed to send Message 8. [  746.671509] Failed to send Message 8. [  748.749673] Failed to send Message 2b. [  759.245414] Failed to send Message 7. [  763.216902] Failed to send Message 2a.

Are there any additional locks that should be held?  Because some commands like --top or --waves can do a lot of distinct read operations (causing a lot of enable/disable calls).

I'm going to sit on this a bit since I don't think the patch is ready for pushing out.

Tom

Quoted 33 lines · Alex Deucher
Quoted 1 line · Tom St Denis

Please add a patch description. With that fixed:

Quoted 28 lines
---
  drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c | 3 +++
  1 file changed, 3 insertions(+)
drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c +3 -1
index 7379910790c9..66f763300c96 100644
@@ -169,6 +169,7 @@ static int  amdgpu_debugfs_process_reg_op(bool read, struct file *f,
         if (pm_pg_lock)
                 mutex_lock(&adev->pm.mutex);
 
+       amdgpu_gfx_off_ctrl(adev, false);
         while (size) {
                 uint32_t value;
 
@@ -192,6 +193,8 @@ static int  amdgpu_debugfs_process_reg_op(bool read, struct file *f,
         }
 
  end:
+       amdgpu_gfx_off_ctrl(adev, true);
+
         if (use_bank) {
                 amdgpu_gfx_select_se_sh(adev, 0xffffffff, 0xffffffff, 0xffffffff);
                 mutex_unlock(&adev->grbm_idx_mutex);
--

2.24.1

Quoted 4 lines
Quoted 4 lines

_______________________________________________
amd-gfx mailing list
[email protected]
https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Flists.freedesktop.org%2Fmailman%2Flistinfo%2Famd-gfx&data=02%7C01%7Ctom.stdenis%40amd.com%7Cf3c4cd3120fa476bbca808d7b54d8076%7C3dd8961fe4884e608e11a82d994e183d%7C0%7C0%7C637177216782684720&sdata=m5eyco1nGc5XD%2Ford7Q3goA48G5NhR%2BqdSYQjnfd7%2Fg%3D&reserved=0

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

#3 lore raw
Quoted 8 lines · Tom St Denis

I got some messages after a while:

[  741.788564] Failed to send Message 8.
[  746.671509] Failed to send Message 8.
[  748.749673] Failed to send Message 2b.
[  759.245414] Failed to send Message 7.
[  763.216902] Failed to send Message 2a.

Quoted 7 lines

Are there any additional locks that should be held?  Because some commands like --top or --waves can do a lot of distinct read operations (causing a lot of enable/disable calls).

I'm going to sit on this a bit since I don't think the patch is ready for pushing out.

How about use RREG32_KIQ and WREG32_KIQ?

Thanks,
Ray

Quoted 37 lines

Tom

Quoted 33 lines · Alex Deucher
Quoted 1 line · Tom St Denis

Please add a patch description. With that fixed:

Quoted 28 lines
---
  drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c | 3 +++
  1 file changed, 3 insertions(+)
drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c +3 -1
index 7379910790c9..66f763300c96 100644
@@ -169,6 +169,7 @@ static int  amdgpu_debugfs_process_reg_op(bool read, struct file *f,
         if (pm_pg_lock)
                 mutex_lock(&adev->pm.mutex);
 
+       amdgpu_gfx_off_ctrl(adev, false);
         while (size) {
                 uint32_t value;
 
@@ -192,6 +193,8 @@ static int  amdgpu_debugfs_process_reg_op(bool read, struct file *f,
         }
 
  end:
+       amdgpu_gfx_off_ctrl(adev, true);
+
         if (use_bank) {
                 amdgpu_gfx_select_se_sh(adev, 0xffffffff, 0xffffffff, 0xffffffff);
                 mutex_unlock(&adev->grbm_idx_mutex);
--

2.24.1

Quoted 8 lines
Quoted 4 lines
Quoted 4 lines

_______________________________________________
amd-gfx mailing list
[email protected]
https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Flists.freedesktop.org%2Fmailman%2Flistinfo%2Famd-gfx&data=02%7C01%7Cray.huang%40amd.com%7C7db7d3365c8842d46cde08d7b54dc560%7C3dd8961fe4884e608e11a82d994e183d%7C0%7C0%7C637177217984125436&sdata=NBNxMQ%2Fuq7YswVzlrvZWbSmcf4JUt4eL5L62%2F7iLL28%3D&reserved=0

_______________________________________________
amd-gfx mailing list
[email protected]
https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Flists.freedesktop.org%2Fmailman%2Flistinfo%2Famd-gfx&data=02%7C01%7Cray.huang%40amd.com%7C7db7d3365c8842d46cde08d7b54dc560%7C3dd8961fe4884e608e11a82d994e183d%7C0%7C0%7C637177217984125436&sdata=NBNxMQ%2Fuq7YswVzlrvZWbSmcf4JUt4eL5L62%2F7iLL28%3D&reserved=0

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

#4 lore raw
Quoted 9 lines · Huang Rui
Quoted 8 lines · Tom St Denis

I got some messages after a while:

[  741.788564] Failed to send Message 8.
[  746.671509] Failed to send Message 8.
[  748.749673] Failed to send Message 2b.
[  759.245414] Failed to send Message 7.
[  763.216902] Failed to send Message 2a.

Quoted 8 lines
Quoted 7 lines

Are there any additional locks that should be held?  Because some commands like --top or --waves can do a lot of distinct read operations (causing a lot of enable/disable calls).

I'm going to sit on this a bit since I don't think the patch is ready for pushing out.

How about use RREG32_KIQ and WREG32_KIQ?

For all register accesses (in the debugfs read/write method)? Can we use those on all ASICs?

Tom

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

#5 lore raw
Quoted 15 lines · Tom
Quoted 13 lines · Huang Rui
Quoted 12 lines · Tom St Denis

I got some messages after a while:

[  741.788564] Failed to send Message 8.
[  746.671509] Failed to send Message 8.
[  748.749673] Failed to send Message 2b.
[  759.245414] Failed to send Message 7.
[  763.216902] Failed to send Message 2a.

Are there any additional locks that should be held?  Because some commands like --top or --waves can do a lot of distinct read operations (causing a lot of enable/disable calls).

Quoted 8 lines
Quoted 4 lines
Quoted 3 lines

I'm going to sit on this a bit since I don't think the patch is ready for pushing out.

How about use RREG32_KIQ and WREG32_KIQ?

For all register accesses (in the debugfs read/write method)? Can we use those on all ASICs?

It can be used for all register access, but using KIQ is not as fast as MMIO.

So we can check if GFXOFF enabled, then go with KIQ path. Because KIQ can wake up the GFX to "on" state at runtime.

Thanks,
Ray

Quoted 4 lines

Tom

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

#6 lore raw
In reply to Huang Rui

Better not use KIQ, because when you use debugfs to read register you usually hit a hang, and by that case KIQ probably already die

-----邮件原件-----
发件人: amd-gfx <[email protected]> 代表 Huang Rui
发送时间: 2020年2月21日 22:34
收件人: StDenis, Tom <[email protected]>
抄送: Alex Deucher <[email protected]>; amd-gfx list <[email protected]> 主题: Re: [PATCH] drm/amd/amdgpu: disable GFXOFF around debugfs access to MMIO

Quoted 8 lines · Tom St Denis

I got some messages after a while:

[  741.788564] Failed to send Message 8.
[  746.671509] Failed to send Message 8.
[  748.749673] Failed to send Message 2b.
[  759.245414] Failed to send Message 7.
[  763.216902] Failed to send Message 2a.

Quoted 7 lines

Are there any additional locks that should be held?  Because some commands like --top or --waves can do a lot of distinct read operations (causing a lot of enable/disable calls).

I'm going to sit on this a bit since I don't think the patch is ready for pushing out.

How about use RREG32_KIQ and WREG32_KIQ?

Thanks,
Ray

Quoted 47 lines

Tom

Quoted 34 lines · Alex Deucher
Quoted 1 line · Tom St Denis

Please add a patch description. With that fixed:

Quoted 29 lines
---
  drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c | 3 +++
  1 file changed, 3 insertions(+)
drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c +3 -1
index 7379910790c9..66f763300c96 100644
@@ -169,6 +169,7 @@ static int  amdgpu_debugfs_process_reg_op(bool read, struct file *f,
         if (pm_pg_lock)
                 mutex_lock(&adev->pm.mutex);
 
+       amdgpu_gfx_off_ctrl(adev, false);
         while (size) {
                 uint32_t value;
 
@@ -192,6 +193,8 @@ static int  amdgpu_debugfs_process_reg_op(bool read, struct file *f,
         }
 
  end:
+       amdgpu_gfx_off_ctrl(adev, true);
+
         if (use_bank) {
                 amdgpu_gfx_select_se_sh(adev, 0xffffffff, 0xffffffff, 0xffffffff);
                 mutex_unlock(&adev->grbm_idx_mutex);
--

2.24.1

Quoted 9 lines
Quoted 9 lines

_______________________________________________
amd-gfx mailing list
[email protected]
https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2F
lists.freedesktop.org%2Fmailman%2Flistinfo%2Famd-gfx&amp;data=02%7 C01%7Cmonk.liu%40amd.com%7Cba45efb26c0240ed036f08d7b6db20aa%7C3dd8 961fe4884e608e11a82d994e183d%7C0%7C0%7C637178924605524378&amp;sdat a=%2FyHkvYU5T%2F4iFxRexsg%2BIdm7sDzyXbjzNpHUGCO7h4k%3D&amp;reserve d=0

Quoted 8 lines

_______________________________________________
amd-gfx mailing list
[email protected]
https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Flist
s.freedesktop.org%2Fmailman%2Flistinfo%2Famd-gfx&amp;data=02%7C01%7Cmo nk.liu%40amd.com%7Cba45efb26c0240ed036f08d7b6db20aa%7C3dd8961fe4884e60 8e11a82d994e183d%7C0%7C0%7C637178924605524378&amp;sdata=%2FyHkvYU5T%2F 4iFxRexsg%2BIdm7sDzyXbjzNpHUGCO7h4k%3D&amp;reserved=0

_______________________________________________
amd-gfx mailing list
[email protected]
https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Flists.freedesktop.org%2Fmailman%2Flistinfo%2Famd-gfx&amp;data=02%7C01%7Cmonk.liu%40amd.com%7Cba45efb26c0240ed036f08d7b6db20aa%7C3dd8961fe4884e608e11a82d994e183d%7C0%7C0%7C637178924605524378&amp;sdata=%2FyHkvYU5T%2F4iFxRexsg%2BIdm7sDzyXbjzNpHUGCO7h4k%3D&amp;reserved=0
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

#7 lore raw
Quoted 1 line · Monk

Better not use KIQ, because when you use debugfs to read register you usually hit a hang, and by that case KIQ probably already die

If CP is busy, the gfx should be in "on" state at that time, we needn't use KIQ.

Thanks,
Ray

Quoted 85 lines

-----邮件原件-----
发件人: amd-gfx <[email protected]> 代表 Huang Rui
发送时间: 2020年2月21日 22:34
收件人: StDenis, Tom <[email protected]>
抄送: Alex Deucher <[email protected]>; amd-gfx list <[email protected]> 主题: Re: [PATCH] drm/amd/amdgpu: disable GFXOFF around debugfs access to MMIO

Quoted 8 lines · Tom St Denis

I got some messages after a while:

[  741.788564] Failed to send Message 8.
[  746.671509] Failed to send Message 8.
[  748.749673] Failed to send Message 2b.
[  759.245414] Failed to send Message 7.
[  763.216902] Failed to send Message 2a.

Quoted 7 lines

Are there any additional locks that should be held?  Because some commands like --top or --waves can do a lot of distinct read operations (causing a lot of enable/disable calls).

I'm going to sit on this a bit since I don't think the patch is ready for pushing out.

How about use RREG32_KIQ and WREG32_KIQ?

Thanks,
Ray

Quoted 47 lines

Tom

Quoted 34 lines · Alex Deucher
Quoted 1 line · Tom St Denis

Please add a patch description. With that fixed:

Quoted 29 lines
---
  drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c | 3 +++
  1 file changed, 3 insertions(+)
drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c +3 -1
index 7379910790c9..66f763300c96 100644
@@ -169,6 +169,7 @@ static int  amdgpu_debugfs_process_reg_op(bool read, struct file *f,
         if (pm_pg_lock)
                 mutex_lock(&adev->pm.mutex);
 
+       amdgpu_gfx_off_ctrl(adev, false);
         while (size) {
                 uint32_t value;
 
@@ -192,6 +193,8 @@ static int  amdgpu_debugfs_process_reg_op(bool read, struct file *f,
         }
 
  end:
+       amdgpu_gfx_off_ctrl(adev, true);
+
         if (use_bank) {
                 amdgpu_gfx_select_se_sh(adev, 0xffffffff, 0xffffffff, 0xffffffff);
                 mutex_unlock(&adev->grbm_idx_mutex);
--

2.24.1

Quoted 9 lines
Quoted 9 lines

_______________________________________________
amd-gfx mailing list
[email protected]
https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2F
lists.freedesktop.org%2Fmailman%2Flistinfo%2Famd-gfx&amp;data=02%7 C01%7Cmonk.liu%40amd.com%7Cba45efb26c0240ed036f08d7b6db20aa%7C3dd8 961fe4884e608e11a82d994e183d%7C0%7C0%7C637178924605524378&amp;sdat a=%2FyHkvYU5T%2F4iFxRexsg%2BIdm7sDzyXbjzNpHUGCO7h4k%3D&amp;reserve d=0

Quoted 8 lines

_______________________________________________
amd-gfx mailing list
[email protected]
https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Flist
s.freedesktop.org%2Fmailman%2Flistinfo%2Famd-gfx&amp;data=02%7C01%7Cmo nk.liu%40amd.com%7Cba45efb26c0240ed036f08d7b6db20aa%7C3dd8961fe4884e60 8e11a82d994e183d%7C0%7C0%7C637178924605524378&amp;sdata=%2FyHkvYU5T%2F 4iFxRexsg%2BIdm7sDzyXbjzNpHUGCO7h4k%3D&amp;reserved=0

Quoted 4 lines

_______________________________________________
amd-gfx mailing list
[email protected]
https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Flists.freedesktop.org%2Fmailman%2Flistinfo%2Famd-gfx&amp;data=02%7C01%7Cmonk.liu%40amd.com%7Cba45efb26c0240ed036f08d7b6db20aa%7C3dd8961fe4884e608e11a82d994e183d%7C0%7C0%7C637178924605524378&amp;sdata=%2FyHkvYU5T%2F4iFxRexsg%2BIdm7sDzyXbjzNpHUGCO7h4k%3D&amp;reserved=0

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

#8 lore raw

Am 21.02.20 um 16:23 schrieb Huang Rui:

Quoted 3 lines · Monk
Quoted 1 line

Better not use KIQ, because when you use debugfs to read register you usually hit a hang, and by that case KIQ probably already die

If CP is busy, the gfx should be in "on" state at that time, we needn't use KIQ.

Yeah, but how do you detect that? Do we have a way to wake up the CP without asking power management to do so?

Cause the register debug interface is meant to be used when the ASIC is completed locked up. Sending messages to the SMU is not really going to work in that situation.

Regards,
Christian.

Quoted 86 lines

Thanks,
Ray

Quoted 82 lines

-----邮件原件-----
发件人: amd-gfx <[email protected]> 代表 Huang Rui
发送时间: 2020年2月21日 22:34
收件人: StDenis, Tom <[email protected]>
抄送: Alex Deucher <[email protected]>; amd-gfx list <[email protected]> 主题: Re: [PATCH] drm/amd/amdgpu: disable GFXOFF around debugfs access to MMIO

Quoted 8 lines · Tom St Denis

I got some messages after a while:

[  741.788564] Failed to send Message 8.
[  746.671509] Failed to send Message 8.
[  748.749673] Failed to send Message 2b.
[  759.245414] Failed to send Message 7.
[  763.216902] Failed to send Message 2a.

Quoted 7 lines

Are there any additional locks that should be held?  Because some commands like --top or --waves can do a lot of distinct read operations (causing a lot of enable/disable calls).

I'm going to sit on this a bit since I don't think the patch is ready for pushing out.

How about use RREG32_KIQ and WREG32_KIQ?

Thanks,
Ray

Quoted 54 lines

Tom

Quoted 34 lines · Alex Deucher
Quoted 1 line · Tom St Denis

Please add a patch description. With that fixed:

Quoted 29 lines
---
   drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c | 3 +++
   1 file changed, 3 insertions(+)
drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c +3 -1
index 7379910790c9..66f763300c96 100644
@@ -169,6 +169,7 @@ static int  amdgpu_debugfs_process_reg_op(bool read, struct file *f,
          if (pm_pg_lock)
                  mutex_lock(&adev->pm.mutex);
 
+       amdgpu_gfx_off_ctrl(adev, false);
          while (size) {
                  uint32_t value;
 
@@ -192,6 +193,8 @@ static int  amdgpu_debugfs_process_reg_op(bool read, struct file *f,
          }
 
   end:
+       amdgpu_gfx_off_ctrl(adev, true);
+
          if (use_bank) {
                  amdgpu_gfx_select_se_sh(adev, 0xffffffff, 0xffffffff, 0xffffffff);
                  mutex_unlock(&adev->grbm_idx_mutex);
--

2.24.1

Quoted 9 lines
Quoted 9 lines

_______________________________________________
amd-gfx mailing list
[email protected]
https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2F
lists.freedesktop.org%2Fmailman%2Flistinfo%2Famd-gfx&amp;data=02%7 C01%7Cmonk.liu%40amd.com%7Cba45efb26c0240ed036f08d7b6db20aa%7C3dd8 961fe4884e608e11a82d994e183d%7C0%7C0%7C637178924605524378&amp;sdat a=%2FyHkvYU5T%2F4iFxRexsg%2BIdm7sDzyXbjzNpHUGCO7h4k%3D&amp;reserve d=0

_______________________________________________
amd-gfx mailing list
[email protected]
https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Flist
s.freedesktop.org%2Fmailman%2Flistinfo%2Famd-gfx&amp;data=02%7C01%7Cmo nk.liu%40amd.com%7Cba45efb26c0240ed036f08d7b6db20aa%7C3dd8961fe4884e60 8e11a82d994e183d%7C0%7C0%7C637178924605524378&amp;sdata=%2FyHkvYU5T%2F 4iFxRexsg%2BIdm7sDzyXbjzNpHUGCO7h4k%3D&amp;reserved=0

Quoted 8 lines
Quoted 4 lines

_______________________________________________
amd-gfx mailing list
[email protected]
https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Flists.freedesktop.org%2Fmailman%2Flistinfo%2Famd-gfx&amp;data=02%7C01%7Cmonk.liu%40amd.com%7Cba45efb26c0240ed036f08d7b6db20aa%7C3dd8961fe4884e608e11a82d994e183d%7C0%7C0%7C637178924605524378&amp;sdata=%2FyHkvYU5T%2F4iFxRexsg%2BIdm7sDzyXbjzNpHUGCO7h4k%3D&amp;reserved=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

#9 lore raw

[AMD Public Use]

If we are trying to debug a reproducible hang, probably best to just to disable gfxoff before messing with it to remove that as a factor. Otherwise, the method included in this patch is the proper way to disable/enable GFXOFF dynamically.

Alex

________________________________
From: amd-gfx <[email protected]> on behalf of Christian König <[email protected]>
Sent: Friday, February 21, 2020 10:27 AM
To: Huang, Ray <[email protected]>; Liu, Monk <[email protected]>
Cc: StDenis, Tom <[email protected]>; Alex Deucher <[email protected]>; amd-gfx list <[email protected]>
Subject: Re: 回复: [PATCH] drm/amd/amdgpu: disable GFXOFF around debugfs access to MMIO

Am 21.02.20 um 16:23 schrieb Huang Rui:

Quoted 3 lines · Monk
Quoted 1 line

Better not use KIQ, because when you use debugfs to read register you usually hit a hang, and by that case KIQ probably already die

If CP is busy, the gfx should be in "on" state at that time, we needn't use KIQ.

Yeah, but how do you detect that? Do we have a way to wake up the CP without asking power management to do so?

Cause the register debug interface is meant to be used when the ASIC is completed locked up. Sending messages to the SMU is not really going to work in that situation.

Regards,
Christian.

Quoted 86 lines

Thanks,
Ray

Quoted 82 lines

-----邮件原件-----
发件人: amd-gfx <[email protected]> 代表 Huang Rui
发送时间: 2020年2月21日 22:34
收件人: StDenis, Tom <[email protected]>
抄送: Alex Deucher <[email protected]>; amd-gfx list <[email protected]> 主题: Re: [PATCH] drm/amd/amdgpu: disable GFXOFF around debugfs access to MMIO

Quoted 8 lines · Tom St Denis

I got some messages after a while:

[  741.788564] Failed to send Message 8.
[  746.671509] Failed to send Message 8.
[  748.749673] Failed to send Message 2b.
[  759.245414] Failed to send Message 7.
[  763.216902] Failed to send Message 2a.
Quoted 7 lines

Are there any additional locks that should be held? Because some commands like --top or --waves can do a lot of distinct read operations (causing a lot of enable/disable calls).

I'm going to sit on this a bit since I don't think the patch is ready for pushing out.

How about use RREG32_KIQ and WREG32_KIQ?

Thanks,
Ray

Quoted 54 lines

Tom

Quoted 34 lines · Alex Deucher
Quoted 1 line · Tom St Denis

Please add a patch description. With that fixed:

Quoted 29 lines
---
   drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c | 3 +++
   1 file changed, 3 insertions(+)
drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c +3 -1
index 7379910790c9..66f763300c96 100644
@@ -169,6 +169,7 @@ static int  amdgpu_debugfs_process_reg_op(bool read, struct file *f,
          if (pm_pg_lock)
                  mutex_lock(&adev->pm.mutex);
 
+       amdgpu_gfx_off_ctrl(adev, false);
          while (size) {
                  uint32_t value;
 
@@ -192,6 +193,8 @@ static int  amdgpu_debugfs_process_reg_op(bool read, struct file *f,
          }
 
   end:
+       amdgpu_gfx_off_ctrl(adev, true);
+
          if (use_bank) {
                  amdgpu_gfx_select_se_sh(adev, 0xffffffff, 0xffffffff, 0xffffffff);
                  mutex_unlock(&adev->grbm_idx_mutex);
--

2.24.1

Quoted 9 lines
Quoted 9 lines

_______________________________________________
amd-gfx mailing list
[email protected]
https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2F
lists.freedesktop.org%2Fmailman%2Flistinfo%2Famd-gfx&amp;data=02%7 C01%7Cmonk.liu%40amd.com%7Cba45efb26c0240ed036f08d7b6db20aa%7C3dd8 961fe4884e608e11a82d994e183d%7C0%7C0%7C637178924605524378&amp;sdat a=%2FyHkvYU5T%2F4iFxRexsg%2BIdm7sDzyXbjzNpHUGCO7h4k%3D&amp;reserve d=0

_______________________________________________
amd-gfx mailing list
[email protected]
https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Flist
s.freedesktop.org%2Fmailman%2Flistinfo%2Famd-gfx&amp;data=02%7C01%7Cmo nk.liu%40amd.com%7Cba45efb26c0240ed036f08d7b6db20aa%7C3dd8961fe4884e60 8e11a82d994e183d%7C0%7C0%7C637178924605524378&amp;sdata=%2FyHkvYU5T%2F 4iFxRexsg%2BIdm7sDzyXbjzNpHUGCO7h4k%3D&amp;reserved=0

Quoted 8 lines
Quoted 4 lines

_______________________________________________
amd-gfx mailing list
[email protected]
https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Flists.freedesktop.org%2Fmailman%2Flistinfo%2Famd-gfx&amp;data=02%7C01%7Calexander.deucher%40amd.com%7Cf3762304925b4019bfed08d7b6e287e4%7C3dd8961fe4884e608e11a82d994e183d%7C0%7C0%7C637178957179179431&amp;sdata=bY7V%2BKOF3gYu4ITGCKgAiRvXUvxPcwsz2zsEJDns3jI%3D&amp;reserved=0

_______________________________________________
amd-gfx mailing list
[email protected]
https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Flists.freedesktop.org%2Fmailman%2Flistinfo%2Famd-gfx&amp;data=02%7C01%7Calexander.deucher%40amd.com%7Cf3762304925b4019bfed08d7b6e287e4%7C3dd8961fe4884e608e11a82d994e183d%7C0%7C0%7C637178957179179431&amp;sdata=bY7V%2BKOF3gYu4ITGCKgAiRvXUvxPcwsz2zsEJDns3jI%3D&amp;reserved=0

_______________________________________________
amd-gfx mailing list
[email protected]
https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Flists.freedesktop.org%2Fmailman%2Flistinfo%2Famd-gfx&amp;data=02%7C01%7Calexander.deucher%40amd.com%7Cf3762304925b4019bfed08d7b6e287e4%7C3dd8961fe4884e608e11a82d994e183d%7C0%7C0%7C637178957179179431&amp;sdata=bY7V%2BKOF3gYu4ITGCKgAiRvXUvxPcwsz2zsEJDns3jI%3D&amp;reserved=0

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

#10 lore raw

Do we have a way to disable GFXOFF on the fly?

If not maybe it would be a good idea to add a separate debugfs file to do this.

Christian.

Am 21.02.20 um 16:39 schrieb Deucher, Alexander:

Quoted 131 lines

[AMD Public Use]

If we are trying to debug a reproducible hang, probably best to just to disable gfxoff before messing with it to remove that as a factor.  Otherwise, the method included in this patch is the proper way to disable/enable GFXOFF dynamically.

Alex

------------------------------------------------------------------------
*From:* amd-gfx <[email protected]> on behalf of Christian König <[email protected]> *Sent:* Friday, February 21, 2020 10:27 AM
*To:* Huang, Ray <[email protected]>; Liu, Monk <[email protected]>
*Cc:* StDenis, Tom <[email protected]>; Alex Deucher <[email protected]>; amd-gfx list <[email protected]> *Subject:* Re: 回复: [PATCH] drm/amd/amdgpu: disable GFXOFF around debugfs access to MMIO
Am 21.02.20 um 16:23 schrieb Huang Rui:

Quoted 2 lines · Monk
Quoted 1 line

Better not use KIQ, because when you use debugfs to read register

you usually hit a hang, and by that case KIQ probably already die

Quoted 1 line

If CP is busy, the gfx should be in "on" state at that time, we

needn't use KIQ.

Yeah, but how do you detect that? Do we have a way to wake up the CP without asking power management to do so?

Cause the register debug interface is meant to be used when the ASIC is completed locked up. Sending messages to the SMU is not really going to work in that situation.

Regards,
Christian.

Quoted 9 lines

Thanks,
Ray

Quoted 5 lines

-----邮件原件-----
发件人: amd-gfx <[email protected]> 代表 Huang Rui 发送时间: 2020年2月21日 22:34
收件人: StDenis, Tom <[email protected]>
抄送: Alex Deucher <[email protected]>; amd-gfx list

<[email protected]>

Quoted 1 line
Quoted 1 line

主题: Re: [PATCH] drm/amd/amdgpu: disable GFXOFF around debugfs

access to MMIO

Quoted 26 lines
Quoted 26 lines · Tom St Denis
Quoted 8 lines

I got some messages after a while:

[  741.788564] Failed to send Message 8.
[  746.671509] Failed to send Message 8.
[  748.749673] Failed to send Message 2b.
[  759.245414] Failed to send Message 7.
[  763.216902] Failed to send Message 2a.

Quoted 7 lines

Are there any additional locks that should be held?  Because some commands like --top or --waves can do a lot of distinct read operations (causing a lot of enable/disable calls).

I'm going to sit on this a bit since I don't think the patch is ready for pushing out.

How about use RREG32_KIQ and WREG32_KIQ?

Thanks,
Ray

Quoted 4 lines

Tom

Quoted 1 line · Alex Deucher

On Wed, Feb 19, 2020 at 10:04 AM Tom St Denis

Quoted 8 lines · <[email protected]> wrote:
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 1 line

Please add a patch description.  With that fixed:

Quoted 4 lines

---
drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c | 3 +++

    1 file changed, 3 insertions(+)
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines

drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c static int

Quoted 6 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c +0 -0
index 7379910790c9..66f763300c96 100644
@@ -169,6 +169,7 @@ static int 

amdgpu_debugfs_process_reg_op(bool read, struct file *f,

Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines

drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c static int

Quoted 8 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c +1 -0
            if (pm_pg_lock)
 mutex_lock(&adev->pm.mutex);
 
+       amdgpu_gfx_off_ctrl(adev, false);
            while (size) {
                    uint32_t value;
 
@@ -192,6 +193,8 @@ static int 

amdgpu_debugfs_process_reg_op(bool read, struct file *f,

Quoted 28 lines
Quoted 28 lines
Quoted 28 lines
Quoted 11 lines
Quoted 11 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c +0 -0
            }
 

    end:
+       amdgpu_gfx_off_ctrl(adev, true);
+
           if (use_bank) { amdgpu_gfx_select_se_sh(adev, 0xffffffff, 0xffffffff, 0xffffffff); mutex_unlock(&adev->grbm_idx_mutex);
--
2.24.1

Quoted 9 lines
Quoted 9 lines

_______________________________________________
amd-gfx mailing list
[email protected]
https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2F
lists.freedesktop.org%2Fmailman%2Flistinfo%2Famd-gfx&amp;data=02%7 C01%7Cmonk.liu%40amd.com%7Cba45efb26c0240ed036f08d7b6db20aa%7C3dd8 961fe4884e608e11a82d994e183d%7C0%7C0%7C637178924605524378&amp;sdat a=%2FyHkvYU5T%2F4iFxRexsg%2BIdm7sDzyXbjzNpHUGCO7h4k%3D&amp;reserve d=0

_______________________________________________
amd-gfx mailing list
[email protected]
https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Flist
s.freedesktop.org%2Fmailman%2Flistinfo%2Famd-gfx&amp;data=02%7C01%7Cmo nk.liu%40amd.com%7Cba45efb26c0240ed036f08d7b6db20aa%7C3dd8961fe4884e60 8e11a82d994e183d%7C0%7C0%7C637178924605524378&amp;sdata=%2FyHkvYU5T%2F 4iFxRexsg%2BIdm7sDzyXbjzNpHUGCO7h4k%3D&amp;reserved=0

Quoted 4 lines
Quoted 4 lines

_______________________________________________
amd-gfx mailing list
[email protected]

https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Flists.freedesktop.org%2Fmailman%2Flistinfo%2Famd-gfx&amp;data=02%7C01%7Calexander.deucher%40amd.com%7Cf3762304925b4019bfed08d7b6e287e4%7C3dd8961fe4884e608e11a82d994e183d%7C0%7C0%7C637178957179179431&amp;sdata=bY7V%2BKOF3gYu4ITGCKgAiRvXUvxPcwsz2zsEJDns3jI%3D&amp;reserved=0

Quoted 4 lines

_______________________________________________
amd-gfx mailing list
[email protected]

Quoted 6 lines

https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Flists.freedesktop.org%2Fmailman%2Flistinfo%2Famd-gfx&amp;data=02%7C01%7Calexander.deucher%40amd.com%7Cf3762304925b4019bfed08d7b6e287e4%7C3dd8961fe4884e608e11a82d994e183d%7C0%7C0%7C637178957179179431&amp;sdata=bY7V%2BKOF3gYu4ITGCKgAiRvXUvxPcwsz2zsEJDns3jI%3D&amp;reserved=0

_______________________________________________
amd-gfx mailing list
[email protected]
https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Flists.freedesktop.org%2Fmailman%2Flistinfo%2Famd-gfx&amp;data=02%7C01%7Calexander.deucher%40amd.com%7Cf3762304925b4019bfed08d7b6e287e4%7C3dd8961fe4884e608e11a82d994e183d%7C0%7C0%7C637178957179179431&amp;sdata=bY7V%2BKOF3gYu4ITGCKgAiRvXUvxPcwsz2zsEJDns3jI%3D&amp;reserved=0

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

#11 lore raw

[AMD Public Use]

Not at the moment. But we could add a debugfs file which just wraps amdgpu_gfx_off_ctrl(). That said, maybe we just add a delay here or a use a timer to delay turning gfxoff back on again so that we aren't turning it on and off so rapidly.

Alex

________________________________
From: Christian König <[email protected]>
Sent: Friday, February 21, 2020 10:43 AM
To: Deucher, Alexander <[email protected]>; Huang, Ray <[email protected]>; Liu, Monk <[email protected]>
Cc: StDenis, Tom <[email protected]>; Alex Deucher <[email protected]>; amd-gfx list <[email protected]>
Subject: Re: 回复: [PATCH] drm/amd/amdgpu: disable GFXOFF around debugfs access to MMIO

Do we have a way to disable GFXOFF on the fly?

If not maybe it would be a good idea to add a separate debugfs file to do this.

Christian.

Am 21.02.20 um 16:39 schrieb Deucher, Alexander:

[AMD Public Use]

If we are trying to debug a reproducible hang, probably best to just to disable gfxoff before messing with it to remove that as a factor. Otherwise, the method included in this patch is the proper way to disable/enable GFXOFF dynamically.

Alex

________________________________
From: amd-gfx <[email protected]><mailto:[email protected]> on behalf of Christian König <[email protected]><mailto:[email protected]>
Sent: Friday, February 21, 2020 10:27 AM
To: Huang, Ray <[email protected]><mailto:[email protected]>; Liu, Monk <[email protected]><mailto:[email protected]>
Cc: StDenis, Tom <[email protected]><mailto:[email protected]>; Alex Deucher <[email protected]><mailto:[email protected]>; amd-gfx list <[email protected]><mailto:[email protected]>
Subject: Re: 回复: [PATCH] drm/amd/amdgpu: disable GFXOFF around debugfs access to MMIO

Am 21.02.20 um 16:23 schrieb Huang Rui:

Quoted 3 lines · Monk
Quoted 1 line

Better not use KIQ, because when you use debugfs to read register you usually hit a hang, and by that case KIQ probably already die

If CP is busy, the gfx should be in "on" state at that time, we needn't use KIQ.

Yeah, but how do you detect that? Do we have a way to wake up the CP without asking power management to do so?

Cause the register debug interface is meant to be used when the ASIC is completed locked up. Sending messages to the SMU is not really going to work in that situation.

Regards,
Christian.

Quoted 86 lines

Thanks,
Ray

Quoted 82 lines

-----邮件原件-----
发件人: amd-gfx <[email protected]><mailto:[email protected]> 代表 Huang Rui
发送时间: 2020年2月21日 22:34
收件人: StDenis, Tom <[email protected]><mailto:[email protected]>
抄送: Alex Deucher <[email protected]><mailto:[email protected]>; amd-gfx list <[email protected]><mailto:[email protected]> 主题: Re: [PATCH] drm/amd/amdgpu: disable GFXOFF around debugfs access to MMIO

Quoted 8 lines · Tom St Denis

I got some messages after a while:

[  741.788564] Failed to send Message 8.
[  746.671509] Failed to send Message 8.
[  748.749673] Failed to send Message 2b.
[  759.245414] Failed to send Message 7.
[  763.216902] Failed to send Message 2a.
Quoted 7 lines

Are there any additional locks that should be held? Because some commands like --top or --waves can do a lot of distinct read operations (causing a lot of enable/disable calls).

I'm going to sit on this a bit since I don't think the patch is ready for pushing out.

How about use RREG32_KIQ and WREG32_KIQ?

Thanks,
Ray

Quoted 54 lines

Tom

Quoted 34 lines · Alex Deucher
Quoted 1 line · On Wed, Feb 19, 2020 at 10:04 AM Tom St Denis…

Please add a patch description. With that fixed:

Quoted 29 lines
---
   drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c | 3 +++
   1 file changed, 3 insertions(+)
drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c +3 -1
index 7379910790c9..66f763300c96 100644
@@ -169,6 +169,7 @@ static int  amdgpu_debugfs_process_reg_op(bool read, struct file *f,
          if (pm_pg_lock)
                  mutex_lock(&adev->pm.mutex);
 
+       amdgpu_gfx_off_ctrl(adev, false);
          while (size) {
                  uint32_t value;
 
@@ -192,6 +193,8 @@ static int  amdgpu_debugfs_process_reg_op(bool read, struct file *f,
          }
 
   end:
+       amdgpu_gfx_off_ctrl(adev, true);
+
          if (use_bank) {
                  amdgpu_gfx_select_se_sh(adev, 0xffffffff, 0xffffffff, 0xffffffff);
                  mutex_unlock(&adev->grbm_idx_mutex);
--

2.24.1

Quoted 9 lines
Quoted 9 lines

_______________________________________________
amd-gfx mailing list [email protected]<mailto:[email protected]>
https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2F
lists.freedesktop.org%2Fmailman%2Flistinfo%2Famd-gfx&amp;data=02%7 C01%7Cmonk.liu%40amd.com%7Cba45efb26c0240ed036f08d7b6db20aa%7C3dd8 961fe4884e608e11a82d994e183d%7C0%7C0%7C637178924605524378&amp;sdat a=%2FyHkvYU5T%2F4iFxRexsg%2BIdm7sDzyXbjzNpHUGCO7h4k%3D&amp;reserve d=0

_______________________________________________
amd-gfx mailing list [email protected]<mailto:[email protected]>
https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Flist
s.freedesktop.org%2Fmailman%2Flistinfo%2Famd-gfx&amp;data=02%7C01%7Cmo nk.liu%40amd.com%7Cba45efb26c0240ed036f08d7b6db20aa%7C3dd8961fe4884e60 8e11a82d994e183d%7C0%7C0%7C637178924605524378&amp;sdata=%2FyHkvYU5T%2F 4iFxRexsg%2BIdm7sDzyXbjzNpHUGCO7h4k%3D&amp;reserved=0

Quoted 8 lines
Quoted 4 lines

_______________________________________________
amd-gfx mailing list [email protected]<mailto:[email protected]>
https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Flists.freedesktop.org%2Fmailman%2Flistinfo%2Famd-gfx&amp;data=02%7C01%7Calexander.deucher%40amd.com%7Cf3762304925b4019bfed08d7b6e287e4%7C3dd8961fe4884e608e11a82d994e183d%7C0%7C0%7C637178957179179431&amp;sdata=bY7V%2BKOF3gYu4ITGCKgAiRvXUvxPcwsz2zsEJDns3jI%3D&amp;reserved=0<https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Flists.freedesktop.org%2Fmailman%2Flistinfo%2Famd-gfx&data=02%7C01%7CAlexander.Deucher%40amd.com%7C50c08a2474b346c44c0608d7b6e4d3ff%7C3dd8961fe4884e608e11a82d994e183d%7C0%7C0%7C637178966243976347&sdata=yQgD1Ywji%2BimCVr06LD0oSnf4ZHGmoN3s8a5NybPx4E%3D&reserved=0>

_______________________________________________
amd-gfx mailing list [email protected]<mailto:[email protected]>
https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Flists.freedesktop.org%2Fmailman%2Flistinfo%2Famd-gfx&amp;data=02%7C01%7Calexander.deucher%40amd.com%7Cf3762304925b4019bfed08d7b6e287e4%7C3dd8961fe4884e608e11a82d994e183d%7C0%7C0%7C637178957179179431&amp;sdata=bY7V%2BKOF3gYu4ITGCKgAiRvXUvxPcwsz2zsEJDns3jI%3D&amp;reserved=0<https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Flists.freedesktop.org%2Fmailman%2Flistinfo%2Famd-gfx&data=02%7C01%7CAlexander.Deucher%40amd.com%7C50c08a2474b346c44c0608d7b6e4d3ff%7C3dd8961fe4884e608e11a82d994e183d%7C0%7C0%7C637178966243986301&sdata=5vafv2zCFbpgaSpgcQzLaEAC3wnqkIvGbrvKH3M11s4%3D&reserved=0>

_______________________________________________
amd-gfx mailing list [email protected]<mailto:[email protected]>
https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Flists.freedesktop.org%2Fmailman%2Flistinfo%2Famd-gfx&amp;data=02%7C01%7Calexander.deucher%40amd.com%7Cf3762304925b4019bfed08d7b6e287e4%7C3dd8961fe4884e608e11a82d994e183d%7C0%7C0%7C637178957179179431&amp;sdata=bY7V%2BKOF3gYu4ITGCKgAiRvXUvxPcwsz2zsEJDns3jI%3D&amp;reserved=0<https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Flists.freedesktop.org%2Fmailman%2Flistinfo%2Famd-gfx&data=02%7C01%7CAlexander.Deucher%40amd.com%7C50c08a2474b346c44c0608d7b6e4d3ff%7C3dd8961fe4884e608e11a82d994e183d%7C0%7C0%7C637178966243986301&sdata=5vafv2zCFbpgaSpgcQzLaEAC3wnqkIvGbrvKH3M11s4%3D&reserved=0>

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

#12 lore raw

Ok how about this:

We add a debugfs file which when read returns the GFXOFF status and when written with a number disabled GFXOFF for N seconds with 0 meaning forever.

Umr gets a new commandline option to write to that file before reading registers.

This way the user can still disable it if it causes any problems. Does that sounds like a plan?

Regards,
Christian.

Am 21.02.20 um 16:56 schrieb Deucher, Alexander:

Quoted 16 lines

[AMD Public Use]

Not at the moment.  But we could add a debugfs file which just wraps amdgpu_gfx_off_ctrl(). That said, maybe we just add a delay here or a use a timer to delay turning gfxoff back on again so that we aren't turning it on and off so rapidly.

Alex

------------------------------------------------------------------------
*From:* Christian König <[email protected]>
*Sent:* Friday, February 21, 2020 10:43 AM
*To:* Deucher, Alexander <[email protected]>; Huang, Ray <[email protected]>; Liu, Monk <[email protected]> *Cc:* StDenis, Tom <[email protected]>; Alex Deucher <[email protected]>; amd-gfx list <[email protected]> *Subject:* Re: 回复: [PATCH] drm/amd/amdgpu: disable GFXOFF around debugfs access to MMIO
Do we have a way to disable GFXOFF on the fly?

Quoted 152 lines

If not maybe it would be a good idea to add a separate debugfs file to do this.

Christian.

Am 21.02.20 um 16:39 schrieb Deucher, Alexander:

Quoted 146 lines

[AMD Public Use]

If we are trying to debug a reproducible hang, probably best to just to disable gfxoff before messing with it to remove that as a factor.  Otherwise, the method included in this patch is the proper way to disable/enable GFXOFF dynamically.

Alex

------------------------------------------------------------------------
*From:* amd-gfx <[email protected]> <mailto:[email protected]> on behalf of Christian König <[email protected]> <mailto:[email protected]> *Sent:* Friday, February 21, 2020 10:27 AM
*To:* Huang, Ray <[email protected]> <mailto:[email protected]>; Liu, Monk <[email protected]> <mailto:[email protected]>
*Cc:* StDenis, Tom <[email protected]> <mailto:[email protected]>; Alex Deucher <[email protected]> <mailto:[email protected]>; amd-gfx list <[email protected]> <mailto:[email protected]> *Subject:* Re: 回复: [PATCH] drm/amd/amdgpu: disable GFXOFF around debugfs access to MMIO
Am 21.02.20 um 16:23 schrieb Huang Rui:

Quoted 2 lines · Monk
Quoted 1 line

Better not use KIQ, because when you use debugfs to read register

you usually hit a hang, and by that case KIQ probably already die

Quoted 1 line

If CP is busy, the gfx should be in "on" state at that time, we

needn't use KIQ.

Yeah, but how do you detect that? Do we have a way to wake up the CP without asking power management to do so?

Cause the register debug interface is meant to be used when the ASIC is completed locked up. Sending messages to the SMU is not really going to work in that situation.

Regards,
Christian.

Quoted 6 lines

Thanks,
Ray

Quoted 2 lines

-----邮件原件-----
发件人: amd-gfx <[email protected]>

<mailto:[email protected]> 代表 Huang Rui

Quoted 2 lines
Quoted 2 lines

发送时间: 2020年2月21日 22:34
收件人: StDenis, Tom <[email protected]>

<mailto:[email protected]>

Quoted 1 line
Quoted 1 line

抄送: Alex Deucher <[email protected]>

<mailto:[email protected]>; amd-gfx list <[email protected]> <mailto:[email protected]>

Quoted 1 line
Quoted 1 line

主题: Re: [PATCH] drm/amd/amdgpu: disable GFXOFF around debugfs

access to MMIO

Quoted 26 lines
Quoted 26 lines · Tom St Denis
Quoted 8 lines

I got some messages after a while:

[  741.788564] Failed to send Message 8.
[  746.671509] Failed to send Message 8.
[  748.749673] Failed to send Message 2b.
[  759.245414] Failed to send Message 7.
[  763.216902] Failed to send Message 2a.

Quoted 7 lines

Are there any additional locks that should be held?  Because some commands like --top or --waves can do a lot of distinct read operations (causing a lot of enable/disable calls).

I'm going to sit on this a bit since I don't think the patch is ready for pushing out.

How about use RREG32_KIQ and WREG32_KIQ?

Thanks,
Ray

Quoted 4 lines

Tom

Quoted 1 line · Alex Deucher

On Wed, Feb 19, 2020 at 10:04 AM Tom St Denis

Quoted 1 line · <[email protected]> <mailto:[email protected]> wrote:
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

<mailto:[email protected]>

Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines

Please add a patch description. With that fixed:

<mailto:[email protected]>

Quoted 11 lines
Quoted 11 lines
Quoted 11 lines
Quoted 11 lines

drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c static int

Quoted 11 lines

---
drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c | 3 +++

    1 file changed, 3 insertions(+)
drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c +0 -0
index 7379910790c9..66f763300c96 100644
@@ -169,6 +169,7 @@ static int  

amdgpu_debugfs_process_reg_op(bool read, struct file *f,

Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines

drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c static int

Quoted 8 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c +1 -0
            if (pm_pg_lock)
 mutex_lock(&adev->pm.mutex);
 
+ amdgpu_gfx_off_ctrl(adev, false);
            while (size) {
                    uint32_t value;
 
@@ -192,6 +193,8 @@ static int  

amdgpu_debugfs_process_reg_op(bool read, struct file *f,

Quoted 11 lines
Quoted 11 lines
Quoted 11 lines
Quoted 11 lines
Quoted 11 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c +0 -0
            }
 

    end:
+ amdgpu_gfx_off_ctrl(adev, true);
+
           if (use_bank) { amdgpu_gfx_select_se_sh(adev, 0xffffffff, 0xffffffff, 0xffffffff); mutex_unlock(&adev->grbm_idx_mutex);
--
2.24.1

Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines

_______________________________________________
amd-gfx mailing list
[email protected]

<mailto:[email protected]>

Quoted 10 lines
Quoted 10 lines
Quoted 10 lines
Quoted 6 lines
Quoted 6 lines

https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2F
lists.freedesktop.org%2Fmailman%2Flistinfo%2Famd-gfx&amp;data=02%7 C01%7Cmonk.liu%40amd.com%7Cba45efb26c0240ed036f08d7b6db20aa%7C3dd8 961fe4884e608e11a82d994e183d%7C0%7C0%7C637178924605524378&amp;sdat a=%2FyHkvYU5T%2F4iFxRexsg%2BIdm7sDzyXbjzNpHUGCO7h4k%3D&amp;reserve d=0

_______________________________________________
amd-gfx mailing list
[email protected] <mailto:[email protected]>

https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Flist

Quoted 1 line
Quoted 1 line
Quoted 1 line

s.freedesktop.org%2Fmailman%2Flistinfo%2Famd-gfx&amp;data=02%7C01%7Cmo

Quoted 1 line
Quoted 1 line
Quoted 1 line

nk.liu%40amd.com%7Cba45efb26c0240ed036f08d7b6db20aa%7C3dd8961fe4884e60

Quoted 1 line
Quoted 1 line
Quoted 1 line

8e11a82d994e183d%7C0%7C0%7C637178924605524378&amp;sdata=%2FyHkvYU5T%2F

Quoted 5 lines
Quoted 5 lines
Quoted 1 line

4iFxRexsg%2BIdm7sDzyXbjzNpHUGCO7h4k%3D&amp;reserved=0

_______________________________________________
amd-gfx mailing list
[email protected] <mailto:[email protected]>

https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Flists.freedesktop.org%2Fmailman%2Flistinfo%2Famd-gfx&amp;data=02%7C01%7Calexander.deucher%40amd.com%7Cf3762304925b4019bfed08d7b6e287e4%7C3dd8961fe4884e608e11a82d994e183d%7C0%7C0%7C637178957179179431&amp;sdata=bY7V%2BKOF3gYu4ITGCKgAiRvXUvxPcwsz2zsEJDns3jI%3D&amp;reserved=0 <https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Flists.freedesktop.org%2Fmailman%2Flistinfo%2Famd-gfx&data=02%7C01%7CAlexander.Deucher%40amd.com%7C50c08a2474b346c44c0608d7b6e4d3ff%7C3dd8961fe4884e608e11a82d994e183d%7C0%7C0%7C637178966243976347&sdata=yQgD1Ywji%2BimCVr06LD0oSnf4ZHGmoN3s8a5NybPx4E%3D&reserved=0>

Quoted 4 lines

_______________________________________________
amd-gfx mailing list
[email protected] <mailto:[email protected]>

https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Flists.freedesktop.org%2Fmailman%2Flistinfo%2Famd-gfx&amp;data=02%7C01%7Calexander.deucher%40amd.com%7Cf3762304925b4019bfed08d7b6e287e4%7C3dd8961fe4884e608e11a82d994e183d%7C0%7C0%7C637178957179179431&amp;sdata=bY7V%2BKOF3gYu4ITGCKgAiRvXUvxPcwsz2zsEJDns3jI%3D&amp;reserved=0 <https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Flists.freedesktop.org%2Fmailman%2Flistinfo%2Famd-gfx&data=02%7C01%7CAlexander.Deucher%40amd.com%7C50c08a2474b346c44c0608d7b6e4d3ff%7C3dd8961fe4884e608e11a82d994e183d%7C0%7C0%7C637178966243986301&sdata=5vafv2zCFbpgaSpgcQzLaEAC3wnqkIvGbrvKH3M11s4%3D&reserved=0>

_______________________________________________
amd-gfx mailing list
[email protected] <mailto:[email protected]>
https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Flists.freedesktop.org%2Fmailman%2Flistinfo%2Famd-gfx&amp;data=02%7C01%7Calexander.deucher%40amd.com%7Cf3762304925b4019bfed08d7b6e287e4%7C3dd8961fe4884e608e11a82d994e183d%7C0%7C0%7C637178957179179431&amp;sdata=bY7V%2BKOF3gYu4ITGCKgAiRvXUvxPcwsz2zsEJDns3jI%3D&amp;reserved=0 <https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Flists.freedesktop.org%2Fmailman%2Flistinfo%2Famd-gfx&data=02%7C01%7CAlexander.Deucher%40amd.com%7C50c08a2474b346c44c0608d7b6e4d3ff%7C3dd8961fe4884e608e11a82d994e183d%7C0%7C0%7C637178966243986301&sdata=5vafv2zCFbpgaSpgcQzLaEAC3wnqkIvGbrvKH3M11s4%3D&reserved=0>

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

#13 lore raw

Probably simpler just to do on/off and let userspace determine timing but other than that ya sounds good.

For things like umr's --top which runs indefinitely having a timer wouldn't work.  Similarly, --waves can take a long time depending on activity and the asic.

Tom

Quoted 4 lines · Christian König

Ok how about this:

We add a debugfs file which when read returns the GFXOFF status and when written with a number disabled GFXOFF for N seconds with 0 meaning forever.

Quoted 178 lines

Umr gets a new commandline option to write to that file before reading registers.

This way the user can still disable it if it causes any problems. Does that sounds like a plan?

Regards,
Christian.

Am 21.02.20 um 16:56 schrieb Deucher, Alexander:

Quoted 169 lines

[AMD Public Use]

Not at the moment.  But we could add a debugfs file which just wraps amdgpu_gfx_off_ctrl(). That said, maybe we just add a delay here or a use a timer to delay turning gfxoff back on again so that we aren't turning it on and off so rapidly.

Alex

------------------------------------------------------------------------
*From:* Christian König <[email protected]>
*Sent:* Friday, February 21, 2020 10:43 AM
*To:* Deucher, Alexander <[email protected]>; Huang, Ray <[email protected]>; Liu, Monk <[email protected]> *Cc:* StDenis, Tom <[email protected]>; Alex Deucher <[email protected]>; amd-gfx list <[email protected]> *Subject:* Re: 回复: [PATCH] drm/amd/amdgpu: disable GFXOFF around debugfs access to MMIO
Do we have a way to disable GFXOFF on the fly?

If not maybe it would be a good idea to add a separate debugfs file to do this.

Christian.

Am 21.02.20 um 16:39 schrieb Deucher, Alexander:

Quoted 147 lines

[AMD Public Use]

If we are trying to debug a reproducible hang, probably best to just to disable gfxoff before messing with it to remove that as a factor.  Otherwise, the method included in this patch is the proper way to disable/enable GFXOFF dynamically.

Alex

------------------------------------------------------------------------
*From:* amd-gfx <[email protected]> <mailto:[email protected]> on behalf of Christian König <[email protected]> <mailto:[email protected]> *Sent:* Friday, February 21, 2020 10:27 AM
*To:* Huang, Ray <[email protected]> <mailto:[email protected]>; Liu, Monk <[email protected]> <mailto:[email protected]>
*Cc:* StDenis, Tom <[email protected]> <mailto:[email protected]>; Alex Deucher <[email protected]> <mailto:[email protected]>; amd-gfx list <[email protected]> <mailto:[email protected]> *Subject:* Re: 回复: [PATCH] drm/amd/amdgpu: disable GFXOFF around debugfs access to MMIO
Am 21.02.20 um 16:23 schrieb Huang Rui:

Quoted 2 lines · Monk
Quoted 1 line

Better not use KIQ, because when you use debugfs to read register

you usually hit a hang, and by that case KIQ probably already die

Quoted 1 line

If CP is busy, the gfx should be in "on" state at that time, we

needn't use KIQ.

Yeah, but how do you detect that? Do we have a way to wake up the CP without asking power management to do so?

Cause the register debug interface is meant to be used when the ASIC is completed locked up. Sending messages to the SMU is not really going to work in that situation.

Regards,
Christian.

Quoted 6 lines

Thanks,
Ray

Quoted 2 lines

-----邮件原件-----
发件人: amd-gfx <[email protected]>

<mailto:[email protected]> 代表 Huang Rui

Quoted 2 lines
Quoted 2 lines

发送时间: 2020年2月21日 22:34
收件人: StDenis, Tom <[email protected]>

<mailto:[email protected]>

Quoted 1 line
Quoted 1 line

抄送: Alex Deucher <[email protected]>

<mailto:[email protected]>; amd-gfx list <[email protected]> <mailto:[email protected]>

Quoted 1 line
Quoted 1 line

主题: Re: [PATCH] drm/amd/amdgpu: disable GFXOFF around debugfs

access to MMIO

Quoted 10 lines
Quoted 10 lines · Tom St Denis
Quoted 8 lines

I got some messages after a while:

[  741.788564] Failed to send Message 8.
[  746.671509] Failed to send Message 8.
[  748.749673] Failed to send Message 2b.
[  759.245414] Failed to send Message 7.
[  763.216902] Failed to send Message 2a.

Quoted 5 lines
Quoted 5 lines
Quoted 5 lines

Are there any additional locks that should be held?  Because some commands like --top or --waves can do a lot of distinct read operations (causing a lot of enable/disable calls).

I'm going to sit on this a bit since I don't think the patch is

ready

Quoted 11 lines
Quoted 11 lines
Quoted 2 lines

for pushing out.

How about use RREG32_KIQ and WREG32_KIQ?

Thanks,
Ray

Quoted 4 lines

Tom

Quoted 1 line · Alex Deucher

On Wed, Feb 19, 2020 at 10:04 AM Tom St Denis

Quoted 1 line · <[email protected]> <mailto:[email protected]> wrote:
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

<mailto:[email protected]>

Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines

Please add a patch description.  With that fixed:

<mailto:[email protected]>

Quoted 11 lines
Quoted 11 lines
Quoted 11 lines
Quoted 11 lines

drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c static int

Quoted 11 lines

---
drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c | 3 +++

    1 file changed, 3 insertions(+)
drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c +0 -0
index 7379910790c9..66f763300c96 100644
@@ -169,6 +169,7 @@ static int  

amdgpu_debugfs_process_reg_op(bool read, struct file *f,

Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines

drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c static int

Quoted 8 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c +1 -0
            if (pm_pg_lock)
 mutex_lock(&adev->pm.mutex);
 
+ amdgpu_gfx_off_ctrl(adev, false);
            while (size) {
                    uint32_t value;
 
@@ -192,6 +193,8 @@ static int  

amdgpu_debugfs_process_reg_op(bool read, struct file *f,

Quoted 11 lines
Quoted 11 lines
Quoted 11 lines
Quoted 11 lines
Quoted 11 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c +0 -0
            }
 

    end:
+ amdgpu_gfx_off_ctrl(adev, true);
+
           if (use_bank) { amdgpu_gfx_select_se_sh(adev, 0xffffffff, 0xffffffff, 0xffffffff); mutex_unlock(&adev->grbm_idx_mutex);
--
2.24.1

Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines

_______________________________________________
amd-gfx mailing list
[email protected]

<mailto:[email protected]>

Quoted 10 lines
Quoted 10 lines
Quoted 10 lines
Quoted 6 lines
Quoted 6 lines

https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2F
lists.freedesktop.org%2Fmailman%2Flistinfo%2Famd-gfx&amp;data=02%7 C01%7Cmonk.liu%40amd.com%7Cba45efb26c0240ed036f08d7b6db20aa%7C3dd8 961fe4884e608e11a82d994e183d%7C0%7C0%7C637178924605524378&amp;sdat a=%2FyHkvYU5T%2F4iFxRexsg%2BIdm7sDzyXbjzNpHUGCO7h4k%3D&amp;reserve d=0

_______________________________________________
amd-gfx mailing list
[email protected] <mailto:[email protected]>

https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Flist

Quoted 1 line
Quoted 1 line
Quoted 1 line

s.freedesktop.org%2Fmailman%2Flistinfo%2Famd-gfx&amp;data=02%7C01%7Cmo

Quoted 1 line
Quoted 1 line
Quoted 1 line

nk.liu%40amd.com%7Cba45efb26c0240ed036f08d7b6db20aa%7C3dd8961fe4884e60

Quoted 1 line
Quoted 1 line
Quoted 1 line

8e11a82d994e183d%7C0%7C0%7C637178924605524378&amp;sdata=%2FyHkvYU5T%2F

Quoted 5 lines
Quoted 5 lines
Quoted 1 line

4iFxRexsg%2BIdm7sDzyXbjzNpHUGCO7h4k%3D&amp;reserved=0

_______________________________________________
amd-gfx mailing list
[email protected] <mailto:[email protected]>

https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Flists.freedesktop.org%2Fmailman%2Flistinfo%2Famd-gfx&amp;data=02%7C01%7Calexander.deucher%40amd.com%7Cf3762304925b4019bfed08d7b6e287e4%7C3dd8961fe4884e608e11a82d994e183d%7C0%7C0%7C637178957179179431&amp;sdata=bY7V%2BKOF3gYu4ITGCKgAiRvXUvxPcwsz2zsEJDns3jI%3D&amp;reserved=0 <https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Flists.freedesktop.org%2Fmailman%2Flistinfo%2Famd-gfx&data=02%7C01%7CTom.StDenis%40amd.com%7Ce7c6277c26884e509ce508d7b6e7aea5%7C3dd8961fe4884e608e11a82d994e183d%7C0%7C0%7C637178978798816096&sdata=Nj%2BxemPqrL4VhXJDcktQBWu77KxtwyYLPUvHEPquvHw%3D&reserved=0>

Quoted 4 lines

_______________________________________________
amd-gfx mailing list
[email protected] <mailto:[email protected]>

https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Flists.freedesktop.org%2Fmailman%2Flistinfo%2Famd-gfx&amp;data=02%7C01%7Calexander.deucher%40amd.com%7Cf3762304925b4019bfed08d7b6e287e4%7C3dd8961fe4884e608e11a82d994e183d%7C0%7C0%7C637178957179179431&amp;sdata=bY7V%2BKOF3gYu4ITGCKgAiRvXUvxPcwsz2zsEJDns3jI%3D&amp;reserved=0 <https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Flists.freedesktop.org%2Fmailman%2Flistinfo%2Famd-gfx&data=02%7C01%7CTom.StDenis%40amd.com%7Ce7c6277c26884e509ce508d7b6e7aea5%7C3dd8961fe4884e608e11a82d994e183d%7C0%7C0%7C637178978798826087&sdata=VQEOX1p4mWqWeamWP9OF4dpQeh8wAdJE%2B4SOThFAhSY%3D&reserved=0>

_______________________________________________
amd-gfx mailing list
[email protected] <mailto:[email protected]>
https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Flists.freedesktop.org%2Fmailman%2Flistinfo%2Famd-gfx&amp;data=02%7C01%7Calexander.deucher%40amd.com%7Cf3762304925b4019bfed08d7b6e287e4%7C3dd8961fe4884e608e11a82d994e183d%7C0%7C0%7C637178957179179431&amp;sdata=bY7V%2BKOF3gYu4ITGCKgAiRvXUvxPcwsz2zsEJDns3jI%3D&amp;reserved=0 <https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Flists.freedesktop.org%2Fmailman%2Flistinfo%2Famd-gfx&data=02%7C01%7CTom.StDenis%40amd.com%7Ce7c6277c26884e509ce508d7b6e7aea5%7C3dd8961fe4884e608e11a82d994e183d%7C0%7C0%7C637178978798836083&sdata=HOIBW4ctr61UCWxr%2FEpBYzP6kTMxx5J9ItOXBMmZUN4%3D&reserved=0>

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

maintainer
#14 lore raw
Quoted 1 line

Probably simpler just to do on/off and let userspace determine timing but other than that ya sounds good.

Works for me as long as we only expose it through debugfs for root. Otherwise there is always the risk of userspace forgetting to turn it on again.

Christian.

Am 21.02.20 um 17:06 schrieb Tom St Denis:

Quoted 206 lines

Probably simpler just to do on/off and let userspace determine timing but other than that ya sounds good.

For things like umr's --top which runs indefinitely having a timer wouldn't work.  Similarly, --waves can take a long time depending on activity and the asic.

Tom

Quoted 195 lines · Christian König

Ok how about this:

We add a debugfs file which when read returns the GFXOFF status and when written with a number disabled GFXOFF for N seconds with 0 meaning forever.

Umr gets a new commandline option to write to that file before reading registers.

This way the user can still disable it if it causes any problems. Does that sounds like a plan?

Regards,
Christian.

Am 21.02.20 um 16:56 schrieb Deucher, Alexander:

Quoted 182 lines

[AMD Public Use]

Not at the moment.  But we could add a debugfs file which just wraps amdgpu_gfx_off_ctrl(). That said, maybe we just add a delay here or a use a timer to delay turning gfxoff back on again so that we aren't turning it on and off so rapidly.

Alex

------------------------------------------------------------------------

*From:* Christian König <[email protected]>
*Sent:* Friday, February 21, 2020 10:43 AM
*To:* Deucher, Alexander <[email protected]>; Huang, Ray <[email protected]>; Liu, Monk <[email protected]> *Cc:* StDenis, Tom <[email protected]>; Alex Deucher <[email protected]>; amd-gfx list <[email protected]> *Subject:* Re: 回复: [PATCH] drm/amd/amdgpu: disable GFXOFF around debugfs access to MMIO
Do we have a way to disable GFXOFF on the fly?

If not maybe it would be a good idea to add a separate debugfs file to do this.

Christian.

Am 21.02.20 um 16:39 schrieb Deucher, Alexander:

Quoted 159 lines

[AMD Public Use]

If we are trying to debug a reproducible hang, probably best to just to disable gfxoff before messing with it to remove that as a factor.  Otherwise, the method included in this patch is the proper way to disable/enable GFXOFF dynamically.

Alex

------------------------------------------------------------------------

*From:* amd-gfx <[email protected]> <mailto:[email protected]> on behalf of Christian König <[email protected]> <mailto:[email protected]> *Sent:* Friday, February 21, 2020 10:27 AM
*To:* Huang, Ray <[email protected]> <mailto:[email protected]>; Liu, Monk <[email protected]> <mailto:[email protected]>
*Cc:* StDenis, Tom <[email protected]> <mailto:[email protected]>; Alex Deucher <[email protected]> <mailto:[email protected]>; amd-gfx list <[email protected]> <mailto:[email protected]> *Subject:* Re: 回复: [PATCH] drm/amd/amdgpu: disable GFXOFF around debugfs access to MMIO
Am 21.02.20 um 16:23 schrieb Huang Rui:

Quoted 2 lines · Monk
Quoted 1 line

Better not use KIQ, because when you use debugfs to read

register you usually hit a hang, and by that case KIQ probably already die

Quoted 1 line

If CP is busy, the gfx should be in "on" state at that time, we

needn't use KIQ.

Yeah, but how do you detect that? Do we have a way to wake up the CP without asking power management to do so?

Cause the register debug interface is meant to be used when the ASIC is completed locked up. Sending messages to the SMU is not really going to work in that situation.

Regards,
Christian.

Quoted 6 lines

Thanks,
Ray

Quoted 2 lines

-----邮件原件-----
发件人: amd-gfx <[email protected]>

<mailto:[email protected]> 代表 Huang Rui

Quoted 2 lines
Quoted 2 lines

发送时间: 2020年2月21日 22:34
收件人: StDenis, Tom <[email protected]>

<mailto:[email protected]>

Quoted 1 line
Quoted 1 line

抄送: Alex Deucher <[email protected]>

<mailto:[email protected]>; amd-gfx list <[email protected]> <mailto:[email protected]>

Quoted 1 line
Quoted 1 line

主题: Re: [PATCH] drm/amd/amdgpu: disable GFXOFF around debugfs

access to MMIO

Quoted 10 lines
Quoted 10 lines · Tom St Denis
Quoted 8 lines

I got some messages after a while:

[  741.788564] Failed to send Message 8.
[  746.671509] Failed to send Message 8.
[  748.749673] Failed to send Message 2b.
[  759.245414] Failed to send Message 7.
[  763.216902] Failed to send Message 2a.

Quoted 5 lines
Quoted 5 lines
Quoted 5 lines

Are there any additional locks that should be held?  Because some commands like --top or --waves can do a lot of distinct read operations (causing a lot of enable/disable calls).

I'm going to sit on this a bit since I don't think the patch is

ready

Quoted 11 lines
Quoted 11 lines
Quoted 2 lines

for pushing out.

How about use RREG32_KIQ and WREG32_KIQ?

Thanks,
Ray

Quoted 4 lines

Tom

Quoted 1 line · Alex Deucher

On Wed, Feb 19, 2020 at 10:04 AM Tom St Denis

Quoted 1 line · <[email protected]> <mailto:[email protected]> wrote:
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

<mailto:[email protected]>

Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines

Please add a patch description.  With that fixed:

<mailto:[email protected]>

Quoted 11 lines
Quoted 11 lines
Quoted 11 lines
Quoted 11 lines

drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c static int

Quoted 11 lines

---
drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c | 3 +++

    1 file changed, 3 insertions(+)
drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c +0 -0
index 7379910790c9..66f763300c96 100644
@@ -169,6 +169,7 @@ static int 

amdgpu_debugfs_process_reg_op(bool read, struct file *f,

Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines

drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c static int

Quoted 8 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c +1 -0
            if (pm_pg_lock)
 mutex_lock(&adev->pm.mutex);
 
+ amdgpu_gfx_off_ctrl(adev, false);
            while (size) {
                    uint32_t value;
 
@@ -192,6 +193,8 @@ static int 

amdgpu_debugfs_process_reg_op(bool read, struct file *f,

Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c +0 -0
            }
 

    end:
+ amdgpu_gfx_off_ctrl(adev, true);
+
           if (use_bank) { amdgpu_gfx_select_se_sh(adev, 0xffffffff, 0xffffffff,

0xffffffff);

Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines

mutex_unlock(&adev->grbm_idx_mutex);
--
2.24.1

_______________________________________________
amd-gfx mailing list
[email protected]

<mailto:[email protected]>

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2F

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

lists.freedesktop.org%2Fmailman%2Flistinfo%2Famd-gfx&amp;data=02%7

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

C01%7Cmonk.liu%40amd.com%7Cba45efb26c0240ed036f08d7b6db20aa%7C3dd8

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

961fe4884e608e11a82d994e183d%7C0%7C0%7C637178924605524378&amp;sdat

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

a=%2FyHkvYU5T%2F4iFxRexsg%2BIdm7sDzyXbjzNpHUGCO7h4k%3D&amp;reserve

Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 1 line
Quoted 1 line

d=0

_______________________________________________
amd-gfx mailing list
[email protected]

<mailto:[email protected]>

Quoted 1 line
Quoted 1 line
Quoted 1 line

https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Flist

Quoted 1 line
Quoted 1 line
Quoted 1 line

s.freedesktop.org%2Fmailman%2Flistinfo%2Famd-gfx&amp;data=02%7C01%7Cmo

Quoted 1 line
Quoted 1 line
Quoted 1 line

nk.liu%40amd.com%7Cba45efb26c0240ed036f08d7b6db20aa%7C3dd8961fe4884e60

Quoted 1 line
Quoted 1 line
Quoted 1 line

8e11a82d994e183d%7C0%7C0%7C637178924605524378&amp;sdata=%2FyHkvYU5T%2F

Quoted 4 lines
Quoted 4 lines
Quoted 1 line

4iFxRexsg%2BIdm7sDzyXbjzNpHUGCO7h4k%3D&amp;reserved=0

_______________________________________________
amd-gfx mailing list
[email protected]

<mailto:[email protected]>

Quoted 1 line
Quoted 1 line

https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Flists.freedesktop.org%2Fmailman%2Flistinfo%2Famd-gfx&amp;data=02%7C01%7Calexander.deucher%40amd.com%7Cf3762304925b4019bfed08d7b6e287e4%7C3dd8961fe4884e608e11a82d994e183d%7C0%7C0%7C637178957179179431&amp;sdata=bY7V%2BKOF3gYu4ITGCKgAiRvXUvxPcwsz2zsEJDns3jI%3D&amp;reserved=0 <https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Flists.freedesktop.org%2Fmailman%2Flistinfo%2Famd-gfx&data=02%7C01%7CTom.StDenis%40amd.com%7Ce7c6277c26884e509ce508d7b6e7aea5%7C3dd8961fe4884e608e11a82d994e183d%7C0%7C0%7C637178978798816096&sdata=Nj%2BxemPqrL4VhXJDcktQBWu77KxtwyYLPUvHEPquvHw%3D&reserved=0>

Quoted 4 lines

_______________________________________________
amd-gfx mailing list
[email protected] <mailto:[email protected]>

https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Flists.freedesktop.org%2Fmailman%2Flistinfo%2Famd-gfx&amp;data=02%7C01%7Calexander.deucher%40amd.com%7Cf3762304925b4019bfed08d7b6e287e4%7C3dd8961fe4884e608e11a82d994e183d%7C0%7C0%7C637178957179179431&amp;sdata=bY7V%2BKOF3gYu4ITGCKgAiRvXUvxPcwsz2zsEJDns3jI%3D&amp;reserved=0 <https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Flists.freedesktop.org%2Fmailman%2Flistinfo%2Famd-gfx&data=02%7C01%7CTom.StDenis%40amd.com%7Ce7c6277c26884e509ce508d7b6e7aea5%7C3dd8961fe4884e608e11a82d994e183d%7C0%7C0%7C637178978798826087&sdata=VQEOX1p4mWqWeamWP9OF4dpQeh8wAdJE%2B4SOThFAhSY%3D&reserved=0>

_______________________________________________
amd-gfx mailing list
[email protected] <mailto:[email protected]>
https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Flists.freedesktop.org%2Fmailman%2Flistinfo%2Famd-gfx&amp;data=02%7C01%7Calexander.deucher%40amd.com%7Cf3762304925b4019bfed08d7b6e287e4%7C3dd8961fe4884e608e11a82d994e183d%7C0%7C0%7C637178957179179431&amp;sdata=bY7V%2BKOF3gYu4ITGCKgAiRvXUvxPcwsz2zsEJDns3jI%3D&amp;reserved=0 <https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Flists.freedesktop.org%2Fmailman%2Flistinfo%2Famd-gfx&data=02%7C01%7CTom.StDenis%40amd.com%7Ce7c6277c26884e509ce508d7b6e7aea5%7C3dd8961fe4884e608e11a82d994e183d%7C0%7C0%7C637178978798836083&sdata=HOIBW4ctr61UCWxr%2FEpBYzP6kTMxx5J9ItOXBMmZUN4%3D&reserved=0>

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

#15 lore raw
In reply to Deucher, Alexander
Quoted 1 line
Quoted 1 line
Quoted 1 line

If we are trying to debug a reproducible hang, probably best to just to disable gfxoff before messing with it to remove that as a factor.

Agree

Quoted 1 line
Quoted 1 line

Otherwise, the method included in this patch is the proper way to disable/enable GFXOFF dynamically.

Sounds not doable, because we cannot disable GFXOFF every time we use debugfs (and restore GFXOFF as well after that debugfs interface done …)

thanks
发件人: Deucher, Alexander <[email protected]>
发送时间: 2020年2月21日 23:40
收件人: Christian König <[email protected]>; Huang, Ray <[email protected]>; Liu, Monk <[email protected]> 抄送: StDenis, Tom <[email protected]>; Alex Deucher <[email protected]>; amd-gfx list <[email protected]> 主题: Re: 回复: [PATCH] drm/amd/amdgpu: disable GFXOFF around debugfs access to MMIO

[AMD Public Use]

If we are trying to debug a reproducible hang, probably best to just to disable gfxoff before messing with it to remove that as a factor. Otherwise, the method included in this patch is the proper way to disable/enable GFXOFF dynamically.

Alex

________________________________
From: amd-gfx <[email protected]<mailto:[email protected]>> on behalf of Christian König <[email protected]<mailto:[email protected]>>
Sent: Friday, February 21, 2020 10:27 AM
To: Huang, Ray <[email protected]<mailto:[email protected]>>; Liu, Monk <[email protected]<mailto:[email protected]>>
Cc: StDenis, Tom <[email protected]<mailto:[email protected]>>; Alex Deucher <[email protected]<mailto:[email protected]>>; amd-gfx list <[email protected]<mailto:[email protected]>>
Subject: Re: 回复: [PATCH] drm/amd/amdgpu: disable GFXOFF around debugfs access to MMIO

Am 21.02.20 um 16:23 schrieb Huang Rui:

Quoted 3 lines · Monk
Quoted 1 line

Better not use KIQ, because when you use debugfs to read register you usually hit a hang, and by that case KIQ probably already die

If CP is busy, the gfx should be in "on" state at that time, we needn't use KIQ.

Yeah, but how do you detect that? Do we have a way to wake up the CP without asking power management to do so?

Cause the register debug interface is meant to be used when the ASIC is completed locked up. Sending messages to the SMU is not really going to work in that situation.

Regards,
Christian.

Quoted 86 lines

Thanks,
Ray

Quoted 82 lines

-----邮件原件-----
发件人: amd-gfx <[email protected]<mailto:[email protected]>> 代表 Huang Rui
发送时间: 2020年2月21日 22:34
收件人: StDenis, Tom <[email protected]<mailto:[email protected]>>
抄送: Alex Deucher <[email protected]<mailto:[email protected]>>; amd-gfx list <[email protected]<mailto:[email protected]>> 主题: Re: [PATCH] drm/amd/amdgpu: disable GFXOFF around debugfs access to MMIO

Quoted 8 lines · Tom St Denis

I got some messages after a while:

[  741.788564] Failed to send Message 8.
[  746.671509] Failed to send Message 8.
[  748.749673] Failed to send Message 2b.
[  759.245414] Failed to send Message 7.
[  763.216902] Failed to send Message 2a.
Quoted 7 lines

Are there any additional locks that should be held? Because some commands like --top or --waves can do a lot of distinct read operations (causing a lot of enable/disable calls).

I'm going to sit on this a bit since I don't think the patch is ready for pushing out.

How about use RREG32_KIQ and WREG32_KIQ?

Thanks,
Ray

Quoted 54 lines

Tom

Quoted 34 lines · Alex Deucher
Quoted 1 line · On Wed, Feb 19, 2020 at 10:04 AM Tom St Denis…

Please add a patch description. With that fixed:

Quoted 29 lines
---
   drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c | 3 +++
   1 file changed, 3 insertions(+)
drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c +3 -1
index 7379910790c9..66f763300c96 100644
@@ -169,6 +169,7 @@ static int  amdgpu_debugfs_process_reg_op(bool read, struct file *f,
          if (pm_pg_lock)
                  mutex_lock(&adev->pm.mutex);
 
+       amdgpu_gfx_off_ctrl(adev, false);
          while (size) {
                  uint32_t value;
 
@@ -192,6 +193,8 @@ static int  amdgpu_debugfs_process_reg_op(bool read, struct file *f,
          }
 
   end:
+       amdgpu_gfx_off_ctrl(adev, true);
+
          if (use_bank) {
                  amdgpu_gfx_select_se_sh(adev, 0xffffffff, 0xffffffff, 0xffffffff);
                  mutex_unlock(&adev->grbm_idx_mutex);
--

2.24.1

Quoted 9 lines
Quoted 9 lines

_______________________________________________
amd-gfx mailing list [email protected]<mailto:[email protected]>
https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2F
lists.freedesktop.org%2Fmailman%2Flistinfo%2Famd-gfx&amp;data=02%7 C01%7Cmonk.liu%40amd.com%7Cba45efb26c0240ed036f08d7b6db20aa%7C3dd8 961fe4884e608e11a82d994e183d%7C0%7C0%7C637178924605524378&amp;sdat a=%2FyHkvYU5T%2F4iFxRexsg%2BIdm7sDzyXbjzNpHUGCO7h4k%3D&amp;reserve d=0

_______________________________________________
amd-gfx mailing list [email protected]<mailto:[email protected]>
https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Flist
s.freedesktop.org%2Fmailman%2Flistinfo%2Famd-gfx&amp;data=02%7C01%7Cmo nk.liu%40amd.com%7Cba45efb26c0240ed036f08d7b6db20aa%7C3dd8961fe4884e60 8e11a82d994e183d%7C0%7C0%7C637178924605524378&amp;sdata=%2FyHkvYU5T%2F 4iFxRexsg%2BIdm7sDzyXbjzNpHUGCO7h4k%3D&amp;reserved=0

Quoted 8 lines
Quoted 4 lines

_______________________________________________
amd-gfx mailing list [email protected]<mailto:[email protected]>
https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Flists.freedesktop.org%2Fmailman%2Flistinfo%2Famd-gfx&amp;data=02%7C01%7Calexander.deucher%40amd.com%7Cf3762304925b4019bfed08d7b6e287e4%7C3dd8961fe4884e608e11a82d994e183d%7C0%7C0%7C637178957179179431&amp;sdata=bY7V%2BKOF3gYu4ITGCKgAiRvXUvxPcwsz2zsEJDns3jI%3D&amp;reserved=0

_______________________________________________
amd-gfx mailing list [email protected]<mailto:[email protected]>
https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Flists.freedesktop.org%2Fmailman%2Flistinfo%2Famd-gfx&amp;data=02%7C01%7Calexander.deucher%40amd.com%7Cf3762304925b4019bfed08d7b6e287e4%7C3dd8961fe4884e608e11a82d994e183d%7C0%7C0%7C637178957179179431&amp;sdata=bY7V%2BKOF3gYu4ITGCKgAiRvXUvxPcwsz2zsEJDns3jI%3D&amp;reserved=0

_______________________________________________
amd-gfx mailing list [email protected]<mailto:[email protected]>
https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Flists.freedesktop.org%2Fmailman%2Flistinfo%2Famd-gfx&amp;data=02%7C01%7Calexander.deucher%40amd.com%7Cf3762304925b4019bfed08d7b6e287e4%7C3dd8961fe4884e608e11a82d994e183d%7C0%7C0%7C637178957179179431&amp;sdata=bY7V%2BKOF3gYu4ITGCKgAiRvXUvxPcwsz2zsEJDns3jI%3D&amp;reserved=0

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

#16 lore raw
In reply to Christian König
Quoted 6 lines · Christian König

Am 21.02.20 um 16:23 schrieb Huang Rui:

Quoted 3 lines · Monk
Quoted 1 line

Better not use KIQ, because when you use debugfs to read register you usually hit a hang, and by that case KIQ probably already die

If CP is busy, the gfx should be in "on" state at that time, we needn't use KIQ.

Yeah, but how do you detect that?

I remember there is a bit in SMU or PWR register which is not exposed yet. And need double confirm with SMU or RLC guys.

Quoted 2 lines

Do we have a way to wake up the CP without asking power management to do so?

Use doorbell interrupt. RLC will detect the doorbell interrupt to tell SMU to wake up gfx at runtime. So I suggest KIQ here.

Quoted 5 lines

Cause the register debug interface is meant to be used when the ASIC is completed locked up. Sending messages to the SMU is not really going to work in that situation.

Agree, actually, we tried this kind of messages a long time before, and will get failure sometimes that the same like Tom here.

Thanks,
Ray

Quoted 98 lines

Regards,
Christian.

Quoted 94 lines

Thanks,
Ray

Quoted 82 lines

-----邮件原件-----
发件人: amd-gfx <[email protected]> 代表 Huang Rui
发送时间: 2020年2月21日 22:34
收件人: StDenis, Tom <[email protected]>
抄送: Alex Deucher <[email protected]>; amd-gfx list <[email protected]> 主题: Re: [PATCH] drm/amd/amdgpu: disable GFXOFF around debugfs access to MMIO

Quoted 8 lines · Tom St Denis

I got some messages after a while:

[  741.788564] Failed to send Message 8.
[  746.671509] Failed to send Message 8.
[  748.749673] Failed to send Message 2b.
[  759.245414] Failed to send Message 7.
[  763.216902] Failed to send Message 2a.

Quoted 7 lines

Are there any additional locks that should be held?  Because some commands like --top or --waves can do a lot of distinct read operations (causing a lot of enable/disable calls).

I'm going to sit on this a bit since I don't think the patch is ready for pushing out.

How about use RREG32_KIQ and WREG32_KIQ?

Thanks,
Ray

Quoted 46 lines

Tom

Quoted 34 lines · Alex Deucher
Quoted 1 line · Tom St Denis

Please add a patch description. With that fixed:

Quoted 29 lines
---
   drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c | 3 +++
   1 file changed, 3 insertions(+)
drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c +3 -1
index 7379910790c9..66f763300c96 100644
@@ -169,6 +169,7 @@ static int  amdgpu_debugfs_process_reg_op(bool read, struct file *f,
          if (pm_pg_lock)
                  mutex_lock(&adev->pm.mutex);
 
+       amdgpu_gfx_off_ctrl(adev, false);
          while (size) {
                  uint32_t value;
 
@@ -192,6 +193,8 @@ static int  amdgpu_debugfs_process_reg_op(bool read, struct file *f,
          }
 
   end:
+       amdgpu_gfx_off_ctrl(adev, true);
+
          if (use_bank) {
                  amdgpu_gfx_select_se_sh(adev, 0xffffffff, 0xffffffff, 0xffffffff);
                  mutex_unlock(&adev->grbm_idx_mutex);
--

2.24.1

Quoted 9 lines
Quoted 9 lines

_______________________________________________
amd-gfx mailing list
[email protected]
https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2F
lists.freedesktop.org%2Fmailman%2Flistinfo%2Famd-gfx&amp;data=02%7 C01%7Cmonk.liu%40amd.com%7Cba45efb26c0240ed036f08d7b6db20aa%7C3dd8 961fe4884e608e11a82d994e183d%7C0%7C0%7C637178924605524378&amp;sdat a=%2FyHkvYU5T%2F4iFxRexsg%2BIdm7sDzyXbjzNpHUGCO7h4k%3D&amp;reserve d=0

Quoted 8 lines

_______________________________________________
amd-gfx mailing list
[email protected]
https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Flist
s.freedesktop.org%2Fmailman%2Flistinfo%2Famd-gfx&amp;data=02%7C01%7Cmo nk.liu%40amd.com%7Cba45efb26c0240ed036f08d7b6db20aa%7C3dd8961fe4884e60 8e11a82d994e183d%7C0%7C0%7C637178924605524378&amp;sdata=%2FyHkvYU5T%2F 4iFxRexsg%2BIdm7sDzyXbjzNpHUGCO7h4k%3D&amp;reserved=0

Quoted 4 lines

_______________________________________________
amd-gfx mailing list
[email protected]
https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Flists.freedesktop.org%2Fmailman%2Flistinfo%2Famd-gfx&amp;data=02%7C01%7Cray.huang%40amd.com%7Cefe423577bde46fc9e2508d7b6e28702%7C3dd8961fe4884e608e11a82d994e183d%7C0%7C0%7C637178956359228789&amp;sdata=rShU5sl749BuNxVR8uFLtIf8kR%2BUWBrt%2FO9H%2F0SRVTo%3D&amp;reserved=0

_______________________________________________
amd-gfx mailing list
[email protected]
https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Flists.freedesktop.org%2Fmailman%2Flistinfo%2Famd-gfx&amp;data=02%7C01%7Cray.huang%40amd.com%7Cefe423577bde46fc9e2508d7b6e28702%7C3dd8961fe4884e608e11a82d994e183d%7C0%7C0%7C637178956359238785&amp;sdata=XkJ5uT1g41lku%2FYxMsMTGaHzajGsCAVvcMUYHvTx%2FV0%3D&amp;reserved=0

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

#17 lore raw
In reply to Huang Rui
Quoted 1 line
Quoted 1 line
Quoted 1 line

RREG32_KIQ and WREG32_KIQ

If you are using RREG32_KIQ it is always go through KIQ no matter GFX is "on" state or not

-----邮件原件-----
发件人: Huang, Ray <[email protected]>
发送时间: 2020年2月21日 23:23
收件人: Liu, Monk <[email protected]>
抄送: StDenis, Tom <[email protected]>; Alex Deucher <[email protected]>; amd-gfx list <[email protected]> 主题: Re: 回复: [PATCH] drm/amd/amdgpu: disable GFXOFF around debugfs access to MMIO

Quoted 2 lines · Monk

Better not use KIQ, because when you use debugfs to read register you usually hit a hang, and by that case KIQ probably already die

If CP is busy, the gfx should be in "on" state at that time, we needn't use KIQ.

Thanks,
Ray

Quoted 96 lines

-----邮件原件-----
发件人: amd-gfx <[email protected]> 代表 Huang Rui 发送时间: 2020年2月21日 22:34
收件人: StDenis, Tom <[email protected]>
抄送: Alex Deucher <[email protected]>; amd-gfx list <[email protected]>
主题: Re: [PATCH] drm/amd/amdgpu: disable GFXOFF around debugfs access to MMIO

Quoted 8 lines · Tom St Denis

I got some messages after a while:

[  741.788564] Failed to send Message 8.
[  746.671509] Failed to send Message 8.
[  748.749673] Failed to send Message 2b.
[  759.245414] Failed to send Message 7.
[  763.216902] Failed to send Message 2a.

Quoted 7 lines

Are there any additional locks that should be held?  Because some commands like --top or --waves can do a lot of distinct read operations (causing a lot of enable/disable calls).

I'm going to sit on this a bit since I don't think the patch is ready for pushing out.

How about use RREG32_KIQ and WREG32_KIQ?

Thanks,
Ray

Quoted 56 lines

Tom

Quoted 34 lines · Alex Deucher
Quoted 1 line · Tom St Denis

Please add a patch description. With that fixed:

Quoted 29 lines
---
  drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c | 3 +++
  1 file changed, 3 insertions(+)
drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c +3 -1
index 7379910790c9..66f763300c96 100644
@@ -169,6 +169,7 @@ static int  amdgpu_debugfs_process_reg_op(bool read, struct file *f,
         if (pm_pg_lock)
                 mutex_lock(&adev->pm.mutex);
 
+       amdgpu_gfx_off_ctrl(adev, false);
         while (size) {
                 uint32_t value;
 
@@ -192,6 +193,8 @@ static int  amdgpu_debugfs_process_reg_op(bool read, struct file *f,
         }
 
  end:
+       amdgpu_gfx_off_ctrl(adev, true);
+
         if (use_bank) {
                 amdgpu_gfx_select_se_sh(adev, 0xffffffff, 0xffffffff, 0xffffffff);
                 mutex_unlock(&adev->grbm_idx_mutex);
--

2.24.1

Quoted 14 lines
Quoted 6 lines

_______________________________________________
amd-gfx mailing list
[email protected]
https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%
2F lists.freedesktop.org%2Fmailman%2Flistinfo%2Famd-gfx&amp;data=02

Quoted 8 lines

%7 C01%7Cmonk.liu%40amd.com%7Cba45efb26c0240ed036f08d7b6db20aa%7C3d d8 961fe4884e608e11a82d994e183d%7C0%7C0%7C637178924605524378&amp;sd at a=%2FyHkvYU5T%2F4iFxRexsg%2BIdm7sDzyXbjzNpHUGCO7h4k%3D&amp;reser ve
d=0

_______________________________________________
amd-gfx mailing list
[email protected]
https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Fli

Quoted 8 lines

st s.freedesktop.org%2Fmailman%2Flistinfo%2Famd-gfx&amp;data=02%7C01%7C mo nk.liu%40amd.com%7Cba45efb26c0240ed036f08d7b6db20aa%7C3dd8961fe4884e 60 8e11a82d994e183d%7C0%7C0%7C637178924605524378&amp;sdata=%2FyHkvYU5T% 2F
4iFxRexsg%2BIdm7sDzyXbjzNpHUGCO7h4k%3D&amp;reserved=0

Quoted 8 lines

_______________________________________________
amd-gfx mailing list
[email protected]
https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Flist
s.freedesktop.org%2Fmailman%2Flistinfo%2Famd-gfx&amp;data=02%7C01%7Cmo nk.liu%40amd.com%7Cba45efb26c0240ed036f08d7b6db20aa%7C3dd8961fe4884e60 8e11a82d994e183d%7C0%7C0%7C637178924605524378&amp;sdata=%2FyHkvYU5T%2F 4iFxRexsg%2BIdm7sDzyXbjzNpHUGCO7h4k%3D&amp;reserved=0

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