From: YiPeng Chai <YiPeng.Chai@amd.com>
To: <amd-gfx@lists.freedesktop.org>
Cc: <Hawking.Zhang@amd.com>, <Tao.Zhou1@amd.com>,
<Candice.Li@amd.com>, <KevinYang.Wang@amd.com>,
<Stanley.Yang@amd.com>, YiPeng Chai <YiPeng.Chai@amd.com>
Subject: [PATCH 4/5] drm/amdgpu: wait for gpu to complete reset
Date: Thu, 13 Jun 2024 10:25:03 +0800 [thread overview]
Message-ID: <20240613022504.81787-4-YiPeng.Chai@amd.com> (raw)
In-Reply-To: <20240613022504.81787-1-YiPeng.Chai@amd.com>
Add completion to wait for gpu to complete reset.
Signed-off-by: YiPeng Chai <YiPeng.Chai@amd.com>
---
drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c | 12 ++++++++++++
drivers/gpu/drm/amd/amdgpu/amdgpu_ras.h | 1 +
2 files changed, 13 insertions(+)
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c
index 7dfb2e548d70..341c9bd0d1a4 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c
@@ -124,6 +124,8 @@ const char *get_ras_block_str(struct ras_common_if *ras_block)
#define AMDGPU_RAS_RETIRE_PAGE_INTERVAL 100 //ms
+#define MAX_GPU_RESET_COMPLETION_TIME 120000 //ms
+
#define RAS_POISON_FIFO_MSG_PENDING_THRESHOLD (AMDGPU_RAS_POISON_FIFO_SIZE/4)
enum amdgpu_ras_retire_page_reservation {
@@ -2526,6 +2528,8 @@ static void amdgpu_ras_do_recovery(struct work_struct *work)
atomic_set(&hive->ras_recovery, 0);
amdgpu_put_xgmi_hive(hive);
}
+
+ complete(&ras->gpu_reset_completion);
}
/* alloc/realloc bps array */
@@ -2946,7 +2950,14 @@ static int amdgpu_ras_poison_consumption_handler(struct amdgpu_device *adev,
con->gpu_reset_flags |= reset;
}
+ reinit_completion(&con->gpu_reset_completion);
+
amdgpu_ras_reset_gpu(adev);
+
+ if (!wait_for_completion_timeout(&con->gpu_reset_completion,
+ msecs_to_jiffies(MAX_GPU_RESET_COMPLETION_TIME)))
+ dev_err(adev->dev, "Waiting for GPU to complete reset timeout! reset:0x%x\n",
+ reset);
}
return 0;
@@ -3072,6 +3083,7 @@ int amdgpu_ras_recovery_init(struct amdgpu_device *adev)
}
}
+ init_completion(&con->gpu_reset_completion);
mutex_init(&con->page_rsv_lock);
INIT_KFIFO(con->poison_fifo);
mutex_init(&con->page_retirement_lock);
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ras.h b/drivers/gpu/drm/amd/amdgpu/amdgpu_ras.h
index 103436bb650e..d5ddd0ca5de1 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ras.h
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ras.h
@@ -537,6 +537,7 @@ struct amdgpu_ras {
DECLARE_KFIFO(poison_fifo, struct ras_poison_msg, AMDGPU_RAS_POISON_FIFO_SIZE);
struct ras_ecc_log_info umc_ecc_log;
struct delayed_work page_retirement_dwork;
+ struct completion gpu_reset_completion;
/* Fatal error detected flag */
atomic_t fed;
--
2.34.1
next prev parent reply other threads:[~2024-06-13 2:27 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-06-13 2:25 [PATCH 1/5] drm/amdgpu: add condition check for waking up thread YiPeng Chai
2024-06-13 2:25 ` [PATCH 2/5] drm/amdgpu: add threshold to interrupt waiting for DE data to be ready YiPeng Chai
2024-06-13 2:25 ` [PATCH 3/5] drm/amdgpu: clear all messages reset flags in fifo before gpu reset YiPeng Chai
2024-06-13 2:25 ` YiPeng Chai [this message]
2024-06-13 10:19 ` [PATCH 4/5] drm/amdgpu: wait for gpu to complete reset Christian König
2024-06-13 2:25 ` [PATCH 5/5] drm/amdgpu: add gpu reset check before page retirement thread runs YiPeng Chai
2024-06-13 10:21 ` Christian König
2024-06-13 8:11 ` [PATCH 1/5] drm/amdgpu: add condition check for waking up thread Lazar, Lijo
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=20240613022504.81787-4-YiPeng.Chai@amd.com \
--to=yipeng.chai@amd.com \
--cc=Candice.Li@amd.com \
--cc=Hawking.Zhang@amd.com \
--cc=KevinYang.Wang@amd.com \
--cc=Stanley.Yang@amd.com \
--cc=Tao.Zhou1@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