AMD-GFX Archive on lore.kernel.org
 help / color / mirror / Atom feed
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 5/5] drm/amdgpu: add gpu reset check before page retirement thread runs
Date: Thu, 13 Jun 2024 10:25:04 +0800	[thread overview]
Message-ID: <20240613022504.81787-5-YiPeng.Chai@amd.com> (raw)
In-Reply-To: <20240613022504.81787-1-YiPeng.Chai@amd.com>

If gpu is recovering, clear all message reset flags
in fifo and wait for gpu to complete recovery.

Signed-off-by: YiPeng Chai <YiPeng.Chai@amd.com>
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c
index 341c9bd0d1a4..bf4f8d439ebe 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c
@@ -2982,6 +2982,18 @@ static int amdgpu_ras_page_retirement_thread(void *param)
 
 		atomic_dec(&con->page_retirement_req_cnt);
 
+		reinit_completion(&con->gpu_reset_completion);
+
+		if (amdgpu_in_reset(adev) || atomic_read(&con->in_recovery)) {
+			uint32_t reset;
+
+			amdgpu_ras_clear_poison_fifo_msg_reset_flag(adev, &reset);
+
+			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!\n");
+		}
+
 #ifdef HAVE_KFIFO_PUT_NON_POINTER
 		if (!amdgpu_ras_get_poison_req(adev, &poison_msg))
 			continue;
-- 
2.34.1


  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 ` [PATCH 4/5] drm/amdgpu: wait for gpu to complete reset YiPeng Chai
2024-06-13 10:19   ` Christian König
2024-06-13  2:25 ` YiPeng Chai [this message]
2024-06-13 10:21   ` [PATCH 5/5] drm/amdgpu: add gpu reset check before page retirement thread runs 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-5-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