From: Monk Liu <Monk.Liu@amd.com>
To: <amd-gfx@lists.freedesktop.org>
Cc: Monk Liu <Monk.Liu@amd.com>
Subject: [PATCH] drm/amdgpu: make IB test synchronize with init for SRIOV
Date: Mon, 29 Jun 2020 15:11:29 +0800 [thread overview]
Message-ID: <1593414689-17565-1-git-send-email-Monk.Liu@amd.com> (raw)
From: pengzhou <PengJu.Zhou@amd.com>
issue:
originally we kickoff IB test asynchronously with driver's init, thus
the IB test may still running when the driver loading done (modprobe amdgpu done).
if we shutdown VM immediately after amdgpu driver loaded then GPU may
hang because the IB test is still running
fix:
make IB test synchronize with driver init thus it won't still running
when we shutdown the VM.
Signed-off-by: Monk Liu <Monk.Liu@amd.com>
---
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 29 ++++++++++++++++++++++++-----
1 file changed, 24 insertions(+), 5 deletions(-)
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
index 457f5d2..4f54660 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
@@ -3292,8 +3292,16 @@ int amdgpu_device_init(struct amdgpu_device *adev,
/* must succeed. */
amdgpu_ras_resume(adev);
- queue_delayed_work(system_wq, &adev->delayed_init_work,
+ if (amdgpu_sriov_vf(adev)) {
+ r = amdgpu_ib_ring_tests(adev);
+ if (r) {
+ DRM_ERROR("ib ring test failed (%d).\n", r);
+ return r;
+ }
+ } else {
+ queue_delayed_work(system_wq, &adev->delayed_init_work,
msecs_to_jiffies(AMDGPU_RESUME_MS));
+ }
r = sysfs_create_files(&adev->dev->kobj, amdgpu_dev_attributes);
if (r) {
@@ -3329,7 +3337,8 @@ void amdgpu_device_fini(struct amdgpu_device *adev)
int r;
DRM_INFO("amdgpu: finishing device.\n");
- flush_delayed_work(&adev->delayed_init_work);
+ if (!amdgpu_sriov_vf(adev))
+ flush_delayed_work(&adev->delayed_init_work);
adev->shutdown = true;
/* make sure IB test finished before entering exclusive mode
@@ -3425,7 +3434,8 @@ int amdgpu_device_suspend(struct drm_device *dev, bool fbcon)
if (fbcon)
amdgpu_fbdev_set_suspend(adev, 1);
- cancel_delayed_work_sync(&adev->delayed_init_work);
+ if (!amdgpu_sriov_vf(adev))
+ cancel_delayed_work_sync(&adev->delayed_init_work);
if (!amdgpu_device_has_dc_support(adev)) {
/* turn off display hw */
@@ -3528,8 +3538,16 @@ int amdgpu_device_resume(struct drm_device *dev, bool fbcon)
if (r)
return r;
- queue_delayed_work(system_wq, &adev->delayed_init_work,
+ if (amdgpu_sriov_vf(adev)) {
+ r = amdgpu_ib_ring_tests(adev);
+ if (r) {
+ DRM_ERROR("ib ring test failed (%d).\n", r);
+ return r;
+ }
+ } else {
+ queue_delayed_work(system_wq, &adev->delayed_init_work,
msecs_to_jiffies(AMDGPU_RESUME_MS));
+ }
if (!amdgpu_device_has_dc_support(adev)) {
/* pin cursors */
@@ -3554,7 +3572,8 @@ int amdgpu_device_resume(struct drm_device *dev, bool fbcon)
return r;
/* Make sure IB tests flushed */
- flush_delayed_work(&adev->delayed_init_work);
+ if (!amdgpu_sriov_vf(adev))
+ flush_delayed_work(&adev->delayed_init_work);
/* blat the mode back in */
if (fbcon) {
--
2.7.4
_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
next reply other threads:[~2020-06-29 7:11 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-06-29 7:11 Monk Liu [this message]
2020-06-29 8:18 ` [PATCH] drm/amdgpu: make IB test synchronize with init for SRIOV Christian König
2020-06-29 9:03 ` Liu, Monk
2020-06-29 9:09 ` Christian König
2020-06-29 9:34 ` Liu, Monk
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1593414689-17565-1-git-send-email-Monk.Liu@amd.com \
--to=monk.liu@amd.com \
--cc=amd-gfx@lists.freedesktop.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).