Skip to contentSkip to conversation

drm/amdgpu: Fix no irq process when evict vram

PATCH In review Yintian Tao 5 participants 6 messages Dec 13, 2017 – Feb 6, 2018 4 messages not in the archive

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

PATCH 1/1 drm/amdgpu: Fix no irq process when evict vram

When unload amdgpu driver we use sdma to evict vram but there is no irq process after sdma completed work which raises that waiting for the fence costs 2s which will trigger VFLR under SRIOV and at last make unload driver failed.The reason is that the shutdown varible in adev is set to true before evict vram, it cause ISR directly return without processing.Therefore, we need set the varible after evict vram.

Change-Id I7bf75481aa0744b99c41672b49670adc70b478bd
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +1 -1
index a269bbc..80934ee 100644
@@ -2458,7 +2458,6 @@ void amdgpu_device_fini(struct amdgpu_device *adev)
 	int r;
 
 	DRM_INFO("amdgpu: finishing device.\n");
-	adev->shutdown = true;
 	if (adev->mode_info.mode_config_initialized)
 		drm_crtc_force_disable_all(adev->ddev);
 
@@ -2466,6 +2465,7 @@ void amdgpu_device_fini(struct amdgpu_device *adev)
 	amdgpu_fence_driver_fini(adev);
 	amdgpu_fbdev_fini(adev);
 	r = amdgpu_fini(adev);
+	adev->shutdown = true;
 	if (adev->firmware.gpu_info_fw) {
 		release_firmware(adev->firmware.gpu_info_fw);
 		adev->firmware.gpu_info_fw = NULL;
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): 1513136263-9908-1-git-send-email-yttao-5C7GfCeVMHo@public.gmane.org

#2 lore raw

Is this a follow on to
https://cgit.freedesktop.org/~agd5f/linux/commit/?h=drm-next-4.16-wip&id=b9141cd3930e390f156739829ca9589fda7926e4

Quoted 37 lines · On Wed, 13 Dec 2017 at 07:11 Yintian Tao <[email protected]>…

When unload amdgpu driver we use sdma to evict vram but there is no irq process after sdma completed work which raises that waiting for the fence costs 2s which will trigger VFLR under SRIOV and at last make unload driver failed.The reason is that the shutdown varible in adev is set to true before evict vram, it cause ISR directly return without processing.Therefore, we need set the varible after evict vram.

Change-Id I7bf75481aa0744b99c41672b49670adc70b478bd
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +1 -2
index a269bbc..80934ee 100644
@@ -2458,7 +2458,6 @@ void amdgpu_device_fini(struct amdgpu_device *adev)
        int r;
 
        DRM_INFO("amdgpu: finishing device.\n");
-       adev->shutdown = true;
        if (adev->mode_info.mode_config_initialized)
                drm_crtc_force_disable_all(adev->ddev);
 
@@ -2466,6 +2465,7 @@ void amdgpu_device_fini(struct amdgpu_device *adev)
        amdgpu_fence_driver_fini(adev);
        amdgpu_fbdev_fini(adev);
        r = amdgpu_fini(adev);
+       adev->shutdown = true;
        if (adev->firmware.gpu_info_fw) {
                release_firmware(adev->firmware.gpu_info_fw);
                adev->firmware.gpu_info_fw = NULL;
--

2.7.4

Quoted 5 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

A message that is not in the archive (sent off-list or not yet received): CAHbf0-HJr=5UJ0rnNvuURQoT8Ze6JnZkc8-_7ysoopUyBPXzwA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org

#4 lore raw

Hi Lothian

First of all, thanks for your review.

No, it is the patch which achieve the same function for the issue. But it is the root cause of fence timeout.
The patch b9141cd3<https://cgit.freedesktop.org/~agd5f/linux/commit/?h=drm-next-4.16-wip&id=b9141cd3930e390f156739829ca9589fda7926e4> is the word-around for the issue. And I think the varible “shutdown” assignment is better to be located after amdgpu_fini() to ensure no irq miss.

Best Regards
Yintian Tao

From: Mike Lothian [mailto:[email protected]]
Sent: Wednesday, December 13, 2017 7:23 PM
To: Tao, Yintian <[email protected]>
Cc: [email protected]
Subject: Re: [PATCH] drm/amdgpu: Fix no irq process when evict vram

Is this a follow on to https://cgit.freedesktop.org/~agd5f/linux/commit/?h=drm-next-4.16-wip&id=b9141cd3930e390f156739829ca9589fda7926e4

On Wed, 13 Dec 2017 at 07:11 Yintian Tao <[email protected]<mailto:[email protected]>> wrote:
When unload amdgpu driver we use sdma to evict vram but there is no
irq process after sdma completed work which raises that waiting for the fence costs 2s which will trigger VFLR under SRIOV and at last make unload driver failed.The reason is that the shutdown varible in adev
is set to true before evict vram, it cause ISR directly return without processing.Therefore, we need set the varible after evict vram.

Change-Id I7bf75481aa0744b99c41672b49670adc70b478bd
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +1 -1
index a269bbc..80934ee 100644
@@ -2458,7 +2458,6 @@ void amdgpu_device_fini(struct amdgpu_device *adev)
        int r;
 
        DRM_INFO("amdgpu: finishing device.\n");
-       adev->shutdown = true;
        if (adev->mode_info.mode_config_initialized)
                drm_crtc_force_disable_all(adev->ddev);
 
@@ -2466,6 +2465,7 @@ void amdgpu_device_fini(struct amdgpu_device *adev)
        amdgpu_fence_driver_fini(adev);
        amdgpu_fbdev_fini(adev);
        r = amdgpu_fini(adev);
+       adev->shutdown = true;
        if (adev->firmware.gpu_info_fw) {
                release_firmware(adev->firmware.gpu_info_fw);
                adev->firmware.gpu_info_fw = NULL;

--
2.7.4

_______________________________________________
amd-gfx mailing list [email protected]<mailto:[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): DM3PR1201MB10408E304E474668C12560BBE5350-BBcFnVpqZhWvVYYlwACKW2rFom/aUZj6nBOFsp37pqbUKgpGm//BTAC/[email protected]

#6 lore raw

I'm hoping this fixes the slow shutdown time of my laptop, which seems to switch the card back on right before switching off

It's been an issue since the introduction of KIQ (around the same time)

Quoted 82 lines · Yintian

Hi Lothian

First of all, thanks for your review.

No, it is the patch which achieve the same function for the issue. But it is the root cause of fence timeout.

The patch b9141cd3
<https://cgit.freedesktop.org/~agd5f/linux/commit/?h=drm-next-4.16-wip&id=b9141cd3930e390f156739829ca9589fda7926e4> is the word-around for the issue. And I think the varible “shutdown”
assignment is better to be located after amdgpu_fini() to ensure no irq
miss.

Best Regards

Yintian Tao

*From:* Mike Lothian [mailto:[email protected]] *Sent:* Wednesday, December 13, 2017 7:23 PM
*To:* Tao, Yintian <[email protected]> *Cc:* [email protected] *Subject:* Re: [PATCH] drm/amdgpu: Fix no irq process when evict vram

Is this a follow on to
https://cgit.freedesktop.org/~agd5f/linux/commit/?h=drm-next-4.16-wip&id=b9141cd3930e390f156739829ca9589fda7926e4

On Wed, 13 Dec 2017 at 07:11 Yintian Tao <[email protected]> wrote:

When unload amdgpu driver we use sdma to evict vram but there is no irq process after sdma completed work which raises that waiting for the fence costs 2s which will trigger VFLR under SRIOV and at last make unload driver failed.The reason is that the shutdown varible in adev is set to true before evict vram, it cause ISR directly return without processing.Therefore, we need set the varible after evict vram.

Change-Id I7bf75481aa0744b99c41672b49670adc70b478bd
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +1 -2
index a269bbc..80934ee 100644
@@ -2458,7 +2458,6 @@ void amdgpu_device_fini(struct amdgpu_device *adev)
        int r;
 
        DRM_INFO("amdgpu: finishing device.\n");
-       adev->shutdown = true;
        if (adev->mode_info.mode_config_initialized)
                drm_crtc_force_disable_all(adev->ddev);
 
@@ -2466,6 +2465,7 @@ void amdgpu_device_fini(struct amdgpu_device *adev)
        amdgpu_fence_driver_fini(adev);
        amdgpu_fbdev_fini(adev);
        r = amdgpu_fini(adev);
+       adev->shutdown = true;
        if (adev->firmware.gpu_info_fw) {
                release_firmware(adev->firmware.gpu_info_fw);
                adev->firmware.gpu_info_fw = NULL;
--

2.7.4

Quoted 6 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

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

This seems like a good thing to do in general even with Monk's fix.

________________________________
From: amd-gfx <amd-gfx-bounces-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org> on behalf of Yintian Tao <[email protected]>
Sent: Tuesday, December 12, 2017 10:37:43 PM
To: [email protected]
Cc: Tao, Yintian
Subject: [PATCH] drm/amdgpu: Fix no irq process when evict vram

When unload amdgpu driver we use sdma to evict vram but there is no irq process after sdma completed work which raises that waiting for the fence costs 2s which will trigger VFLR under SRIOV and at last make unload driver failed.The reason is that the shutdown varible in adev is set to true before evict vram, it cause ISR directly return without processing.Therefore, we need set the varible after evict vram.

Change-Id I7bf75481aa0744b99c41672b49670adc70b478bd
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +1 -1
index a269bbc..80934ee 100644
@@ -2458,7 +2458,6 @@ void amdgpu_device_fini(struct amdgpu_device *adev)
         int r;
 
         DRM_INFO("amdgpu: finishing device.\n");
-       adev->shutdown = true;
         if (adev->mode_info.mode_config_initialized)
                 drm_crtc_force_disable_all(adev->ddev);
 
@@ -2466,6 +2465,7 @@ void amdgpu_device_fini(struct amdgpu_device *adev)
         amdgpu_fence_driver_fini(adev);
         amdgpu_fbdev_fini(adev);
         r = amdgpu_fini(adev);
+       adev->shutdown = true;
         if (adev->firmware.gpu_info_fw) {
                 release_firmware(adev->firmware.gpu_info_fw);
                 adev->firmware.gpu_info_fw = NULL;

--
2.7.4

_______________________________________________
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): BN6PR12MB16525F17767212FA9471691FF7350-/b2+HYfkarQqUD6E6FAiowdYzm3356FpvxpqHgZTriW3zl9H0oFU5g@public.gmane.org

#9 lore raw

Yintian,

Any plans to commit this?

Alex

Quoted 55 lines · Alexander

This seems like a good thing to do in general even with Monk's fix.

________________________________
From: amd-gfx <[email protected]> on behalf of Yintian Tao <[email protected]>
Sent: Tuesday, December 12, 2017 10:37:43 PM
To: [email protected]
Cc: Tao, Yintian
Subject: [PATCH] drm/amdgpu: Fix no irq process when evict vram

When unload amdgpu driver we use sdma to evict vram but there is no irq process after sdma completed work which raises that waiting for the fence costs 2s which will trigger VFLR under SRIOV and at last make unload driver failed.The reason is that the shutdown varible in adev is set to true before evict vram, it cause ISR directly return without processing.Therefore, we need set the varible after evict vram.

Change-Id I7bf75481aa0744b99c41672b49670adc70b478bd
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +1 -2
index a269bbc..80934ee 100644
@@ -2458,7 +2458,6 @@ void amdgpu_device_fini(struct amdgpu_device *adev)
         int r;
 
         DRM_INFO("amdgpu: finishing device.\n");
-       adev->shutdown = true;
         if (adev->mode_info.mode_config_initialized)
                 drm_crtc_force_disable_all(adev->ddev);
 
@@ -2466,6 +2465,7 @@ void amdgpu_device_fini(struct amdgpu_device *adev)
         amdgpu_fence_driver_fini(adev);
         amdgpu_fbdev_fini(adev);
         r = amdgpu_fini(adev);
+       adev->shutdown = true;
         if (adev->firmware.gpu_info_fw) {
                 release_firmware(adev->firmware.gpu_info_fw);
                 adev->firmware.gpu_info_fw = NULL;
--

2.7.4

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

Quoted 5 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